diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java index feb23ddb75..783ed509d9 100644 --- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java +++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java @@ -584,12 +584,13 @@ public class Create extends InputAbstract { applyAddressesAndQueues(filters); if (home != null) { - filters.put("${home}", path(home, false)); + filters.put("${home}", path(home)); } - filters.put("${artemis.home}", path(getHome().toString(), false)); - filters.put("${artemis.instance}", path(directory, false)); + filters.put("${artemis.home}", path(getHome().toString())); + filters.put("${artemis.instance}", path(directory)); + filters.put("${artemis.instance.uri}", directory.toURI().toString()); filters.put("${artemis.instance.name}", directory.getName()); - filters.put("${java.home}", path(System.getProperty("java.home"), false)); + filters.put("${java.home}", path(System.getProperty("java.home"))); new File(directory, "bin").mkdirs(); new File(directory, "etc").mkdirs(); @@ -688,7 +689,7 @@ public class Create extends InputAbstract { context.out.println(""); context.out.println("You can now start the broker by executing: "); context.out.println(""); - context.out.println(String.format(" \"%s\" run", path(new File(directory, "bin/artemis"), true))); + context.out.println(String.format(" \"%s\" run", path(new File(directory, "bin/artemis")))); File service = new File(directory, BIN_ARTEMIS_SERVICE); context.out.println(""); @@ -696,7 +697,7 @@ public class Create extends InputAbstract { if (!IS_WINDOWS || IS_CYGWIN) { context.out.println("Or you can run the broker in the background using:"); context.out.println(""); - context.out.println(String.format(" \"%s\" start", path(service, true))); + context.out.println(String.format(" \"%s\" start", path(service))); context.out.println(""); } @@ -704,14 +705,14 @@ public class Create extends InputAbstract { service = new File(directory, BIN_ARTEMIS_SERVICE_EXE); context.out.println("Or you can setup the broker as Windows service and run it in the background:"); context.out.println(""); - context.out.println(String.format(" \"%s\" install", path(service, true))); - context.out.println(String.format(" \"%s\" start", path(service, true))); + context.out.println(String.format(" \"%s\" install", path(service))); + context.out.println(String.format(" \"%s\" start", path(service))); context.out.println(""); context.out.println(" To stop the windows service:"); - context.out.println(String.format(" \"%s\" stop", path(service, true))); + context.out.println(String.format(" \"%s\" stop", path(service))); context.out.println(""); context.out.println(" To uninstall the windows service"); - context.out.println(String.format(" \"%s\" uninstall", path(service, true))); + context.out.println(String.format(" \"%s\" uninstall", path(service))); } return null; @@ -752,7 +753,7 @@ public class Create extends InputAbstract { private String getLogManager() throws IOException { String logManager = ""; - File dir = new File(path(getHome().toString(), false) + "/lib"); + File dir = new File(path(getHome().toString()) + "/lib"); File[] matches = dir.listFiles(new FilenameFilter() { @Override @@ -866,16 +867,12 @@ public class Create extends InputAbstract { } } - private String path(String value, boolean unixPaths) throws IOException { - return path(new File(value), unixPaths); + private String path(String value) throws IOException { + return path(new File(value)); } - private String path(File value, boolean unixPaths) throws IOException { - if (unixPaths && IS_CYGWIN) { - return value.getCanonicalPath(); - } else { - return value.getCanonicalPath(); - } + private String path(File value) throws IOException { + return value.getCanonicalPath(); } private void write(String source, HashMap filters, boolean unixTarget) throws Exception { diff --git a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/bin/artemis b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/bin/artemis index 96497440fb..b66141a71e 100755 --- a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/bin/artemis +++ b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/bin/artemis @@ -44,13 +44,14 @@ if [ -z "$ARTEMIS_INSTANCE" ] ; then ARTEMIS_INSTANCE=`cd "$ARTEMIS_INSTANCE/.." && pwd` fi +# Load Profile Data +. "$ARTEMIS_INSTANCE/etc/artemis.profile" + # Set Defaults Properties -ARTEMIS_LOGGING_CONF="file:$ARTEMIS_INSTANCE/etc/logging.properties" +ARTEMIS_LOGGING_CONF="$ARTEMIS_INSTANCE_URI/etc/logging.properties" ARTEMIS_DATA_DIR="$ARTEMIS_INSTANCE/data" ARTEMIS_LOG_MANAGER=org.jboss.logmanager.LogManager -# Load Profile Data -. "$ARTEMIS_INSTANCE/etc/artemis.profile" CLASSPATH="$ARTEMIS_HOME/lib/artemis-boot.jar" diff --git a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/bin/artemis.cmd b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/bin/artemis.cmd index abbd468996..9c6fd7dfb6 100644 --- a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/bin/artemis.cmd +++ b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/bin/artemis.cmd @@ -48,7 +48,7 @@ echo. :RUN_JAVA rem "Set Defaults." -set ARTEMIS_LOGGING_CONF=file:%ARTEMIS_INSTANCE%\etc\logging.properties +set ARTEMIS_LOGGING_CONF=%ARTEMIS_INSTANCE_URI%/etc/logging.properties set ARTEMIS_DATA_DIR=%ARTEMIS_INSTANCE%\data set ARTEMIS_LOG_MANAGER=org.jboss.logmanager.LogManager diff --git a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/artemis.profile b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/artemis.profile index 5b44b9bb76..ed23e5344f 100644 --- a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/artemis.profile +++ b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/artemis.profile @@ -18,6 +18,11 @@ ARTEMIS_HOME='${artemis.home}' ARTEMIS_INSTANCE='${artemis.instance}' +# The logging config will need an URI +# this will be encoded in case you use spaces or special characters +# on your directory structure +ARTEMIS_INSTANCE_URI='${artemis.instance.uri}' + # 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" diff --git a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/artemis.profile.cmd b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/artemis.profile.cmd index 31cb5766f2..fe372758a5 100644 --- a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/artemis.profile.cmd +++ b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/artemis.profile.cmd @@ -19,6 +19,11 @@ rem under the License. set ARTEMIS_HOME="${artemis.home}" set ARTEMIS_INSTANCE="${artemis.instance}" +rem The logging config will need an URI +rem this will be encoded in case you use spaces or special characters +rem on your directory structure +set ARTEMIS_INSTANCE_URI="${artemis.instance.uri}" + 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