geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject cvs commit: incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment Bootstrap.java
Date Tue, 24 Feb 2004 07:36:20 GMT
dain        2004/02/23 23:36:20

  Modified:    modules/assembly maven.xml
               modules/deployment/src/java/org/apache/geronimo/deployment
                        Bootstrap.java
  Log:
  Changed maven integration with bootstrap code to use a jellybean tag,
  which creates a much cleaner integration (including unwrapped exception)
  
  Revision  Changes    Path
  1.4       +33 -13    incubator-geronimo/modules/assembly/maven.xml
  
  Index: maven.xml
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/assembly/maven.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- maven.xml	24 Feb 2004 06:05:36 -0000	1.3
  +++ maven.xml	24 Feb 2004 07:36:20 -0000	1.4
  @@ -3,7 +3,9 @@
   
   <project default="default"
       xmlns:j="jelly:core"
  -    xmlns:ant="jelly:ant">
  +    xmlns:ant="jelly:ant"
  +    xmlns:define="jelly:define"
  +    xmlns:bootstrap="geronimo:bootstrap">
   
       <!-- ================= -->
       <!-- Global Properties -->
  @@ -18,7 +20,6 @@
       <!-- Load the global properties -->
       <ant:property file="${project.root}/etc/global.properties"/>
   
  -
       <!-- ==================== -->
       <!-- Default Global Goals -->
       <!-- ==================== -->
  @@ -106,16 +107,35 @@
           <ant:echo>Bootstrapping service deployer</ant:echo>
           <ant:mkdir dir="${distDir}/bin"/>
           <ant:mkdir dir="${distDir}/config-store"/>
  -        <j:invokeStatic className="org.apache.geronimo.deployment.Bootstrap" method="bootstrap">
  -            <j:arg type="java.lang.String" value="${distDir}/bin/deployer.jar"/>
  -            <j:arg type="java.lang.String" value="${distDir}"/>
  -            <j:arg type="java.lang.String" value="config-store"/>
  -            <j:arg type="java.lang.String" value="${basedir}/src/plan/deployer-config.xml"/>
  -            <j:arg type="java.lang.String" value="${deploy.classpath}"/>
  -            <j:arg type="java.lang.String" value="geronimo.deployment:role=Deployer,config=org/apache/geronimo/J2EEDeployer"/>
  -            <j:arg type="java.lang.String" value="deploy"/>
  -            <j:arg type="java.lang.String" value="org/apache/geronimo/J2EEDeployer"/>
  -        </j:invokeStatic>
  +
  +        <define:taglib uri="geronimo:bootstrap">
  +            <define:jellybean
  +                name="bootstrap"
  +                className="org.apache.geronimo.deployment.Bootstrap"
  +                method="bootstrap"/>
  +        </define:taglib>
  +
  +        <bootstrap:bootstrap
  +            outputFile="${distDir}/bin/deployer.jar"
  +            baseDir="${distDir}"
  +            store="config-store"
  +            deploymentPlan="${basedir}/src/plan/deployer-config.xml"
  +            classPath="${deploy.classpath}"
  +            mainGBean="geronimo.deployment:role=Deployer,config=org/apache/geronimo/J2EEDeployer"
  +            mainMethod="deploy"
  +            configurations="org/apache/geronimo/J2EEDeployer"
  +            />
  +
  +        <!--        <j:invokeStatic className="org.apache.geronimo.deployment.Bootstrap"
method="bootstrap">-->
  +        <!--            <j:arg type="java.lang.String" value="${distDir}/bin/deployer.jar"/>-->
  +        <!--            <j:arg type="java.lang.String" value="${distDir}"/>-->
  +        <!--            <j:arg type="java.lang.String" value="config-store"/>-->
  +        <!--            <j:arg type="java.lang.String" value="${basedir}/src/plan/deployer-config.xml"/>-->
  +        <!--            <j:arg type="java.lang.String" value="${deploy.classpath}"/>-->
  +        <!--            <j:arg type="java.lang.String" value="geronimo.deployment:role=Deployer,config=org/apache/geronimo/J2EEDeployer"/>-->
  +        <!--            <j:arg type="java.lang.String" value="deploy"/>-->
  +        <!--            <j:arg type="java.lang.String" value="org/apache/geronimo/J2EEDeployer"/>-->
  +        <!--        </j:invokeStatic>-->
   
           <!-- build the system configuration and server.jar -->
           <ant:echo>Building system configuration</ant:echo>
  
  
  
  1.9       +83 -12    incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/Bootstrap.java
  
  Index: Bootstrap.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/Bootstrap.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Bootstrap.java	24 Feb 2004 06:05:36 -0000	1.8
  +++ Bootstrap.java	24 Feb 2004 07:36:20 -0000	1.9
  @@ -84,6 +84,8 @@
   import org.apache.geronimo.system.serverinfo.ServerInfo;
   import org.apache.xmlbeans.XmlBeans;
   import org.apache.xmlbeans.XmlObject;
  +import org.apache.commons.logging.Log;
  +import org.apache.commons.logging.LogFactory;
   
   /**
    * Helper class to bootstrap the Geronimo deployer.
  @@ -95,12 +97,81 @@
       private static final ObjectName REPOSITORY_NAME = JMXUtil.getObjectName("geronimo.deployer:role=Repository,root=repository");
       private static final ObjectName SERVICE_BUILDER_NAME = JMXUtil.getObjectName("geronimo.deployer:role=Builder,type=Service,id="
+ CONFIG_ID.toString());
   
  -    /**
  -     * Invoked from maven.xml during the build to create the first Deployment Configuration
  -     * @param car the configuration file to generate
  -     */
  -    public static void bootstrap(String car, String baseDir, String store, String planPath,
String classPath, String mainGBean, String mainMethod, String configurations) {
  -        File carfile = new File(car);
  +    private String outputFile;
  +    private String baseDir;
  +    private String store;
  +    private String deploymentPlan;
  +    private String classPath;
  +    private String mainGBean;
  +    private String mainMethod;
  +    private String configurations;
  +
  +    public String getOutputFile() {
  +        return outputFile;
  +    }
  +
  +    public void setOutputFile(String outputFile) {
  +        this.outputFile = outputFile;
  +    }
  +
  +    public String getBaseDir() {
  +        return baseDir;
  +    }
  +
  +    public void setBaseDir(String baseDir) {
  +        this.baseDir = baseDir;
  +    }
  +
  +    public String getStore() {
  +        return store;
  +    }
  +
  +    public void setStore(String store) {
  +        this.store = store;
  +    }
  +
  +    public String getDeploymentPlan() {
  +        return deploymentPlan;
  +    }
  +
  +    public void setDeploymentPlan(String deploymentPlan) {
  +        this.deploymentPlan = deploymentPlan;
  +    }
  +
  +    public String getClassPath() {
  +        return classPath;
  +    }
  +
  +    public void setClassPath(String classPath) {
  +        this.classPath = classPath;
  +    }
  +
  +    public String getMainGBean() {
  +        return mainGBean;
  +    }
  +
  +    public void setMainGBean(String mainGBean) {
  +        this.mainGBean = mainGBean;
  +    }
  +
  +    public String getMainMethod() {
  +        return mainMethod;
  +    }
  +
  +    public void setMainMethod(String mainMethod) {
  +        this.mainMethod = mainMethod;
  +    }
  +
  +    public String getConfigurations() {
  +        return configurations;
  +    }
  +
  +    public void setConfigurations(String configurations) {
  +        this.configurations = configurations;
  +    }
  +
  +    public void bootstrap() {
  +        File file = new File(outputFile);
           File storeDir = new File(baseDir, store);
   
           ClassLoader oldCL = Thread.currentThread().getContextClassLoader();
  @@ -119,7 +190,7 @@
               mainAttributes.putValue(CommandLine.CONFIGURATIONS.toString(), configurations);
   
               // write the deployer system out to a jar
  -            JarOutputStream jos = new JarOutputStream(new BufferedOutputStream(new FileOutputStream(carfile)),
manifest);
  +            JarOutputStream jos = new JarOutputStream(new BufferedOutputStream(new FileOutputStream(file)),
manifest);
               try {
                   // add the startup jar entry which allows us to locat the startup directory
                   jos.putNextEntry(new ZipEntry("META-INF/startup-jar"));
  @@ -137,24 +208,24 @@
   
               // install the deployer systen in to the config store
               LocalConfigStore configStore = new LocalConfigStore(storeDir);
  -            configStore.install(carfile.toURL());
  +            configStore.install(file.toURL());
   
               System.setProperty("geronimo.base.dir", baseDir);
               Kernel kernel = new Kernel("geronimo.bootstrap");
               kernel.boot();
   
               ConfigurationManager configurationManager = kernel.getConfigurationManager();
  -            ObjectName deploymentSystemName = configurationManager.load(deploymentSystemConfig,
carfile.toURL());
  +            ObjectName deploymentSystemName = configurationManager.load(deploymentSystemConfig,
file.toURL());
               kernel.startRecursiveGBean(deploymentSystemName);
   
               GBeanMBean serviceDeployerConfig = getServiceDeployerConfig();
               serviceDeployerConfig.setReferencePatterns("Parent", Collections.singleton(deploymentSystemName));
  -            ObjectName serviceDeployerName = configurationManager.load(serviceDeployerConfig,
carfile.toURL());
  +            ObjectName serviceDeployerName = configurationManager.load(serviceDeployerConfig,
file.toURL());
               kernel.startRecursiveGBean(serviceDeployerName);
   
               File tempFile = File.createTempFile("deployer", ".car");
               try {
  -                URL planURL = new File(planPath).toURL();
  +                URL planURL = new File(deploymentPlan).toURL();
                   XmlObject plan = XmlBeans.getContextTypeLoader().parse(planURL, null, null);
                   kernel.getMBeanServer().invoke(
                           SERVICE_BUILDER_NAME,
  
  
  

Mime
View raw message