Setting posix permissions is not supported on windows.

Use a boot jar to setup the classpath.
This commit is contained in:
Hiram Chirino 2015-04-15 19:55:28 -04:00
parent a1bdb3c02a
commit 3b82dc52ed
19 changed files with 322 additions and 173 deletions

46
activemq-boot/pom.xml Normal file
View File

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-pom</artifactId>
<version>10.0.0-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>activemq-boot</artifactId>
<packaging>jar</packaging>
<name>ActiveMQ6 Boot</name>
<properties>
<activemq.basedir>${project.basedir}/..</activemq.basedir>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@ -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;
/**
* <p>
* A main class which setups up a classpath and then passes
* execution off to the ActiveMQ cli main.
* </p>
*/
public class ActiveMQ
{
public static void main(String[] args) throws Throwable
{
ArrayList<File> dirs = new ArrayList<File>();
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<URL> urls = new ArrayList<URL>();
for (File bootdir : dirs)
{
if (bootdir.exists() && bootdir.isDirectory())
{
// Find the jar files in the directory..
ArrayList<File> files = new ArrayList<File>();
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<File>()
{
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<URL> urls, File file)
{
try
{
urls.add(file.toURI().toURL());
}
catch (MalformedURLException e)
{
e.printStackTrace();
}
}
}

View File

@ -37,7 +37,6 @@ public class ActiveMQ
Cli.CliBuilder<Action> builder = Cli.<Action>builder("activemq") Cli.CliBuilder<Action> builder = Cli.<Action>builder("activemq")
.withDescription("ActiveMQ Command Line") .withDescription("ActiveMQ Command Line")
.withCommand(HelpAction.class) .withCommand(HelpAction.class)
.withCommand(Create.class)
.withDefaultCommand(HelpAction.class); .withDefaultCommand(HelpAction.class);
if (instance != null) if (instance != null)

View File

@ -110,14 +110,6 @@ public class Create implements Action
write("bin/activemq-service", null, true); write("bin/activemq-service", null, true);
makeExec("bin/activemq-service"); 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/logging.properties", null, false);
write("etc/bootstrap.xml", null, false); write("etc/bootstrap.xml", null, false);
@ -211,6 +203,8 @@ public class Create implements Action
} }
private void makeExec(String path) throws IOException private void makeExec(String path) throws IOException
{
try
{ {
File file = new File(directory, path); File file = new File(directory, path);
Files.setPosixFilePermissions(file.toPath(), new HashSet<PosixFilePermission>(Arrays.asList( Files.setPosixFilePermissions(file.toPath(), new HashSet<PosixFilePermission>(Arrays.asList(
@ -219,6 +213,11 @@ public class Create implements Action
OTHERS_READ, OTHERS_EXECUTE OTHERS_READ, OTHERS_EXECUTE
))); )));
} }
catch (Throwable ignore)
{
// Our best effort was not good enough :)
}
}
String path(String value, boolean unixPaths) throws IOException String path(String value, boolean unixPaths) throws IOException
{ {

View File

@ -46,6 +46,16 @@ public class Run implements Action
private Broker server; 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 @Override
public Object execute(ActionContext context) throws Exception public Object execute(ActionContext context) throws Exception
{ {
@ -60,17 +70,16 @@ public class Run implements Action
if (configuration == null) 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. // To support Windows paths as explained above.
configuration = configuration.replace("\\", "/");
System.out.println("Loading configuration file: " + configuration); System.out.println("Loading configuration file: " + configuration);
BrokerDTO broker = BrokerFactory.createBrokerConfiguration(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()); addShutdownHook(new File(fileName).getParentFile());

View File

@ -16,6 +16,8 @@
*/ */
package org.apache.activemq.factory; package org.apache.activemq.factory;
import java.io.File;
import org.apache.activemq.core.config.impl.FileSecurityConfiguration; import org.apache.activemq.core.config.impl.FileSecurityConfiguration;
import org.apache.activemq.dto.BasicSecurityDTO; import org.apache.activemq.dto.BasicSecurityDTO;
import org.apache.activemq.dto.SecurityDTO; import org.apache.activemq.dto.SecurityDTO;
@ -24,13 +26,25 @@ import org.apache.activemq.spi.core.security.ActiveMQSecurityManagerImpl;
public class BasicSecurityHandler implements SecurityHandler 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 @Override
public ActiveMQSecurityManager createSecurityManager(SecurityDTO security) throws Exception public ActiveMQSecurityManager createSecurityManager(SecurityDTO security) throws Exception
{ {
BasicSecurityDTO fileSecurity = (BasicSecurityDTO) security; BasicSecurityDTO fileSecurity = (BasicSecurityDTO) security;
String home = System.getProperty("activemq.home"); String home = System.getProperty("activemq.home");
FileSecurityConfiguration securityConfiguration = new FileSecurityConfiguration(fileSecurity.users.replace("${activemq.home}", home).replace("\\", "/"), FileSecurityConfiguration securityConfiguration = new FileSecurityConfiguration(fixupFileURI(fileSecurity.users),
fileSecurity.roles.replace("${activemq.home}", home).replace("\\", "/"), fixupFileURI(fileSecurity.roles),
fileSecurity.defaultUser, fileSecurity.defaultUser,
fileSecurity.maskPassword, fileSecurity.maskPassword,
fileSecurity.passwordCodec); fileSecurity.passwordCodec);

View File

@ -23,6 +23,7 @@ import org.apache.activemq.integration.Broker;
import org.apache.activemq.spi.core.security.ActiveMQSecurityManager; import org.apache.activemq.spi.core.security.ActiveMQSecurityManager;
import org.apache.activemq.utils.FactoryFinder; import org.apache.activemq.utils.FactoryFinder;
import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.net.URI; import java.net.URI;
@ -40,9 +41,9 @@ public class BrokerFactory
try try
{ {
FactoryFinder finder = new FactoryFinder("META-INF/services/org/apache/activemq/broker/"); 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()); 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)); 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 public static Broker createServer(ServerDTO brokerDTO, ActiveMQSecurityManager security) throws Exception
{ {
if (brokerDTO.configuration != null) if (brokerDTO.configuration != null)
{ {
BrokerHandler handler; BrokerHandler handler;
URI configURI = new URI(brokerDTO.configuration.replace("\\", "/")); URI configURI = new URI(fixupFileURI(brokerDTO.configuration));
try try
{ {
FactoryFinder finder = new FactoryFinder("META-INF/services/org/apache/activemq/broker/server/"); 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()); throw new ConfigurationException("Invalid configuration URI, can't find configuration scheme: " + configURI.getScheme());
} }

View File

@ -46,24 +46,14 @@ fi
# Set Defaults Properties # Set Defaults Properties
ACTIVEMQ_LOGGING_CONF="file:$ACTIVEMQ_INSTANCE/etc/logging.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 ACTIVEMQ_LOG_MANAGER=org.jboss.logmanager.LogManager
JAVA_ARGS="-XX:+UseParallelGC -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Xms512M -Xmx1024M" JAVA_ARGS="-XX:+UseParallelGC -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Xms512M -Xmx1024M"
CLASSPATH=""
# Load Profile Data # Load Profile Data
. "$ACTIVEMQ_INSTANCE/etc/activemq.profile" . "$ACTIVEMQ_INSTANCE/etc/activemq.profile"
# Optionally load jars installed in the instance directory. CLASSPATH="$ACTIVEMQ_HOME/lib/activemq-boot.jar"
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
# OS specific support. # OS specific support.
cygwin=false; cygwin=false;
@ -86,8 +76,6 @@ if $cygwin ; then
ACTIVEMQ_INSTANCE=`cygpath --unix "$ACTIVEMQ_INSTANCE"` ACTIVEMQ_INSTANCE=`cygpath --unix "$ACTIVEMQ_INSTANCE"`
[ -n "$JAVA_HOME" ] && [ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --unix "$JAVA_HOME"` JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
[ -n "$CLASSPATH" ] &&
CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
fi fi
if [ -z "$JAVACMD" ] ; then if [ -z "$JAVACMD" ] ; then
@ -112,14 +100,20 @@ if [ ! -x "$JAVACMD" ] ; then
exit 1 exit 1
fi fi
JAVA_ARGS="$JAVA_ARGS $ACTIVEMQ_CLUSTER_PROPS if $cygwin ; then
-Dactivemq.home="$ACTIVEMQ_HOME" JAVA_HOME=`cygpath --windows "$JAVA_HOME"`
-Dactivemq.instance="$ACTIVEMQ_INSTANCE" ACTIVEMQ_HOME=`cygpath --windows "$ACTIVEMQ_HOME"`
-Djava.library.path="$ACTIVEMQ_HOME/bin/lib/linux-i686:$ACTIVEMQ_INSTANCE/bin/lib/linux-x86_64" CLASSPATH=`cygpath --windows "$CLASSPATH"`
-Djava.io.tmpdir="$ACTIVEMQ_INSTANCE/tmp" fi
-Ddata.dir="$ACTIVEMQ_DATA_DIR"
-Djava.util.logging.manager="$ACTIVEMQ_LOG_MANAGER"
-Dlogging.configuration="$ACTIVEMQ_LOGGING_CONF"
$DEBUG_ARGS"
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 $@

View File

@ -48,22 +48,26 @@ echo.
:RUN_JAVA :RUN_JAVA
rem "Set Defaults." rem "Set Defaults."
set JAVA_ARGS=-Xmx1024M set JAVA_ARGS=-XX:+UseParallelGC -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Xms512M -Xmx1024M
set ACTIVEMQ_LOGGING_CONF="file:%ACTIVEMQ_INSTANCE%\config\logging.properties" set ACTIVEMQ_LOGGING_CONF=file:%ACTIVEMQ_INSTANCE%\etc\logging.properties
set ACTIVEMQ_DATA_DIR="%ACTIVEMQ_INSTANCE%\data" set ACTIVEMQ_DATA_DIR=%ACTIVEMQ_INSTANCE%\data
set ACTIVEMQ_LOG_MANAGER=org.jboss.logmanager.LogManager set ACTIVEMQ_LOG_MANAGER=org.jboss.logmanager.LogManager
rem "Load Profile Config" rem "Load Profile Config"
call "%ACTIVEMQ_INSTANCE%\etc\activemq.profile.cmd" %* call "%ACTIVEMQ_INSTANCE%\etc\activemq.profile.cmd" %*
rem "Create full JVM Args" 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\ set JVM_ARGS=%JAVA_ARGS%
rem "Set Debug & Cluster props"
if not "%DEBUG_ARGS%"=="" set JVM_ARGS=%JVM_ARGS% %DEBUG_ARGS%
if not "%ACTIVEMQ_CLUSTER_PROPS%"=="" set JVM_ARGS=%JVM_ARGS% %ACTIVEMQ_CLUSTER_PROPS% 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 :END
endlocal endlocal

View File

@ -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 %*

View File

@ -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 $@

View File

@ -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 %*

View File

@ -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 $@

View File

@ -15,23 +15,13 @@ rem KIND, either express or implied. See the License for the
rem specific language governing permissions and limitations rem specific language governing permissions and limitations
rem under the License. rem under the License.
set ACTIVEMQ_HOME='${activemq.home}' set ACTIVEMQ_HOME=${activemq.home}
set ACTIVEMQ_BASE='${activemq.base}'
rem Path to logging configuration file rem Cluster Properties: Used to pass arguments to ActiveMQ which can be referenced in activemq-configuration.xml
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 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 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 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 Debug args: Uncomment to enable debug
rem set DEBUG_ARGS=-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005 rem set DEBUG_ARGS=-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005

View File

@ -37,6 +37,11 @@
<dependencies> <dependencies>
<!-- ActiveMQ artifacts --> <!-- ActiveMQ artifacts -->
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-boot</artifactId>
<version>${project.version}</version>
</dependency>
<dependency> <dependency>
<groupId>org.apache.activemq</groupId> <groupId>org.apache.activemq</groupId>
<artifactId>activemq-server</artifactId> <artifactId>activemq-server</artifactId>

View File

@ -26,9 +26,26 @@
<format>tar.gz</format> <format>tar.gz</format>
</formats> </formats>
<includeBaseDirectory>true</includeBaseDirectory> <includeBaseDirectory>true</includeBaseDirectory>
<dependencySets> <dependencySets>
<dependencySet> <dependencySet>
<directoryMode>755</directoryMode>
<fileMode>644</fileMode>
<outputDirectory>lib</outputDirectory>
<outputFileNameMapping>${artifact.artifactId}.${artifact.extension}</outputFileNameMapping>
<unpack>false</unpack>
<useTransitiveDependencies>false</useTransitiveDependencies>
<includes> <includes>
<include>org.apache.activemq:activemq-boot</include>
</includes>
</dependencySet>
<dependencySet>
<directoryMode>755</directoryMode>
<fileMode>644</fileMode>
<includes>
<!-- modules --> <!-- modules -->
<include>org.apache.activemq:activemq-bootstrap</include> <include>org.apache.activemq:activemq-bootstrap</include>
<include>org.apache.activemq:activemq-commons</include> <include>org.apache.activemq:activemq-commons</include>

View File

@ -44,6 +44,10 @@ if [ -z "$ACTIVEMQ_HOME" ] ; then
ACTIVEMQ_HOME=`cd "$ACTIVEMQ_HOME/.." && pwd` ACTIVEMQ_HOME=`cd "$ACTIVEMQ_HOME/.." && pwd`
fi fi
# Set Defaults Properties
JAVA_ARGS="-XX:+UseParallelGC -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Xms512M -Xmx1024M"
CLASSPATH="$ACTIVEMQ_HOME/lib/activemq-boot.jar"
# OS specific support. # OS specific support.
cygwin=false; cygwin=false;
darwin=false; darwin=false;
@ -65,8 +69,6 @@ if $cygwin ; then
ACTIVEMQ_HOME=`cygpath --unix "$ACTIVEMQ_HOME"` ACTIVEMQ_HOME=`cygpath --unix "$ACTIVEMQ_HOME"`
[ -n "$JAVA_HOME" ] && [ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --unix "$JAVA_HOME"` JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
[ -n "$CLASSPATH" ] &&
CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
fi fi
if [ -z "$JAVACMD" ] ; then if [ -z "$JAVACMD" ] ; then
@ -91,12 +93,16 @@ if [ ! -x "$JAVACMD" ] ; then
exit 1 exit 1
fi fi
for i in `ls $ACTIVEMQ_HOME/lib/*.jar`; do
CLASSPATH=$i:$CLASSPATH
done
# Set Defaults Properties if $cygwin ; then
JAVA_ARGS="-XX:+UseParallelGC -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Xms512M -Xmx1024M" 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 $ACTIVEMQ_CLUSTER_PROPS \
exec "$JAVACMD" $JAVA_ARGS -classpath $CLASSPATH org.apache.activemq.cli.ActiveMQ $@ -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 $@

View File

@ -48,27 +48,16 @@ echo.
:RUN_JAVA :RUN_JAVA
rem "Set Defaults." rem "Set Defaults."
set JAVA_ARGS=-Xmx1024M set JAVA_ARGS=-XX:+UseParallelGC -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Xms512M -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%"
)
rem "Create full JVM Args" 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\ set JVM_ARGS=%JAVA_ARGS%
rem "Set Debug & Cluster props"
if not "%DEBUG_ARGS%"=="" set JVM_ARGS=%JVM_ARGS% %DEBUG_ARGS%
if not "%ACTIVEMQ_CLUSTER_PROPS%"=="" set JVM_ARGS=%JVM_ARGS% %ACTIVEMQ_CLUSTER_PROPS% 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 :END
endlocal endlocal

View File

@ -31,6 +31,7 @@
<modules> <modules>
<module>activemq-protocols</module> <module>activemq-protocols</module>
<module>activemq-dto</module> <module>activemq-dto</module>
<module>activemq-boot</module>
</modules> </modules>
<name>ActiveMQ6 Parent</name> <name>ActiveMQ6 Parent</name>