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/jetty/src/java/org/apache/geronimo/jetty/deployment WARConfigBuilder.java
Date Fri, 23 Apr 2004 03:08:28 GMT
dain        2004/04/22 20:08:28

  Modified:    modules/assembly maven.xml
               modules/assembly/src/plan system-plan.xml
               modules/connector/src/java/org/apache/geronimo/connector/deployment
                        AbstractRARConfigBuilder.java
               modules/connector/src/test/org/apache/geronimo/connector/deployment
                        RAR_1_0ConfigBuilderTest.java
                        RAR_1_5ConfigBuilderTest.java
               modules/deployment/src/java/org/apache/geronimo/deployment
                        Bootstrap.java ConfigurationBuilder.java
                        Deployer.java
               modules/deployment/src/java/org/apache/geronimo/deployment/plugin/local
                        DistributeCommand.java
               modules/deployment/src/java/org/apache/geronimo/deployment/service
                        ServiceConfigBuilder.java
               modules/deployment/src/schema geronimo-common.xsd
                        geronimo-config.xsd
               modules/jetty/src/java/org/apache/geronimo/jetty/deployment
                        WARConfigBuilder.java
  Log:
  Changed deployer to take the main class and class path used for the manifest.
  Changed deployers to take the manifest in addtion to the file name.
  Removed the old executable tags.
  
  Revision  Changes    Path
  1.9       +5 -1      incubator-geronimo/modules/assembly/maven.xml
  
  Index: maven.xml
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/assembly/maven.xml,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- maven.xml	16 Apr 2004 05:57:21 -0000	1.8
  +++ maven.xml	23 Apr 2004 03:08:28 -0000	1.9
  @@ -155,6 +155,10 @@
               <ant:arg value="src/plan/system-plan.xml"/>
               <ant:arg value="--outfile"/>
               <ant:arg value="${distDir}/bin/server.jar"/>
  +            <ant:arg value="--mainClass"/>
  +            <ant:arg value="org.apache.geronimo.system.main.Daemon"/>
  +            <ant:arg value="--classPath"/>
  +            <ant:arg value="${server.classpath}"/>
           </ant:java>
   
           <!-- build the J2EEServer configuration -->
  
  
  
  1.6       +0 -2      incubator-geronimo/modules/assembly/src/plan/system-plan.xml
  
  Index: system-plan.xml
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/assembly/src/plan/system-plan.xml,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- system-plan.xml	22 Apr 2004 21:39:56 -0000	1.5
  +++ system-plan.xml	23 Apr 2004 03:08:28 -0000	1.6
  @@ -31,8 +31,6 @@
       configId="org/apache/geronimo/System"
       >
   
  -    <executable mainClass="org.apache.geronimo.system.main.Daemon" classPath="../lib/geronimo-kernel-DEV.jar
../lib/geronimo-system-DEV.jar ../lib/cglib-full-2.0.jar ../lib/commons-cli-1.0.jar ../lib/commons-logging-1.0.3.jar
../lib/log4j-1.2.8.jar ../lib/mx4j-2.0.1.jar ../lib/xercesImpl-2.6.0.jar ../lib/xmlParserAPIs-2.2.1.jar"/>
  -
       <!-- ServerInfo service -->
       <gbean name="geronimo.system:role=ServerInfo" class="org.apache.geronimo.system.serverinfo.ServerInfo"/>
   
  
  
  
  1.15      +5 -4      incubator-geronimo/modules/connector/src/java/org/apache/geronimo/connector/deployment/AbstractRARConfigBuilder.java
  
  Index: AbstractRARConfigBuilder.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/connector/src/java/org/apache/geronimo/connector/deployment/AbstractRARConfigBuilder.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- AbstractRARConfigBuilder.java	17 Apr 2004 20:34:24 -0000	1.14
  +++ AbstractRARConfigBuilder.java	23 Apr 2004 03:08:28 -0000	1.15
  @@ -31,6 +31,7 @@
   import java.util.jar.JarEntry;
   import java.util.jar.JarInputStream;
   import java.util.jar.JarOutputStream;
  +import java.util.jar.Manifest;
   import javax.management.MalformedObjectNameException;
   import javax.management.ObjectName;
   
  @@ -132,13 +133,13 @@
           }
       }
   
  -    public void buildConfiguration(File outfile, File module, XmlObject plan) throws IOException,
DeploymentException {
  +    public void buildConfiguration(File outfile, Manifest manifest, File module, XmlObject
plan) throws IOException, DeploymentException {
           if (module.isDirectory()) {
               throw new DeploymentException("Cannot deploy an unpacked RAR");
           }
           FileInputStream is = new FileInputStream(module);
           try {
  -            buildConfiguration(outfile, is, plan);
  +            buildConfiguration(outfile, manifest, is, plan);
           } finally {
               try {
                   is.close();
  @@ -148,7 +149,7 @@
           }
       }
   
  -    public void buildConfiguration(File outfile, InputStream in, XmlObject plan) throws
IOException, DeploymentException {
  +    public void buildConfiguration(File outfile, Manifest manifest, InputStream in, XmlObject
plan) throws IOException, DeploymentException {
           GerConnectorType geronimoConnector = ((GerConnectorDocument) plan).getConnector();
           URI configID;
           try {
  
  
  
  1.7       +2 -2      incubator-geronimo/modules/connector/src/test/org/apache/geronimo/connector/deployment/RAR_1_0ConfigBuilderTest.java
  
  Index: RAR_1_0ConfigBuilderTest.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/connector/src/test/org/apache/geronimo/connector/deployment/RAR_1_0ConfigBuilderTest.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- RAR_1_0ConfigBuilderTest.java	3 Apr 2004 22:37:57 -0000	1.6
  +++ RAR_1_0ConfigBuilderTest.java	23 Apr 2004 03:08:28 -0000	1.7
  @@ -118,7 +118,7 @@
           kernel.boot();
           try {
               RAR_1_0ConfigBuilder configBuilder = new RAR_1_0ConfigBuilder(kernel, null,
new ObjectName("geronimo.connector:service=ConnectionTracker"));
  -            configBuilder.buildConfiguration(outfile, getRARInputStream(), geronimoConnectorDocument);
  +            configBuilder.buildConfiguration(outfile, null, getRARInputStream(), geronimoConnectorDocument);
           } finally {
               kernel.shutdown();
               outfile.delete();
  
  
  
  1.9       +2 -2      incubator-geronimo/modules/connector/src/test/org/apache/geronimo/connector/deployment/RAR_1_5ConfigBuilderTest.java
  
  Index: RAR_1_5ConfigBuilderTest.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/connector/src/test/org/apache/geronimo/connector/deployment/RAR_1_5ConfigBuilderTest.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- RAR_1_5ConfigBuilderTest.java	3 Apr 2004 22:37:57 -0000	1.8
  +++ RAR_1_5ConfigBuilderTest.java	23 Apr 2004 03:08:28 -0000	1.9
  @@ -118,7 +118,7 @@
           kernel.boot();
           try {
               RAR_1_5ConfigBuilder configBuilder = new RAR_1_5ConfigBuilder(kernel, null,
new ObjectName("geronimo.connector:service=ConnectionTracker"));
  -            configBuilder.buildConfiguration(outfile, getRARInputStream(), geronimoConnectorDocument);
  +            configBuilder.buildConfiguration(outfile, null, getRARInputStream(), geronimoConnectorDocument);
           } finally {
               kernel.shutdown();
               outfile.delete();
  
  
  
  1.15      +2 -2      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.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- Bootstrap.java	5 Apr 2004 05:54:11 -0000	1.14
  +++ Bootstrap.java	23 Apr 2004 03:08:28 -0000	1.15
  @@ -148,7 +148,7 @@
               // build and install the j2ee-deployer configuration
               File tempFile = File.createTempFile("j2ee-deployer", ".car");
               try {
  -                builder.buildConfiguration(tempFile, (InputStream)null, j2eeDeployerXML);
  +                builder.buildConfiguration(tempFile, manifest, (InputStream)null, j2eeDeployerXML);
                   configStore.install(tempFile.toURL());
               } finally {
                   tempFile.delete();
  
  
  
  1.9       +5 -7      incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/ConfigurationBuilder.java
  
  Index: ConfigurationBuilder.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/ConfigurationBuilder.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- ConfigurationBuilder.java	17 Apr 2004 20:34:24 -0000	1.8
  +++ ConfigurationBuilder.java	23 Apr 2004 03:08:28 -0000	1.9
  @@ -17,16 +17,14 @@
   
   package org.apache.geronimo.deployment;
   
  -import java.io.IOException;
   import java.io.File;
  +import java.io.IOException;
   import java.io.InputStream;
   import java.net.URL;
  -import java.util.jar.JarInputStream;
  -import java.util.List;
   
  -import org.apache.xmlbeans.XmlObject;
   import org.apache.xmlbeans.SchemaTypeLoader;
   import org.apache.xmlbeans.XmlException;
  +import org.apache.xmlbeans.XmlObject;
   
   /**
    *
  @@ -59,7 +57,7 @@
        * @throws IOException if there was a problem reading or writing the files
        * @throws DeploymentException if there was a problem with the configuration
        */
  -    void buildConfiguration(File outfile, File module, XmlObject plan) throws IOException,
DeploymentException;
  +    void buildConfiguration(File outfile, java.util.jar.Manifest manifest, File module,
XmlObject plan) throws IOException, DeploymentException;
   
       /**
        * Build a configuration from an arbitrary input stream
  @@ -69,5 +67,5 @@
        * @throws IOException if there was a problem reading or writing the files
        * @throws DeploymentException if there was a problem with the configuration
        */
  -    void buildConfiguration(File outfile, InputStream module, XmlObject plan) throws IOException,
DeploymentException;
  +    void buildConfiguration(File outfile, java.util.jar.Manifest manifest, InputStream
module, XmlObject plan) throws IOException, DeploymentException;
   }
  
  
  
  1.18      +23 -4     incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/Deployer.java
  
  Index: Deployer.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/Deployer.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- Deployer.java	3 Apr 2004 22:37:57 -0000	1.17
  +++ Deployer.java	23 Apr 2004 03:08:28 -0000	1.18
  @@ -29,6 +29,8 @@
   import java.util.Iterator;
   import java.util.List;
   import java.util.Properties;
  +import java.util.jar.Manifest;
  +import java.util.jar.Attributes;
   import javax.management.MalformedObjectNameException;
   import javax.management.ObjectName;
   
  @@ -111,18 +113,29 @@
               saveOutput = true;
           }
   
  +        Manifest manifest = new Manifest();
  +        Attributes mainAttributes = manifest.getMainAttributes();
  +        mainAttributes.putValue(Attributes.Name.MANIFEST_VERSION.toString(), "1.0");
  +        if(cmd.mainClass != null) {
  +            mainAttributes.putValue(Attributes.Name.MAIN_CLASS.toString(), cmd.mainClass);
  +        }
  +        if(cmd.classPath != null) {
  +            mainAttributes.putValue(Attributes.Name.CLASS_PATH.toString(), cmd.classPath);
  +        }
  +
  +
           try {
               if (cmd.module == null) {
  -                builder.buildConfiguration(cmd.carfile, (InputStream) null, plan);
  +                builder.buildConfiguration(cmd.carfile, manifest, (InputStream) null, plan);
               } else if ("file".equals(cmd.module.getProtocol())) {
                   File module = new File(new URI(cmd.module.toString()));
  -                builder.buildConfiguration(cmd.carfile, module, plan);
  +                builder.buildConfiguration(cmd.carfile, manifest, module, plan);
               } else if (cmd.module.toString().endsWith("/")) {
                   throw new DeploymentException("Unpacked modules must be files");
               } else {
                   InputStream moduleStream = cmd.module.openStream();
                   try {
  -                    builder.buildConfiguration(cmd.carfile, moduleStream, plan);
  +                    builder.buildConfiguration(cmd.carfile, manifest, moduleStream, plan);
                   } finally {
                       try {
                           moduleStream.close();
  @@ -175,6 +188,8 @@
           options.addOption("o", "outfile", true, "output file to generate");
           options.addOption("m", "module", true, "module to deploy");
           options.addOption("p", "plan", true, "deployment plan");
  +        options.addOption(null, "mainClass", true, "deployment plan");
  +        options.addOption(null, "classPath", true, "deployment plan");
   
           CommandLine cmd = new PosixParser().parse(options, args);
           if (cmd.hasOption("h")) {
  @@ -201,6 +216,8 @@
               System.err.println("No plan or module specified");
               return null;
           }
  +        command.mainClass = cmd.hasOption("mainClass") ? cmd.getOptionValue("mainClass")
: null;
  +        command.classPath = cmd.hasOption("classPath") ? cmd.getOptionValue("classPath")
: null;
           return command;
       }
   
  @@ -222,6 +239,8 @@
           private File carfile;
           private URL module;
           private URL plan;
  +        private String mainClass;
  +        private String classPath;
       }
   
       public static final GBeanInfo GBEAN_INFO;
  
  
  
  1.10      +2 -2      incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/local/DistributeCommand.java
  
  Index: DistributeCommand.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/local/DistributeCommand.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- DistributeCommand.java	3 Apr 2004 22:37:58 -0000	1.9
  +++ DistributeCommand.java	23 Apr 2004 03:08:28 -0000	1.10
  @@ -49,7 +49,7 @@
           try {
               // create some working space
               configFile = File.createTempFile("deploy", ".car");
  -            builder.buildConfiguration(configFile, in, plan);
  +            builder.buildConfiguration(configFile, null, in, plan);
   
               // install in our local server
               store.install(configFile.toURL());
  
  
  
  1.13      +5 -21     incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java
  
  Index: ServiceConfigBuilder.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- ServiceConfigBuilder.java	3 Apr 2004 22:37:58 -0000	1.12
  +++ ServiceConfigBuilder.java	23 Apr 2004 03:08:28 -0000	1.13
  @@ -39,7 +39,6 @@
   import org.apache.geronimo.deployment.xbeans.ConfigurationDocument;
   import org.apache.geronimo.deployment.xbeans.ConfigurationType;
   import org.apache.geronimo.deployment.xbeans.DependencyType;
  -import org.apache.geronimo.deployment.xbeans.ExecutableType;
   import org.apache.geronimo.deployment.xbeans.GbeanType;
   import org.apache.geronimo.deployment.xbeans.ServiceDocument;
   import org.apache.geronimo.gbean.GBeanInfo;
  @@ -82,32 +81,17 @@
           return null;
       }
   
  -    public void buildConfiguration(File outfile, File module, XmlObject plan) throws IOException,
DeploymentException {
  -        buildConfiguration(outfile, (InputStream)null, plan);
  +    public void buildConfiguration(File outfile, Manifest manifest, File module, XmlObject
plan) throws IOException, DeploymentException {
  +        buildConfiguration(outfile, manifest, (InputStream)null, plan);
       }
   
  -    public void buildConfiguration(File outfile, InputStream ignored, XmlObject plan) throws
IOException, DeploymentException {
  -        // create the manifext
  -        Manifest manifest = new Manifest();
  -        Attributes mainAttributes = manifest.getMainAttributes();
  -        mainAttributes.putValue(Attributes.Name.MANIFEST_VERSION.toString(), "1.0");
  -
  -        // add the manifest entries to make the archive executable
  -        ConfigurationType configType = ((ConfigurationDocument) plan).getConfiguration();
  -        ExecutableType executable = configType.getExecutable();
  -        if(executable != null) {
  -            mainAttributes.putValue(Attributes.Name.MAIN_CLASS.toString(), executable.getMainClass());
  -            if(executable.getClassPath() != null) {
  -                mainAttributes.putValue(Attributes.Name.CLASS_PATH.toString(), executable.getClassPath());
  -            }
  -        }
  -
  +    public void buildConfiguration(File outfile, Manifest manifest, InputStream ignored,
XmlObject plan) throws IOException, DeploymentException {
           FileOutputStream fos = new FileOutputStream(outfile);
           try {
               JarOutputStream os = new JarOutputStream(new BufferedOutputStream(fos), manifest);
   
               // if this is an executable jar add the startup jar finder file
  -            if(executable != null) {
  +            if (manifest.getMainAttributes().containsKey(Attributes.Name.MAIN_CLASS)) {
                   os.putNextEntry(new ZipEntry("META-INF/startup-jar"));
                   os.closeEntry();
               }
  
  
  
  1.5       +0 -5      incubator-geronimo/modules/deployment/src/schema/geronimo-common.xsd
  
  Index: geronimo-common.xsd
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/deployment/src/schema/geronimo-common.xsd,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- geronimo-common.xsd	10 Mar 2004 09:58:50 -0000	1.4
  +++ geronimo-common.xsd	23 Apr 2004 03:08:28 -0000	1.5
  @@ -32,11 +32,6 @@
           </xs:documentation>
       </xs:annotation>
   
  -    <xs:complexType name="executableType">
  -        <xs:attribute name="mainClass" type="xs:string" use="required"/>
  -        <xs:attribute name="classPath" type="xs:string" use="optional"/>
  -    </xs:complexType>
  -
       <xs:complexType name="dependencyType">
           <xs:choice>
               <xs:sequence>
  
  
  
  1.5       +0 -1      incubator-geronimo/modules/deployment/src/schema/geronimo-config.xsd
  
  Index: geronimo-config.xsd
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/deployment/src/schema/geronimo-config.xsd,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- geronimo-config.xsd	10 Mar 2004 09:58:50 -0000	1.4
  +++ geronimo-config.xsd	23 Apr 2004 03:08:28 -0000	1.5
  @@ -38,7 +38,6 @@
   
       <xs:complexType name="configurationType">
           <xs:sequence>
  -            <xs:element name="executable" type="executableType" minOccurs="0" maxOccurs="1"/>
               <xs:element name="include" type="dependencyType" minOccurs="0" maxOccurs="unbounded"/>
               <xs:element name="dependency" type="dependencyType" minOccurs="0" maxOccurs="unbounded"/>
               <xs:element name="gbean" type="gbeanType" minOccurs="1" maxOccurs="unbounded"/>
  
  
  
  1.19      +5 -4      incubator-geronimo/modules/jetty/src/java/org/apache/geronimo/jetty/deployment/WARConfigBuilder.java
  
  Index: WARConfigBuilder.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/jetty/src/java/org/apache/geronimo/jetty/deployment/WARConfigBuilder.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- WARConfigBuilder.java	17 Apr 2004 20:34:24 -0000	1.18
  +++ WARConfigBuilder.java	23 Apr 2004 03:08:28 -0000	1.19
  @@ -36,6 +36,7 @@
   import java.util.Properties;
   import java.util.jar.JarInputStream;
   import java.util.jar.JarOutputStream;
  +import java.util.jar.Manifest;
   import java.util.zip.ZipEntry;
   
   import javax.management.MalformedObjectNameException;
  @@ -120,11 +121,11 @@
       }
   
   
  -    public void buildConfiguration(File outfile, File module, XmlObject plan) throws IOException,
DeploymentException {
  +    public void buildConfiguration(File outfile, Manifest manifest, File module, XmlObject
plan) throws IOException, DeploymentException {
           if (!module.isDirectory()) {
               FileInputStream in = new FileInputStream(module);
               try {
  -                buildConfiguration(outfile, in, plan);
  +                buildConfiguration(outfile, manifest, in, plan);
                   return;
               } finally {
                   try {
  @@ -180,7 +181,7 @@
           }
       }
   
  -    public void buildConfiguration(File outfile, InputStream in, XmlObject plan) throws
IOException, DeploymentException {
  +    public void buildConfiguration(File outfile, Manifest manifest, InputStream in, XmlObject
plan) throws IOException, DeploymentException {
           WebAppType webApp = null;
           JettyWebAppType jettyWebApp = ((JettyWebAppDocument) plan).getWebApp();
           URI configID = getConfigID(jettyWebApp);
  
  
  

Mime
View raw message