Skip to content

Commit

Permalink
Add documentation for current resources
Browse files Browse the repository at this point in the history
  • Loading branch information
damacus authored Mar 30, 2020
1 parent 5fa2a0a commit 56ba891
Show file tree
Hide file tree
Showing 9 changed files with 145 additions and 443 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

This file is used to list changes made in each version of the Java cookbook.

## 8.0.1 (30-03-2020)

- Added documentation in documentation/resources for `adoptopenjdk_install`, `alternatives`, `certificate`, `corretto_install`, `jce`, `openjdk_install`

## 8.0.0 (30-03-2020)

- Added `openjdk_install` resource & documentation
Expand Down
424 changes: 7 additions & 417 deletions README.md

Large diffs are not rendered by default.

34 changes: 34 additions & 0 deletions documentation/resources/alternatives.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[back to resource list](https://github.com/sous-chefs/java#resources)

# java_alternatives

The `java_alternatives` resource uses `update-alternatives` command to set and unset command alternatives for various Java tools such as java, javac, etc.

## Actions

- `:set`: set alternatives for Java tools
- `:unset`: unset alternatives for Java tools

## Properties

| Name | Type | Default | Description |
| -------------------- | ------------- | ------- | ---------------------------------------------------------------------------- |
| `java_location` | `String` | | Java installation location |
| `bin_cmds` | `String` | | Array of Java tool names to set or unset alternatives on |
| `default` | `true, false` | `true` | Whether to set the Java tools as system default. Boolean, defaults to `true` |
| `priority` | `Integer` | `1061` | Priority of the alternatives. Integer, defaults to `1061` |
| `reset_alternatives` | `true, false` | `true` | Whether to reset alternatives before setting them |

- `java_location`: Java installation location.
- `bin_cmds`: .
- `default`: .
- `priority`: .

## Examples

```ruby
java_alternatives "set java alternatives" do
java_location '/usr/local/java'
bin_cmds ["java", "javac"]
end
```
33 changes: 33 additions & 0 deletions documentation/resources/certificate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[back to resource list](https://github.com/sous-chefs/java#resources)

# java_certificate

Java certificate simplifies adding certificates to a java keystore.
It can also populate the keystore with a certificate retrieved from a given SSL end-point.

## Actions

- `:install`: installs a certificate.
- `:remove`: removes a certificate.

## Properties

| Name | Type | Default | Description |
| ----------------- | ------ | --------------------------- | --------------------------------------------------------------------------------------- |
| `java_home` | | node['java']['java_home'] | The java home directory |
| `java_version` | | node['java']['jdk_version'] | The java version |
| `keystore_path` | String | | Path to the keystore |
| `keystore_passwd` | String | `changeit` | Password to the keystore |
| `cert_alias` | String | | The alias of the certificate in the keystore. This defaults to the name of the resource |
| `cert_data` | String | | The certificate data to install |
| `cert_file` | String | | Path to a certificate file to install |
| `ssl_endpoint` | String | | An SSL end-point from which to download the certificate |

## Examples

```ruby
java_certificate 'java_certificate_ssl_endpoint' do
ssl_endpoint 'google.com:443'
java_version '8'
end
```
41 changes: 41 additions & 0 deletions documentation/resources/jce.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
[back to resource list](https://github.com/sous-chefs/java#resources)

# java_jce

`java_jce` installs the Java Cryptography Extension (JCE) policy files for a given Java installation.

## Actions

- `:install`: Installs the JCE policy files.

## Properties

| Name | Type | Default | Description |
| -------------- | ------ | -------------------------------------------------------- | -------------------------------------------------------------------------- |
| `jdk_version` | String | `node['java']['jdk_version']` | The Java version to install into |
| `jce_url` | String | `node['java']['oracle']['jce'][jdk_version]['url']` | The URL for the JCE distribution |
| `jce_checksum` | String | `node['java']['oracle']['jce'][jdk_version]['checksum']` | The checksum of the JCE distribution |
| `jce_cookie` | String | `node['java']['oracle']['accept_oracle_download_terms']` | Indicates that you accept Oracle's EULA |
| `jce_home` | String | `node['java']['oracle']['jce']['home']` | The location where JCE files will be decompressed for installation |
| `java_home` | String | `node['java']['java_home']` | The location of the Java installation |
| `principal` | String | `node['java']['windows']['owner']` | For Windows installations only, this determines the owner of the JCE files |

## Examples

``` ruby
# Install the JCE for the default Java installation:
java_jce 'Install the JCE files'

# Install the JCE for a Java installation in /opt/tools/jdk8:
java_jce 'Install the JCE files' do
java_home '/opt/tools/jdk8'
end

# Install the JCE for a Java 8 installation in /opt/tools/java using a custom download location:
java_jce 'Install the JCE files' do
java_home '/opt/tools/java'
jdk_version '8'
jce_url 'https://artifacts/path/to/jce/policy.zip'
jce_checksum 'deadbeefcafe...'
end
```
7 changes: 1 addition & 6 deletions metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
maintainer_email '[email protected]'
license 'Apache-2.0'
description 'Recipes and resources for installing Java and managing certificates'
version '8.0.0'
version '8.0.1'

supports 'debian'
supports 'ubuntu'
Expand All @@ -14,13 +14,8 @@
supports 'amazon'
supports 'oracle'
supports 'freebsd'
supports 'windows'
supports 'suse'
supports 'opensuseleap'
supports 'mac_os_x'

depends 'homebrew'
depends 'windows'

source_url 'https://github.com/sous-chefs/java'
issues_url 'https://github.com/sous-chefs/java/issues'
Expand Down
15 changes: 10 additions & 5 deletions resources/alternatives.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,16 @@
# See the License for the specific language governing permissions and
# limitations under the License.

property :java_location, String
property :bin_cmds, Array
property :default, [true, false], default: true
property :priority, Integer, default: 1061
property :reset_alternatives, [true, false], default: true
property :java_location, String,
description: 'Java installation location'
property :bin_cmds, Array,
description: 'Array of Java tool names to set or unset alternatives on'
property :default, [true, false], default: true,
description: 'Whether to set the Java tools as system default. Boolean, defaults to `true`'
property :priority, Integer, default: 1061,
description: ' Priority of the alternatives. Integer, defaults to `1061`'
property :reset_alternatives, [true, false], default: true,
description: 'Whether to reset alternatives before setting them'

action :set do
if new_resource.bin_cmds
Expand Down
16 changes: 8 additions & 8 deletions resources/certificate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.

property :java_home, String, default: lazy { node['java']['java_home'] }
property :java_version, String, default: lazy { node['java']['jdk_version'] }
property :keystore_path, String
property :keystore_passwd, String, default: 'changeit'
property :cert_alias, String, name_property: true
property :cert_data, String
property :cert_file, String
property :ssl_endpoint, String
property :java_home, String, default: lazy { node['java']['java_home'] }, description: 'The java home directory'
property :java_version, String, default: lazy { node['java']['jdk_version'] }, description: ' The java version'
property :keystore_path, String, description: 'Path to the keystore'
property :keystore_passwd, String, default: 'changeit', description: 'Password to the keystore'
property :cert_alias, String, name_property: true, description: 'The alias of the certificate in the keystore. This defaults to the name of the resource'
property :cert_data, String, description: 'The certificate data to install'
property :cert_file, String, description: 'Path to a certificate file to install'
property :ssl_endpoint, String, description: 'An SSL end-point from which to download the certificate'

action :install do
require 'openssl'
Expand Down
14 changes: 7 additions & 7 deletions resources/jce.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.

property :jdk_version, String, default: lazy { node['java']['jdk_version'].to_s }
property :jce_url, String, default: lazy { node['java']['oracle']['jce'][jdk_version]['url'] }
property :jce_checksum, String, default: lazy { node['java']['oracle']['jce'][jdk_version]['checksum'] }
property :java_home, String, default: lazy { node['java']['java_home'] }
property :jce_home, String, default: lazy { node['java']['oracle']['jce']['home'] }
property :jce_cookie, String, default: lazy { node['java']['oracle']['accept_oracle_download_terms'] ? 'oraclelicense=accept-securebackup-cookie' : '' }
property :principal, String, default: lazy { platform_family?('windows') ? node['java']['windows']['owner'] : 'administrator' }
property :jdk_version, String, default: lazy { node['java']['jdk_version'].to_s }, description: 'The Java version to install into'
property :jce_url, String, default: lazy { node['java']['oracle']['jce'][jdk_version]['url'] }, description: 'The URL for the JCE distribution'
property :jce_checksum, String, default: lazy { node['java']['oracle']['jce'][jdk_version]['checksum'] }, description: 'The checksum of the JCE distribution'
property :java_home, String, default: lazy { node['java']['java_home'] }, description: 'Indicates that you accept Oracles EULA'
property :jce_home, String, default: lazy { node['java']['oracle']['jce']['home'] }, description: 'The location where JCE files will be decompressed for installation'
property :jce_cookie, String, default: lazy { node['java']['oracle']['accept_oracle_download_terms'] ? 'oraclelicense=accept-securebackup-cookie' : '' }, description: 'The location of the Java installation'
property :principal, String, default: lazy { platform_family?('windows') ? node['java']['windows']['owner'] : 'administrator' }, description: 'For Windows installations only, this determines the owner of the JCE files'

action :install do
jdk_version = new_resource.jdk_version
Expand Down

0 comments on commit 56ba891

Please sign in to comment.