cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r375265 - in /cocoon/branches/BRANCH_2_1_X: cocoon.sh status.xml tools/src/loader/Loader.java
Date Mon, 06 Feb 2006 12:38:01 GMT
Author: jbq
Date: Mon Feb  6 04:37:59 2006
New Revision: 375265

URL: http://svn.apache.org/viewcvs?rev=375265&view=rev
Log:
Fix COCOON-1715: Allow ContinuationsManagerImpl to run in CLI

Modified:
    cocoon/branches/BRANCH_2_1_X/cocoon.sh
    cocoon/branches/BRANCH_2_1_X/status.xml
    cocoon/branches/BRANCH_2_1_X/tools/src/loader/Loader.java

Modified: cocoon/branches/BRANCH_2_1_X/cocoon.sh
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/cocoon.sh?rev=375265&r1=375264&r2=375265&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/cocoon.sh (original)
+++ cocoon/branches/BRANCH_2_1_X/cocoon.sh Mon Feb  6 04:37:59 2006
@@ -138,8 +138,12 @@
 LOADER=Loader
 LOADER_LIB="${COCOON_HOME}/tools/loader"
 
-CLI=-Dloader.main.class=org.apache.cocoon.Main
+CLI="-Dloader.main.class=org.apache.cocoon.Main"
 CLI_LIBRARIES="-Dloader.jar.repositories=$COCOON_LIB"
+CLI_CLASSPATH="-Dloader.class.path=lib/core/servlet_2_2.jar"
+CLI_VERBOSE="-Dloader.verbose=false"
+CLI_PROPERTIES="$CLI_LIBRARIES $CLI_CLASSPATH $CLI_VERBOSE"
+
 PRECOMPILE=-Dloader.main.class=org.apache.cocoon.bean.XSPPrecompileWrapper
 PRECOMPILE_LIBRARIES="-Dloader.jar.repositories=$COCOON_LIB"
 
@@ -157,7 +161,7 @@
 
 case "$ACTION" in
   cli)
-        $JAVA $JAVA_OPTIONS -cp $LOADER_LIB $ENDORSED $CLI_LIBRARIES $CLI $LOADER $ARGS
+        $JAVA $JAVA_OPTIONS -cp $LOADER_LIB $ENDORSED $CLI_PROPERTIES $CLI $LOADER $ARGS
         ;;
 
   precompile)

Modified: cocoon/branches/BRANCH_2_1_X/status.xml
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/status.xml?rev=375265&r1=375264&r2=375265&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/status.xml (original)
+++ cocoon/branches/BRANCH_2_1_X/status.xml Mon Feb  6 04:37:59 2006
@@ -180,6 +180,9 @@
   <release version="@version@" date="@date@">
 -->
   <release version="2.1.9" date="TBD">
+    <action dev="JBQ" type="fix" fixes-bug="COCOON-1715">
+      Allow to run Cocoon CLI by adding servlet.jar in the classpath.  Turn off cli's debug
messages by default.
+    </action>
     <action dev="JBQ" type="fix" fixes-bug="COCOON-1681" due-to="Antonio Fiol" due-to-email="antonio.fiol@gmail.com">
       Fix a bug in DirectoryGenerator: when using cocoon: changes were not detected
     </action>

Modified: cocoon/branches/BRANCH_2_1_X/tools/src/loader/Loader.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/tools/src/loader/Loader.java?rev=375265&r1=375264&r2=375265&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/tools/src/loader/Loader.java (original)
+++ cocoon/branches/BRANCH_2_1_X/tools/src/loader/Loader.java Mon Feb  6 04:37:59 2006
@@ -30,10 +30,12 @@
  */
 public class Loader {
 
-    static final boolean VERBOSE = true;
+    static boolean verbose = true;
     
     static final String REPOSITORIES = "loader.jar.repositories";
     static final String MAIN_CLASS = "loader.main.class";
+    static final String VERBOSE_PROPERTY = "loader.verbose";
+    static final String CLASSPATH_PROPERTY = "loader.class.path";
     
     class RepositoryClassLoader extends URLClassLoader {
 
@@ -42,7 +44,7 @@
         }
             
         public void addRepository(File repository) {
-            if (VERBOSE) System.out.println("Processing repository: " + repository);
+            if (verbose) System.out.println("Processing repository: " + repository);
 
             if (repository.exists() && repository.isDirectory()) {
                 File[] jars = repository.listFiles();
@@ -51,7 +53,7 @@
                     if (jars[i].getAbsolutePath().endsWith(".jar")) {
                         try  {
                             URL url = jars[i].toURL();
-                            if (VERBOSE) System.out.println("Adding jar: " + jars[i]);
+                            if (verbose) System.out.println("Adding jar: " + jars[i]);
                             super.addURL(url);                
                         } catch (MalformedURLException e) {
                             throw new IllegalArgumentException(e.toString());
@@ -60,39 +62,56 @@
                 }
             }
         }
+
+        public void addFile(File file) throws MalformedURLException {
+            if (verbose) System.out.println("Adding path: " + file);
+            super.addURL(file.toURL());
+        }
     }
 
     public static void main(String[] args) throws Exception {
         new Loader().run(args);
     }
-    
+
     void run(String[] args) throws Exception 
-    {    
+    {
         String repositories = System.getProperty(REPOSITORIES);
         if (repositories == null) {
             System.out.println("Loader requires the '" + REPOSITORIES + "' property to be
set");
             System.exit(1);
         }
-            
+
         String mainClass = System.getProperty(MAIN_CLASS);
         if (mainClass == null) {
             System.out.println("Loader requires the '" + MAIN_CLASS + "' property to be set");
             System.exit(1);
         }
 
-        if (VERBOSE) System.out.println("-------------------- Loading --------------------");
+        String verboseProperty = System.getProperty(VERBOSE_PROPERTY);
+        if (verboseProperty != null)
+            verbose = Boolean.parseBoolean(verboseProperty);
+        String classPath = System.getProperty(CLASSPATH_PROPERTY);
+
+        if (verbose) System.out.println("-------------------- Loading --------------------");
 
         RepositoryClassLoader classLoader = new RepositoryClassLoader(this.getClass().getClassLoader());
 
         StringTokenizer st = new StringTokenizer(repositories, File.pathSeparator);
         while (st.hasMoreTokens()) {
             classLoader.addRepository(new File(st.nextToken()));        
-        }        
+        }
+
+        if (classPath != null) {
+            st = new StringTokenizer(classPath, File.pathSeparator);
+            while (st.hasMoreTokens()) {
+                classLoader.addFile(new File(st.nextToken()));
+            }
+        }
 
         Thread.currentThread().setContextClassLoader(classLoader);
 
-        if (VERBOSE) System.out.println("-------------------- Executing -----------------");
-        if (VERBOSE) System.out.println("Main Class: " + mainClass);
+        if (verbose) System.out.println("-------------------- Executing -----------------");
+        if (verbose) System.out.println("Main Class: " + mainClass);
             
         invokeMain(classLoader, mainClass, args);            
     }
@@ -112,4 +131,4 @@
         
         main.invoke(null, methodParams);
     }    
-}
\ No newline at end of file
+}



Mime
View raw message