Skip to content

Commit c2e584f

Browse files
author
Glyn Normington
committed
Add MariaDB JDBC framework
The MariaDB JDBC driver is used instead of the MySQL JDBC driver since its license terms are more favourable. [#52325391]
1 parent d1aaaf6 commit c2e584f

11 files changed

Lines changed: 395 additions & 6 deletions

File tree

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/runConfigurations/All_Tests.xml

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/runConfigurations/Without_Integration_Tests.xml

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/components.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ jres:
2626
frameworks:
2727
- "JavaBuildpack::Framework::AppDynamics"
2828
- "JavaBuildpack::Framework::JavaOpts"
29+
- "JavaBuildpack::Framework::MariaDbJdbc"
2930
- "JavaBuildpack::Framework::NewRelic"
3031
- "JavaBuildpack::Framework::SpringInsight"
3132
- "JavaBuildpack::Framework::PlayAutoReconfiguration"

config/mariadbjdbc.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Cloud Foundry Java Buildpack
2+
# Copyright (c) 2013 the original author or authors.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
# Configuration for the MariaDB JDBC framework
17+
---
18+
version: 1.1.+
19+
repository_root: "http://download.pivotal.io.s3.amazonaws.com/mariadb-jdbc"

java-buildpack.iml

Lines changed: 258 additions & 1 deletion
Large diffs are not rendered by default.
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Encoding: utf-8
2+
# Cloud Foundry Java Buildpack
3+
# Copyright 2013 the original author or authors.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
require 'fileutils'
18+
require 'java_buildpack/framework'
19+
require 'java_buildpack/util/service_utils'
20+
require 'java_buildpack/versioned_dependency_component'
21+
22+
module JavaBuildpack::Framework
23+
24+
# Encapsulates the functionality for enabling the MariaDB JDBC client.
25+
class MariaDbJdbc < JavaBuildpack::VersionedDependencyComponent
26+
27+
def initialize(context)
28+
super('MariaDB JDBC', context)
29+
end
30+
31+
def compile
32+
download_jar jar_name
33+
end
34+
35+
def release
36+
end
37+
38+
protected
39+
40+
def supports?
41+
!has_driver? && JavaBuildpack::Util::ServiceUtils.find_service(@vcap_services, SERVICE_NAME)
42+
end
43+
44+
private
45+
46+
SERVICE_NAME = /cleardb/.freeze
47+
48+
def jar_name
49+
"#{@parsable_component_name}-#{@version}.jar"
50+
end
51+
52+
def has_driver?
53+
!@application.glob('mariadb-java-client*.jar', 'mysql-connector-java*.jar').empty?
54+
end
55+
56+
end
57+
58+
end

spec/fixtures/framework_mariadb_jdbc_with_driver/mariadb-java-client-0.0.0.jar

Whitespace-only changes.

spec/fixtures/framework_mariadb_jdbc_with_mysql_driver/mysql-connector-java-5.1.27-bin.jar

Whitespace-only changes.
341 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)