From 3b82dc52ed8ddc4d2c42eff21ee20d6519edb8b8 Mon Sep 17 00:00:00 2001 From: Hiram Chirino Date: Wed, 15 Apr 2015 19:55:28 -0400 Subject: [PATCH] Setting posix permissions is not supported on windows. Use a boot jar to setup the classpath. --- activemq-boot/pom.xml | 46 ++++++ .../org/apache/activemq/boot/ActiveMQ.java | 136 ++++++++++++++++++ .../org/apache/activemq/cli/ActiveMQ.java | 1 - .../apache/activemq/cli/commands/Create.java | 27 ++-- .../org/apache/activemq/cli/commands/Run.java | 17 ++- .../factory/BasicSecurityHandler.java | 18 ++- .../activemq/factory/BrokerFactory.java | 22 ++- .../apache/activemq/cli/commands/bin/activemq | 42 +++--- .../activemq/cli/commands/bin/activemq.cmd | 20 +-- .../apache/activemq/cli/commands/bin/run.bat | 17 --- .../apache/activemq/cli/commands/bin/run.sh | 19 --- .../apache/activemq/cli/commands/bin/stop.bat | 17 --- .../apache/activemq/cli/commands/bin/stop.sh | 19 --- .../cli/commands/etc/activemq.profile.cmd | 16 +-- distribution/activemq/pom.xml | 5 + .../activemq/src/main/assembly/dep.xml | 17 +++ .../activemq/src/main/resources/bin/activemq | 32 +++-- .../src/main/resources/bin/activemq.cmd | 23 +-- pom.xml | 1 + 19 files changed, 322 insertions(+), 173 deletions(-) create mode 100644 activemq-boot/pom.xml create mode 100644 activemq-boot/src/main/java/org/apache/activemq/boot/ActiveMQ.java delete mode 100755 activemq-bootstrap/src/main/resources/org/apache/activemq/cli/commands/bin/run.bat delete mode 100755 activemq-bootstrap/src/main/resources/org/apache/activemq/cli/commands/bin/run.sh delete mode 100755 activemq-bootstrap/src/main/resources/org/apache/activemq/cli/commands/bin/stop.bat delete mode 100755 activemq-bootstrap/src/main/resources/org/apache/activemq/cli/commands/bin/stop.sh diff --git a/activemq-boot/pom.xml b/activemq-boot/pom.xml new file mode 100644 index 0000000000..bd931d05a0 --- /dev/null +++ b/activemq-boot/pom.xml @@ -0,0 +1,46 @@ + + + + + 4.0.0 + + + org.apache.activemq + activemq-pom + 10.0.0-SNAPSHOT + .. + + + activemq-boot + jar + ActiveMQ6 Boot + + + ${project.basedir}/.. + + + + + junit + junit + test + + + + diff --git a/activemq-boot/src/main/java/org/apache/activemq/boot/ActiveMQ.java b/activemq-boot/src/main/java/org/apache/activemq/boot/ActiveMQ.java new file mode 100644 index 0000000000..afe965f27d --- /dev/null +++ b/activemq-boot/src/main/java/org/apache/activemq/boot/ActiveMQ.java @@ -0,0 +1,136 @@ +/** + * 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.boot; + +import java.io.File; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLClassLoader; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; + +/** + *

+ * A main class which setups up a classpath and then passes + * execution off to the ActiveMQ cli main. + *

+ */ +public class ActiveMQ +{ + + public static void main(String[] args) throws Throwable + { + ArrayList dirs = new ArrayList(); + String instance = System.getProperty("activemq.instance"); + if (instance != null) + { + dirs.add(new File(new File(instance), "lib")); + } + + String home = System.getProperty("activemq.home"); + if (home != null) + { + dirs.add(new File(new File(home), "lib")); + } + + ArrayList urls = new ArrayList(); + for (File bootdir : dirs) + { + if (bootdir.exists() && bootdir.isDirectory()) + { + + // Find the jar files in the directory.. + ArrayList files = new ArrayList(); + for (File f : bootdir.listFiles()) + { + if (f.getName().endsWith(".jar") || f.getName().endsWith(".zip")) + { + files.add(f); + } + } + + // Sort the list by file name.. + Collections.sort(files, new Comparator() + { + public int compare(File file, File file1) + { + return file.getName().compareTo(file1.getName()); + } + }); + + for (File f : files) + { + add(urls, f); + } + + } + } + + if (instance != null) + { + System.setProperty("java.io.tmpdir", new File(new File(instance), "tmp").getCanonicalPath()); + } + + // Lets try to covert the logging.configuration setting to a valid URI + String loggingConfig = System.getProperty("logging.configuration"); + if (loggingConfig != null) + { + System.setProperty("logging.configuration", fixupFileURI(loggingConfig)); + } + + // Now setup our classloader.. + URLClassLoader loader = new URLClassLoader(urls.toArray(new URL[urls.size()])); + Thread.currentThread().setContextClassLoader(loader); + Class clazz = loader.loadClass("org.apache.activemq.cli.ActiveMQ"); + Method method = clazz.getMethod("main", args.getClass()); + try + { + method.invoke(null, (Object) args); + } + catch (InvocationTargetException e) + { + throw e.getTargetException(); + } + + } + + static String fixupFileURI(String value) + { + if (value != null && value.startsWith("file:")) + { + value = value.substring("file:".length()); + value = new File(value).toURI().toString(); + } + return value; + } + + private static void add(ArrayList urls, File file) + { + try + { + urls.add(file.toURI().toURL()); + } + catch (MalformedURLException e) + { + e.printStackTrace(); + } + } + +} diff --git a/activemq-bootstrap/src/main/java/org/apache/activemq/cli/ActiveMQ.java b/activemq-bootstrap/src/main/java/org/apache/activemq/cli/ActiveMQ.java index 321ea98428..64947c315e 100644 --- a/activemq-bootstrap/src/main/java/org/apache/activemq/cli/ActiveMQ.java +++ b/activemq-bootstrap/src/main/java/org/apache/activemq/cli/ActiveMQ.java @@ -37,7 +37,6 @@ public class ActiveMQ Cli.CliBuilder builder = Cli.builder("activemq") .withDescription("ActiveMQ Command Line") .withCommand(HelpAction.class) - .withCommand(Create.class) .withDefaultCommand(HelpAction.class); if (instance != null) diff --git a/activemq-bootstrap/src/main/java/org/apache/activemq/cli/commands/Create.java b/activemq-bootstrap/src/main/java/org/apache/activemq/cli/commands/Create.java index cc9b19ce48..1a30a84219 100644 --- a/activemq-bootstrap/src/main/java/org/apache/activemq/cli/commands/Create.java +++ b/activemq-bootstrap/src/main/java/org/apache/activemq/cli/commands/Create.java @@ -110,14 +110,6 @@ public class Create implements Action write("bin/activemq-service", null, true); makeExec("bin/activemq-service"); - write("bin/run.bat", null, false); - write("bin/run.sh", null, true); - makeExec("bin/run.sh"); - - write("bin/stop.bat", null, false); - write("bin/stop.sh", null, true); - makeExec("bin/stop.sh"); - write("etc/logging.properties", null, false); write("etc/bootstrap.xml", null, false); @@ -212,12 +204,19 @@ public class Create implements Action private void makeExec(String path) throws IOException { - File file = new File(directory, path); - Files.setPosixFilePermissions(file.toPath(), new HashSet(Arrays.asList( - OWNER_READ, OWNER_WRITE, OWNER_EXECUTE, - GROUP_READ, GROUP_WRITE, GROUP_EXECUTE, - OTHERS_READ, OTHERS_EXECUTE - ))); + try + { + File file = new File(directory, path); + Files.setPosixFilePermissions(file.toPath(), new HashSet(Arrays.asList( + OWNER_READ, OWNER_WRITE, OWNER_EXECUTE, + GROUP_READ, GROUP_WRITE, GROUP_EXECUTE, + OTHERS_READ, OTHERS_EXECUTE + ))); + } + catch (Throwable ignore) + { + // Our best effort was not good enough :) + } } String path(String value, boolean unixPaths) throws IOException diff --git a/activemq-bootstrap/src/main/java/org/apache/activemq/cli/commands/Run.java b/activemq-bootstrap/src/main/java/org/apache/activemq/cli/commands/Run.java index 3c75a8fdc3..b238d8a694 100644 --- a/activemq-bootstrap/src/main/java/org/apache/activemq/cli/commands/Run.java +++ b/activemq-bootstrap/src/main/java/org/apache/activemq/cli/commands/Run.java @@ -46,6 +46,16 @@ public class Run implements Action private Broker server; + static String fixupFileURI(String value) + { + if (value != null && value.startsWith("file:")) + { + value = value.substring("file:".length()); + value = new File(value).toURI().toString(); + } + return value; + } + @Override public Object execute(ActionContext context) throws Exception { @@ -60,17 +70,16 @@ public class Run implements Action if (configuration == null) { - configuration = "xml:" + activemqInstance + "/etc/bootstrap.xml"; + File xmlFile = new File(new File(new File(activemqInstance), "etc"), "bootstrap.xml"); + configuration = "xml:" + xmlFile.toURI().toString().substring("file:".length()); } // To support Windows paths as explained above. - configuration = configuration.replace("\\", "/"); - System.out.println("Loading configuration file: " + configuration); BrokerDTO broker = BrokerFactory.createBrokerConfiguration(configuration); - String fileName = new URI(broker.server.configuration).getSchemeSpecificPart(); + String fileName = new URI(fixupFileURI(broker.server.configuration)).getSchemeSpecificPart(); addShutdownHook(new File(fileName).getParentFile()); diff --git a/activemq-bootstrap/src/main/java/org/apache/activemq/factory/BasicSecurityHandler.java b/activemq-bootstrap/src/main/java/org/apache/activemq/factory/BasicSecurityHandler.java index 20c7e6fda2..8d480135f5 100644 --- a/activemq-bootstrap/src/main/java/org/apache/activemq/factory/BasicSecurityHandler.java +++ b/activemq-bootstrap/src/main/java/org/apache/activemq/factory/BasicSecurityHandler.java @@ -16,6 +16,8 @@ */ package org.apache.activemq.factory; +import java.io.File; + import org.apache.activemq.core.config.impl.FileSecurityConfiguration; import org.apache.activemq.dto.BasicSecurityDTO; import org.apache.activemq.dto.SecurityDTO; @@ -24,13 +26,25 @@ import org.apache.activemq.spi.core.security.ActiveMQSecurityManagerImpl; public class BasicSecurityHandler implements SecurityHandler { + + + static String fixupFileURI(String value) + { + if (value != null && value.startsWith("file:")) + { + value = value.substring("file:".length()); + value = new File(value).toURI().toString(); + } + return value; + } + @Override public ActiveMQSecurityManager createSecurityManager(SecurityDTO security) throws Exception { BasicSecurityDTO fileSecurity = (BasicSecurityDTO) security; String home = System.getProperty("activemq.home"); - FileSecurityConfiguration securityConfiguration = new FileSecurityConfiguration(fileSecurity.users.replace("${activemq.home}", home).replace("\\", "/"), - fileSecurity.roles.replace("${activemq.home}", home).replace("\\", "/"), + FileSecurityConfiguration securityConfiguration = new FileSecurityConfiguration(fixupFileURI(fileSecurity.users), + fixupFileURI(fileSecurity.roles), fileSecurity.defaultUser, fileSecurity.maskPassword, fileSecurity.passwordCodec); diff --git a/activemq-bootstrap/src/main/java/org/apache/activemq/factory/BrokerFactory.java b/activemq-bootstrap/src/main/java/org/apache/activemq/factory/BrokerFactory.java index ba11d56f40..cfa52d8602 100644 --- a/activemq-bootstrap/src/main/java/org/apache/activemq/factory/BrokerFactory.java +++ b/activemq-bootstrap/src/main/java/org/apache/activemq/factory/BrokerFactory.java @@ -23,6 +23,7 @@ import org.apache.activemq.integration.Broker; import org.apache.activemq.spi.core.security.ActiveMQSecurityManager; import org.apache.activemq.utils.FactoryFinder; +import java.io.File; import java.io.IOException; import java.net.URI; @@ -40,9 +41,9 @@ public class BrokerFactory try { FactoryFinder finder = new FactoryFinder("META-INF/services/org/apache/activemq/broker/"); - factory = (BrokerFactoryHandler)finder.newInstance(configURI.getScheme()); + factory = (BrokerFactoryHandler) finder.newInstance(configURI.getScheme()); } - catch (IOException ioe ) + catch (IOException ioe) { throw new ConfigurationException("Invalid configuration URI, can't find configuration scheme: " + configURI.getScheme()); } @@ -56,18 +57,29 @@ public class BrokerFactory return createBrokerConfiguration(new URI(configuration)); } + static String fixupFileURI(String value) + { + if (value != null && value.startsWith("file:")) + { + value = value.substring("file:".length()); + value = new File(value).toURI().toString(); + } + return value; + } + public static Broker createServer(ServerDTO brokerDTO, ActiveMQSecurityManager security) throws Exception { if (brokerDTO.configuration != null) { BrokerHandler handler; - URI configURI = new URI(brokerDTO.configuration.replace("\\", "/")); + URI configURI = new URI(fixupFileURI(brokerDTO.configuration)); + try { FactoryFinder finder = new FactoryFinder("META-INF/services/org/apache/activemq/broker/server/"); - handler = (BrokerHandler)finder.newInstance(configURI.getScheme()); + handler = (BrokerHandler) finder.newInstance(configURI.getScheme()); } - catch (IOException ioe ) + catch (IOException ioe) { throw new ConfigurationException("Invalid configuration URI, can't find configuration scheme: " + configURI.getScheme()); } diff --git a/activemq-bootstrap/src/main/resources/org/apache/activemq/cli/commands/bin/activemq b/activemq-bootstrap/src/main/resources/org/apache/activemq/cli/commands/bin/activemq index ba87e094fb..bca157bd3a 100755 --- a/activemq-bootstrap/src/main/resources/org/apache/activemq/cli/commands/bin/activemq +++ b/activemq-bootstrap/src/main/resources/org/apache/activemq/cli/commands/bin/activemq @@ -46,24 +46,14 @@ fi # Set Defaults Properties ACTIVEMQ_LOGGING_CONF="file:$ACTIVEMQ_INSTANCE/etc/logging.properties" -ACTIVEMQ_DATA_DIR=$ACTIVEMQ_INSTANCE/data +ACTIVEMQ_DATA_DIR="$ACTIVEMQ_INSTANCE/data" ACTIVEMQ_LOG_MANAGER=org.jboss.logmanager.LogManager JAVA_ARGS="-XX:+UseParallelGC -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Xms512M -Xmx1024M" -CLASSPATH="" # Load Profile Data . "$ACTIVEMQ_INSTANCE/etc/activemq.profile" -# Optionally load jars installed in the instance directory. -if [ -d $ACTIVEMQ_INSTANCE/lib ] ; then - for i in `ls $ACTIVEMQ_INSTANCE/lib/*.jar`; do - CLASSPATH=$CLASSPATH:$i - done -fi - -for i in `ls $ACTIVEMQ_HOME/lib/*.jar`; do - CLASSPATH=$CLASSPATH:$i -done +CLASSPATH="$ACTIVEMQ_HOME/lib/activemq-boot.jar" # OS specific support. cygwin=false; @@ -86,8 +76,6 @@ if $cygwin ; then ACTIVEMQ_INSTANCE=`cygpath --unix "$ACTIVEMQ_INSTANCE"` [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --unix "$CLASSPATH"` fi if [ -z "$JAVACMD" ] ; then @@ -112,14 +100,20 @@ if [ ! -x "$JAVACMD" ] ; then exit 1 fi -JAVA_ARGS="$JAVA_ARGS $ACTIVEMQ_CLUSTER_PROPS - -Dactivemq.home="$ACTIVEMQ_HOME" - -Dactivemq.instance="$ACTIVEMQ_INSTANCE" - -Djava.library.path="$ACTIVEMQ_HOME/bin/lib/linux-i686:$ACTIVEMQ_INSTANCE/bin/lib/linux-x86_64" - -Djava.io.tmpdir="$ACTIVEMQ_INSTANCE/tmp" - -Ddata.dir="$ACTIVEMQ_DATA_DIR" - -Djava.util.logging.manager="$ACTIVEMQ_LOG_MANAGER" - -Dlogging.configuration="$ACTIVEMQ_LOGGING_CONF" - $DEBUG_ARGS" +if $cygwin ; then + JAVA_HOME=`cygpath --windows "$JAVA_HOME"` + ACTIVEMQ_HOME=`cygpath --windows "$ACTIVEMQ_HOME"` + CLASSPATH=`cygpath --windows "$CLASSPATH"` +fi -exec "$JAVACMD" $JAVA_ARGS -classpath $CLASSPATH org.apache.activemq.cli.ActiveMQ $@ +exec "$JAVACMD" $JAVA_ARGS $ACTIVEMQ_CLUSTER_PROPS \ + -classpath "$CLASSPATH" \ + -Dactivemq.home="$ACTIVEMQ_HOME" \ + -Dactivemq.instance="$ACTIVEMQ_INSTANCE" \ + -Djava.library.path="$ACTIVEMQ_HOME/bin/lib/linux-i686:$ACTIVEMQ_INSTANCE/bin/lib/linux-x86_64" \ + -Djava.io.tmpdir="$ACTIVEMQ_INSTANCE/tmp" \ + -Ddata.dir="$ACTIVEMQ_DATA_DIR" \ + -Djava.util.logging.manager="$ACTIVEMQ_LOG_MANAGER" \ + -Dlogging.configuration="$ACTIVEMQ_LOGGING_CONF" \ + $DEBUG_ARGS \ + org.apache.activemq.boot.ActiveMQ $@ diff --git a/activemq-bootstrap/src/main/resources/org/apache/activemq/cli/commands/bin/activemq.cmd b/activemq-bootstrap/src/main/resources/org/apache/activemq/cli/commands/bin/activemq.cmd index d88ba0c802..357b44de22 100755 --- a/activemq-bootstrap/src/main/resources/org/apache/activemq/cli/commands/bin/activemq.cmd +++ b/activemq-bootstrap/src/main/resources/org/apache/activemq/cli/commands/bin/activemq.cmd @@ -48,22 +48,26 @@ echo. :RUN_JAVA rem "Set Defaults." -set JAVA_ARGS=-Xmx1024M -set ACTIVEMQ_LOGGING_CONF="file:%ACTIVEMQ_INSTANCE%\config\logging.properties" -set ACTIVEMQ_DATA_DIR="%ACTIVEMQ_INSTANCE%\data" +set JAVA_ARGS=-XX:+UseParallelGC -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Xms512M -Xmx1024M +set ACTIVEMQ_LOGGING_CONF=file:%ACTIVEMQ_INSTANCE%\etc\logging.properties +set ACTIVEMQ_DATA_DIR=%ACTIVEMQ_INSTANCE%\data set ACTIVEMQ_LOG_MANAGER=org.jboss.logmanager.LogManager rem "Load Profile Config" call "%ACTIVEMQ_INSTANCE%\etc\activemq.profile.cmd" %* rem "Create full JVM Args" -set JVM_ARGS=%JAVA_ARGS% -classpath %ACTIVEMQ_INSTANCE%\lib\* -Dactivemq.home=%ACTIVEMQ_HOME% -Dactivemq.instance=%ACTIVEMQ_INSTANCE% -Djava.io.tmpdir=%ACTIVEMQ_INSTANCE%/tmp -Ddata.dir=%ACTIVEMQ_DATA_DIR% -Djava.util.logging.manager=%ACTIVEMQ_LOG_MANAGER% -Dlogging.configuration=%ACTIVEMQ_LOGGING_CONF% -Djava.library.path=%ACTIVEMQ_INSTANCE%\lib\ - -rem "Set Debug & Cluster props" -if not "%DEBUG_ARGS%"=="" set JVM_ARGS=%JVM_ARGS% %DEBUG_ARGS% +set JVM_ARGS=%JAVA_ARGS% if not "%ACTIVEMQ_CLUSTER_PROPS%"=="" set JVM_ARGS=%JVM_ARGS% %ACTIVEMQ_CLUSTER_PROPS% +set JVM_ARGS=%JVM_ARGS% -classpath "%ACTIVEMQ_HOME%\lib\activemq-boot.jar" +set JVM_ARGS=%JVM_ARGS% -Dactivemq.home="%ACTIVEMQ_HOME%" +set JVM_ARGS=%JVM_ARGS% -Dactivemq.instance="%ACTIVEMQ_INSTANCE%" +set JVM_ARGS=%JVM_ARGS% -Ddata.dir="%ACTIVEMQ_DATA_DIR%" +set JVM_ARGS=%JVM_ARGS% -Djava.util.logging.manager="%ACTIVEMQ_LOG_MANAGER%" +set JVM_ARGS=%JVM_ARGS% -Dlogging.configuration="%ACTIVEMQ_LOGGING_CONF%" +if not "%DEBUG_ARGS%"=="" set JVM_ARGS=%JVM_ARGS% %DEBUG_ARGS% -"%_JAVACMD%" %JVM_ARGS% org.apache.activemq.cli.ActiveMQ %* +"%_JAVACMD%" %JVM_ARGS% org.apache.activemq.boot.ActiveMQ %* :END endlocal diff --git a/activemq-bootstrap/src/main/resources/org/apache/activemq/cli/commands/bin/run.bat b/activemq-bootstrap/src/main/resources/org/apache/activemq/cli/commands/bin/run.bat deleted file mode 100755 index a617b8947e..0000000000 --- a/activemq-bootstrap/src/main/resources/org/apache/activemq/cli/commands/bin/run.bat +++ /dev/null @@ -1,17 +0,0 @@ -rem Licensed to the Apache Software Foundation (ASF) under one -rem or more contributor license agreements. See the NOTICE file -rem distributed with this work for additional information -rem regarding copyright ownership. The ASF licenses this file -rem to you under the Apache License, Version 2.0 (the -rem "License"); you may not use this file except in compliance -rem with 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, -rem software distributed under the License is distributed on an -rem "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -rem KIND, either express or implied. See the License for the -rem specific language governing permissions and limitations -rem under the License. -activemq.cmd run %* diff --git a/activemq-bootstrap/src/main/resources/org/apache/activemq/cli/commands/bin/run.sh b/activemq-bootstrap/src/main/resources/org/apache/activemq/cli/commands/bin/run.sh deleted file mode 100755 index 7235fd9cee..0000000000 --- a/activemq-bootstrap/src/main/resources/org/apache/activemq/cli/commands/bin/run.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/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. - -`dirname "$0"`/activemq run $@ diff --git a/activemq-bootstrap/src/main/resources/org/apache/activemq/cli/commands/bin/stop.bat b/activemq-bootstrap/src/main/resources/org/apache/activemq/cli/commands/bin/stop.bat deleted file mode 100755 index 653e7b3935..0000000000 --- a/activemq-bootstrap/src/main/resources/org/apache/activemq/cli/commands/bin/stop.bat +++ /dev/null @@ -1,17 +0,0 @@ -rem Licensed to the Apache Software Foundation (ASF) under one -rem or more contributor license agreements. See the NOTICE file -rem distributed with this work for additional information -rem regarding copyright ownership. The ASF licenses this file -rem to you under the Apache License, Version 2.0 (the -rem "License"); you may not use this file except in compliance -rem with 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, -rem software distributed under the License is distributed on an -rem "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -rem KIND, either express or implied. See the License for the -rem specific language governing permissions and limitations -rem under the License. -activemq.cmd stop %* diff --git a/activemq-bootstrap/src/main/resources/org/apache/activemq/cli/commands/bin/stop.sh b/activemq-bootstrap/src/main/resources/org/apache/activemq/cli/commands/bin/stop.sh deleted file mode 100755 index fd4ead0056..0000000000 --- a/activemq-bootstrap/src/main/resources/org/apache/activemq/cli/commands/bin/stop.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/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. - -`dirname "$0"`/activemq stop $@ diff --git a/activemq-bootstrap/src/main/resources/org/apache/activemq/cli/commands/etc/activemq.profile.cmd b/activemq-bootstrap/src/main/resources/org/apache/activemq/cli/commands/etc/activemq.profile.cmd index 37144e71aa..77800c87f6 100644 --- a/activemq-bootstrap/src/main/resources/org/apache/activemq/cli/commands/etc/activemq.profile.cmd +++ b/activemq-bootstrap/src/main/resources/org/apache/activemq/cli/commands/etc/activemq.profile.cmd @@ -15,23 +15,13 @@ rem KIND, either express or implied. See the License for the rem specific language governing permissions and limitations rem under the License. -set ACTIVEMQ_HOME='${activemq.home}' -set ACTIVEMQ_BASE='${activemq.base}' +set ACTIVEMQ_HOME=${activemq.home} -rem Path to logging configuration file -set ACTIVEMQ_LOGGING_CONF=file:%ACTIVEMQ_BASE%\etc\logging.properties - -rem Path to data directory -set ACTIVEMQ_DATA_DIR=%ACTIVEMQ_BASE%\data - -rem Log manager class -set ACTIVEMQ_LOG_MANAGER=org.jboss.logmanager.LogManager - -rem Cluster Properties: Used to pass arguments to ActiveMQ. These can be referenced in activemq-configuration.xml +rem Cluster Properties: Used to pass arguments to ActiveMQ which can be referenced in activemq-configuration.xml rem set ACTIVEMQ_CLUSTER_PROPS=-Dactivemq.remoting.default.port=61617 -Dactivemq.remoting.amqp.port=5673 -Dactivemq.remoting.stomp.port=61614 -Dactivemq.remoting.hornetq.port=5446 rem Java Opts -set JAVA_ARGS=-Xmx1024m +rem set JAVA_ARGS=-XX:+UseParallelGC -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Xms512M -Xmx1024M rem Debug args: Uncomment to enable debug rem set DEBUG_ARGS=-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005 diff --git a/distribution/activemq/pom.xml b/distribution/activemq/pom.xml index a3ba77bc01..6cfe7d04b9 100644 --- a/distribution/activemq/pom.xml +++ b/distribution/activemq/pom.xml @@ -37,6 +37,11 @@ + + org.apache.activemq + activemq-boot + ${project.version} + org.apache.activemq activemq-server diff --git a/distribution/activemq/src/main/assembly/dep.xml b/distribution/activemq/src/main/assembly/dep.xml index 5d0b21aaf8..c792469b9c 100644 --- a/distribution/activemq/src/main/assembly/dep.xml +++ b/distribution/activemq/src/main/assembly/dep.xml @@ -26,9 +26,26 @@ tar.gz true + + + 755 + 644 + lib + ${artifact.artifactId}.${artifact.extension} + false + false + + org.apache.activemq:activemq-boot + + + + + 755 + 644 + org.apache.activemq:activemq-bootstrap org.apache.activemq:activemq-commons diff --git a/distribution/activemq/src/main/resources/bin/activemq b/distribution/activemq/src/main/resources/bin/activemq index e15d094e5d..4b99fd6f88 100755 --- a/distribution/activemq/src/main/resources/bin/activemq +++ b/distribution/activemq/src/main/resources/bin/activemq @@ -44,6 +44,10 @@ if [ -z "$ACTIVEMQ_HOME" ] ; then ACTIVEMQ_HOME=`cd "$ACTIVEMQ_HOME/.." && pwd` fi +# Set Defaults Properties +JAVA_ARGS="-XX:+UseParallelGC -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Xms512M -Xmx1024M" +CLASSPATH="$ACTIVEMQ_HOME/lib/activemq-boot.jar" + # OS specific support. cygwin=false; darwin=false; @@ -53,10 +57,10 @@ case "`uname`" in export OSTYPE ;; Darwin*) darwin=true - if [ -z "$JAVA_HOME" ] ; then - JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home - fi - ;; + if [ -z "$JAVA_HOME" ] ; then + JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home + fi + ;; esac # For Cygwin, ensure paths are in UNIX format before anything is touched @@ -65,8 +69,6 @@ if $cygwin ; then 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 @@ -91,12 +93,16 @@ if [ ! -x "$JAVACMD" ] ; then exit 1 fi -for i in `ls $ACTIVEMQ_HOME/lib/*.jar`; do - CLASSPATH=$i:$CLASSPATH -done -# Set Defaults Properties -JAVA_ARGS="-XX:+UseParallelGC -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Xms512M -Xmx1024M" +if $cygwin ; then + JAVA_HOME=`cygpath --windows "$JAVA_HOME"` + ACTIVEMQ_HOME=`cygpath --windows "$ACTIVEMQ_HOME"` + CLASSPATH=`cygpath --windows "$CLASSPATH"` +fi -JAVA_ARGS="$JAVA_ARGS -Dactivemq.home=$ACTIVEMQ_HOME" -exec "$JAVACMD" $JAVA_ARGS -classpath $CLASSPATH org.apache.activemq.cli.ActiveMQ $@ +exec "$JAVACMD" $JAVA_ARGS $ACTIVEMQ_CLUSTER_PROPS \ + -classpath "$CLASSPATH" \ + -Dactivemq.home="$ACTIVEMQ_HOME" \ + -Djava.library.path="$ACTIVEMQ_HOME/bin/lib/linux-i686:$ACTIVEMQ_INSTANCE/bin/lib/linux-x86_64" \ + $DEBUG_ARGS \ + org.apache.activemq.boot.ActiveMQ $@ diff --git a/distribution/activemq/src/main/resources/bin/activemq.cmd b/distribution/activemq/src/main/resources/bin/activemq.cmd index d503a270b2..8ab6163c2e 100755 --- a/distribution/activemq/src/main/resources/bin/activemq.cmd +++ b/distribution/activemq/src/main/resources/bin/activemq.cmd @@ -48,27 +48,16 @@ echo. :RUN_JAVA rem "Set Defaults." -set JAVA_ARGS=-Xmx1024M -set ACTIVEMQ_LOGGING_CONF="file:%ACTIVEMQ_HOME%\config\logging.properties" -set ACTIVEMQ_DATA_DIR="%ACTIVEMQ_HOME%\data" -set ACTIVEMQ_LOG_MANAGER=org.jboss.logmanager.LogManager - -rem "Load Config" -if "%ACTIVEMQ_CONF%" == "" set ACTIVEMQ_CONF="%ACTIVEMQ_HOME%\bin\activemq.conf.bat" -if exist "%ACTIVEMQ_CONF%" ( - call "%ACTIVEMQ_CONF%" %* -) else ( - echo Config file not found "%ACTIVEMQ_CONF%" -) +set JAVA_ARGS=-XX:+UseParallelGC -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Xms512M -Xmx1024M rem "Create full JVM Args" -set JVM_ARGS=%JAVA_ARGS% -classpath %ACTIVEMQ_HOME%\lib\* -Dactivemq.home=%ACTIVEMQ_HOME% -Ddata.dir=%ACTIVEMQ_DATA_DIR% -Djava.util.logging.manager=%ACTIVEMQ_LOG_MANAGER% -Dlogging.configuration=%ACTIVEMQ_LOGGING_CONF% -Djava.library.path=%ACTIVEMQ_HOME%\lib\ - -rem "Set Debug & Cluster props" -if not "%DEBUG_ARGS%"=="" set JVM_ARGS=%JVM_ARGS% %DEBUG_ARGS% +set JVM_ARGS=%JAVA_ARGS% if not "%ACTIVEMQ_CLUSTER_PROPS%"=="" set JVM_ARGS=%JVM_ARGS% %ACTIVEMQ_CLUSTER_PROPS% +set JVM_ARGS=%JVM_ARGS% -classpath "%ACTIVEMQ_HOME%\lib\activemq-boot.jar" +set JVM_ARGS=%JVM_ARGS% -Dactivemq.home="%ACTIVEMQ_HOME%" +if not "%DEBUG_ARGS%"=="" set JVM_ARGS=%JVM_ARGS% %DEBUG_ARGS% -"%_JAVACMD%" %JVM_ARGS% org.apache.activemq.cli.ActiveMQ %* +"%_JAVACMD%" %JVM_ARGS% org.apache.activemq.boot.ActiveMQ %* :END endlocal diff --git a/pom.xml b/pom.xml index c1e5b1bb6e..0f3680c540 100644 --- a/pom.xml +++ b/pom.xml @@ -31,6 +31,7 @@ activemq-protocols activemq-dto + activemq-boot ActiveMQ6 Parent