This commit is contained in:
Justin Bertram 2018-02-14 09:17:08 -06:00
commit 32296cac7e
15 changed files with 117 additions and 59 deletions

View File

@ -133,7 +133,6 @@ public class Artemis {
} }
public static Object internalExecute(File artemisHome, File artemisInstance, String[] args, ActionContext context) throws Exception { public static Object internalExecute(File artemisHome, File artemisInstance, String[] args, ActionContext context) throws Exception {
Action action = builder(artemisInstance).build().parse(args); Action action = builder(artemisInstance).build().parse(args);
action.setHomeValues(artemisHome, artemisInstance); action.setHomeValues(artemisHome, artemisInstance);

View File

@ -30,6 +30,8 @@ public abstract class ActionAbstract implements Action {
private String brokerHome; private String brokerHome;
private String brokerEtc;
private URI brokerInstanceURI; private URI brokerInstanceURI;
protected ActionContext context; protected ActionContext context;
@ -65,6 +67,19 @@ public abstract class ActionAbstract implements Action {
return brokerInstance; return brokerInstance;
} }
public String getBrokerEtc() {
if (brokerEtc == null) {
brokerEtc = System.getProperty("artemis.instance.etc");
if (brokerEtc != null) {
brokerEtc = brokerEtc.replace("\\", "/");
} else {
brokerEtc = getBrokerInstance() + "/etc";
}
System.setProperty("artemis.instance.etc", brokerEtc);
}
return brokerEtc;
}
public URI getBrokerURIInstance() { public URI getBrokerURIInstance() {

View File

@ -136,7 +136,7 @@ public abstract class Configurable extends ActionAbstract {
protected String getConfiguration() { protected String getConfiguration() {
if (configuration == null) { if (configuration == null) {
File xmlFile = new File(new File(new File(getBrokerInstance()), "etc"), "bootstrap.xml"); File xmlFile = new File(new File(getBrokerEtc()), "bootstrap.xml");
configuration = "xml:" + xmlFile.toURI().toString().substring("file:".length()); configuration = "xml:" + xmlFile.toURI().toString().substring("file:".length());
// To support Windows paths as explained above. // To support Windows paths as explained above.
@ -149,7 +149,7 @@ public abstract class Configurable extends ActionAbstract {
} }
protected String getManagementConfiguration() { protected String getManagementConfiguration() {
File xmlFile = new File(new File(new File(getBrokerInstance()), "etc"), "management.xml"); File xmlFile = new File(new File(getBrokerEtc()), "management.xml");
String configuration = "xml:" + xmlFile.toURI().toString().substring("file:".length()); String configuration = "xml:" + xmlFile.toURI().toString().substring("file:".length());
// To support Windows paths as explained above. // To support Windows paths as explained above.

View File

@ -76,18 +76,18 @@ public class Create extends InputAbstract {
public static final String BIN_ARTEMIS_CMD = "bin/artemis.cmd"; public static final String BIN_ARTEMIS_CMD = "bin/artemis.cmd";
public static final String BIN_ARTEMIS_SERVICE_EXE = "bin/artemis-service.exe"; public static final String BIN_ARTEMIS_SERVICE_EXE = "bin/artemis-service.exe";
public static final String BIN_ARTEMIS_SERVICE_XML = "bin/artemis-service.xml"; public static final String BIN_ARTEMIS_SERVICE_XML = "bin/artemis-service.xml";
public static final String ETC_ARTEMIS_PROFILE_CMD = "etc/artemis.profile.cmd"; public static final String ETC_ARTEMIS_PROFILE_CMD = "artemis.profile.cmd";
public static final String BIN_ARTEMIS = "bin/artemis"; public static final String BIN_ARTEMIS = "bin/artemis";
public static final String BIN_ARTEMIS_SERVICE = "bin/artemis-service"; public static final String BIN_ARTEMIS_SERVICE = "bin/artemis-service";
public static final String ETC_ARTEMIS_PROFILE = "etc/artemis.profile"; public static final String ETC_ARTEMIS_PROFILE = "artemis.profile";
public static final String ETC_LOGGING_PROPERTIES = "etc/logging.properties"; public static final String ETC_LOGGING_PROPERTIES = "logging.properties";
public static final String ETC_BOOTSTRAP_XML = "etc/bootstrap.xml"; public static final String ETC_BOOTSTRAP_XML = "bootstrap.xml";
public static final String ETC_MANAGEMENT_XML = "etc/management.xml"; public static final String ETC_MANAGEMENT_XML = "management.xml";
public static final String ETC_BROKER_XML = "etc/broker.xml"; public static final String ETC_BROKER_XML = "broker.xml";
public static final String ETC_ARTEMIS_ROLES_PROPERTIES = "etc/artemis-roles.properties"; public static final String ETC_ARTEMIS_ROLES_PROPERTIES = "artemis-roles.properties";
public static final String ETC_ARTEMIS_USERS_PROPERTIES = "etc/artemis-users.properties"; public static final String ETC_ARTEMIS_USERS_PROPERTIES = "artemis-users.properties";
private static final String ETC_LOGIN_CONFIG = "etc/login.config"; private static final String ETC_LOGIN_CONFIG = "login.config";
private static final String ETC_LOGIN_CONFIG_WITH_GUEST = "etc/login-with-guest.config"; private static final String ETC_LOGIN_CONFIG_WITH_GUEST = "etc/login-with-guest.config";
private static final String ETC_LOGIN_CONFIG_WITHOUT_GUEST = "etc/login-without-guest.config"; private static final String ETC_LOGIN_CONFIG_WITHOUT_GUEST = "etc/login-without-guest.config";
public static final String ETC_REPLICATED_SETTINGS_TXT = "etc/replicated-settings.txt"; public static final String ETC_REPLICATED_SETTINGS_TXT = "etc/replicated-settings.txt";
@ -107,7 +107,7 @@ public class Create extends InputAbstract {
public static final String ETC_GLOBAL_MAX_SPECIFIED_TXT = "etc/global-max-specified.txt"; public static final String ETC_GLOBAL_MAX_SPECIFIED_TXT = "etc/global-max-specified.txt";
public static final String ETC_GLOBAL_MAX_DEFAULT_TXT = "etc/global-max-default.txt"; public static final String ETC_GLOBAL_MAX_DEFAULT_TXT = "etc/global-max-default.txt";
public static final String ETC_JOLOKIA_ACCESS_XML = "etc/jolokia-access.xml"; public static final String ETC_JOLOKIA_ACCESS_XML = "jolokia-access.xml";
@Arguments(description = "The instance directory to hold the broker's configuration and data. Path must be writable.", required = true) @Arguments(description = "The instance directory to hold the broker's configuration and data. Path must be writable.", required = true)
private File directory; private File directory;
@ -154,8 +154,11 @@ public class Create extends InputAbstract {
@Option(name = "--home", description = "Directory where ActiveMQ Artemis is installed") @Option(name = "--home", description = "Directory where ActiveMQ Artemis is installed")
private File home; private File home;
@Option(name = "--data", description = "Directory where ActiveMQ Data is used. Paths are relative to artemis.instance") @Option(name = "--data", description = "Directory where ActiveMQ data are stored. Paths can be absolute or relative to artemis.instance directory ('data' by default)")
private String data = "./data"; private String data = "data";
@Option(name = "--etc", description = "Directory where ActiveMQ configuration is located. Paths can be absolute or relative to artemis.instance directory ('etc' by default)")
private String etc = "etc";
@Option(name = "--clustered", description = "Enable clustering") @Option(name = "--clustered", description = "Enable clustering")
private boolean clustered = false; private boolean clustered = false;
@ -387,6 +390,14 @@ public class Create extends InputAbstract {
this.data = data; this.data = data;
} }
public String getEtc() {
return etc;
}
public void setEtc(String etc) {
this.etc = etc;
}
private String getClusterUser() { private String getClusterUser() {
if (clusterUser == null) { if (clusterUser == null) {
clusterUser = input("--cluster-user", "Please provide the username:", "cluster-admin"); clusterUser = input("--cluster-user", "Please provide the username:", "cluster-admin");
@ -508,6 +519,15 @@ public class Create extends InputAbstract {
} }
} }
private File createDirectory(String name, File root) {
File directory = new File(name);
if (!directory.isAbsolute()) {
directory = new File(root, name);
}
directory.mkdirs();
return directory;
}
public Object run(ActionContext context) throws Exception { public Object run(ActionContext context) throws Exception {
IS_WINDOWS = System.getProperty("os.name").toLowerCase().trim().startsWith("win"); IS_WINDOWS = System.getProperty("os.name").toLowerCase().trim().startsWith("win");
@ -651,12 +671,15 @@ public class Create extends InputAbstract {
filters.put("${java.home}", path(System.getProperty("java.home"))); filters.put("${java.home}", path(System.getProperty("java.home")));
new File(directory, "bin").mkdirs(); new File(directory, "bin").mkdirs();
new File(directory, "etc").mkdirs(); File etcFolder = createDirectory(etc, directory);
filters.put("${artemis.instance.etc.uri}", etcFolder.toURI().toString());
filters.put("${artemis.instance.etc.uri.windows}", etcFolder.toURI().toString().replaceAll("%", "%%"));
filters.put("${artemis.instance.etc}", path(etcFolder));
new File(directory, "log").mkdirs(); new File(directory, "log").mkdirs();
new File(directory, "tmp").mkdirs(); new File(directory, "tmp").mkdirs();
new File(directory, "lib").mkdirs(); new File(directory, "lib").mkdirs();
File dataFolder = new File(directory, "data"); File dataFolder = createDirectory(data, directory);
dataFolder.mkdirs(); filters.put("${artemis.instance.data}", path(dataFolder));
filters.put("${logmanager}", getLogManager()); filters.put("${logmanager}", getLogManager());
@ -667,20 +690,18 @@ public class Create extends InputAbstract {
filters.put("${java-opts}", javaOptions); filters.put("${java-opts}", javaOptions);
if (isAllowAnonymous()) { if (isAllowAnonymous()) {
write(ETC_LOGIN_CONFIG_WITH_GUEST, filters, false); write(ETC_LOGIN_CONFIG_WITH_GUEST, new File(etcFolder, ETC_LOGIN_CONFIG), filters, false);
new File(directory, ETC_LOGIN_CONFIG_WITH_GUEST).renameTo(new File(directory, ETC_LOGIN_CONFIG));
} else { } else {
write(ETC_LOGIN_CONFIG_WITHOUT_GUEST, filters, false); write(ETC_LOGIN_CONFIG_WITHOUT_GUEST, new File(etcFolder, ETC_LOGIN_CONFIG), filters, false);
new File(directory, ETC_LOGIN_CONFIG_WITHOUT_GUEST).renameTo(new File(directory, ETC_LOGIN_CONFIG));
} }
write(ETC_ARTEMIS_ROLES_PROPERTIES, filters, false); writeEtc(ETC_ARTEMIS_ROLES_PROPERTIES, etcFolder, filters, false);
if (IS_WINDOWS) { if (IS_WINDOWS) {
write(BIN_ARTEMIS_CMD, null, false); write(BIN_ARTEMIS_CMD, filters, false);
write(BIN_ARTEMIS_SERVICE_EXE); write(BIN_ARTEMIS_SERVICE_EXE);
write(BIN_ARTEMIS_SERVICE_XML, filters, false); write(BIN_ARTEMIS_SERVICE_XML, filters, false);
write(ETC_ARTEMIS_PROFILE_CMD, filters, false); writeEtc(ETC_ARTEMIS_PROFILE_CMD, etcFolder, filters, false);
} }
if (!IS_WINDOWS || IS_CYGWIN) { if (!IS_WINDOWS || IS_CYGWIN) {
@ -688,10 +709,10 @@ public class Create extends InputAbstract {
makeExec(BIN_ARTEMIS); makeExec(BIN_ARTEMIS);
write(BIN_ARTEMIS_SERVICE, filters, true); write(BIN_ARTEMIS_SERVICE, filters, true);
makeExec(BIN_ARTEMIS_SERVICE); makeExec(BIN_ARTEMIS_SERVICE);
write(ETC_ARTEMIS_PROFILE, filters, true); writeEtc(ETC_ARTEMIS_PROFILE, etcFolder, filters, true);
} }
write(ETC_LOGGING_PROPERTIES, null, false); writeEtc(ETC_LOGGING_PROPERTIES, etcFolder, null, false);
if (noWeb) { if (noWeb) {
filters.put("${bootstrap-web-settings}", ""); filters.put("${bootstrap-web-settings}", "");
@ -745,14 +766,14 @@ public class Create extends InputAbstract {
performAutoTune(filters, journalType, dataFolder); performAutoTune(filters, journalType, dataFolder);
write(ETC_BROKER_XML, filters, false); writeEtc(ETC_BROKER_XML, etcFolder, filters, false);
write(ETC_ARTEMIS_USERS_PROPERTIES, filters, false); writeEtc(ETC_ARTEMIS_USERS_PROPERTIES, etcFolder, filters, false);
// we want this variable to remain unchanged so that it will use the value set in the profile // we want this variable to remain unchanged so that it will use the value set in the profile
filters.remove("${artemis.instance}"); filters.remove("${artemis.instance}");
write(ETC_BOOTSTRAP_XML, filters, false); writeEtc(ETC_BOOTSTRAP_XML, etcFolder, filters, false);
write(ETC_MANAGEMENT_XML, filters, false); writeEtc(ETC_MANAGEMENT_XML, etcFolder, filters, false);
write(ETC_JOLOKIA_ACCESS_XML, filters, false); writeEtc(ETC_JOLOKIA_ACCESS_XML, etcFolder, filters, false);
context.out.println(""); context.out.println("");
context.out.println("You can now start the broker by executing: "); context.out.println("You can now start the broker by executing: ");
@ -984,6 +1005,10 @@ public class Create extends InputAbstract {
write(source, new File(directory, source), filters, unixTarget); write(source, new File(directory, source), filters, unixTarget);
} }
private void writeEtc(String source, File etcFolder, HashMap<String, String> filters, boolean unixTarget) throws Exception {
write("etc/" + source, new File(etcFolder, source), filters, unixTarget);
}
private void write(String source, private void write(String source,
File target, File target,
HashMap<String, String> filters, HashMap<String, String> filters,
@ -999,7 +1024,6 @@ public class Create extends InputAbstract {
String separator = unixTarget && IS_CYGWIN ? "\n" : System.getProperty("line.separator"); String separator = unixTarget && IS_CYGWIN ? "\n" : System.getProperty("line.separator");
content = content.replaceAll("\\r?\\n", Matcher.quoteReplacement(separator)); content = content.replaceAll("\\r?\\n", Matcher.quoteReplacement(separator));
ByteArrayInputStream in = new ByteArrayInputStream(content.getBytes(encoding)); ByteArrayInputStream in = new ByteArrayInputStream(content.getBytes(encoding));
try (FileOutputStream fout = new FileOutputStream(target)) { try (FileOutputStream fout = new FileOutputStream(target)) {
copy(in, fout); copy(in, fout);
} }

View File

@ -60,7 +60,7 @@ public abstract class UserAction extends InputAbstract {
String userFileName = (String) entry.getOptions().get(USER_FILE_PROP_NAME); String userFileName = (String) entry.getOptions().get(USER_FILE_PROP_NAME);
String roleFileName = (String) entry.getOptions().get(ROLE_FILE_PROP_NAME); String roleFileName = (String) entry.getOptions().get(ROLE_FILE_PROP_NAME);
File etcDir = new File(getBrokerInstance(), "etc"); File etcDir = new File(getBrokerEtc());
File userFile = new File(etcDir, userFileName); File userFile = new File(etcDir, userFileName);
File roleFile = new File(etcDir, roleFileName); File roleFile = new File(etcDir, roleFileName);

View File

@ -45,11 +45,11 @@ if [ -z "$ARTEMIS_INSTANCE" ] ; then
fi fi
# Load Profile Data # Load Profile Data
. "$ARTEMIS_INSTANCE/etc/artemis.profile" ARTEMIS_INSTANCE_ETC='${artemis.instance.etc}'
. "$ARTEMIS_INSTANCE_ETC/artemis.profile"
# Set Defaults Properties # Set Defaults Properties
ARTEMIS_LOGGING_CONF="$ARTEMIS_INSTANCE_URI/etc/logging.properties" ARTEMIS_LOGGING_CONF="$ARTEMIS_INSTANCE_ETC_URI/logging.properties"
ARTEMIS_DATA_DIR="$ARTEMIS_INSTANCE/data"
ARTEMIS_LOG_MANAGER=org.jboss.logmanager.LogManager ARTEMIS_LOG_MANAGER=org.jboss.logmanager.LogManager
@ -109,7 +109,7 @@ fi
exec "$JAVACMD" \ exec "$JAVACMD" \
$JAVA_ARGS \ $JAVA_ARGS \
-Xbootclasspath/a:"$LOG_MANAGER" \ -Xbootclasspath/a:"$LOG_MANAGER" \
-Djava.security.auth.login.config="$ARTEMIS_INSTANCE/etc/login.config" \ -Djava.security.auth.login.config="$ARTEMIS_INSTANCE_ETC_URI/login.config" \
$ARTEMIS_CLUSTER_PROPS \ $ARTEMIS_CLUSTER_PROPS \
-classpath "$CLASSPATH" \ -classpath "$CLASSPATH" \
-Dartemis.home="$ARTEMIS_HOME" \ -Dartemis.home="$ARTEMIS_HOME" \
@ -117,6 +117,7 @@ exec "$JAVACMD" \
-Djava.library.path="$ARTEMIS_HOME/bin/lib/linux-$(uname -m)" \ -Djava.library.path="$ARTEMIS_HOME/bin/lib/linux-$(uname -m)" \
-Djava.io.tmpdir="$ARTEMIS_INSTANCE/tmp" \ -Djava.io.tmpdir="$ARTEMIS_INSTANCE/tmp" \
-Ddata.dir="$ARTEMIS_DATA_DIR" \ -Ddata.dir="$ARTEMIS_DATA_DIR" \
-Dartemis.instance.etc="$ARTEMIS_INSTANCE_ETC" \
-Djava.util.logging.manager="$ARTEMIS_LOG_MANAGER" \ -Djava.util.logging.manager="$ARTEMIS_LOG_MANAGER" \
-Dlogging.configuration="$ARTEMIS_LOGGING_CONF" \ -Dlogging.configuration="$ARTEMIS_LOGGING_CONF" \
$DEBUG_ARGS \ $DEBUG_ARGS \

View File

@ -24,7 +24,10 @@
<env name="ARTEMIS_HOME" value="${artemis.home}"/> <env name="ARTEMIS_HOME" value="${artemis.home}"/>
<env name="ARTEMIS_INSTANCE" value="${artemis.instance}"/> <env name="ARTEMIS_INSTANCE" value="${artemis.instance}"/>
<env name="ARTEMIS_INSTANCE_ETC" value="${artemis.instance.etc}"/>
<env name="ARTEMIS_INSTANCE_URI" value="${artemis.instance.uri}"/> <env name="ARTEMIS_INSTANCE_URI" value="${artemis.instance.uri}"/>
<env name="ARTEMIS_INSTANCE_ETC_URI" value="${artemis.instance.etc.uri.windows}"/>
<env name="ARTEMIS_DATA_DIR" value="${artemis.instance.data}"/>
<logpath>${artemis.instance}\log</logpath> <logpath>${artemis.instance}\log</logpath>
<logmode>roll</logmode> <logmode>roll</logmode>
@ -55,14 +58,16 @@
<argument>%ARTEMIS_HOME%\lib\artemis-boot.jar</argument> <argument>%ARTEMIS_HOME%\lib\artemis-boot.jar</argument>
<argument>-Dartemis.home=%ARTEMIS_HOME%</argument> <argument>-Dartemis.home=%ARTEMIS_HOME%</argument>
<argument>-Dartemis.instance=%ARTEMIS_INSTANCE%</argument> <argument>-Dartemis.instance=%ARTEMIS_INSTANCE%</argument>
<argument>-Ddata.dir=%ARTEMIS_DATA_DIR%</argument>
<argument>-Dartemis.instance.etc="%ARTEMIS_INSTANCE_ETC%"</argument>
<argument>-Djava.util.logging.manager=org.jboss.logmanager.LogManager</argument> <argument>-Djava.util.logging.manager=org.jboss.logmanager.LogManager</argument>
<argument>-Dlogging.configuration=%ARTEMIS_INSTANCE_URI%/etc/logging.properties</argument> <argument>-Dlogging.configuration=%ARTEMIS_INSTANCE_ETC_URI%/logging.properties</argument>
<argument>-Djava.security.auth.login.config=%ARTEMIS_INSTANCE%\etc\login.config</argument> <argument>-Djava.security.auth.login.config=%ARTEMIS_INSTANCE_ETC%\login.config</argument>
<argument>-Dhawtio.realm=activemq</argument> <argument>-Dhawtio.realm=activemq</argument>
<argument>-Dhawtio.offline="true"</argument> <argument>-Dhawtio.offline="true"</argument>
<argument>-Dhawtio.role=${role}</argument> <argument>-Dhawtio.role=${role}</argument>
<argument>-Dhawtio.rolePrincipalClasses=org.apache.activemq.artemis.spi.core.security.jaas.RolePrincipal</argument> <argument>-Dhawtio.rolePrincipalClasses=org.apache.activemq.artemis.spi.core.security.jaas.RolePrincipal</argument>
<argument>-Djolokia.policyLocation=%ARTEMIS_INSTANCE_URI%/etc/jolokia-access.xml</argument> <argument>-Djolokia.policyLocation=%ARTEMIS_INSTANCE_ETC_URI%/jolokia-access.xml</argument>
<!-- Debug args: Uncomment to enable debug <!-- Debug args: Uncomment to enable debug
<argument>-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005</argument> <argument>-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005</argument>

View File

@ -45,11 +45,11 @@ echo.
:RUN_JAVA :RUN_JAVA
rem "Load Profile Config" rem "Load Profile Config"
call %ARTEMIS_INSTANCE%\etc\artemis.profile.cmd %* set ARTEMIS_INSTANCE_ETC="${artemis.instance.etc}"
call %ARTEMIS_INSTANCE_ETC%\artemis.profile.cmd %*
rem "Set Defaults." rem "Set Defaults."
set ARTEMIS_LOGGING_CONF=%ARTEMIS_INSTANCE_URI%/etc/logging.properties set ARTEMIS_LOGGING_CONF=%ARTEMIS_INSTANCE_ETC_URI%/logging.properties
set ARTEMIS_DATA_DIR=%ARTEMIS_INSTANCE%\data
set ARTEMIS_LOG_MANAGER=org.jboss.logmanager.LogManager set ARTEMIS_LOG_MANAGER=org.jboss.logmanager.LogManager
rem "Create full JVM Args" rem "Create full JVM Args"
@ -59,6 +59,7 @@ set JVM_ARGS=%JVM_ARGS% -classpath %ARTEMIS_HOME%\lib\artemis-boot.jar
set JVM_ARGS=%JVM_ARGS% -Dartemis.home=%ARTEMIS_HOME% set JVM_ARGS=%JVM_ARGS% -Dartemis.home=%ARTEMIS_HOME%
set JVM_ARGS=%JVM_ARGS% -Dartemis.instance=%ARTEMIS_INSTANCE% set JVM_ARGS=%JVM_ARGS% -Dartemis.instance=%ARTEMIS_INSTANCE%
set JVM_ARGS=%JVM_ARGS% -Ddata.dir=%ARTEMIS_DATA_DIR% set JVM_ARGS=%JVM_ARGS% -Ddata.dir=%ARTEMIS_DATA_DIR%
set JVM_ARGS=%JVM_ARGS% -Dartemis.instance.etc="%ARTEMIS_INSTANCE_ETC%"
set JVM_ARGS=%JVM_ARGS% -Djava.util.logging.manager=%ARTEMIS_LOG_MANAGER% set JVM_ARGS=%JVM_ARGS% -Djava.util.logging.manager=%ARTEMIS_LOG_MANAGER%
set JVM_ARGS=%JVM_ARGS% -Dlogging.configuration=%ARTEMIS_LOGGING_CONF% set JVM_ARGS=%JVM_ARGS% -Dlogging.configuration=%ARTEMIS_LOGGING_CONF%
if not "%DEBUG_ARGS%"=="" set JVM_ARGS=%JVM_ARGS% %DEBUG_ARGS% if not "%DEBUG_ARGS%"=="" set JVM_ARGS=%JVM_ARGS% %DEBUG_ARGS%

View File

@ -17,18 +17,20 @@
ARTEMIS_HOME='${artemis.home}' ARTEMIS_HOME='${artemis.home}'
ARTEMIS_INSTANCE='${artemis.instance}' ARTEMIS_INSTANCE='${artemis.instance}'
ARTEMIS_DATA_DIR='${artemis.instance.data}'
# The logging config will need an URI # The logging config will need an URI
# this will be encoded in case you use spaces or special characters # this will be encoded in case you use spaces or special characters
# on your directory structure # on your directory structure
ARTEMIS_INSTANCE_URI='${artemis.instance.uri}' ARTEMIS_INSTANCE_URI='${artemis.instance.uri}'
ARTEMIS_INSTANCE_ETC_URI='${artemis.instance.etc.uri}'
# Cluster Properties: Used to pass arguments to ActiveMQ Artemis which can be referenced in broker.xml # Cluster Properties: Used to pass arguments to ActiveMQ Artemis which can be referenced in broker.xml
#ARTEMIS_CLUSTER_PROPS="-Dactivemq.remoting.default.port=61617 -Dactivemq.remoting.amqp.port=5673 -Dactivemq.remoting.stomp.port=61614 -Dactivemq.remoting.hornetq.port=5446" #ARTEMIS_CLUSTER_PROPS="-Dactivemq.remoting.default.port=61617 -Dactivemq.remoting.amqp.port=5673 -Dactivemq.remoting.stomp.port=61614 -Dactivemq.remoting.hornetq.port=5446"
# Java Opts # Java Opts
JAVA_ARGS="${java-opts} -XX:+PrintClassHistogram -XX:+UseG1GC -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Xms512M -Xmx2G -Dhawtio.realm=activemq -Dhawtio.offline="true" -Dhawtio.role=${role} -Dhawtio.rolePrincipalClasses=org.apache.activemq.artemis.spi.core.security.jaas.RolePrincipal -Djolokia.policyLocation=${ARTEMIS_INSTANCE_URI}/etc/jolokia-access.xml" JAVA_ARGS="${java-opts} -XX:+PrintClassHistogram -XX:+UseG1GC -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Xms512M -Xmx2G -Dhawtio.realm=activemq -Dhawtio.offline="true" -Dhawtio.role=${role} -Dhawtio.rolePrincipalClasses=org.apache.activemq.artemis.spi.core.security.jaas.RolePrincipal -Djolokia.policyLocation=${ARTEMIS_INSTANCE_ETC_URI}jolokia-access.xml"
# #
# There might be options that you only want to enable on specifc commands, like setting a JMX port # There might be options that you only want to enable on specifc commands, like setting a JMX port

View File

@ -18,17 +18,20 @@ rem under the License.
set ARTEMIS_HOME="${artemis.home}" set ARTEMIS_HOME="${artemis.home}"
set ARTEMIS_INSTANCE="${artemis.instance}" set ARTEMIS_INSTANCE="${artemis.instance}"
set ARTEMIS_DATA_DIR='${artemis.instance.data}'
rem The logging config will need an URI rem The logging config will need an URI
rem this will be encoded in case you use spaces or special characters rem this will be encoded in case you use spaces or special characters
rem on your directory structure rem on your directory structure
set ARTEMIS_INSTANCE_URI="${artemis.instance.uri.windows}" set ARTEMIS_INSTANCE_URI="${artemis.instance.uri.windows}"
set ARTEMIS_INSTANCE_ETC_URI="${artemis.instance.etc.uri.windows}"
rem Cluster Properties: Used to pass arguments to ActiveMQ Artemis which can be referenced in broker.xml rem Cluster Properties: Used to pass arguments to ActiveMQ Artemis which can be referenced in broker.xml
rem set ARTEMIS_CLUSTER_PROPS=-Dactivemq.remoting.default.port=61617 -Dactivemq.remoting.amqp.port=5673 -Dactivemq.remoting.stomp.port=61614 -Dactivemq.remoting.hornetq.port=5446 rem set ARTEMIS_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=${java-opts} -XX:+PrintClassHistogram -XX:+UseG1GC -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Xms512M -Xmx1024M -Xbootclasspath/a:%ARTEMIS_HOME%\lib\${logmanager} -Djava.security.auth.login.config=%ARTEMIS_INSTANCE%\etc\login.config -Dhawtio.offline="true" -Dhawtio.realm=activemq -Dhawtio.role=${role} -Dhawtio.rolePrincipalClasses=org.apache.activemq.artemis.spi.core.security.jaas.RolePrincipal -Djolokia.policyLocation=%ARTEMIS_INSTANCE_URI%\etc\jolokia-access.xml -Dartemis.instance=%ARTEMIS_INSTANCE% set JAVA_ARGS=${java-opts} -XX:+PrintClassHistogram -XX:+UseG1GC -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Xms512M -Xmx1024M -Xbootclasspath/a:%ARTEMIS_HOME%\lib\${logmanager} -Djava.security.auth.login.config=%ARTEMIS_ETC_INSTANCE%\login.config -Dhawtio.offline="true" -Dhawtio.realm=activemq -Dhawtio.role=${role} -Dhawtio.rolePrincipalClasses=org.apache.activemq.artemis.spi.core.security.jaas.RolePrincipal -Djolokia.policyLocation=%ARTEMIS_INSTANCE_ETC_URI%\jolokia-access.xml -Dartemis.instance=%ARTEMIS_INSTANCE%
rem There might be options that you only want to enable on specifc commands, like setting a JMX port rem There might be options that you only want to enable on specifc commands, like setting a JMX port
rem See https://issues.apache.org/jira/browse/ARTEMIS-318 rem See https://issues.apache.org/jira/browse/ARTEMIS-318

View File

@ -22,7 +22,7 @@
<!-- artemis.URI.instance is parsed from artemis.instance by the CLI startup. <!-- artemis.URI.instance is parsed from artemis.instance by the CLI startup.
This is to avoid situations where you could have spaces or special characters on this URI --> This is to avoid situations where you could have spaces or special characters on this URI -->
<server configuration="${artemis.URI.instance}/etc/broker.xml"/> <server configuration="${artemis.instance.etc.uri}/broker.xml"/>
${bootstrap-web-settings} ${bootstrap-web-settings}

View File

@ -54,6 +54,7 @@ public class CliTestBase {
public void tearDown() throws Exception { public void tearDown() throws Exception {
ActiveMQClient.clearThreadPools(); ActiveMQClient.clearThreadPools();
System.clearProperty("artemis.instance"); System.clearProperty("artemis.instance");
System.clearProperty("artemis.instance.etc");
Run.setEmbedded(false); Run.setEmbedded(false);
if (original == null) { if (original == null) {

View File

@ -33,16 +33,16 @@ public class StreamClassPathTest {
openStream(Create.BIN_ARTEMIS_CMD); openStream(Create.BIN_ARTEMIS_CMD);
openStream(Create.BIN_ARTEMIS_SERVICE_EXE); openStream(Create.BIN_ARTEMIS_SERVICE_EXE);
openStream(Create.BIN_ARTEMIS_SERVICE_XML); openStream(Create.BIN_ARTEMIS_SERVICE_XML);
openStream(Create.ETC_ARTEMIS_PROFILE_CMD); openStream("etc/" + Create.ETC_ARTEMIS_PROFILE_CMD);
openStream(Create.BIN_ARTEMIS); openStream(Create.BIN_ARTEMIS);
openStream(Create.BIN_ARTEMIS_SERVICE); openStream(Create.BIN_ARTEMIS_SERVICE);
openStream(Create.ETC_ARTEMIS_PROFILE); openStream("etc/" + Create.ETC_ARTEMIS_PROFILE);
openStream(Create.ETC_LOGGING_PROPERTIES); openStream("etc/" + Create.ETC_LOGGING_PROPERTIES);
openStream(Create.ETC_BOOTSTRAP_XML); openStream("etc/" + Create.ETC_BOOTSTRAP_XML);
openStream(Create.ETC_MANAGEMENT_XML); openStream("etc/" + Create.ETC_MANAGEMENT_XML);
openStream(Create.ETC_BROKER_XML); openStream("etc/" + Create.ETC_BROKER_XML);
openStream(Create.ETC_ARTEMIS_ROLES_PROPERTIES); openStream("etc/" + Create.ETC_ARTEMIS_ROLES_PROPERTIES);
openStream(Create.ETC_ARTEMIS_USERS_PROPERTIES); openStream("etc/" + Create.ETC_ARTEMIS_USERS_PROPERTIES);
openStream(Create.ETC_REPLICATED_SETTINGS_TXT); openStream(Create.ETC_REPLICATED_SETTINGS_TXT);
openStream(Create.ETC_REPLICATED_SETTINGS_TXT); openStream(Create.ETC_REPLICATED_SETTINGS_TXT);
openStream(Create.ETC_SHARED_STORE_SETTINGS_TXT); openStream(Create.ETC_SHARED_STORE_SETTINGS_TXT);
@ -59,7 +59,7 @@ public class StreamClassPathTest {
openStream(Create.ETC_COMMENTED_PING_TXT); openStream(Create.ETC_COMMENTED_PING_TXT);
openStream(Create.ETC_GLOBAL_MAX_SPECIFIED_TXT); openStream(Create.ETC_GLOBAL_MAX_SPECIFIED_TXT);
openStream(Create.ETC_GLOBAL_MAX_DEFAULT_TXT); openStream(Create.ETC_GLOBAL_MAX_DEFAULT_TXT);
openStream(Create.ETC_JOLOKIA_ACCESS_XML); openStream("etc/" + Create.ETC_JOLOKIA_ACCESS_XML);
openStream(Create.ETC_DATABASE_STORE_TXT); openStream(Create.ETC_DATABASE_STORE_TXT);
} }

View File

@ -506,6 +506,7 @@ public class ConfigurationImplTest extends ActiveMQTestBase {
// Validate that the resolve method will work even with artemis.instance doesn't exist // Validate that the resolve method will work even with artemis.instance doesn't exist
String oldProperty = System.getProperty("artemis.instance"); String oldProperty = System.getProperty("artemis.instance");
String oldEtc = System.getProperty("artemis.instance.etc");
File tempFolder = null; File tempFolder = null;
try { try {
@ -526,8 +527,10 @@ public class ConfigurationImplTest extends ActiveMQTestBase {
} finally { } finally {
if (oldProperty == null) { if (oldProperty == null) {
System.clearProperty("artemis.instance"); System.clearProperty("artemis.instance");
System.clearProperty("artemis.instance.etc");
} else { } else {
System.setProperty("artemis.instance", oldProperty); System.setProperty("artemis.instance", oldProperty);
System.setProperty("artemis.instance.etc", oldEtc);
} }
if (tempFolder != null) { if (tempFolder != null) {

View File

@ -92,7 +92,7 @@ For a full list of updated properties always use:
[--autocreate] [--blocking] [--cluster-password <clusterPassword>] [--autocreate] [--blocking] [--cluster-password <clusterPassword>]
[--cluster-user <clusterUser>] [--clustered] [--data <data>] [--cluster-user <clusterUser>] [--clustered] [--data <data>]
[--default-port <defaultPort>] [--disable-persistence] [--default-port <defaultPort>] [--disable-persistence]
[--encoding <encoding>] [--failover-on-shutdown] [--force] [--encoding <encoding>] [--etc <etc>] [--failover-on-shutdown] [--force]
[--global-max-size <globalMaxSize>] [--home <home>] [--host <host>] [--global-max-size <globalMaxSize>] [--home <home>] [--host <host>]
[--http-host <httpHost>] [--http-port <httpPort>] [--http-host <httpHost>] [--http-port <httpPort>]
[--java-options <javaOptions>] [--mapped] [--max-hops <maxHops>] [--java-options <javaOptions>] [--mapped] [--max-hops <maxHops>]
@ -135,8 +135,8 @@ For a full list of updated properties always use:
Enable clustering Enable clustering
--data <data> --data <data>
Directory where ActiveMQ Data is used. Paths are relative to Directory where ActiveMQ data are stored. Paths can be absolute or
artemis.instance relative to artemis.instance directory ('data' by default)
--default-port <defaultPort> --default-port <defaultPort>
The port number to use for the main 'artemis' acceptor (Default: The port number to use for the main 'artemis' acceptor (Default:
@ -148,6 +148,10 @@ For a full list of updated properties always use:
--encoding <encoding> --encoding <encoding>
The encoding that text files should use The encoding that text files should use
--etc <etc>
Directory where ActiveMQ configuration is located. Paths can be absolute or
relative to artemis.instance directory ('etc' by default)
--failover-on-shutdown --failover-on-shutdown
Valid for shared store: will shutdown trigger a failover? (Default: Valid for shared store: will shutdown trigger a failover? (Default:
false) false)