activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r465930 - in /incubator/activemq/trunk: activemq-console/src/main/java/org/apache/activemq/console/Main.java assembly/src/release/conf/activemq-nojournal.xml assembly/src/release/conf/activemq.xml assembly/src/release/conf/log4j.properties
Date Thu, 19 Oct 2006 23:22:51 GMT
Author: chirino
Date: Thu Oct 19 16:22:50 2006
New Revision: 465930

URL: http://svn.apache.org/viewvc?view=rev&rev=465930
Log:
https://issues.apache.org/activemq/browse/AMQ-997


Modified:
    incubator/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/Main.java
    incubator/activemq/trunk/assembly/src/release/conf/activemq-nojournal.xml
    incubator/activemq/trunk/assembly/src/release/conf/activemq.xml
    incubator/activemq/trunk/assembly/src/release/conf/log4j.properties

Modified: incubator/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/Main.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/Main.java?view=diff&rev=465930&r1=465929&r2=465930
==============================================================================
--- incubator/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/Main.java
(original)
+++ incubator/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/Main.java
Thu Oct 19 16:22:50 2006
@@ -29,6 +29,7 @@
 import java.net.URLClassLoader;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Comparator;
 import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
@@ -44,9 +45,12 @@
     public static final String TASK_DEFAULT_CLASS  = "org.apache.activemq.console.command.ShellCommand";
 
     private File          activeMQHome;
+	private File          activeMQBase;
     private ClassLoader   classLoader;
+    private List          classpaths = new ArrayList(5);
     private List          extensions = new ArrayList(5);
 
+
     private static boolean useDefExt = true;
 
     public static void main(String[] args) {
@@ -57,11 +61,30 @@
         // Parse for extension directory option
         app.parseExtensions(tokens);
 
-        // Add default extension directories
+        // Add the following to the classpath:
+        // 
+        // ${activemq.base}/conf
+        // ${activemq.base}/lib/* (only if activemq.base != activemq.home)
+        // ${activemq.home}/lib/* 
+        // ${activemq.base}/lib/optional/* (only if activemq.base != activemq.home)
+        // ${activemq.home}/lib/optional/* 
+        // 
         if(useDefExt && app.canUseExtdir()) {
-            app.addExtensionDirectory(new File(app.getActiveMQHome(), "conf"));
+
+        	boolean baseIsHome = app.getActiveMQBase().equals(app.getActiveMQHome()); 
+        	
+            app.addClassPath(new File(app.getActiveMQBase(), "conf"));
+            
+            if(!baseIsHome) {
+                app.addExtensionDirectory(new File(app.getActiveMQBase(), "lib"));
+            }
             app.addExtensionDirectory(new File(app.getActiveMQHome(), "lib"));
+            
+            if(!baseIsHome) {
+                app.addExtensionDirectory(new File(new File(app.getActiveMQBase(), "lib"),
"optional"));
+            }
             app.addExtensionDirectory(new File(new File(app.getActiveMQHome(), "lib"), "optional"));
+            
         }
 
         try {
@@ -71,7 +94,7 @@
         }
     }
 
-    public void parseExtensions(List tokens) {
+	public void parseExtensions(List tokens) {
         if (tokens.isEmpty()) {
             return;
         }
@@ -142,6 +165,10 @@
     public void addExtensionDirectory(File directory) {
         extensions.add(directory);
     }
+    
+    private void addClassPath(File file) {
+        classpaths.add(file);
+	}
 
     /**
      * The extension directory feature will not work if the broker factory is already in
the classpath
@@ -162,21 +189,40 @@
         if(classLoader==null) {
             // Setup the ClassLoader
             classLoader = Main.class.getClassLoader();
-            if (!extensions.isEmpty()) {
+            if (!extensions.isEmpty() || !classpaths.isEmpty()) {
 
                 ArrayList urls = new ArrayList();
-                for (Iterator iter = extensions.iterator(); iter.hasNext();) {
+                
+                for (Iterator iter = classpaths.iterator(); iter.hasNext();) {
                     File dir = (File) iter.next();
                     // try{ System.out.println("Adding to classpath: " + dir.getCanonicalPath());
}catch(Exception e){}
                     urls.add(dir.toURL());
-                    File[] files = dir.listFiles();
-                    if( files!=null ) {
-                        for (int j = 0; j < files.length; j++) {
-                            if( files[j].getName().endsWith(".zip") || files[j].getName().endsWith(".jar")
) {
-                                // try{ System.out.println("Adding to classpath: " + files[j].getCanonicalPath());
}catch(Exception e){}
-                                urls.add(files[j].toURL());
-                            }
-                        }
+                }
+                
+                for (Iterator iter = extensions.iterator(); iter.hasNext();) {
+                    File dir = (File) iter.next();
+                    if( dir.isDirectory() ) {
+	                    File[] files = dir.listFiles();
+	                    if( files!=null ) {
+	                    	
+	                    	// Sort the jars so that classpath built is consistently
+	                    	// in the same order.  Also allows us to use jar names to control
+	                    	// classpath order.
+	                    	Arrays.sort(files, new Comparator(){
+								public int compare(Object o1, Object o2) {
+									File f1 = (File) o1;
+									File f2 = (File) o2;
+									return f1.getName().compareTo(f2.getName());
+								}
+							});
+	                    	
+	                        for (int j = 0; j < files.length; j++) {
+	                            if( files[j].getName().endsWith(".zip") || files[j].getName().endsWith(".jar")
) {
+	                                // try{ System.out.println("Adding to classpath: " + files[j].getCanonicalPath());
}catch(Exception e){}
+	                                urls.add(files[j].toURL());
+	                            }
+	                        }
+	                    }
                     }
                 }
 
@@ -222,4 +268,20 @@
         
         return activeMQHome;
     }
+    
+    public File getActiveMQBase() {
+        if(activeMQBase==null) {
+            if(System.getProperty("activemq.base") != null) {
+            	activeMQBase = new File(System.getProperty("activemq.base"));
+            }
+            
+            if(activeMQBase==null){
+                activeMQBase = getActiveMQHome();
+                System.setProperty("activemq.base",activeMQBase.getAbsolutePath());
+            }
+        }
+        
+        return activeMQBase;
+    }
+
 }

Modified: incubator/activemq/trunk/assembly/src/release/conf/activemq-nojournal.xml
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/assembly/src/release/conf/activemq-nojournal.xml?view=diff&rev=465930&r1=465929&r2=465930
==============================================================================
--- incubator/activemq/trunk/assembly/src/release/conf/activemq-nojournal.xml (original)
+++ incubator/activemq/trunk/assembly/src/release/conf/activemq-nojournal.xml Thu Oct 19 16:22:50
2006
@@ -44,7 +44,7 @@
   
   
     <persistenceAdapter>
-        <jdbcPersistenceAdapter dataDirectory="activemq-data"/>
+        <jdbcPersistenceAdapter dataDirectory="${activemq.base}/activemq-data"/>
 
         <!-- 
         <jdbcPersistenceAdapter dataDirectory="activemq-data" dataSource="#oracle-ds"/>

Modified: incubator/activemq/trunk/assembly/src/release/conf/activemq.xml
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/assembly/src/release/conf/activemq.xml?view=diff&rev=465930&r1=465929&r2=465930
==============================================================================
--- incubator/activemq/trunk/assembly/src/release/conf/activemq.xml (original)
+++ incubator/activemq/trunk/assembly/src/release/conf/activemq.xml Thu Oct 19 16:22:50 2006
@@ -52,7 +52,7 @@
   
   
     <persistenceAdapter>
-        <journaledJDBC journalLogFiles="5" dataDirectory="${activemq.home}/activemq-data"/>
+        <journaledJDBC journalLogFiles="5" dataDirectory="${activemq.base}/activemq-data"/>
       <!-- To use a different datasource, use the following syntax : -->
       <!-- 
       <journaledJDBC journalLogFiles="5" dataDirectory="../activemq-data" dataSource="#postgres-ds"/>

Modified: incubator/activemq/trunk/assembly/src/release/conf/log4j.properties
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/assembly/src/release/conf/log4j.properties?view=diff&rev=465930&r1=465929&r2=465930
==============================================================================
--- incubator/activemq/trunk/assembly/src/release/conf/log4j.properties (original)
+++ incubator/activemq/trunk/assembly/src/release/conf/log4j.properties Thu Oct 19 16:22:50
2006
@@ -36,7 +36,7 @@
 
 # File appender
 log4j.appender.out=org.apache.log4j.RollingFileAppender
-log4j.appender.out.file=${activemq.home}/data/activemq.log
+log4j.appender.out.file=${activemq.base}/activemq-data/activemq.log
 log4j.appender.out.maxFileSize=1024KB
 log4j.appender.out.maxBackupIndex=5
 log4j.appender.out.append=true



Mime
View raw message