Skip to content

Commit 8d2de7a

Browse files
committed
Reorganizes README to be more clear
1 parent cac108f commit 8d2de7a

1 file changed

Lines changed: 82 additions & 86 deletions

File tree

README.md

Lines changed: 82 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,55 @@
1-
Description
2-
===========
1+
java
2+
=====
33

44
This cookbook installs a Java JDK/JRE. It defaults to installing
55
OpenJDK, but it can also install Oracle and IBM JDKs.
66

7-
**IMPORTANT NOTE**
7+
Usage
8+
-----
89

9-
As of 26 March 2012 you can no longer directly download the JDK from
10-
Oracle's website without using a special cookie. This cookbook uses
11-
that cookie to download the oracle recipe on your behalf, however the
12-
`java::oracle` recipe forces you to set either override the
13-
`node['java']['oracle']['accept_oracle_download_terms']` to true or
14-
set up a private repository accessible by HTTP.
10+
Simply include the `java` recipe wherever you would like Java installed, such as a run list (`recipe[java]`) or a cookbook (`include_recipe 'java'`). By default, OpenJDK 6 is installed. The `install_flavor` attribute is used to determine which JDK to install (OpenJDK, Oracle, IBM, or Windows), and `jdk_version` specifies which version to install (currently 6 and 7 are supported for all JDK types, 8 for Oracle only).
1511

16-
### Example
12+
### Examples
1713

18-
override the `accept_oracle_download_terms` in, e.g., `roles/base.rb`
14+
To install Oracle Java 7 (note that when installing Oracle JDK, `accept_oracle_download_terms` must be set -- see below for details):
1915

16+
name "java"
17+
description "Install Oracle Java"
2018
default_attributes(
21-
:java => {
22-
:oracle => {
23-
"accept_oracle_download_terms" => true
24-
}
25-
}
19+
"java" => {
20+
"install_flavor" => "oracle",
21+
"accept_oracle_download_terms" => true,
22+
"jdk_version" => "7"
23+
}
24+
)
25+
run_list(
26+
"recipe[java]"
27+
)
28+
29+
To install IBM flavored Java:
30+
31+
name "java"
32+
description "Install IBM Java on Ubuntu"
33+
default_attributes(
34+
"java" => {
35+
"install_flavor" => "ibm",
36+
"ibm" => {
37+
"accept_ibm_download_terms" => true,
38+
"url" => "http://fileserver.example.com/ibm-java-x86_64-sdk-7.0-4.1.bin",
39+
"checksum" => "The SHA256 checksum of the bin"
40+
}
41+
}
42+
)
43+
run_list(
44+
"recipe[java]"
2645
)
2746

2847
Requirements
29-
============
48+
-----
3049

3150
Chef 0.10.10+ and Ohai 6.10+ for `platform_family` use.
3251

33-
## Platform
52+
### Platform
3453

3554
* Debian, Ubuntu
3655
* CentOS, Red Hat, Fedora, Scientific, Amazon, XenServer
@@ -39,11 +58,8 @@ Chef 0.10.10+ and Ohai 6.10+ for `platform_family` use.
3958
* SmartOS
4059
* Windows
4160

42-
This cookbook includes cross-platform testing support via
43-
`test-kitchen`, see `TESTING.md`.
44-
4561
Attributes
46-
==========
62+
-----
4763

4864
See `attributes/default.rb` for default values.
4965

@@ -85,11 +101,11 @@ the .tar.gz.
85101
JDK installed to be default on the system. Defaults to true.
86102

87103
Recipes
88-
=======
104+
-----
89105

90-
## default
106+
### default
91107

92-
Include the default recipe in a run list, to get `java`. By default
108+
Include the default recipe in a run list or recipe to get `java`. By default
93109
the `openjdk` flavor of Java is installed, but this can be changed by
94110
using the `install_flavor` attribute. By default on Windows platform
95111
systems, the `install_flavor` is `windows`.
@@ -101,21 +117,21 @@ NOTE: In most cases, including just the default recipe will be sufficient.
101117
It's possible to include the install_type recipes directly, as long as
102118
the necessary attributes (such as java_home) are set.
103119

104-
## set_attributes_from_version
120+
### set_attributes_from_version
105121

106-
Sets default attributes based on the JDK version. This logic must be in
122+
Sets default attributes based on the JDK version. This is included by `default.rb`. This logic must be in
107123
a recipe instead of attributes/default.rb. See [#95](https://github.com/socrata-cookbooks/java/pull/95)
108124
for details.
109125

110-
## default_java_symlink
126+
### default_java_symlink
111127

112128
Updates /usr/lib/jvm/default-java to point to JAVA_HOME.
113129

114-
## purge_packages
130+
### purge_packages
115131

116132
Purges deprecated Sun Java packages.
117133

118-
## openjdk
134+
### openjdk
119135

120136
This recipe installs the `openjdk` flavor of Java. It also uses the
121137
`alternatives` system on RHEL/Debian families to set the default Java.
@@ -125,13 +141,30 @@ agreement during package installation, set
125141
`node['java']['accept_license_agreement']` to true in order to indicate
126142
that you accept the license.
127143

128-
## oracle
144+
### oracle
129145

130146
This recipe installs the `oracle` flavor of Java. This recipe does not
131147
use distribution packages as Oracle changed the licensing terms with
132148
JDK 1.6u27 and prohibited the practice for both RHEL and Debian family
133149
platforms.
134150

151+
As of 26 March 2012 you can no longer directly download the JDK from
152+
Oracle's website without using a special cookie. This cookbook uses
153+
that cookie to download the oracle recipe on your behalf, however the
154+
`java::oracle` recipe forces you to set either override the
155+
`node['java']['oracle']['accept_oracle_download_terms']` to true or
156+
set up a private repository accessible by HTTP.
157+
158+
override the `accept_oracle_download_terms` in, e.g., `roles/base.rb`
159+
160+
default_attributes(
161+
:java => {
162+
:oracle => {
163+
"accept_oracle_download_terms" => true
164+
}
165+
}
166+
)
167+
135168
For both RHEL and Debian families, this recipe pulls the binary
136169
distribution from the Oracle website, and installs it in the default
137170
`JAVA_HOME` for each distribution. For Debian, this is
@@ -142,22 +175,22 @@ After putting the binaries in place, the `java::oracle` recipe updates
142175
`update-alternatives` script. This is all handled in the `java_ark`
143176
LWRP.
144177

145-
## oracle_i386
178+
### oracle_i386
146179

147180
This recipe installs the 32-bit Java virtual machine without setting
148181
it as the default. This can be useful if you have applications on the
149182
same machine that require different versions of the JVM.
150183

151184
This recipe operates in a similar manner to `java::oracle`.
152185

153-
## oracle_rpm
186+
### oracle_rpm
154187

155188
This recipe installs the Oracle JRE or JDK provided by a custom YUM
156189
repositories.
157190
It also uses the `alternatives` system on RHEL families to set
158191
the default Java.
159192

160-
## windows
193+
### windows
161194

162195
Because there is no easy way to pull the java msi off oracle's site,
163196
this recipe requires you to host it internally on your own http repo.
@@ -169,7 +202,7 @@ the `aws` and `windows` cookbooks. As of version 1.18.0, this cookbook
169202
references them with `suggests` instead of `depends`, as they are only
170203
used by the `windows` recipe.
171204

172-
## ibm
205+
### ibm
173206

174207
The `java::ibm` recipe is used to install the IBM version of Java.
175208
Note that IBM requires you to create an account *and* log in to
@@ -185,9 +218,9 @@ At this time the `java::ibm` recipe does not support multiple SDK
185218
installations.
186219

187220
Resources/Providers
188-
===================
221+
-----
189222

190-
## java_ark
223+
### java_ark
191224

192225
This cookbook contains the `java_ark` LWRP. Generally speaking this
193226
LWRP is deprecated in favor of `ark` from the
@@ -197,13 +230,13 @@ still used in this cookbook for handling the Oracle JDK installation.
197230
By default, the extracted directory is extracted to
198231
`app_root/extracted_dir_name` and symlinked to `app_root/default`
199232

200-
### Actions
233+
#### Actions
201234

202235
- `:install`: extracts the tarball and makes necessary symlinks
203236
- `:remove`: removes the tarball and run update-alternatives for all
204237
symlinked `bin_cmds`
205238

206-
### Attribute Parameters
239+
#### Attribute Parameters
207240

208241
- `url`: path to tarball, .tar.gz, .bin (oracle-specific), and .zip
209242
currently supported
@@ -223,7 +256,7 @@ By default, the extracted directory is extracted to
223256
- `default`: whether this the default installation of this package,
224257
boolean true or false
225258

226-
### Examples
259+
#### Examples
227260

228261
# install jdk6 from Oracle
229262
java_ark "jdk" do
@@ -234,25 +267,25 @@ By default, the extracted directory is extracted to
234267
action :install
235268
end
236269

237-
## java_alternatives
270+
### java_alternatives
238271

239272
The `java_alternatives` LWRP uses `update-alternatives` command
240273
to set and unset command alternatives for various Java tools
241274
such as java, javac, etc.
242275

243-
### Actions
276+
#### Actions
244277

245278
- `:set`: set alternatives for Java tools
246279
- `:unset`: unset alternatives for Java tools
247280

248-
### Attribute Parameters
281+
#### Attribute Parameters
249282

250283
- `java_location`: Java installation location.
251284
- `bin_cmds`: array of Java tool names to set or unset alternatives on.
252285
- `default`: whether to set the Java tools as system default. Boolean, defaults to `true`.
253286
- `priority`: priority of the alternatives. Integer, defaults to `1061`.
254287

255-
### Examples
288+
#### Examples
256289

257290
# set alternatives for java and javac commands
258291
java_alternatives "set java alternatives" do
@@ -261,53 +294,16 @@ such as java, javac, etc.
261294
action :set
262295
end
263296

264-
###
265-
Usage
266-
=====
267-
268-
Simply include the `java` recipe where ever you would like Java installed.
269-
270-
To install Oracle flavored Java override the `node['java']['install_flavor']` attribute with in role:
271-
272-
name "java"
273-
description "Install Oracle Java on Ubuntu"
274-
default_attributes(
275-
"java" => {
276-
"install_flavor" => "oracle"
277-
}
278-
)
279-
run_list(
280-
"recipe[java]"
281-
)
282-
283-
To install IBM flavored Java, set the required attributes:
284-
285-
name "java"
286-
description "Install IBM Java on Ubuntu"
287-
default_attributes(
288-
"java" => {
289-
"install_flavor" => "ibm",
290-
"ibm" => {
291-
"accept_ibm_download_terms" => true,
292-
"url" => "http://fileserver.example.com/ibm-java-x86_64-sdk-7.0-4.1.bin",
293-
"checksum" => "The SHA256 checksum of the bin"
294-
}
295-
}
296-
)
297-
run_list(
298-
"recipe[java]"
299-
)
300-
297+
####
301298

302299
Development
303-
===========
300+
-----
304301

305302
This cookbook uses
306303
[test-kitchen](https://github.com/opscode/test-kitchen) for
307304
integration tests and
308-
[ChefSpec/RSpec](https://github.com/acrmp/chefspec) for unit tests.
309-
Pull requests should pass existing tests in
310-
`files/default/tests/minitest-handler`.
305+
[ChefSpec/RSpec](https://github.com/sethvargo/chefspec) for unit tests.
306+
See [TESTING.md](https://github.com/socrata-cookbooks/java/blob/master/TESTING.md) for testing instructions.
311307

312308
At this time due to licensing concerns, the IBM recipe is not set up
313309
in test kitchen. If you would like to test this locally, copy
@@ -329,7 +325,7 @@ Java SDK you wish to use/test, host it on an internal HTTP server, and
329325
calculate the SHA256 checksum to use in the suite.
330326

331327
License and Author
332-
==================
328+
-----
333329

334330
* Author: Seth Chisamore (<schisamo@opscode.com>)
335331
* Author: Bryan W. Berry (<bryan.berry@gmail.com>)

0 commit comments

Comments
 (0)