Browse files

Merge pull request #3 from mbornoz/java-improvements

Added classes to install JAI, refactoring and clean-up
  • Loading branch information...
2 parents b840191 + 1fd1c39 commit 94a32bd6a9de817d489cb7dc504609a57402fe72 @mbornoz mbornoz committed May 17, 2011
View
0 manifests/classes/dev.pp → manifests/classes/java-dev.pp
File renamed without changes.
View
43 manifests/classes/java-jai-imageio.pp
@@ -0,0 +1,43 @@
+# Java Advanced Imaging
+
+class java::jai-imageio {
+
+ include java::params
+
+ common::archive::tar-gz{"${java::params::jvm_path}/ext/jai_imageio-${java::params::jai_imageio_version}/.installed":
+ source => $architecture ? {
+ "i386" => "${java::params::jai_imageio_url_base}/jai_imageio-${java::params::jai_imageio_version}-lib-linux-i586.tar.gz",
+ "amd64" => "${java::params::jai_imageio_url_base}/jai_imageio-${java::params::jai_imageio_version}-lib-linux-amd64.tar.gz",
+ },
+ target => "${java::params::jvm_path}/ext",
+ require => Package["${java::params::pkgname}"],
+ }
+
+ file {"${java::params::jvm_path}/jre/lib/${java::params::jai_arch}/libclib_jiio.so":
+ ensure => link,
+ target => "${java::params::jvm_path}/ext/jai_imageio-${java::params::jai_imageio_version}/lib/libclib_jiio.so",
+ require => [
+ Package["${java::params::pkgname}"],
+ Common::Archive::Tar-gz["${java::params::jvm_path}/ext/jai_imageio-${java::params::jai_imageio_version}/.installed"]
+ ],
+ }
+
+ file {"${java::params::jvm_path}/jre/lib/ext/jai_imageio.jar":
+ ensure => link,
+ target => "${java::params::jvm_path}/ext/jai_imageio-${java::params::jai_imageio_version}/lib/jai_imageio.jar",
+ require => [
+ Package["${java::params::pkgname}"],
+ Common::Archive::Tar-gz["${java::params::jvm_path}/ext/jai_imageio-${java::params::jai_imageio_version}/.installed"]
+ ],
+ }
+
+ file {"${java::params::jvm_path}/jre/lib/ext/clibwrapper_jiio.jar":
+ ensure => link,
+ target => "${java::params::jvm_path}/ext/jai_imageio-${java::params::jai_imageio_version}/lib/clibwrapper_jiio.jar",
+ require => [
+ Package["${java::params::pkgname}"],
+ Common::Archive::Tar-gz["${java::params::jvm_path}/ext/jai_imageio-${java::params::jai_imageio_version}/.installed"]
+ ],
+ }
+
+}
View
50 manifests/classes/java-jai.pp
@@ -0,0 +1,50 @@
+# Java Advanced Imaging
+
+class java::jai {
+
+ include java::params
+
+ common::archive::tar-gz{"${java::params::jvm_path}/ext/jai-${java::params::jai_version}/.installed":
+ source => "${java::params::jai_url_base}/${java::params::jai_version}/jai-${java::params::jai_version}-lib-linux-${java::params::jai_arch}.tar.gz",
+ target => "${java::params::jvm_path}/ext",
+ require => Package["${java::params::pkgname}"],
+ }
+
+ file {"${java::params::jvm_path}/jre/lib/${java::params::jai_arch}/libmlib_jai.so":
+ ensure => link,
+ target => "${java::params::jvm_path}/ext/jai-${java::params::jai_version}/lib/libmlib_jai.so",
+ require => [
+ Package["${java::params::pkgname}"],
+ Common::Archive::Tar-gz["${java::params::jvm_path}/ext/jai-${java::params::jai_version}/.installed"]
+ ],
+ }
+
+ file {"${java::params::jvm_path}/jre/lib/ext/jai_core.jar":
+ ensure => link,
+ target => "${java::params::jvm_path}/ext/jai-${java::params::jai_version}/lib/jai_core.jar",
+ require => [
+ Package["${java::params::pkgname}"],
+ Common::Archive::Tar-gz["${java::params::jvm_path}/ext/jai-${java::params::jai_version}/.installed"]
+ ],
+ }
+
+ file {"${java::params::jvm_path}/jre/lib/ext/jai_codec.jar":
+ ensure => link,
+ target => "${java::params::jvm_path}/ext/jai-${java::params::jai_version}/lib/jai_codec.jar",
+ require => [
+ Package["${java::params::pkgname}"],
+ Common::Archive::Tar-gz["${java::params::jvm_path}/ext/jai-${java::params::jai_version}/.installed"]
+ ],
+ }
+
+ file {"${java::params::jvm_path}/jre/lib/ext/mlibwrapper_jai.jar":
+ ensure => link,
+ target => "${java::params::jvm_path}/ext/jai-${java::params::jai_version}/lib/mlibwrapper_jai.jar",
+ require => [
+ Package["${java::params::pkgname}"],
+ Common::Archive::Tar-gz["${java::params::jvm_path}/ext/jai-${java::params::jai_version}/.installed"]
+ ],
+ }
+
+}
+
View
49 manifests/classes/java-params.pp
@@ -0,0 +1,49 @@
+class java::params {
+
+ $pkgname = $java16_vendor ? {
+ bea => "java-1.6.0-bea",
+ ibm => "java-1.6.0-ibm",
+ sun => $operatingsystem ? {
+ /RedHat|CentOS/ => "java-1.6.0-sun",
+ /Debian|Ubuntu/ => "sun-java6-jdk",
+ },
+ default => $operatingsystem ? {
+ /RedHat|CentOS/ => "java-1.6.0-openjdk",
+ /Debian|Ubuntu/ => "openjdk-6-jdk",
+ },
+ }
+
+ $jai_imageio_version = $java_jai_imageio_version ? {
+ "" => "1_1",
+ default => $java_jai_imageio_version,
+ }
+
+ $jai_imageio_url_base = $java_jai_imageio_url_base ? {
+ "" => "http://download.java.net/media/jai-imageio/builds/release/1.1",
+ default => $java_jai_imageio_url_base,
+ }
+
+ $jvm_path = $java_jvm_path ? {
+ "" => $operatingsystem ? {
+ /RedHat|CentOS/ => "/usr/lib/jvm/java-sun",
+ /Debian|Ubuntu/ => "/usr/lib/jvm/java-6-sun",
+ },
+ default => $java_jvm_path,
+ }
+
+ $jai_arch = $java_jai_arch ? {
+ "i386" => "i586",
+ default => "amd64",
+ }
+
+ $jai_version = $java_jai_version ? {
+ "" => "1_1_3",
+ default => $java_jai_version,
+ }
+
+ $jai_url_base = $java_jai_url_base ? {
+ "" => "http://download.java.net/media/jai/builds/release",
+ default => $java_jai_url_base,
+ }
+
+}
View
48 manifests/classes/java-v6.pp
@@ -0,0 +1,48 @@
+class java::v6 {
+
+ include java::params
+
+ if $operatingsystem =~ /Ubuntu|Debian/ and $java16_vendor == "sun" {
+
+ # Thanks to Java strange licensing
+ file {"/var/cache/debconf/sun-java6-bin.preseed":
+ ensure => present,
+ content => "sun-java6-bin shared/accepted-sun-dlj-v1-1 boolean true",
+ }
+
+ package {"sun-java6-bin":
+ ensure => present,
+ responsefile => "/var/cache/debconf/sun-java6-bin.preseed",
+ require => File["/var/cache/debconf/sun-java6-bin.preseed"],
+ before => Package["${java::params::pkgname}"],
+ }
+
+ # On Debian/Ubuntu status of update-java-alternatives is always 1,
+ # || true is a dirty workaround to stop puppet from thinking it failed!
+ exec {"set default jvm":
+ command => "update-alternatives --set java /usr/lib/jvm/java-6-sun/jre/bin/java || true",
+ unless => 'test $(readlink /etc/alternatives/java) = /usr/lib/jvm/java-6-sun/jre/bin/java',
+ require => Package["sun-java6-bin"],
+ }
+
+ $jvm = '6'
+ file {"/etc/profile.d/java_home":
+ ensure => present,
+ content => template("java/java-home.erb"),
+ }
+
+ }
+
+ package {"${java::params::pkgname}":
+ alias => "java-1.6",
+ ensure => present,
+ }
+
+ if $operatingsystem =~ /RedHat|CentOS/ {
+ package {"${java::params::pkgname}-devel":
+ alias => "java-1.6-devel",
+ ensure => present,
+ }
+ }
+
+}
View
25 manifests/classes/v5.pp
@@ -1,25 +0,0 @@
-class java::v5 {
-
- case $java15_vendor {
- bea: {
- $java_pkgname = "java-1.5.0-bea"
- }
- ibm: {
- $java_pkgname = "java-1.5.0-ibm"
- }
- default: {
- $java_pkgname = "java-1.5.0-sun"
- }
- }
-
- package{ "${java_pkgname}":
- alias => "java-1.5",
- ensure => present,
- }
-
- package{ "${java_pkgname}-devel":
- alias => "java-1.5-devel",
- ensure => present,
- }
-}
-
View
68 manifests/classes/v6.pp
@@ -1,68 +0,0 @@
-#
-class java::v6 {
-
- case $java16_vendor {
- bea: {
- $java_pkgname = "java-1.6.0-bea"
- }
- ibm: {
- $java_pkgname = "java-1.6.0-ibm"
- }
- sun: {
- $java_pkgname = $operatingsystem ? {
- RedHat => "java-1.6.0-sun",
- Debian => "sun-java6-jdk",
- }
-
- if $operatingsystem == "Debian" {
-
- # Thanks to Java strange licensing
- file {"/var/cache/debconf/sun-java6-bin.preseed":
- ensure => present,
- content => "sun-java6-bin shared/accepted-sun-dlj-v1-1 boolean true",
- }
-
- package { "sun-java6-bin":
- ensure => present,
- responsefile => "/var/cache/debconf/sun-java6-bin.preseed",
- require => File["/var/cache/debconf/sun-java6-bin.preseed"],
- before => Package["sun-java6-jdk"],
- }
-
- # On Debian/Ubuntu status of update-java-alternatives is always 1,
- # || true is a dirty workaround to stop puppet from thinking it failed!
- exec {"set default jvm":
- command => "update-alternatives --set java /usr/lib/jvm/java-6-sun/jre/bin/java || true",
- unless => 'test $(readlink /etc/alternatives/java) = /usr/lib/jvm/java-6-sun/jre/bin/java',
- require => Package["sun-java6-bin"],
- }
-
- $jvm = '6'
- file {"/etc/profile.d/java_home":
- ensure => present,
- content => template("java/java-home.erb"),
- }
-
- }
- }
- default: {
- $java_pkgname = $operatingsystem ? {
- RedHat => "java-1.6.0-openjdk",
- Debian => "openjdk-6-jdk",
- }
- }
- }
-
- package{ "${java_pkgname}":
- alias => "java-1.6",
- ensure => present,
- }
-
- if $operatingsystem == "RedHat" {
- package{ "${java_pkgname}-devel":
- alias => "java-1.6-devel",
- ensure => present,
- }
- }
-
-}
View
13 manifests/init.pp
@@ -2,18 +2,7 @@
class java {
case $operatingsystem {
- Debian: {
- case $lsbdistcodename {
- etch,lenny,squeeze : { include java::v6 }
- default: { fail "java::v6 not available for ${operatingsystem}/${lsbdistcodename}" }
- }
- }
- Ubuntu: {
- case $lsbdistcodename {
- hardy,intrepid,jaunty,lucid : { include java::v6 }
- default: { fail "java::v6 not available for ${operatingsystem}/${lsbdistcodename}" }
- }
- }
+ Debian,Ubuntu,RedHat,CentOS: { include java::v6 }
default: { notice "Unsupported operatingsystem ${operatingsystem}" }
}

0 comments on commit 94a32bd

Please sign in to comment.