geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ammul...@apache.org
Subject svn commit: r329700 - in /geronimo/trunk/modules: assembly/maven.xml deploy-tool/src/java/org/apache/geronimo/deployment/cli/DeployTool.java
Date Mon, 31 Oct 2005 01:47:54 GMT
Author: ammulder
Date: Sun Oct 30 17:47:50 2005
New Revision: 329700

URL: http://svn.apache.org/viewcvs?rev=329700&view=rev
Log:
Back door to speed up assembly module

Modified:
    geronimo/trunk/modules/assembly/maven.xml
    geronimo/trunk/modules/deploy-tool/src/java/org/apache/geronimo/deployment/cli/DeployTool.java

Modified: geronimo/trunk/modules/assembly/maven.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/assembly/maven.xml?rev=329700&r1=329699&r2=329700&view=diff
==============================================================================
--- geronimo/trunk/modules/assembly/maven.xml (original)
+++ geronimo/trunk/modules/assembly/maven.xml Sun Oct 30 17:47:50 2005
@@ -358,122 +358,55 @@
             />
 
         <!-- build the system configuration and server.jar -->
-        <ant:echo>Building server.jar</ant:echo>
-        <ant:mkdir dir="${geronimo.assembly.dir}/bin"/>
-        <ant:java fork="true" jar="${geronimo.assembly.dir}/bin/deployer.jar" failonerror="true">
-            <ant:jvmarg value="-ea"/>
-<!--
-            <ant:jvmarg value="-Xdebug"/>
-            <ant:jvmarg value="-Xnoagent"/>
-            <ant:jvmarg value="-Djava.compiler=NONE"/>
-            <ant:jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"/>
--->
-            <ant:arg value="--offline"/>
-            <ant:arg value="package"/>
-            <ant:arg value="--classPath"/>
-            <ant:arg value="${server.classpath}"/>
-            <ant:arg value="--mainClass"/>
-            <ant:arg value="org.apache.geronimo.system.main.Daemon"/>
-            <ant:arg value="--endorsedDirs"/>
-            <ant:arg value="lib/endorsed"/>
-            <ant:arg value="--extensionDirs"/>
-            <ant:arg value="lib/ext"/>
-            <ant:arg value="--install"/>
-            <ant:arg value="target/plan/system-plan.xml"/>
-            <ant:arg value="${geronimo.assembly.dir}/bin/server.jar"/>
-        </ant:java>
-
-        <!-- to debug one of these deployer calls, include these jvmargs right after the
-ea arg
-        <ant:jvmarg value="-Xdebug"/>
-        <ant:jvmarg value="-Xnoagent"/>
-        <ant:jvmarg value="-Djava.compiler=NONE"/>
-        <ant:jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"/>
-        -->
-
+        <ant:echo file="${basedir}/target/deploy-commands">package --classPath "${server.classpath}"
--mainClass org.apache.geronimo.system.main.Daemon --endorsedDirs lib/endorsed --extensionDirs
lib/ext --install target/plan/system-plan.xml ${geronimo.assembly.dir}/bin/server.jar${line.separator}</ant:echo>
+        
         <!-- build the RMINaming configuration -->
-        <ant:echo>Building RMI Naming configuration</ant:echo>
-        <ant:java fork="true" jar="${geronimo.assembly.dir}/bin/deployer.jar" failonerror="true">
-            <ant:jvmarg value="-ea"/>
-            <ant:arg value="--offline"/>
-            <ant:arg value="distribute"/>
-            <ant:arg value="target/plan/naming-server-plan.xml"/>
-        </ant:java>
+        <ant:echo file="${basedir}/target/deploy-commands" append="true"
+             message="distribute target/plan/naming-server-plan.xml${line.separator}" />
 
         <!-- build the J2EEServer configuration -->
-        <ant:echo>Building server configuration</ant:echo>
-        <ant:java fork="true" jar="${geronimo.assembly.dir}/bin/deployer.jar" failonerror="true">
-            <ant:jvmarg value="-ea"/>
-            <ant:arg value="--offline"/>
-            <ant:arg value="distribute"/>
-            <ant:arg value="target/plan/j2ee-server-plan.xml"/>
-        </ant:java>
+        <ant:echo file="${basedir}/target/deploy-commands" append="true"
+             message="distribute target/plan/j2ee-server-plan.xml${line.separator}" />
 
-        <ant:echo>Building security configuration</ant:echo>
-        <ant:java fork="true" jar="${geronimo.assembly.dir}/bin/deployer.jar" failonerror="true">
-            <ant:jvmarg value="-ea"/>
-            <ant:arg value="--offline"/>
-            <ant:arg value="distribute"/>
-            <ant:arg value="target/plan/j2ee-security-plan.xml"/>
-        </ant:java>
+        <ant:echo file="${basedir}/target/deploy-commands" append="true"
+             message="distribute target/plan/j2ee-security-plan.xml${line.separator}" />
 
-        <ant:java fork="true" jar="${geronimo.assembly.dir}/bin/deployer.jar" failonerror="true">
-            <ant:jvmarg value="-ea"/>
-            <ant:arg value="--offline"/>
-            <ant:arg value="distribute"/>
-            <ant:arg value="target/plan/j2ee-jetty-plan.xml"/>
-        </ant:java>
-        <ant:java fork="true" jar="${geronimo.assembly.dir}/bin/deployer.jar" failonerror="true">
-            <ant:jvmarg value="-ea"/>
-            <ant:arg value="--offline"/>
-            <ant:arg value="distribute"/>
-            <ant:arg value="target/plan/j2ee-tomcat-plan.xml"/>
-        </ant:java>
-        <!-- build the runtime deployer configuration -->
-        <ant:echo>Building runtime deployer configuration</ant:echo>
-        <ant:java fork="true" jar="${geronimo.assembly.dir}/bin/deployer.jar" failonerror="true">
-            <ant:jvmarg value="-ea"/>
-            <ant:arg value="--offline"/>
-            <ant:arg value="distribute"/>
-            <ant:arg value="target/plan/j2ee-runtime-deployer-plan.xml"/>
-        </ant:java>
-        <ant:java fork="true" jar="${geronimo.assembly.dir}/bin/deployer.jar" failonerror="true">
-            <ant:jvmarg value="-ea"/>
-            <ant:arg value="--offline"/>
-            <ant:arg value="distribute"/>
-            <ant:arg value="${basedir}/target/plan/j2ee-jetty-runtime-deployer-plan.xml"/>
-        </ant:java>
-        <ant:java fork="true" jar="${geronimo.assembly.dir}/bin/deployer.jar" failonerror="true">
-            <ant:jvmarg value="-ea"/>
-            <ant:arg value="--offline"/>
-            <ant:arg value="distribute"/>
-            <ant:arg value="${basedir}/target/plan/j2ee-tomcat-runtime-deployer-plan.xml"/>
-        </ant:java>
+        <ant:echo file="${basedir}/target/deploy-commands" append="true"
+             message="distribute target/plan/j2ee-jetty-plan.xml${line.separator}" />
 
+        <ant:echo file="${basedir}/target/deploy-commands" append="true"
+             message="distribute target/plan/j2ee-tomcat-plan.xml${line.separator}" />
+       
+        <ant:echo file="${basedir}/target/deploy-commands" append="true"
+             message="distribute target/plan/j2ee-runtime-deployer-plan.xml${line.separator}"
/>
+
+        <ant:echo file="${basedir}/target/deploy-commands" append="true"
+             message="distribute ${basedir}/target/plan/j2ee-jetty-runtime-deployer-plan.xml${line.separator}"
/>
+        
+        <ant:echo file="${basedir}/target/deploy-commands" append="true"
+             message="distribute ${basedir}/target/plan/j2ee-tomcat-runtime-deployer-plan.xml${line.separator}"
/>
 
         <!-- build the system configuration and client.jar -->
-        <ant:echo>Building client.jar</ant:echo>
-        <ant:mkdir dir="${geronimo.assembly.dir}/bin"/>
-        <ant:java fork="true" jar="${geronimo.assembly.dir}/bin/deployer.jar" failonerror="true">
-            <ant:jvmarg value="-ea"/>
-            <ant:arg value="--offline"/>
-            <ant:arg value="package"/>
-            <ant:arg value="--mainClass"/>
-            <ant:arg value="org.apache.geronimo.system.main.ClientCommandLine"/>
-            <ant:arg value="--classPath"/>
-            <ant:arg value="${client.classpath}"/>
-            <ant:arg value="--endorsedDirs"/>
-            <ant:arg value="${libDir}/endorsed"/>
-            <ant:arg value="--install"/>
-            <ant:arg value="target/plan/client-system-plan.xml"/>
-            <ant:arg value="${geronimo.assembly.dir}/bin/client.jar"/>
-        </ant:java>
+        <ant:echo file="${basedir}/target/deploy-commands" append="true">package --mainClass
org.apache.geronimo.system.main.ClientCommandLine --classPath "${client.classpath}" --endorsedDirs
${libDir}/endorsed --install target/plan/client-system-plan.xml ${geronimo.assembly.dir}/bin/client.jar${line.separator}</ant:echo>
 
+        <ant:echo file="${basedir}/target/deploy-commands" append="true"
+             message="distribute target/plan/j2ee-client-plan.xml${line.separator}" />
+        
+        <!-- to debug this deployer call, include these jvmargs right after the -ea arg
+        <ant:jvmarg value="-Xdebug"/>
+        <ant:jvmarg value="-Xnoagent"/>
+        <ant:jvmarg value="-Djava.compiler=NONE"/>
+        <ant:jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"/>
+        -->
+
+        <!-- Run all the commands we just queued up -->
         <ant:java fork="true" jar="${geronimo.assembly.dir}/bin/deployer.jar" failonerror="true">
             <ant:jvmarg value="-ea"/>
             <ant:arg value="--offline"/>
-            <ant:arg value="distribute"/>
-            <ant:arg value="target/plan/j2ee-client-plan.xml"/>
+            <ant:arg value="command-file"/>
+            <ant:arg value="${basedir}/target/deploy-commands"/>
         </ant:java>
+
         <!-- ============================================== -->
         <!-- Deploy all configurations to live server       -->
         <!-- ============================================== -->

Modified: geronimo/trunk/modules/deploy-tool/src/java/org/apache/geronimo/deployment/cli/DeployTool.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/deploy-tool/src/java/org/apache/geronimo/deployment/cli/DeployTool.java?rev=329700&r1=329699&r2=329700&view=diff
==============================================================================
--- geronimo/trunk/modules/deploy-tool/src/java/org/apache/geronimo/deployment/cli/DeployTool.java
(original)
+++ geronimo/trunk/modules/deploy-tool/src/java/org/apache/geronimo/deployment/cli/DeployTool.java
Sun Oct 30 17:47:50 2005
@@ -20,10 +20,7 @@
 import org.apache.geronimo.common.DeploymentException;
 
 import java.util.*;
-import java.io.PrintWriter;
-import java.io.OutputStreamWriter;
-import java.io.InputStreamReader;
-import java.io.BufferedReader;
+import java.io.*;
 
 /**
  * The main class for the CLI deployer.  Handles chunking the input arguments
@@ -76,12 +73,14 @@
     }
 
     private boolean failed = false;
+    String[] generalArgs = new String[0];
+    ServerConnection con = null;
+    private boolean multipleCommands = false;
 
     public boolean execute(String args[]) {
         PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out), true);
         BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
         String command;
-        String[] generalArgs = new String[0];
         String[] commandArgs = new String[0];
         if(args.length == 0) {
             command = "help";
@@ -91,14 +90,53 @@
                 command = "help";
             } else {
                 command = temp[temp.length-1];
-                generalArgs = new String[temp.length-1];
-                System.arraycopy(temp, 0, generalArgs, 0, temp.length-1);
+                if(generalArgs.length == 0 && temp.length > 1) {
+                    generalArgs = new String[temp.length-1];
+                    System.arraycopy(temp, 0, generalArgs, 0, temp.length-1);
+                }
                 commandArgs = new String[args.length - temp.length];
                 System.arraycopy(args, temp.length, commandArgs, 0, commandArgs.length);
             }
         }
         if(command.equals("help")) {
             showHelp(out, commandArgs);
+        } else if(command.equals("command-file")) {
+            multipleCommands = true;
+            if(commandArgs.length != 1) {
+                processException(out, new DeploymentSyntaxException("Must provide a command
file to read from and no other arguments"));
+            } else {
+                String arg = commandArgs[0];
+                File source = new File(arg);
+                if(!source.exists() || !source.canRead() || source.isDirectory()) {
+                    processException(out, new DeploymentSyntaxException("Cannot read command
file "+source.getAbsolutePath()));
+                } else {
+                    try {
+                        BufferedReader commands = new BufferedReader(new FileReader(source));
+                        String line;
+                        boolean oneFailed = false;
+                        while((line = commands.readLine()) != null) {
+                            line = line.trim();
+                            if(!line.equals("")) {
+                                String[] lineArgs = splitCommand(line);
+                                if(failed) {
+                                    oneFailed = true;
+                                }
+                                failed = false;
+                                execute(lineArgs);
+                            }
+                        }
+                        failed = oneFailed;
+                    } catch (IOException e) {
+                        processException(out, new DeploymentException("Unable to read command
file", e));
+                    } finally {
+                        try {
+                            con.close();
+                        } catch (DeploymentException e) {
+                            processException(out, e);
+                        }
+                    }
+                }
+            }
         } else {
             DeployCommand dc = getCommand(command);
             if(dc == null) {
@@ -106,9 +144,10 @@
                 processException(out, new DeploymentSyntaxException("No such command: '"+command+"'"));
                 showHelp(out, new String[0]);
             } else {
-                ServerConnection con = null;
                 try {
-                    con = new ServerConnection(generalArgs, dc.isLocalOnly(), out, in);
+                    if(con == null) {
+                        con = new ServerConnection(generalArgs, dc.isLocalOnly(), out, in);
+                    }
                     try {
                         dc.execute(out, con, commandArgs);
                     } catch (DeploymentSyntaxException e) {
@@ -116,10 +155,12 @@
                     } catch (DeploymentException e) {
                         processException(out, e);
                     } finally {
-                        try {
-                            con.close();
-                        } catch(DeploymentException e) {
-                            processException(out, e);
+                        if(!multipleCommands) {
+                            try {
+                                con.close();
+                            } catch(DeploymentException e) {
+                                processException(out, e);
+                            }
                         }
                     }
                 } catch(DeploymentException e) {
@@ -130,6 +171,26 @@
         out.flush();
         System.out.flush();
         return !failed;
+    }
+
+    public static String[] splitCommand(String line) {
+        String[] chunks = line.split("\"");
+        List list = new LinkedList();
+        for (int i = 0; i < chunks.length; i++) {
+            String chunk = chunks[i];
+            if(i % 2 == 1) { // it's in quotes
+                list.add(chunk);
+            } else { // it's not in quotes
+                list.addAll(Arrays.asList(chunk.split("\\s")));
+            }
+        }
+        for (Iterator it = list.iterator(); it.hasNext();) {
+            String test = (String) it.next();
+            if(test.trim().equals("")) {
+                it.remove();
+            }
+        }
+        return (String[]) list.toArray(new String[list.size()]);
     }
 
     private void processException(PrintWriter out, Exception e) {



Mime
View raw message