Skip to content

Commit bca74ea

Browse files
committed
Remove system.properties
Previously, the buildpack could be configured by adding a system.properties file into an application before it was pushed. This conflated the actions of pushing and application and configuring the environment that the application ran in. This change removes most of the use of system.properties from the system, but does not quite remove it all. The JRE memory subsystem still has references to system.properties (although those code-paths will never be called) and those will be removed in another story. In addition to the code changes around system.properties, the structure of the documentation has been changed. The documentation is now in multiple Markdown files located in the docs/ directory. These files are linked to from a table of contents embedded in README.md. This means that a user will see the documentation links on first arrival at the buildpack and will be sent to more detailed information that is versioned with the buildpack code itself. [#52105249]
1 parent 03d0c69 commit bca74ea

30 files changed

+505
-591
lines changed

README.md

Lines changed: 21 additions & 429 deletions
Large diffs are not rendered by default.

config/java_opts.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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 +JAVA_OPTS+ framework
17+
---

config/main.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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 Java +main()+ container
17+
---

config/tomcat.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@
1717
---
1818
version: 7.0.+
1919
repository_root: "http://download.pivotal.io.s3.amazonaws.com/tomcat/lucid/x86_64"
20-
support_jar:
20+
support:
2121
version: 1.1.+
2222
repository_root: "http://download.pivotal.io.s3.amazonaws.com/tomcat-buildpack-support/lucid/x86_64"

docs/container-java-main.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Java Main Class Container
2+
The Java Main Class Container allows applications that provide a class with a `main()` method in it to be run. These applications are run with a command that looks like `./java/bin/java -cp . com.gopivotal.SampleClass`.
3+
4+
| Detection ||
5+
| --- | ---
6+
| **Criteria** | `Main-Class` attribute set in `META-INF/MANIFEST.MF` or `java_main_class` set
7+
| **Tags** | `java-main`
8+
9+
## Configuration
10+
The container can be configured by modifying the [`config/main.yml`][main_yml] file.
11+
12+
[main_yml]: ../config/main.yml
13+
14+
| Name | Description
15+
| ---- | -----------
16+
| `java_main_class` | The Java class name to run. Values containing whitespace are rejected with an error, but all others values appear without modification on the Java command line. If not specified, the Java Manifest value of `Main-Class` is used.
17+
18+

docs/container-tomcat.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Tomcat Container
2+
The Tomcat Container allows web application to be run. These applications are run as the root web application in a Tomcat container.
3+
4+
| Detection ||
5+
| --- | ---
6+
| **Criteria** | Existence of a `WEB-INF/` folder in the application directory
7+
| **Tags** | `tomcat-<version>`
8+
9+
## Configuration
10+
The container can be configured by modifying the [`config/tomcat.yml`][tomcat_yml] file. The container uses the [`Repository` utility support][util_repositories] and so it supports the [version syntax][version_syntax] defined there.
11+
12+
[tomcat_yml]: ../config/tomcat.yml
13+
[util_repositories]: util-repositories.md
14+
[version_syntax]: util-repositories.md#version-syntax-and-ordering
15+
16+
| Name | Description
17+
| ---- | -----------
18+
| `version` | The version of Tomcat to use. . Candidate versions can be found in [this listing][tomcat_index_yml].
19+
20+
[tomcat_index_yml]: http://download.pivotal.io.s3.amazonaws.com/tomcat/lucid/x86_64/index.yml
21+
22+
23+
## Supporting Functionality
24+
Additional supporting functionality can be found in the [`java-buildpack-support][java_buildpack_support] Git repository.
25+
26+
[java_buildpack_support]: https://github.com/cloudfoundry/java-buildpack-support

docs/design.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Design
2+
The buildpack is designed as a collection of components. These components are divided into three types; _JREs_, _Containers_, and _Frameworks_.
3+
4+
## JRE Components
5+
JRE components represent the JRE that will be used when running an application. This type of component is responsible for determining which JRE should be used, downloading and unpacking that JRE, and resolving any JRE-specific options that should be used at runtime.
6+
7+
Only a single JRE component can be used to run an application. If more than one JRE can be used, an error will be raised and application deployment will fail.
8+
9+
## Container Components
10+
Container components represent the way that an application will be run. Container types range from traditional application servers and servlet containers to simple Java `main()` method execution. This type of component is responsible for determining which container should be used, downloading and unpacking that container, and producing the command that will be executed by Cloud Foundry at runtime.
11+
12+
Only a single container component can run an application. If more than one container can be used, an error will be raised and application deployment will fail.
13+
14+
## Framework Components
15+
Framework components represent additional behavior or transformations used when an application is run. Framework types include the downloading of JDBC JARs for bound services and automatic reconfiguration of `DataSource`s in Spring configuration to match bound services. This type of component is responsible for determining which frameworks are required, transforming the application, and contributing any additional options that should be used at runtime.
16+
17+
Any number of framework components can be used when running an application.

docs/extending-containers.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Extending Containers
2+
To add a container, the class file must be located in [`lib/java_buildpack/container`][container_dir] and the class name added to [`config/components.yml`][components_yml]. The class must have the following methods
3+
4+
[container_dir]: ../lib/java_buildpack/container
5+
[components_yml]: ../config/components.yml
6+
7+
```ruby
8+
# An initializer for the instance.
9+
#
10+
# @param [Hash<Symbol, String>] context A shared context provided to all components
11+
# @option context [String] :app_dir the directory that the application exists in
12+
# @option context [String] :java_home the directory that acts as +JAVA_HOME+
13+
# @option context [Array<String>] :java_opts an array that Java options can be added to
14+
# @option context [Hash] :configuration the configuration provided by the user
15+
def initialize(context)
16+
17+
# Determines if the container can be used to run the application.
18+
#
19+
# @return [String, nil] If the container can be used to run the application, a +String+ that uniquely identifies the
20+
# container (e.g. +tomcat-7.0.29+). Otherwise, +nil+.
21+
def detect
22+
23+
# Downloads and unpacks the container. The container is expected to transform the application in whatever way
24+
# necessary (e.g. moving files or creating symbolic links) to run it. Status output written to +STDOUT+ is expected as
25+
# part of this invocation.
26+
#
27+
# @return [void]
28+
def compile
29+
30+
# Creates the command to run the application with. The container is expected to read +context[:java_home]+ and
31+
# +context[:java_opts]+ and take those values into account when creating the command.
32+
#
33+
# @return [String] the command to run the application with
34+
def release
35+
```

docs/extending-frameworks.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Extending Frameworks
2+
To add a framework, the class file must be located in [`lib/java_buildpack/framework`][framework_dir] and the class name added to [`config/components.yml`][components_yml]. The class must have the following methods:
3+
4+
[framework_dir]: ../lib/java_buildpack/framework
5+
[components_yml]: ../config/components.yml
6+
7+
```ruby
8+
# An initializer for the instance.
9+
#
10+
# @param [Hash<Symbol, String>] context A shared context provided to all components
11+
# @option context [String] :app_dir the directory that the application exists in
12+
# @option context [Array<String>] :java_opts an array that Java options can be added to
13+
# @option context [Hash] :configuration the configuration provided by the user
14+
def initialize(context)
15+
16+
# Determines if the framework can be applied to the application
17+
#
18+
# @return [String, nil] If the framework can be used to run the application, a +String+ that uniquely identifies the
19+
# framework (e.g. +java-opts+). Otherwise, +nil+.
20+
def detect
21+
22+
# Transforms the application based on the framework. Status output written to +STDOUT+ is expected as part of this
23+
# invocation.
24+
#
25+
# @return [void]
26+
def compile
27+
28+
# Adds any framework-specific options to +context[:java_opts]+. Typically this includes any JRE configuration required
29+
# by the framework, but could be anything that a framework needs to have configured.
30+
#
31+
# @return [void]
32+
def release
33+
```

docs/extending-jres.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# JREs
2+
To add a JRE, the class file must be located in [`lib/java_buildpack/jre`][jre_dir] and the class name added to [`config/components.yml`][components_yml]. The class must have the following methods:
3+
4+
[jre_dir]: ../lib/java_buildpack/jre
5+
[components_yml]: ../config/components.yml
6+
7+
```ruby
8+
# An initializer for the instance.
9+
#
10+
# @param [Hash<Symbol, String>] context A shared context provided to all components
11+
# @option context [String] :app_dir the directory that the application exists in
12+
# @option context [String] :java_home the directory that acts as +JAVA_HOME+
13+
# @option context [Array<String>] :java_opts an array that Java options can be added to
14+
# @option context [Hash] :configuration the configuration provided by the user
15+
def initialize(context)
16+
17+
# Determines if the JRE can be used to run the application.
18+
#
19+
# @return [String, nil] If the JRE can be used to run the application, a +String+ that uniquely identifies the JRE
20+
# (e.g. +openjdk-1.7.0_21+). Otherwise, +nil+.
21+
def detect
22+
23+
# Downloads and unpacks the JRE. Status output written to +STDOUT+ is expected as part of this invocation.
24+
#
25+
# @return [void]
26+
def compile
27+
28+
# Adds any JRE-specific options to +context[:java_opts]+. Typically this includes memory configuration (heap, perm gen,
29+
# etc.) but could be anything that a JRE needs to have configured. As well, +context[:java_home]+ is expected to be
30+
# updated with the value that the JRE has been unpacked to. This must be done using the {String.concat} method to
31+
# ensure that the value is accessible to other components.
32+
#
33+
# @return [void]
34+
def release
35+
```

0 commit comments

Comments
 (0)