activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r495172 - in /incubator/activemq/trunk: activemq-console/src/main/java/org/apache/activemq/console/ activemq-console/src/main/java/org/apache/activemq/console/command/ assembly/src/main/descriptors/ assembly/src/release/bin/
Date Thu, 11 Jan 2007 09:49:09 GMT
Author: aco
Date: Thu Jan 11 01:49:08 2007
New Revision: 495172

URL: http://svn.apache.org/viewvc?view=rev&rev=495172
Log:
AMQ-1096: Added a activemq.classpath system property to provide extensions to the ActiveMQ
classpath. Extensions can now be added via 'set ACTIVEMQ_CLASSPATH=c:/foo'
AMQ-1046: Consolidated all admin scripts to a single activemq-admin script file. To run admin
scripts, use: activemq-admin bstat, activemq-admin query, activemq-admin stop, etc.

Added:
    incubator/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/command/BstatCommand.java
  (with props)
    incubator/activemq/trunk/assembly/src/release/bin/activemq-admin
    incubator/activemq/trunk/assembly/src/release/bin/activemq-admin.bat   (with props)
Removed:
    incubator/activemq/trunk/assembly/src/release/bin/browse
    incubator/activemq/trunk/assembly/src/release/bin/browse.bat
    incubator/activemq/trunk/assembly/src/release/bin/bstat
    incubator/activemq/trunk/assembly/src/release/bin/bstat.bat
    incubator/activemq/trunk/assembly/src/release/bin/lcp.bat
    incubator/activemq/trunk/assembly/src/release/bin/list
    incubator/activemq/trunk/assembly/src/release/bin/list.bat
    incubator/activemq/trunk/assembly/src/release/bin/query
    incubator/activemq/trunk/assembly/src/release/bin/query.bat
    incubator/activemq/trunk/assembly/src/release/bin/shutdown
    incubator/activemq/trunk/assembly/src/release/bin/shutdown.bat
Modified:
    incubator/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/Main.java
    incubator/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/command/ShellCommand.java
    incubator/activemq/trunk/assembly/src/main/descriptors/unix-bin.xml
    incubator/activemq/trunk/assembly/src/release/bin/activemq
    incubator/activemq/trunk/assembly/src/release/bin/activemq.bat

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=495172&r1=495171&r2=495172
==============================================================================
--- 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 Jan 11 01:49:08 2007
@@ -33,6 +33,9 @@
 import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.StringTokenizer;
 
 /**
  * Main class that can bootstrap an ActiveMQ broker console. Handles command line
@@ -45,10 +48,10 @@
     public static final String TASK_DEFAULT_CLASS  = "org.apache.activemq.console.command.ShellCommand";
 
     private File          activeMQHome;
-	private File          activeMQBase;
+    private File          activeMQBase;
     private ClassLoader   classLoader;
-    private List          classpaths = new ArrayList(5);
-    private List          extensions = new ArrayList(5);
+    private Set           extensions = new HashSet(5);
+    private Set           activeMQClassPath = new HashSet(5);
 
 
     private static boolean useDefExt = true;
@@ -62,80 +65,81 @@
         app.parseExtensions(tokens);
 
         // Add the following to the classpath:
-        // 
+        //
         // ${activemq.base}/conf
         // ${activemq.base}/lib/* (only if activemq.base != activemq.home)
-        // ${activemq.home}/lib/* 
+        // ${activemq.home}/lib/*
         // ${activemq.base}/lib/optional/* (only if activemq.base != activemq.home)
-        // ${activemq.home}/lib/optional/* 
-        // 
+        // ${activemq.home}/lib/optional/*
+        //
         if(useDefExt && app.canUseExtdir()) {
 
-        	boolean baseIsHome = app.getActiveMQBase().equals(app.getActiveMQHome()); 
-        	
-            app.addClassPath(new File(app.getActiveMQBase(), "conf"));
-            
+            boolean baseIsHome = app.getActiveMQBase().equals(app.getActiveMQHome());
+
             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"));
-            
+
         }
 
+        // Add any custom classpath specified from the system property activemq.classpath
+        app.addClassPathList(System.getProperty("activemq.classpath"));
+
         try {
             app.runTaskClass(tokens);
         } catch (ClassNotFoundException e) {
             System.out.println("Could not load class: " + e.getMessage());
             try {
-				ClassLoader cl = app.getClassLoader();
-				if( cl!=null ) {
-		            System.out.println("Class loader setup: ");
-					printClassLoaderTree(cl);
-				}
-			} catch (MalformedURLException e1) {
-			}
+                ClassLoader cl = app.getClassLoader();
+                if( cl!=null ) {
+                    System.out.println("Class loader setup: ");
+                    printClassLoaderTree(cl);
+                }
+            } catch (MalformedURLException e1) {
+            }
         } catch (Throwable e) {
             System.out.println("Failed to execute main task. Reason: " + e);
         }
     }
 
     /**
-     * Print out what's in the classloader tree being used. 
-     * 
+     * Print out what's in the classloader tree being used.
+     *
      * @param cl
-     * @return
+     * @return depth
      */
-	private static int printClassLoaderTree(ClassLoader cl) {
-		int depth = 0;
-		if( cl.getParent()!=null ) {
-			depth = printClassLoaderTree(cl.getParent())+1;
-		}
-		
-		StringBuffer indent = new StringBuffer();
-		for (int i = 0; i < depth; i++) {
-			indent.append("  ");
-		}
-		
-		if( cl instanceof URLClassLoader ) {
-			URLClassLoader ucl = (URLClassLoader) cl;
-			System.out.println(indent+cl.getClass().getName()+" {");
-			URL[] urls = ucl.getURLs();
-			for (int i = 0; i < urls.length; i++) {
-				System.out.println(indent+"  "+urls[i]);
-			}
-			System.out.println(indent+"}");
-		} else {
-			System.out.println(indent+cl.getClass().getName());
-		}
-		return depth;
-	}
+    private static int printClassLoaderTree(ClassLoader cl) {
+        int depth = 0;
+        if( cl.getParent()!=null ) {
+            depth = printClassLoaderTree(cl.getParent())+1;
+        }
 
-	public void parseExtensions(List tokens) {
+        StringBuffer indent = new StringBuffer();
+        for (int i = 0; i < depth; i++) {
+            indent.append("  ");
+        }
+
+        if( cl instanceof URLClassLoader ) {
+            URLClassLoader ucl = (URLClassLoader) cl;
+            System.out.println(indent+cl.getClass().getName()+" {");
+            URL[] urls = ucl.getURLs();
+            for (int i = 0; i < urls.length; i++) {
+                System.out.println(indent+"  "+urls[i]);
+            }
+            System.out.println(indent+"}");
+        } else {
+            System.out.println(indent+cl.getClass().getName());
+        }
+        return depth;
+    }
+
+    public void parseExtensions(List tokens) {
         if (tokens.isEmpty()) {
             return;
         }
@@ -183,12 +187,12 @@
             } else {
                 i++;
             }
-		}
+        }
 
     }
 
     public void runTaskClass(List tokens) throws Throwable {
-    	
+
         System.out.println("ACTIVEMQ_HOME: "+ getActiveMQHome());
         System.out.println("ACTIVEMQ_BASE: "+ getActiveMQBase());
 
@@ -208,16 +212,25 @@
     public void addExtensionDirectory(File directory) {
         extensions.add(directory);
     }
-    
-    private void addClassPath(File file) {
-        classpaths.add(file);
-	}
+
+    public void addClassPathList(String fileList) {
+        if (fileList != null && fileList.length() > 0) {
+            StringTokenizer tokenizer = new StringTokenizer(fileList, ";");
+            while (tokenizer.hasMoreTokens()) {
+                addClassPath(new File(tokenizer.nextToken()));
+            }
+        }
+    }
+
+    public void addClassPath(File classpath) {
+        activeMQClassPath.add(classpath);
+    }
 
     /**
      * The extension directory feature will not work if the broker factory is already in
the classpath
      * since we have to load him from a child ClassLoader we build for it to work correctly.
      *
-     * @return
+     * @return true, if extension dir can be used. false otherwise.
      */
     public boolean canUseExtdir() {
         try {
@@ -232,40 +245,40 @@
         if(classLoader==null) {
             // Setup the ClassLoader
             classLoader = Main.class.getClassLoader();
-            if (!extensions.isEmpty() || !classpaths.isEmpty()) {
+            if (!extensions.isEmpty() || !activeMQClassPath.isEmpty()) {
 
                 ArrayList urls = new ArrayList();
-                
-                for (Iterator iter = classpaths.iterator(); iter.hasNext();) {
+
+                for (Iterator iter = activeMQClassPath.iterator(); iter.hasNext();) {
                     File dir = (File) iter.next();
                     // try{ System.out.println("Adding to classpath: " + dir.getCanonicalPath());
}catch(Exception e){}
                     urls.add(dir.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());
-	                            }
-	                        }
-	                    }
+                        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());
+                                }
+                            }
+                        }
                     }
                 }
 
@@ -308,23 +321,22 @@
                 System.setProperty("activemq.home",activeMQHome.getAbsolutePath());
             }
         }
-        
+
         return activeMQHome;
     }
-    
+
     public File getActiveMQBase() {
         if(activeMQBase==null) {
             if(System.getProperty("activemq.base") != null) {
-            	activeMQBase = new File(System.getProperty("activemq.base"));
+                activeMQBase = new File(System.getProperty("activemq.base"));
             }
-            
+
             if(activeMQBase==null){
                 activeMQBase = getActiveMQHome();
                 System.setProperty("activemq.base",activeMQBase.getAbsolutePath());
             }
         }
-        
+
         return activeMQBase;
     }
-
 }

Added: incubator/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/command/BstatCommand.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/command/BstatCommand.java?view=auto&rev=495172
==============================================================================
--- incubator/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/command/BstatCommand.java
(added)
+++ incubator/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/command/BstatCommand.java
Thu Jan 11 01:49:08 2007
@@ -0,0 +1,72 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.console.command;
+
+import java.util.List;
+import java.util.Iterator;
+import java.util.ArrayList;
+
+public class BstatCommand extends QueryCommand {
+    /**
+     * Performs a predefiend query option
+     * @param tokens - command arguments
+     * @throws Exception
+     */
+    protected void runTask(List tokens) throws Exception {
+        List queryTokens = new ArrayList();
+        // Find the first non-option token
+        String brokerName = "*";
+        for (Iterator i = tokens.iterator(); i.hasNext();) {
+            String token = (String)i.next();
+            if (!token.startsWith("-")) {
+                brokerName = token;
+                break;
+            } else {
+                // Re-insert options
+                queryTokens.add(token);
+            }
+        }
+
+        // Build the predefined option
+        queryTokens.add("--objname");
+        queryTokens.add("Type=*,BrokerName=" + brokerName);
+        queryTokens.add("-xQTopic=ActiveMQ.Advisory.*");
+        queryTokens.add("--vuew");
+        queryTokens.add("Type,BrokerName,Destination,ConnectorName,EnqueueCount," +
+                        "DequeueCount,TotalEnqueueCount,TotalDequeueCount,Messages," +
+                        "TotalMessages,ConsumerCount,TotalConsumerCount,DispatchQueueSize");
+
+        // Call the query command
+        super.runTask(queryTokens);
+    }
+
+    protected String[] helpFile = new String[] {
+        "Task Usage: activemq-admin bstat [bstat-options] [broker-name]",
+        "Description: Performs a predefined query that displays useful statistics regarding
the specified broker.",
+        "             If no broker name is specified, it will try and select from all registered
brokers.",
+        "",
+        "Bstat Options:",
+        "    --jmxurl <url>                Set the JMX URL to connect to.",
+        "    --version                     Display the version information.",
+        "    -h,-?,--help                  Display the query broker help information.",
+        "",
+        "Examples:",
+        "    activemq-admin bstat localhost",
+        "        - Display a summary of statistics for the broker 'localhost'"
+    };
+}

Propchange: incubator/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/command/BstatCommand.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/command/BstatCommand.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/command/BstatCommand.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: incubator/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/command/ShellCommand.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/command/ShellCommand.java?view=diff&rev=495172&r1=495171&r2=495172
==============================================================================
--- incubator/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/command/ShellCommand.java
(original)
+++ incubator/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/command/ShellCommand.java
Thu Jan 11 01:49:08 2007
@@ -92,7 +92,7 @@
     }
 
     /**
-     * Parses for specific command task, default task is a start task.
+     * Parses for specific command task.
      * @param tokens - command arguments
      * @throws Exception
      */
@@ -109,6 +109,8 @@
                 new ListCommand().execute(tokens);
             } else if (taskToken.equals("query")) {
                 new QueryCommand().execute(tokens);
+            } else if (taskToken.equals("bstat")) {
+                new BstatCommand().execute(tokens);
             } else if (taskToken.equals("browse")) {
                 new AmqBrowseCommand().execute(tokens);
             } else if (taskToken.equals("purge")) {
@@ -116,12 +118,10 @@
             } else if (taskToken.equals("help")) {
                 printHelp();
             } else {
-                // If not valid task, push back to list
-                tokens.add(0, taskToken);
-                new StartCommand().execute(tokens);
+                printHelp();
             }
         } else {
-            new StartCommand().execute(tokens);
+            printHelp();
         }
         
     }

Modified: incubator/activemq/trunk/assembly/src/main/descriptors/unix-bin.xml
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/assembly/src/main/descriptors/unix-bin.xml?view=diff&rev=495172&r1=495171&r2=495172
==============================================================================
--- incubator/activemq/trunk/assembly/src/main/descriptors/unix-bin.xml (original)
+++ incubator/activemq/trunk/assembly/src/main/descriptors/unix-bin.xml Thu Jan 11 01:49:08
2007
@@ -75,11 +75,7 @@
       <outputDirectory></outputDirectory>
       <includes>
         <include>bin/activemq</include>
-        <include>bin/browse</include>
-        <include>bin/bstat</include>
-        <include>bin/list</include>
-        <include>bin/query</include>
-        <include>bin/shutdown</include>
+        <include>bin/activemq-admin</include>
         <include>bin/macosx/activemq</include>
         <include>bin/linux/activemq</include>
       </includes>

Modified: incubator/activemq/trunk/assembly/src/release/bin/activemq
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/assembly/src/release/bin/activemq?view=diff&rev=495172&r1=495171&r2=495172
==============================================================================
--- incubator/activemq/trunk/assembly/src/release/bin/activemq (original)
+++ incubator/activemq/trunk/assembly/src/release/bin/activemq Thu Jan 11 01:49:08 2007
@@ -120,6 +120,7 @@
 if $cygwin; then
   ACTIVEMQ_HOME=`cygpath --windows "$ACTIVEMQ_HOME"`
   ACTIVEMQ_BASE=`cygpath --windows "$ACTIVEMQ_BASE"`
+  ACTIVEMQ_CLASSPATH=`cygpath --path --windows "$ACTIVEMQ_CLASSPATH"`
   JAVA_HOME=`cygpath --windows "$JAVA_HOME"`
   CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
   CYGHOME=`cygpath --windows "$HOME"`
@@ -139,17 +140,21 @@
 fi
 
 ACTIVEMQ_OPTS="$ACTIVEMQ_OPTS $SUNJMX $SSL_OPTS"
+
+# Set default classpath
+ACTIVEMQ_CLASSPATH="${ACTIVEMQ_HOME}/conf;"$ACTIVEMQ_CLASSPATH
+
 # Uncomment to enable YourKit profiling
 #ACTIVEMQ_DEBUG_OPTS="-Xrunyjpagent"
 
 # Uncomment to enable remote debugging
 #ACTIVEMQ_DEBUG_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005"
 
-#ACTIVEMQ_TASK="start"
+ACTIVEMQ_TASK="start"
 if [ -n "$CYGHOME" ]; then
-    exec "$JAVACMD" $ACTIVEMQ_DEBUG_OPTS $ACTIVEMQ_OPTS -classpath "${ACTIVEMQ_CLASSPATH}"
-Dactivemq.home="${ACTIVEMQ_HOME}" -Dactivemq.base="${ACTIVEMQ_BASE}" -Dcygwin.user.home="$CYGHOME"
-jar "${ACTIVEMQ_HOME}/bin/run.jar" $ACTIVEMQ_TASK $@
+    exec "$JAVACMD" $ACTIVEMQ_DEBUG_OPTS $ACTIVEMQ_OPTS -Dactivemq.classpath="${ACTIVEMQ_CLASSPATH}"
-Dactivemq.home="${ACTIVEMQ_HOME}" -Dactivemq.base="${ACTIVEMQ_BASE}" -Dcygwin.user.home="$CYGHOME"
-jar "${ACTIVEMQ_HOME}/bin/run.jar" $ACTIVEMQ_TASK $@
 else
-    exec "$JAVACMD" $ACTIVEMQ_DEBUG_OPTS $ACTIVEMQ_OPTS -classpath "${ACTIVEMQ_CLASSPATH}"
-Dactivemq.home="${ACTIVEMQ_HOME}" -Dactivemq.base="${ACTIVEMQ_BASE}" -jar "${ACTIVEMQ_HOME}/bin/run.jar"
$ACTIVEMQ_TASK $@
+    exec "$JAVACMD" $ACTIVEMQ_DEBUG_OPTS $ACTIVEMQ_OPTS -Dactivemq.classpath="${ACTIVEMQ_CLASSPATH}"
-Dactivemq.home="${ACTIVEMQ_HOME}" -Dactivemq.base="${ACTIVEMQ_BASE}" -jar "${ACTIVEMQ_HOME}/bin/run.jar"
$ACTIVEMQ_TASK $@
 fi
 
 

Added: incubator/activemq/trunk/assembly/src/release/bin/activemq-admin
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/assembly/src/release/bin/activemq-admin?view=auto&rev=495172
==============================================================================
--- incubator/activemq/trunk/assembly/src/release/bin/activemq-admin (added)
+++ incubator/activemq/trunk/assembly/src/release/bin/activemq-admin Thu Jan 11 01:49:08 2007
@@ -0,0 +1,149 @@
+#!/bin/sh
+
+# ------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+# 
+# http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ------------------------------------------------------------------------
+
+# load system-wide activemq configuration
+if [ -f "/etc/activemq.conf" ] ; then
+  . /etc/activemq.conf
+fi
+
+# provide default values for people who don't use RPMs
+if [ -z "$usejikes" ] ; then
+  usejikes=false;
+fi
+
+# load user activemq configuration
+if [ -f "$HOME/.activemqrc" ] ; then
+  . "$HOME/.activemqrc"
+fi
+
+# OS specific support.  $var _must_ be set to either true or false.
+cygwin=false;
+darwin=false;
+case "`uname`" in
+  CYGWIN*) cygwin=true ;;
+  Darwin*) darwin=true
+           if [ -z "$JAVA_HOME" ] ; then
+             JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home
+           fi
+           ;;
+esac
+
+if [ -z "$ACTIVEMQ_HOME" ] ; then
+  # try to find ACTIVEMQ
+  if [ -d /opt/activemq ] ; then
+    ACTIVEMQ_HOME=/opt/activemq
+  fi
+
+  if [ -d "${HOME}/opt/activemq" ] ; then
+    ACTIVEMQ_HOME="${HOME}/opt/activemq"
+  fi
+
+  ## resolve links - $0 may be a link to activemq's home
+  PRG="$0"
+  progname=`basename "$0"`
+  saveddir=`pwd`
+
+  # need this for relative symlinks
+  dirname_prg=`dirname "$PRG"`
+  cd "$dirname_prg"
+
+  while [ -h "$PRG" ] ; do
+    ls=`ls -ld "$PRG"`
+    link=`expr "$ls" : '.*-> \(.*\)$'`
+    if expr "$link" : '.*/.*' > /dev/null; then
+	PRG="$link"
+    else
+	PRG=`dirname "$PRG"`"/$link"
+    fi
+  done
+
+  ACTIVEMQ_HOME=`dirname "$PRG"`/..
+
+  cd "$saveddir"
+
+  # make it fully qualified
+  ACTIVEMQ_HOME=`cd "$ACTIVEMQ_HOME" && pwd`
+fi
+
+# For Cygwin, ensure paths are in UNIX format before anything is touched
+if $cygwin ; then
+  [ -n "$ACTIVEMQ_HOME" ] &&
+    ACTIVEMQ_HOME=`cygpath --unix "$ACTIVEMQ_HOME"`
+  [ -n "$JAVA_HOME" ] &&
+    JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+  [ -n "$CLASSPATH" ] &&
+    CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
+fi
+
+if [ -z "$JAVACMD" ] ; then
+  if [ -n "$JAVA_HOME"  ] ; then
+    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+      # IBM's JDK on AIX uses strange locations for the executables
+      JAVACMD="$JAVA_HOME/jre/sh/java"
+    else
+      JAVACMD="$JAVA_HOME/bin/java"
+    fi
+  else
+    JAVACMD=`which java 2> /dev/null `
+    if [ -z "$JAVACMD" ] ; then
+        JAVACMD=java
+    fi
+  fi
+fi
+
+if [ ! -x "$JAVACMD" ] ; then
+  echo "Error: JAVA_HOME is not defined correctly."
+  echo "  We cannot execute $JAVACMD"
+  exit 1
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin; then
+  ACTIVEMQ_HOME=`cygpath --windows "$ACTIVEMQ_HOME"`
+  JAVA_HOME=`cygpath --windows "$JAVA_HOME"`
+  CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
+  CYGHOME=`cygpath --windows "$HOME"`
+fi
+
+
+if [ -z "$ACTIVEMQ_OPTS" ] ; then
+  ACTIVEMQ_OPTS="-Xmx512M -Dderby.system.home=../data -Dderby.storage.fileSyncTransactionLog=true"
+fi
+
+# Uncomment to enable YourKit profiling
+#ACTIVEMQ_DEBUG_OPTS="-Xrunyjpagent"
+
+# Uncomment to enable remote debugging
+#ACTIVEMQ_DEBUG_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005"
+
+ACTIVEMQ_CMD_LINE_ARGS=$@
+if [ -z "$ACTIVEMQ_CMD_LINE_ARGS" ] ; then
+    ACTIVEMQ_CMD_LINE_ARGS="--help"
+fi 
+
+# Setup ActiveMQ classpath. Default is the conf directory.
+ACTIVEMQ_CLASSPATH="${ACTIVEMQ_HOME}/conf;"$ACTIVEMQ_CLASSPATH
+
+if [ -n "$CYGHOME" ]; then
+    exec "$JAVACMD" $ACTIVEMQ_DEBUG_OPTS $ACTIVEMQ_OPTS -Dactivemq.classpath="${ACTIVEMQ_CLASSPATH}"
-Dactivemq.home="${ACTIVEMQ_HOME}" -Dcygwin.user.home="$CYGHOME" -jar "${ACTIVEMQ_HOME}/bin/run.jar"
$ACTIVEMQ_CMD_LINE_ARGS
+else
+    exec "$JAVACMD" $ACTIVEMQ_DEBUG_OPTS $ACTIVEMQ_OPTS -Dactivemq.classpath="${ACTIVEMQ_CLASSPATH}"
-Dactivemq.home="${ACTIVEMQ_HOME}" -jar "${ACTIVEMQ_HOME}/bin/run.jar" $ACTIVEMQ_CMD_LINE_ARGS
+fi
+
+

Added: incubator/activemq/trunk/assembly/src/release/bin/activemq-admin.bat
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/assembly/src/release/bin/activemq-admin.bat?view=auto&rev=495172
==============================================================================
--- incubator/activemq/trunk/assembly/src/release/bin/activemq-admin.bat (added)
+++ incubator/activemq/trunk/assembly/src/release/bin/activemq-admin.bat Thu Jan 11 01:49:08
2007
@@ -0,0 +1,120 @@
+@echo off
+
+REM ------------------------------------------------------------------------
+REM Licensed to the Apache Software Foundation (ASF) under one or more
+REM contributor license agreements.  See the NOTICE file distributed with
+REM this work for additional information regarding copyright ownership.
+REM The ASF licenses this file to You under the Apache License, Version 2.0
+REM (the "License"); you may not use this file except in compliance with
+REM the License.  You may obtain a copy of the License at
+REM
+REM http://www.apache.org/licenses/LICENSE-2.0
+REM
+REM Unless required by applicable law or agreed to in writing, software
+REM distributed under the License is distributed on an "AS IS" BASIS,
+REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+REM See the License for the specific language governing permissions and
+REM limitations under the License.
+REM ------------------------------------------------------------------------
+
+if exist "%HOME%\activemqrc_pre.bat" call "%HOME%\activemqrc_pre.bat"
+
+if "%OS%"=="Windows_NT" @setlocal
+
+rem %~dp0 is expanded pathname of the current script under NT
+set DEFAULT_ACTIVEMQ_HOME=%~dp0..
+
+if "%ACTIVEMQ_HOME%"=="" set ACTIVEMQ_HOME=%DEFAULT_ACTIVEMQ_HOME%
+set DEFAULT_ACTIVEMQ_HOME=
+
+rem Slurp the command line arguments. This loop allows for an unlimited number
+rem of arguments (up to the command line limit, anyway).
+
+set ACTIVEMQ_CMD_LINE_ARGS=%1
+if ""%1""=="""" goto doneStart
+shift
+:setupArgs
+if ""%1""=="""" goto doneStart
+set ACTIVEMQ_CMD_LINE_ARGS=%ACTIVEMQ_CMD_LINE_ARGS% %1
+shift
+goto setupArgs
+
+rem This label provides a place for the argument list loop to break out 
+rem and for NT handling to skip to.
+
+:doneStart
+rem find ACTIVEMQ_HOME if it does not exist due to either an invalid value passed
+rem by the user or the %0 problem on Windows 9x
+if exist "%ACTIVEMQ_HOME%\README.txt" goto checkJava
+
+rem check for activemq in Program Files on system drive
+if not exist "%SystemDrive%\Program Files\activemq" goto checkSystemDrive
+set ACTIVEMQ_HOME=%SystemDrive%\Program Files\activemq
+goto checkJava
+
+:checkSystemDrive
+rem check for activemq in root directory of system drive
+if not exist %SystemDrive%\activemq\README.txt goto checkCDrive
+set ACTIVEMQ_HOME=%SystemDrive%\activemq
+goto checkJava
+
+:checkCDrive
+rem check for activemq in C:\activemq for Win9X users
+if not exist C:\activemq\README.txt goto noAntHome
+set ACTIVEMQ_HOME=C:\activemq
+goto checkJava
+
+:noAntHome
+echo ACTIVEMQ_HOME is set incorrectly or activemq could not be located. Please set ACTIVEMQ_HOME.
+goto end
+
+:checkJava
+set _JAVACMD=%JAVACMD%
+
+set JAVA_EXT_DIRS=%JAVA_HOME%\lib\ext;%ACTIVEMQ_HOME%;%ACTIVEMQ_HOME%\lib;%ACTIVEMQ_HOME%\lib\optional
+
+if "%JAVA_HOME%" == "" goto noJavaHome
+if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
+if "%_JAVACMD%" == "" set _JAVACMD=%JAVA_HOME%\bin\java.exe
+goto runAnt
+
+:noJavaHome
+if "%_JAVACMD%" == "" set _JAVACMD=java.exe
+echo.
+echo Warning: JAVA_HOME environment variable is not set.
+echo.
+
+:runAnt
+if "%ACTIVEMQ_BASE%" == "" set ACTIVEMQ_BASE=%ACTIVEMQ_HOME%
+if "%ACTIVEMQ_OPTS%" == "" set ACTIVEMQ_OPTS=-Xmx512M -Dorg.apache.activemq.UseDedicatedTaskRunner=true
-Dderby.system.home="%ACTIVEMQ_BASE%\data" -Dderby.storage.fileSyncTransactionLog=true
+
+if "%SUNJMX%" == "" set SUNJMX=-Dcom.sun.management.jmxremote
+REM set SUNJMX=-Dcom.sun.management.jmxremote.port=1616 -Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
+
+if "%SSL_OPTS%" == "" set SSL_OPTS=-Djavax.net.ssl.keyStorePassword=password -Djavax.net.ssl.trustStorePassword=password
-Djavax.net.ssl.keyStore="%ACTIVEMQ_BASE%/conf/broker.ks" -Djavax.net.ssl.trustStore="%ACTIVEMQ_BASE%/conf/broker.ts"
+
+if "%ACTIVEMQ_CMD_LINE_ARGS%" == "" set ACTIVEMQ_CMD_LINE_ARGS=--help
+
+REM Uncomment to enable YourKit profiling
+REM SET ACTIVEMQ_DEBUG_OPTS="-Xrunyjpagent"
+
+REM Uncomment to enable remote debugging
+REM SET ACTIVEMQ_DEBUG_OPTS=-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005
+
+REM Setup ActiveMQ Classpath. Default is the conf directory.
+set ACTIVEMQ_CLASSPATH=%ACTIVEMQ_HOME%/conf;%ACTIVEMQ_CLASSPATH%
+
+"%_JAVACMD%" %ACTIVEMQ_DEBUG_OPTS% %ACTIVEMQ_OPTS% -Djava.ext.dirs="%JAVA_EXT_DIRS%" -Dactivemq.classpath="%ACTIVEMQ_CLASSPATH%"
-jar "%ACTIVEMQ_HOME%/bin/run.jar" %ACTIVEMQ_CMD_LINE_ARGS%
+
+goto end
+
+:end
+set _JAVACMD=
+set ACTIVEMQ_CMD_LINE_ARGS=
+
+if "%OS%"=="Windows_NT" @endlocal
+
+:mainEnd
+if exist "%HOME%\activemqrc_post.bat" call "%HOME%\activemqrc_post.bat"
+
+

Propchange: incubator/activemq/trunk/assembly/src/release/bin/activemq-admin.bat
------------------------------------------------------------------------------
    svn:eol-style = CRLF

Propchange: incubator/activemq/trunk/assembly/src/release/bin/activemq-admin.bat
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: incubator/activemq/trunk/assembly/src/release/bin/activemq.bat
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/assembly/src/release/bin/activemq.bat?view=diff&rev=495172&r1=495171&r2=495172
==============================================================================
--- incubator/activemq/trunk/assembly/src/release/bin/activemq.bat (original)
+++ incubator/activemq/trunk/assembly/src/release/bin/activemq.bat Thu Jan 11 01:49:08 2007
@@ -99,8 +99,13 @@
 REM Uncomment to enable remote debugging
 REM SET ACTIVEMQ_DEBUG_OPTS=-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005
 
+REM Setup ActiveMQ Classpath. Default is the conf directory.
+set ACTIVEMQ_CLASSPATH=%ACTIVEMQ_HOME%/conf;%ACTIVEMQ_CLASSPATH%
+
+REM Set the task to run
 set ACTIVEMQ_TASK="start"
-"%_JAVACMD%" %SUNJMX% %ACTIVEMQ_DEBUG_OPTS% %ACTIVEMQ_OPTS% %SSL_OPTS% -classpath "%ACTIVEMQ_CLASSPATH%"
-Dactivemq.home="%ACTIVEMQ_HOME%" -Dactivemq.base="%ACTIVEMQ_BASE%" -jar "%ACTIVEMQ_HOME%/bin/run.jar"
%ACTIVEMQ_TASK% %ACTIVEMQ_CMD_LINE_ARGS%
+
+"%_JAVACMD%" %SUNJMX% %ACTIVEMQ_DEBUG_OPTS% %ACTIVEMQ_OPTS% %SSL_OPTS% -Dactivemq.classpath="%ACTIVEMQ_CLASSPATH%"
-Dactivemq.home="%ACTIVEMQ_HOME%" -Dactivemq.base="%ACTIVEMQ_BASE%" -jar "%ACTIVEMQ_HOME%/bin/run.jar"
%ACTIVEMQ_TASK% %ACTIVEMQ_CMD_LINE_ARGS%
 
 goto end
 



Mime
View raw message