OW2 Consortium elastic-grid

Rev

Rev 107 | Rev 445 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
10 jeje 1
package com.elasticgrid.substrates.tomcat6
2
 
3
import com.elasticgrid.substrates.AbstractSubstrate
4
import groovy.xml.MarkupBuilder
18 jeje 5
import com.elasticgrid.substrates.FirewallRule
6
import com.elasticgrid.substrates.FirewallRule.IpProtocol
10 jeje 7
 
8
class Tomcat6Substrate extends AbstractSubstrate {
14 jeje 9
    def version
10 jeje 10
 
11
    public String getName() {
12
        return "Tomcat 6";
13
    }
14
 
15
    public void addDomainSpecificLangueFeatures(MarkupBuilder builder, ExpandoMetaClass emc) {
16
        emc.tomcat = { Map attributes, Closure cl ->
196 jeje 17
            version = attributes.version ?: '6.0.18'
20 jeje 18
            def removeOnDestroy = attributes.removeOnDestroy ?: true
10 jeje 19
            serviceExec(name: 'Tomcat') {
20 jeje 20
                software(name: 'Tomcat', version: version, removeOnDestroy: removeOnDestroy) {
196 jeje 21
                    install source: "https://elastic-grid-substrates.s3.amazonaws.com/tomcat/apache-tomcat-${version}.zip",
22
                            target: 'tomcat', unarchive: true
20 jeje 23
                    postInstall(removeOnCompletion: removeOnDestroy) {
196 jeje 24
                        execute command: "/bin/chmod +x \${EG_HOME}/system/external/tomcat/apache-tomcat-$version/bin/*.sh",
10 jeje 25
                                nohup: false
26
                    }
27
                }
28
                execute inDirectory: 'bin', command: 'catalina.sh run'
20 jeje 29
                cl()
10 jeje 30
                maintain 1
196 jeje 31
                maxPerMachine 1
10 jeje 32
            }
33
        }
34
        emc.webapp = { Map attributes ->
20 jeje 35
            data source: attributes.source,
196 jeje 36
                 target: "\${EG_HOME}/system/external/tomcat/apache-tomcat-$version/webapps"
10 jeje 37
        }
38
    }
39
 
18 jeje 40
    /**
41
     * Open port 8080 for TCP from anywhere.
42
     * @todo temporary situation until we have the Apache frontend working fine.
43
     */
44
    @Override
45
    public List<FirewallRule> getFirewallRules() {
46
        [new FirewallRule(getName(), IpProtocol.TCP, 8080, '??')]
47
    }
10 jeje 48
 
196 jeje 49
}