activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbert...@apache.org
Subject [08/11] activemq-artemis git commit: Moving artemis-tools to artemis-cli and improving the tooling
Date Mon, 04 May 2015 15:30:39 GMT
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ea3370b3/artemis-bootstrap/src/main/resources/org/apache/activemq/artemis/cli/commands/bin/artemis-service
----------------------------------------------------------------------
diff --git a/artemis-bootstrap/src/main/resources/org/apache/activemq/artemis/cli/commands/bin/artemis-service b/artemis-bootstrap/src/main/resources/org/apache/activemq/artemis/cli/commands/bin/artemis-service
deleted file mode 100755
index 7a53901..0000000
--- a/artemis-bootstrap/src/main/resources/org/apache/activemq/artemis/cli/commands/bin/artemis-service
+++ /dev/null
@@ -1,154 +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.
-
-service=`basename "$0"`
-
-#
-# Discover the ARTEMIS_INSTANCE from the location of this script.
-#
-if [ -z "$ARTEMIS_INSTANCE" ] ; then
-
-  ## resolve links - $0 may be a link to ActiveMQ's home
-  PRG="$0"
-  saveddir=`pwd`
-
-  # need this for relative symlinks
-  dirname_prg=`dirname "$PRG"`
-  cd "$dirname_prg"
-
-  while [ -h "$PRG" ] ; do
-    ls=`ls -ld "$PRG"`
-    link=`expr "$ls" : '.*-> \(.*\)$'`
-    if expr "$link" : '.*/.*' > /dev/null; then
-      PRG="$link"
-    else
-      PRG=`dirname "$PRG"`"/$link"
-    fi
-  done
-
-  ARTEMIS_INSTANCE=`dirname "$PRG"`
-  cd "$saveddir"
-
-  # make it fully qualified
-  ARTEMIS_INSTANCE=`cd "$ARTEMIS_INSTANCE/.." && pwd`
-  export ARTEMIS_INSTANCE
-
-fi
-
-PID_FILE="${ARTEMIS_INSTANCE}/data/artemis.pid"
-
-if [ ! -d "${ARTEMIS_INSTANCE}/data/" ]; then
-    mkdir "${ARTEMIS_INSTANCE}/data/"
-fi
-
-status() {
-  if [ -f "${PID_FILE}" ] ; then
-    pid=`cat "${PID_FILE}"`
-    # check to see if it's gone...
-    ps -p ${pid} > /dev/null
-    if [ $? -eq 0 ] ; then
-      return 0
-    else
-      rm "${PID_FILE}"
-      return 3
-    fi
-  fi
-  return 3
-}
-
-stop() {
-  if [ -f "${PID_FILE}" ] ; then
-    pid=`cat "${PID_FILE}"`
-    kill $@ ${pid} > /dev/null
-  fi
-  for i in 1 2 3 4 5 ; do
-    status
-    if [ $? -ne 0 ] ; then
-      return 0
-    fi
-    sleep 1
-  done
-  echo "Could not stop process ${pid}"
-  return 1
-}
-
-start() {
-
-  status
-  if [ $? -eq 0 ] ; then
-    echo "Already running."
-    return 1
-  fi
-
-  nohup ${ARTEMIS_INSTANCE}/bin/artemis run > /dev/null 2> /dev/null &
-
-  echo $! > "${PID_FILE}"
-
-  # check to see if stays up...
-  sleep 1
-  status
-  if [ $? -ne 0 ] ; then
-    echo "Could not start ${service}"
-    return 1
-  fi
-  echo "${service} is now running (${pid})"
-  return 0
-}
-
-case $1 in
-  start)
-    echo "Starting ${service}"
-    start
-    exit $?
-  ;;
-
-  force-stop)
-    echo "Forcibly Stopping ${service}"
-    stop -9
-    exit $?
-  ;;
-
-  stop)
-    echo "Gracefully Stopping ${service}"
-    stop
-    exit $?
-  ;;
-
-  restart)
-    echo "Restarting ${service}"
-    stop
-    start
-    exit $?
-  ;;
-
-  status)
-    status
-    rc=$?
-    if [ $rc -eq 0 ] ; then
-      echo "${service} is running (${pid})"
-    else
-      echo "${service} is stopped"
-    fi
-    exit $rc
-  ;;
-
-  *)
-    echo "Usage: $0 {start|stop|restart|force-stop|status}" >&2
-    exit 2
-  ;;
-esac

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ea3370b3/artemis-bootstrap/src/main/resources/org/apache/activemq/artemis/cli/commands/bin/artemis-service.xml
----------------------------------------------------------------------
diff --git a/artemis-bootstrap/src/main/resources/org/apache/activemq/artemis/cli/commands/bin/artemis-service.xml b/artemis-bootstrap/src/main/resources/org/apache/activemq/artemis/cli/commands/bin/artemis-service.xml
deleted file mode 100644
index a39d16f..0000000
--- a/artemis-bootstrap/src/main/resources/org/apache/activemq/artemis/cli/commands/bin/artemis-service.xml
+++ /dev/null
@@ -1,59 +0,0 @@
-<!--
-
-    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.
-
--->
-
-<service>
-   <id>armetis-${host}</id>
-   <name>ActiveMQ Artemis: ${host}</name>
-   <description>Apache ActiveMQ Artemis is a reliable messaging broker</description>
-
-   <logpath>${artemis.instance}\log</logpath>
-   <logmode>roll</logmode>
-
-   <executable>"${java.home}\bin\java.exe"</executable>
-   <argument>-XX:+UseParallelGC</argument>
-   <argument>-XX:+AggressiveOpts</argument>
-   <argument>-XX:+UseFastAccessorMethods</argument>
-   <argument>-Xms512M</argument>
-   <argument>-Xmx1024M</argument>
-
-   <!-- Cluster Properties: Used to pass arguments to ActiveMQ which can be referenced in broker.xml
-   <argument>-Dartemis.remoting.default.port=61617</argument>
-   <argument>-Dartemis.remoting.amqp.port=5673</argument>
-   <argument>-Dartemis.remoting.stomp.port=61614</argument>
-   <argument>-Dartemis.remoting.hornetq.port=5446</argument>
-   -->
-
-   <argument>-classpath</argument>
-   <argument>"${artemis.home}\lib\artemis-boot.jar"</argument>
-   <argument>"-artemis.home=${artemis.home}"</argument>
-   <argument>"-artemis.instance=${artemis.instance}"</argument>
-   <argument>"-Ddata.dir=${artemis.instance}/data"</argument>
-   <argument>-Djava.util.logging.manager=org.jboss.logmanager.LogManager</argument>
-   <argument>"-Dlogging.configuration=file:${artemis.instance}\etc\logging.properties"</argument>
-
-
-   <!-- Debug args: Uncomment to enable debug
-   <argument>-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005</argument>
-   -->
-
-   <argument>Armetis</argument>
-
-   <argument>run</argument>
-
-</service>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ea3370b3/artemis-bootstrap/src/main/resources/org/apache/activemq/artemis/cli/commands/bin/artemis.cmd
----------------------------------------------------------------------
diff --git a/artemis-bootstrap/src/main/resources/org/apache/activemq/artemis/cli/commands/bin/artemis.cmd b/artemis-bootstrap/src/main/resources/org/apache/activemq/artemis/cli/commands/bin/artemis.cmd
deleted file mode 100755
index 5e8f500..0000000
--- a/artemis-bootstrap/src/main/resources/org/apache/activemq/artemis/cli/commands/bin/artemis.cmd
+++ /dev/null
@@ -1,76 +0,0 @@
-@echo off
-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.
-
-setlocal
-
-if NOT "%ARTEMIS_INSTANCE%"=="" goto CHECK_ARTEMIS_INSTANCE
-PUSHD .
-CD %~dp0..
-set ARTEMIS_INSTANCE=%CD%
-POPD
-
-:CHECK_ARTEMIS_INSTANCE
-if exist "%ARTEMIS_INSTANCE%\bin\activemq.cmd" goto CHECK_JAVA
-
-:NO_HOME
-echo ARTEMIS_INSTANCE environment variable is set incorrectly. Please set ARTEMIS_INSTANCE.
-goto END
-
-:CHECK_JAVA
-set _JAVACMD=%JAVACMD%
-
-if "%JAVA_HOME%" == "" goto NO_JAVA_HOME
-if not exist "%JAVA_HOME%\bin\java.exe" goto NO_JAVA_HOME
-if "%_JAVACMD%" == "" set _JAVACMD=%JAVA_HOME%\bin\java.exe
-goto RUN_JAVA
-
-:NO_JAVA_HOME
-if "%_JAVACMD%" == "" set _JAVACMD=java.exe
-echo.
-echo Warning: JAVA_HOME environment variable is not set.
-echo.
-
-:RUN_JAVA
-
-rem "Set Defaults."
-set JAVA_ARGS=-XX:+UseParallelGC -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Xms512M -Xmx1024M
-set ARTEMIS_LOGGING_CONF=file:%ARTEMIS_INSTANCE%\etc\logging.properties
-set ARTEMIS_DATA_DIR=%ARTEMIS_INSTANCE%\data
-set ARTEMIS_LOG_MANAGER=org.jboss.logmanager.LogManager
-
-rem "Load Profile Config"
-call "%ARTEMIS_INSTANCE%\etc\artemis.profile.cmd" %*
-
-rem "Create full JVM Args"
-set JVM_ARGS=%JAVA_ARGS%
-if not "%ARTEMIS_CLUSTER_PROPS%"=="" set JVM_ARGS=%JVM_ARGS% %ARTEMIS_CLUSTER_PROPS%
-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.instance="%ARTEMIS_INSTANCE%"
-set JVM_ARGS=%JVM_ARGS% -Ddata.dir="%ARTEMIS_DATA_DIR%"
-set JVM_ARGS=%JVM_ARGS% -Djava.util.logging.manager="%ARTEMIS_LOG_MANAGER%"
-set JVM_ARGS=%JVM_ARGS% -Dlogging.configuration="%ARTEMIS_LOGGING_CONF%"
-if not "%DEBUG_ARGS%"=="" set JVM_ARGS=%JVM_ARGS% %DEBUG_ARGS%
-
-"%_JAVACMD%" %JVM_ARGS% org.apache.activemq.artemis.boot.Artemis %*
-
-:END
-endlocal
-GOTO :EOF
-
-:EOF

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ea3370b3/artemis-bootstrap/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/artemis-roles.properties
----------------------------------------------------------------------
diff --git a/artemis-bootstrap/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/artemis-roles.properties b/artemis-bootstrap/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/artemis-roles.properties
deleted file mode 100644
index 4e2d44c..0000000
--- a/artemis-bootstrap/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/artemis-roles.properties
+++ /dev/null
@@ -1,17 +0,0 @@
-## ---------------------------------------------------------------------------
-## 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.
-## ---------------------------------------------------------------------------
-guest=guest
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ea3370b3/artemis-bootstrap/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/artemis-users.properties
----------------------------------------------------------------------
diff --git a/artemis-bootstrap/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/artemis-users.properties b/artemis-bootstrap/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/artemis-users.properties
deleted file mode 100644
index 4e2d44c..0000000
--- a/artemis-bootstrap/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/artemis-users.properties
+++ /dev/null
@@ -1,17 +0,0 @@
-## ---------------------------------------------------------------------------
-## 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.
-## ---------------------------------------------------------------------------
-guest=guest
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ea3370b3/artemis-bootstrap/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/artemis.profile
----------------------------------------------------------------------
diff --git a/artemis-bootstrap/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/artemis.profile b/artemis-bootstrap/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/artemis.profile
deleted file mode 100644
index 889a0a9..0000000
--- a/artemis-bootstrap/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/artemis.profile
+++ /dev/null
@@ -1,27 +0,0 @@
-# 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.
-
-ARTEMIS_HOME='${artemis.home}'
-
-# Cluster Properties: Used to pass arguments to ActiveMQ 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"
-
-# Java Opts
-#JAVA_ARGS="-XX:+UseParallelGC -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Xms512M -Xmx1024M"
-
-# Debug args: Uncomment to enable debug
-#DEBUG_ARGS="-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005"

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ea3370b3/artemis-bootstrap/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/artemis.profile.cmd
----------------------------------------------------------------------
diff --git a/artemis-bootstrap/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/artemis.profile.cmd b/artemis-bootstrap/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/artemis.profile.cmd
deleted file mode 100644
index 450ba79..0000000
--- a/artemis-bootstrap/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/artemis.profile.cmd
+++ /dev/null
@@ -1,27 +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.
-
-set ARTEMIS_HOME=${artemis.home}
-
-rem Cluster Properties: Used to pass arguments to ActiveMQ 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 Java Opts
-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

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ea3370b3/artemis-bootstrap/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/bootstrap.xml
----------------------------------------------------------------------
diff --git a/artemis-bootstrap/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/bootstrap.xml b/artemis-bootstrap/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/bootstrap.xml
deleted file mode 100644
index 21d174f..0000000
--- a/artemis-bootstrap/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/bootstrap.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<!--
-  ~ 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.
-  -->
-
-<broker xmlns="http://activemq.org/schema">
-
-   <basic-security
-           users="file:${artemis.instance}/etc/artemis-users.properties"
-           roles="file:${artemis.instance}/etc/artemis-roles.properties"
-           default-user="guest"
-           />
-
-   <server configuration="file:${artemis.instance}/etc/broker.xml"/>
-
-   <web bind="http://localhost:8161" path="web">
-       <app url="jolokia" war="jolokia-war-1.2.3.war"/>
-   </web>
-
-</broker>
-

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ea3370b3/artemis-bootstrap/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/broker.xml
----------------------------------------------------------------------
diff --git a/artemis-bootstrap/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/broker.xml b/artemis-bootstrap/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/broker.xml
deleted file mode 100644
index 35ca9c6..0000000
--- a/artemis-bootstrap/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/broker.xml
+++ /dev/null
@@ -1,81 +0,0 @@
-<?xml version='1.0'?>
-<!--
-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.
--->
-
-<configuration xmlns="urn:activemq"
-               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-               xsi:schemaLocation="urn:activemq /schema/artemis-configuration.xsd">
-   <jms xmlns="urn:activemq:jms">
-      <queue name="DLQ"/>
-      <queue name="ExpiryQueue"/>
-   </jms>
-   <core xmlns="urn:activemq:core">
-      <paging-directory>${data.dir:../data}/paging</paging-directory>
-
-      <bindings-directory>${data.dir:../data}/bindings</bindings-directory>
-
-      <journal-directory>${data.dir:../data}/journal</journal-directory>
-
-      <journal-min-files>10</journal-min-files>
-
-      <large-messages-directory>${data.dir:../data}/large-messages</large-messages-directory>
-
-      <connectors>
-         <!-- Default Connector.  Returned to clients during broadcast and distributed around cluster.  See broadcast and discovery-groups -->
-         <connector name="activemq">tcp://${activemq.remoting.default.host:localhost}:${activemq.remoting.default.port:61616}</connector>
-      </connectors>
-
-      <acceptors>
-         <!-- Default ActiveMQ Acceptor.  Multi-protocol adapter.  Currently supports Core, OpenWire, Stomp and AMQP. -->
-         <acceptor name="activemq">tcp://${activemq.remoting.default.host:localhost}:${activemq.remoting.default.port:61616}</acceptor>
-
-         <!-- AMQP Acceptor.  Listens on default AMQP port for AMQP traffic.-->
-         <acceptor name="amqp">tcp://${activemq.remoting.amqp.host:localhost}:${activemq.remoting.amqp.port:5672}?protocols=AMQP</acceptor>
-
-         <!-- STOMP Acceptor. -->
-         <acceptor name="stomp">tcp://${activemq.remoting.stomp.host:localhost}:${activemq.remoting.stomp.port:61613}?protocols=STOMP</acceptor>
-
-         <!-- HornetQ Compatibility Acceptor.  Enables ActiveMQ Core and STOMP for legacy HornetQ clients. -->
-         <acceptor name="hornetq">tcp://${activemq.remoting.hornetq.host:localhost}:${activemq.remoting.hornetq.port:5445}?protocols=CORE,STOMP</acceptor>
-      </acceptors>
-
-      ${cluster.settings}${replicated.settings}${shared-store.settings}
-
-      <security-settings>
-         <security-setting match="#">
-            <permission type="createNonDurableQueue" roles="guest"/>
-            <permission type="deleteNonDurableQueue" roles="guest"/>
-            <permission type="consume" roles="guest"/>
-            <permission type="send" roles="guest"/>
-         </security-setting>
-      </security-settings>
-
-      <address-settings>
-         <!--default for catch all-->
-         <address-setting match="#">
-            <dead-letter-address>jms.queue.DLQ</dead-letter-address>
-            <expiry-address>jms.queue.ExpiryQueue</expiry-address>
-            <redelivery-delay>0</redelivery-delay>
-            <max-size-bytes>10485760</max-size-bytes>
-            <message-counter-history-day-limit>10</message-counter-history-day-limit>
-            <address-full-policy>BLOCK</address-full-policy>
-         </address-setting>
-      </address-settings>
-   </core>
-</configuration>

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ea3370b3/artemis-bootstrap/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/cluster-settings.txt
----------------------------------------------------------------------
diff --git a/artemis-bootstrap/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/cluster-settings.txt b/artemis-bootstrap/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/cluster-settings.txt
deleted file mode 100644
index 7d9229c..0000000
--- a/artemis-bootstrap/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/cluster-settings.txt
+++ /dev/null
@@ -1,25 +0,0 @@
-
-      <broadcast-groups>
-         <broadcast-group name="bg-group1">
-            <group-address>231.7.7.7</group-address>
-            <group-port>9876</group-port>
-            <broadcast-period>5000</broadcast-period>
-            <connector-ref>activemq</connector-ref>
-         </broadcast-group>
-      </broadcast-groups>
-
-      <discovery-groups>
-         <discovery-group name="dg-group1">
-            <group-address>231.7.7.7</group-address>
-            <group-port>9876</group-port>
-            <refresh-timeout>10000</refresh-timeout>
-         </discovery-group>
-      </discovery-groups>
-
-      <cluster-connections>
-         <cluster-connection name="my-cluster">
-            <address>jms</address>
-            <connector-ref>activemq</connector-ref>
-            <discovery-group-ref discovery-group-name="dg-group1"/>
-         </cluster-connection>
-      </cluster-connections>

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ea3370b3/artemis-bootstrap/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/logging.properties
----------------------------------------------------------------------
diff --git a/artemis-bootstrap/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/logging.properties b/artemis-bootstrap/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/logging.properties
deleted file mode 100644
index 084b74c..0000000
--- a/artemis-bootstrap/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/logging.properties
+++ /dev/null
@@ -1,51 +0,0 @@
-#
-# 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.
-#
-
-# Additional logger names to configure (root logger is always configured)
-# Root logger option
-loggers=org.jboss.logging,org.apache.activemq.artemis.core.server,org.apache.activemq.artemis.utils,org.apache.activemq.artemis.journal,org.apache.activemq.artemis.jms.server,org.apache.activemq.artemis.integration.bootstrap
-
-# Root logger level
-logger.level=INFO
-# ActiveMQ logger levels
-logger.org.apache.activemq.artemis.core.server.level=INFO
-logger.org.apache.activemq.artemis.journal.level=INFO
-logger.org.apache.activemq.artemis.utils.level=INFO
-logger.org.apache.activemq.artemis.jms.level=INFO
-logger.org.apache.activemq.artemis.integration.bootstrap.level=INFO
-# Root logger handlers
-logger.handlers=FILE,CONSOLE
-
-# Console handler configuration
-handler.CONSOLE=org.jboss.logmanager.handlers.ConsoleHandler
-handler.CONSOLE.properties=autoFlush
-handler.CONSOLE.level=DEBUG
-handler.CONSOLE.autoFlush=true
-handler.CONSOLE.formatter=PATTERN
-
-# File handler configuration
-handler.FILE=org.jboss.logmanager.handlers.FileHandler
-handler.FILE.level=DEBUG
-handler.FILE.properties=autoFlush,fileName
-handler.FILE.autoFlush=true
-handler.FILE.fileName=${artemis.instance}/log/activemq.log
-handler.FILE.formatter=PATTERN
-
-# Formatter pattern configuration
-formatter.PATTERN=org.jboss.logmanager.formatters.PatternFormatter
-formatter.PATTERN.properties=pattern
-formatter.PATTERN.pattern=%d{HH:mm:ss,SSS} %-5p [%c] %s%E%n

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ea3370b3/artemis-bootstrap/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/replicated-settings.txt
----------------------------------------------------------------------
diff --git a/artemis-bootstrap/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/replicated-settings.txt b/artemis-bootstrap/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/replicated-settings.txt
deleted file mode 100644
index db9faa0..0000000
--- a/artemis-bootstrap/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/replicated-settings.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-
-      <ha-policy>
-         <replication>
-            <master/>
-         </replication>
-      </ha-policy>

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ea3370b3/artemis-bootstrap/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/shared-store-settings.txt
----------------------------------------------------------------------
diff --git a/artemis-bootstrap/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/shared-store-settings.txt b/artemis-bootstrap/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/shared-store-settings.txt
deleted file mode 100644
index 5901938..0000000
--- a/artemis-bootstrap/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/shared-store-settings.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-
-      <ha-policy>
-         <shared-store>
-            <master/>
-         </shared-store>
-      </ha-policy>

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ea3370b3/artemis-bootstrap/src/test/java/org/apache/activemq/artemis/test/FileBrokerTest.java
----------------------------------------------------------------------
diff --git a/artemis-bootstrap/src/test/java/org/apache/activemq/artemis/test/FileBrokerTest.java b/artemis-bootstrap/src/test/java/org/apache/activemq/artemis/test/FileBrokerTest.java
deleted file mode 100644
index 89eccef..0000000
--- a/artemis-bootstrap/src/test/java/org/apache/activemq/artemis/test/FileBrokerTest.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/**
- * 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.artemis.test;
-
-import org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl;
-import org.apache.activemq.artemis.dto.ServerDTO;
-import org.apache.activemq.artemis.integration.FileBroker;
-import org.apache.activemq.artemis.jms.server.impl.JMSServerManagerImpl;
-import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManagerImpl;
-import org.junit.Assert;
-import org.junit.Test;
-
-public class FileBrokerTest
-{
-   @Test
-   public void startWithJMS() throws Exception
-   {
-      ServerDTO serverDTO = new ServerDTO();
-      serverDTO.configuration = "broker.xml";
-      FileBroker broker = null;
-      try
-      {
-         broker = new FileBroker(serverDTO, new ActiveMQSecurityManagerImpl());
-         broker.start();
-         JMSServerManagerImpl jmsServerManager = (JMSServerManagerImpl) broker.getComponents().get("jms");
-         Assert.assertNotNull(jmsServerManager);
-         Assert.assertTrue(jmsServerManager.isStarted());
-         //this tells us the jms server is activated
-         Assert.assertTrue(jmsServerManager.getJMSStorageManager().isStarted());
-         ActiveMQServerImpl activeMQServer = (ActiveMQServerImpl) broker.getComponents().get("core");
-         Assert.assertNotNull(activeMQServer);
-         Assert.assertTrue(activeMQServer.isStarted());
-         Assert.assertTrue(broker.isStarted());
-      }
-      finally
-      {
-         if (broker != null)
-         {
-            broker.stop();
-         }
-      }
-   }
-
-   @Test
-   public void startWithoutJMS() throws Exception
-   {
-      ServerDTO serverDTO = new ServerDTO();
-      serverDTO.configuration = "activemq-configuration-nojms.xml";
-      FileBroker broker = null;
-      try
-      {
-         broker = new FileBroker(serverDTO, new ActiveMQSecurityManagerImpl());
-         broker.start();
-         JMSServerManagerImpl jmsServerManager = (JMSServerManagerImpl) broker.getComponents().get("jms");
-         Assert.assertNull(jmsServerManager);
-         ActiveMQServerImpl activeMQServer = (ActiveMQServerImpl) broker.getComponents().get("core");
-         Assert.assertNotNull(activeMQServer);
-         Assert.assertTrue(activeMQServer.isStarted());
-         Assert.assertTrue(broker.isStarted());
-      }
-      finally
-      {
-         assert broker != null;
-         broker.stop();
-      }
-   }
-}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ea3370b3/artemis-bootstrap/src/test/resources/activemq-configuration-nojms.xml
----------------------------------------------------------------------
diff --git a/artemis-bootstrap/src/test/resources/activemq-configuration-nojms.xml b/artemis-bootstrap/src/test/resources/activemq-configuration-nojms.xml
deleted file mode 100644
index c4cbd62..0000000
--- a/artemis-bootstrap/src/test/resources/activemq-configuration-nojms.xml
+++ /dev/null
@@ -1,73 +0,0 @@
-<?xml version='1.0'?>
-<!--
-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.
--->
-
-<configuration xmlns="urn:activemq">
-   <core xmlns="urn:activemq:core">
-      <paging-directory>${data.dir:../data}/paging</paging-directory>
-
-      <bindings-directory>${data.dir:../data}/bindings</bindings-directory>
-
-      <journal-directory>${data.dir:../data}/journal</journal-directory>
-
-      <journal-min-files>10</journal-min-files>
-
-      <large-messages-directory>${data.dir:../data}/large-messages</large-messages-directory>
-
-      <connectors>
-         <!-- Default Connector.  Returned to clients during broadcast and distributed around cluster.  See broadcast and discovery-groups -->
-         <connector name="activemq">tcp://${activemq.remoting.default.host:localhost}:${activemq.remoting.default.port:61616}</connector>
-      </connectors>
-
-      <acceptors>
-         <!-- Default ActiveMQ Acceptor.  Multi-protocol adapter.  Currently supports Core, OpenWire, Stomp and AMQP. -->
-         <acceptor name="activemq">tcp://${activemq.remoting.default.host:localhost}:${activemq.remoting.default.port:61616}</acceptor>
-
-         <!-- AMQP Acceptor.  Listens on default AMQP port for AMQP traffic.-->
-         <acceptor name="amqp">tcp://${activemq.remoting.amqp.host:localhost}:${activemq.remoting.amqp.port:5672}?protocols=AMQP</acceptor>
-
-         <!-- STOMP Acceptor. -->
-         <acceptor name="stomp">tcp://${activemq.remoting.stomp.host:localhost}:${activemq.remoting.stomp.port:61613}?protocols=STOMP</acceptor>
-
-         <!-- HornetQ Compatibility Acceptor.  Enables ActiveMQ Core and STOMP for legacy HornetQ clients. -->
-         <acceptor name="hornetq">tcp://${activemq.remoting.hornetq.host:localhost}:${activemq.remoting.hornetq.port:5445}?protocols=CORE,STOMP</acceptor>
-      </acceptors>
-
-      <security-settings>
-         <security-setting match="#">
-            <permission type="createNonDurableQueue" roles="guest"/>
-            <permission type="deleteNonDurableQueue" roles="guest"/>
-            <permission type="consume" roles="guest"/>
-            <permission type="send" roles="guest"/>
-         </security-setting>
-      </security-settings>
-
-      <address-settings>
-         <!--default for catch all-->
-         <address-setting match="#">
-            <dead-letter-address>jms.queue.DLQ</dead-letter-address>
-            <expiry-address>jms.queue.ExpiryQueue</expiry-address>
-            <redelivery-delay>0</redelivery-delay>
-            <max-size-bytes>10485760</max-size-bytes>
-            <message-counter-history-day-limit>10</message-counter-history-day-limit>
-            <address-full-policy>BLOCK</address-full-policy>
-         </address-setting>
-      </address-settings>
-   </core>
-</configuration>

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ea3370b3/artemis-bootstrap/src/test/resources/broker.xml
----------------------------------------------------------------------
diff --git a/artemis-bootstrap/src/test/resources/broker.xml b/artemis-bootstrap/src/test/resources/broker.xml
deleted file mode 100644
index 219c0b2..0000000
--- a/artemis-bootstrap/src/test/resources/broker.xml
+++ /dev/null
@@ -1,77 +0,0 @@
-<?xml version='1.0'?>
-<!--
-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.
--->
-
-<configuration xmlns="urn:activemq">
-   <jms xmlns="urn:activemq:jms">
-      <queue name="DLQ"/>
-      <queue name="ExpiryQueue"/>
-   </jms>
-   <core xmlns="urn:activemq:core">
-      <paging-directory>${data.dir:../data}/paging</paging-directory>
-
-      <bindings-directory>${data.dir:../data}/bindings</bindings-directory>
-
-      <journal-directory>${data.dir:../data}/journal</journal-directory>
-
-      <journal-min-files>10</journal-min-files>
-
-      <large-messages-directory>${data.dir:../data}/large-messages</large-messages-directory>
-
-      <connectors>
-         <!-- Default Connector.  Returned to clients during broadcast and distributed around cluster.  See broadcast and discovery-groups -->
-         <connector name="activemq">tcp://${activemq.remoting.default.host:localhost}:${activemq.remoting.default.port:61616}</connector>
-      </connectors>
-
-      <acceptors>
-         <!-- Default ActiveMQ Acceptor.  Multi-protocol adapter.  Currently supports Core, OpenWire, Stomp and AMQP. -->
-         <acceptor name="activemq">tcp://${activemq.remoting.default.host:localhost}:${activemq.remoting.default.port:61616}</acceptor>
-
-         <!-- AMQP Acceptor.  Listens on default AMQP port for AMQP traffic.-->
-         <acceptor name="amqp">tcp://${activemq.remoting.amqp.host:localhost}:${activemq.remoting.amqp.port:5672}?protocols=AMQP</acceptor>
-
-         <!-- STOMP Acceptor. -->
-         <acceptor name="stomp">tcp://${activemq.remoting.stomp.host:localhost}:${activemq.remoting.stomp.port:61613}?protocols=STOMP</acceptor>
-
-         <!-- HornetQ Compatibility Acceptor.  Enables ActiveMQ Core and STOMP for legacy HornetQ clients. -->
-         <acceptor name="hornetq">tcp://${activemq.remoting.hornetq.host:localhost}:${activemq.remoting.hornetq.port:5445}?protocols=CORE,STOMP</acceptor>
-      </acceptors>
-
-      <security-settings>
-         <security-setting match="#">
-            <permission type="createNonDurableQueue" roles="guest"/>
-            <permission type="deleteNonDurableQueue" roles="guest"/>
-            <permission type="consume" roles="guest"/>
-            <permission type="send" roles="guest"/>
-         </security-setting>
-      </security-settings>
-
-      <address-settings>
-         <!--default for catch all-->
-         <address-setting match="#">
-            <dead-letter-address>jms.queue.DLQ</dead-letter-address>
-            <expiry-address>jms.queue.ExpiryQueue</expiry-address>
-            <redelivery-delay>0</redelivery-delay>
-            <max-size-bytes>10485760</max-size-bytes>
-            <message-counter-history-day-limit>10</message-counter-history-day-limit>
-            <address-full-policy>BLOCK</address-full-policy>
-         </address-setting>
-      </address-settings>
-   </core>
-</configuration>

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ea3370b3/artemis-cli/pom.xml
----------------------------------------------------------------------
diff --git a/artemis-cli/pom.xml b/artemis-cli/pom.xml
new file mode 100644
index 0000000..b8ce69f
--- /dev/null
+++ b/artemis-cli/pom.xml
@@ -0,0 +1,146 @@
+<!--
+  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>artemis-pom</artifactId>
+      <version>1.0.0-SNAPSHOT</version>
+   </parent>
+
+   <artifactId>artemis-cli</artifactId>
+   <packaging>jar</packaging>
+   <name>ActiveMQ Artemis Bootstrap</name>
+
+   <properties>
+      <activemq.basedir>${project.basedir}/..</activemq.basedir>
+   </properties>
+
+   <dependencies>
+      <dependency>
+         <groupId>org.apache.activemq</groupId>
+         <artifactId>artemis-server</artifactId>
+         <version>${project.version}</version>
+      </dependency>
+      <dependency>
+         <groupId>org.apache.activemq</groupId>
+         <artifactId>artemis-jms-server</artifactId>
+         <version>${project.version}</version>
+      </dependency>
+      <dependency>
+         <groupId>org.apache.activemq</groupId>
+         <artifactId>artemis-dto</artifactId>
+         <version>${project.version}</version>
+      </dependency>
+      <dependency>
+         <groupId>org.jboss.logging</groupId>
+         <artifactId>jboss-logging-processor</artifactId>
+         <scope>provided</scope>
+         <optional>true</optional>
+      </dependency>
+      <dependency>
+         <groupId>org.jboss.logging</groupId>
+         <artifactId>jboss-logging</artifactId>
+      </dependency>
+      <dependency>
+         <groupId>io.airlift</groupId>
+         <artifactId>airline</artifactId>
+      </dependency>
+      <dependency>
+        <groupId>com.sun.winsw</groupId>
+        <artifactId>winsw</artifactId>
+        <version>1.9</version>
+        <classifier>bin</classifier>
+        <type>exe</type>
+        <scope>test</scope>
+      </dependency>
+      <dependency>
+         <groupId>junit</groupId>
+         <artifactId>junit</artifactId>
+         <scope>test</scope>
+      </dependency>
+      <dependency>
+         <groupId>org.apache.activemq</groupId>
+         <artifactId>artemis-amqp-protocol</artifactId>
+         <version>${project.version}</version>
+         <scope>test</scope>
+      </dependency>
+      <dependency>
+         <groupId>org.apache.activemq</groupId>
+         <artifactId>artemis-stomp-protocol</artifactId>
+         <version>${project.version}</version>
+         <scope>test</scope>
+      </dependency>
+      <dependency>
+         <groupId>org.apache.activemq</groupId>
+         <artifactId>artemis-openwire-protocol</artifactId>
+         <version>${project.version}</version>
+         <scope>test</scope>
+      </dependency>
+   </dependencies>
+
+   <build>
+     <resources>
+       <resource>
+         <directory>${project.basedir}/src/main/resources</directory>
+         <includes>
+           <include>**/*</include>
+         </includes>
+       </resource>
+       <resource>
+         <directory>${project.basedir}/src/main/filtered-resources</directory>
+         <filtering>true</filtering>
+         <includes>
+           <include>**/*</include>
+         </includes>
+       </resource>
+     </resources>
+
+     <plugins>
+       <plugin>
+         <groupId>org.apache.maven.plugins</groupId>
+         <artifactId>maven-dependency-plugin</artifactId>
+         <version>2.2</version>
+         <executions>
+           <execution>
+             <id>unpack</id>
+             <phase>process-resources</phase>
+             <goals>
+               <goal>copy</goal>
+             </goals>
+             <configuration>
+               <artifactItems>
+                 <artifactItem>
+                   <groupId>com.sun.winsw</groupId>
+                   <artifactId>winsw</artifactId>
+                   <version>1.9</version>
+                   <classifier>bin</classifier>
+                   <type>exe</type>
+                   <outputDirectory>${basedir}/target/classes/org/apache/activemq/cli/commands/bin</outputDirectory>
+                   <destFileName>activemq-service.exe</destFileName>
+                 </artifactItem>
+               </artifactItems>
+             </configuration>
+           </execution>
+         </executions>
+       </plugin>
+     </plugins>
+   </build>
+
+
+</project>

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ea3370b3/artemis-cli/src/main/filtered-resources/org/apache/activemq/artemis/cli/banner.txt
----------------------------------------------------------------------
diff --git a/artemis-cli/src/main/filtered-resources/org/apache/activemq/artemis/cli/banner.txt b/artemis-cli/src/main/filtered-resources/org/apache/activemq/artemis/cli/banner.txt
new file mode 100644
index 0000000..7b6aade
--- /dev/null
+++ b/artemis-cli/src/main/filtered-resources/org/apache/activemq/artemis/cli/banner.txt
@@ -0,0 +1,8 @@
+     _        _               _
+    / \  ____| |_  ___ __  __(_) _____
+   / _ \|  _ \ __|/ _ \  \/  | |/  __/
+  / ___ \ | \/ |_/  __/ |\/| | |\___ \
+ /_/   \_\|   \__\____|_|  |_|_|/___ /
+ Apache ActiveMQ Artemis ${project.version}
+
+

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ea3370b3/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/Artemis.java
----------------------------------------------------------------------
diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/Artemis.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/Artemis.java
new file mode 100644
index 0000000..3271aa6
--- /dev/null
+++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/Artemis.java
@@ -0,0 +1,102 @@
+/**
+ * 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.artemis.cli;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import io.airlift.command.Cli;
+import io.airlift.command.ParseArgumentsUnexpectedException;
+import org.apache.activemq.artemis.cli.commands.Action;
+import org.apache.activemq.artemis.cli.commands.ActionContext;
+import org.apache.activemq.artemis.cli.commands.Create;
+import org.apache.activemq.artemis.cli.commands.HelpAction;
+import org.apache.activemq.artemis.cli.commands.Run;
+import org.apache.activemq.artemis.cli.commands.Stop;
+import org.apache.activemq.artemis.cli.commands.tools.DecodeJournal;
+import org.apache.activemq.artemis.cli.commands.tools.EncodeJournal;
+import org.apache.activemq.artemis.cli.commands.tools.HelpData;
+import org.apache.activemq.artemis.cli.commands.tools.PrintData;
+import org.apache.activemq.artemis.cli.commands.tools.XmlDataExporter;
+import org.apache.activemq.artemis.cli.commands.tools.XmlDataImporter;
+
+public class Artemis
+{
+
+   public static void main(String[] args) throws Exception
+   {
+      String instance = System.getProperty("artemis.instance");
+      Cli.CliBuilder<Action> builder = Cli.<Action>builder("artemis")
+         .withDescription("ActiveMQ Artemis Command Line")
+         .withCommand(HelpAction.class)
+         .withDefaultCommand(HelpAction.class);
+
+
+      builder.withGroup("data").withDescription("data tools group (print|exp|imp|exp|encode|decode) (example ./artemis data print)").
+              withDefaultCommand(HelpData.class).withCommands(PrintData.class, XmlDataExporter.class, XmlDataImporter.class,
+                                                               DecodeJournal.class, EncodeJournal.class);
+
+      if (instance != null)
+      {
+         builder = builder
+            .withCommands(Run.class, Stop.class);
+      }
+      else
+      {
+         builder = builder
+            .withCommand(Create.class);
+      }
+
+
+      Cli<Action> parser = builder.build();
+      try
+      {
+         parser.parse(args).execute(ActionContext.system());
+      }
+      catch (ParseArgumentsUnexpectedException e)
+      {
+         System.err.println(e.getMessage());
+         System.out.println();
+         parser.parse("help").execute(ActionContext.system());
+      }
+      catch (ConfigurationException configException)
+      {
+         System.err.println(configException.getMessage());
+         System.out.println();
+         System.out.println("Configuration should be specified as 'scheme:location'. Default configuration is 'xml:${ARTEMIS_INSTANCE}/etc/bootstrap.xml'");
+      }
+
+   }
+
+   public static void printBanner() throws Exception
+   {
+      copy(Artemis.class.getResourceAsStream("banner.txt"), System.out);
+   }
+
+   private static long copy(InputStream in, OutputStream out) throws Exception
+   {
+      byte[] buffer = new byte[1024];
+      int len = in.read(buffer);
+      while (len != -1)
+      {
+         out.write(buffer, 0, len);
+         len = in.read(buffer);
+      }
+      return len;
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ea3370b3/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/ConfigurationException.java
----------------------------------------------------------------------
diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/ConfigurationException.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/ConfigurationException.java
new file mode 100644
index 0000000..2e8f9d9
--- /dev/null
+++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/ConfigurationException.java
@@ -0,0 +1,25 @@
+/**
+ * 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.artemis.cli;
+
+public class ConfigurationException extends Exception
+{
+   public ConfigurationException(String message)
+   {
+      super(message);
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ea3370b3/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Action.java
----------------------------------------------------------------------
diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Action.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Action.java
new file mode 100644
index 0000000..f2f0426
--- /dev/null
+++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Action.java
@@ -0,0 +1,24 @@
+/**
+ * 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.artemis.cli.commands;
+
+public interface Action
+{
+
+   Object execute(ActionContext context) throws Exception;
+
+}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ea3370b3/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/ActionContext.java
----------------------------------------------------------------------
diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/ActionContext.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/ActionContext.java
new file mode 100644
index 0000000..a7ac12a
--- /dev/null
+++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/ActionContext.java
@@ -0,0 +1,41 @@
+/**
+ * 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.artemis.cli.commands;
+
+import java.io.InputStream;
+import java.io.PrintStream;
+
+public class ActionContext
+{
+
+   public ActionContext(InputStream in, PrintStream out, PrintStream err)
+   {
+      this.in = in;
+      this.out = out;
+      this.err = err;
+   }
+
+   InputStream in;
+   PrintStream out;
+   PrintStream err;
+
+   public static ActionContext system()
+   {
+      return new ActionContext(System.in, System.out, System.err);
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ea3370b3/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java
----------------------------------------------------------------------
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
new file mode 100644
index 0000000..be1d03a
--- /dev/null
+++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java
@@ -0,0 +1,368 @@
+package org.apache.activemq.artemis.cli.commands;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.nio.file.Files;
+import java.nio.file.attribute.PosixFilePermission;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import io.airlift.command.Arguments;
+import io.airlift.command.Command;
+import io.airlift.command.Option;
+
+import static java.nio.file.attribute.PosixFilePermission.GROUP_EXECUTE;
+import static java.nio.file.attribute.PosixFilePermission.GROUP_READ;
+import static java.nio.file.attribute.PosixFilePermission.GROUP_WRITE;
+import static java.nio.file.attribute.PosixFilePermission.OTHERS_EXECUTE;
+import static java.nio.file.attribute.PosixFilePermission.OTHERS_READ;
+import static java.nio.file.attribute.PosixFilePermission.OWNER_EXECUTE;
+import static java.nio.file.attribute.PosixFilePermission.OWNER_READ;
+import static java.nio.file.attribute.PosixFilePermission.OWNER_WRITE;
+
+/**
+ * CLI action that creates a broker instance directory.
+ */
+@Command(name = "create", description = "creates a new broker instance")
+public class Create implements Action
+{
+   @Arguments(description = "The instance directory to hold the broker's configuration and data", required = true)
+   File directory;
+
+   @Option(name = "--host", description = "The host name of the broker")
+   String host;
+
+   @Option(name = "--force", description = "Overwrite configuration at destination directory")
+   boolean force;
+
+   @Option(name = "--home", description = "Directory where ActiveMQ Artemis is installed")
+   File home;
+
+   @Option(name = "--with-ssl", description = "Generate an SSL enabled configuration")
+   boolean with_ssl = true;
+
+   @Option(name = "--clustered", description = "Enable clustering")
+   boolean clustered = false;
+
+   @Option(name = "--replicated", description = "Enable broker replication")
+   boolean replicated = false;
+
+   @Option(name = "--shared-store", description = "Enable broker shared store")
+   boolean sharedStore = false;
+
+   @Option(name = "--encoding", description = "The encoding that text files should use")
+   String encoding = "UTF-8";
+
+   ActionContext context;
+   boolean IS_WINDOWS;
+   boolean IS_CYGWIN;
+
+   @Override
+   public Object execute(ActionContext context) throws Exception
+   {
+      try
+      {
+         return run(context);
+      }
+      catch (Throwable e)
+      {
+         e.printStackTrace(context.err);
+         return e;
+      }
+   }
+
+   public Object run(ActionContext context) throws Exception
+   {
+      this.context = context;
+      IS_WINDOWS = System.getProperty("os.name").toLowerCase().trim().startsWith("win");
+      IS_CYGWIN = IS_WINDOWS && System.getenv("OSTYPE") == "cygwin";
+
+      if (clustered & sharedStore)
+      {
+
+      }
+
+      context.out.println(String.format("Creating ActiveMQ Artemis instance at: %s", directory.getCanonicalPath()));
+      if (host == null)
+      {
+         host = directory.getName();
+      }
+
+      HashMap<String, String> filters = new HashMap<String, String>();
+      String replicatedSettings = "";
+      if (replicated)
+      {
+         clustered = true;
+         replicatedSettings = readTextFile("etc/replicated-settings.txt");
+      }
+      filters.put("${replicated.settings}", replicatedSettings);
+
+      String sharedStoreSettings = "";
+      if (sharedStore)
+      {
+         clustered = true;
+         sharedStoreSettings = readTextFile("etc/shared-store-settings.txt");
+      }
+      filters.put("${hared-store.settings}", sharedStoreSettings);
+
+      String clusterSettings = "";
+      if (clustered)
+      {
+         clusterSettings = readTextFile("etc/cluster-settings.txt");
+      }
+      filters.put("${cluster.settings}", clusterSettings);
+
+
+      filters.put("${user}", System.getProperty("user.name", ""));
+      filters.put("${host}", host);
+      if (home != null)
+      {
+         filters.put("${home}", path(home, false));
+      }
+      filters.put("${artemis.home}", path(System.getProperty("artemis.home"), false));
+      filters.put("${artemis.instance}", path(directory, false));
+      filters.put("${java.home}", path(System.getProperty("java.home"), false));
+
+      new File(directory, "bin").mkdirs();
+      new File(directory, "etc").mkdirs();
+      new File(directory, "log").mkdirs();
+      new File(directory, "tmp").mkdirs();
+      new File(directory, "data").mkdirs();
+
+
+      if (IS_WINDOWS)
+      {
+         write("bin/artemis.cmd", null, false);
+         write("bin/artemis-service.exe");
+         write("bin/artemis-service.xml", filters, false);
+         write("etc/artemis.profile.cmd", filters, false);
+      }
+
+      if (!IS_WINDOWS || IS_CYGWIN)
+      {
+         write("bin/artemis", null, true);
+         makeExec("bin/artemis");
+         write("bin/artemis-service", null, true);
+         makeExec("bin/artemis-service");
+         write("etc/artemis.profile", filters, true);
+         makeExec("etc/artemis.profile");
+      }
+
+      write("etc/logging.properties", null, false);
+      write("etc/bootstrap.xml", null, false);
+      write("etc/broker.xml", filters, false);
+      write("etc/artemis-roles.properties", null, false);
+      write("etc/artemis-users.properties", null, false);
+
+      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)));
+
+      File service = new File(directory, "bin/artemis-service");
+      context.out.println("");
+
+      if (!IS_WINDOWS || IS_CYGWIN)
+      {
+
+         // Does it look like we are on a System V init system?
+         if (new File("/etc/init.d/").isDirectory())
+         {
+            context.out.println("Or you can setup the broker as system service and run it in the background:");
+            context.out.println("");
+            context.out.println("   sudo ln -s \"%s\" /etc/init.d/".format(service.getCanonicalPath()));
+            context.out.println("   /etc/init.d/artemis-service start");
+            context.out.println("");
+
+         }
+         else
+         {
+
+            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("");
+         }
+
+      }
+      if (IS_WINDOWS)
+      {
+
+         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("");
+
+      }
+
+      return null;
+   }
+
+   private void makeExec(String path) throws IOException
+   {
+      try
+      {
+         File file = new File(directory, path);
+         Files.setPosixFilePermissions(file.toPath(), new HashSet<PosixFilePermission>(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
+   {
+      return path(new File(value), unixPaths);
+   }
+
+   private String path(File value, boolean unixPaths) throws IOException
+   {
+      if (unixPaths && IS_CYGWIN)
+      {
+//        import scala.sys.process._
+//        Seq("cygpath", value.getCanonicalPath).!!.trim
+         return value.getCanonicalPath();
+      }
+      else
+      {
+         return value.getCanonicalPath();
+      }
+   }
+
+   private void write(String source, HashMap<String, String> filters, boolean unixTarget) throws IOException
+   {
+      write(source, new File(directory, source), filters, unixTarget);
+   }
+
+   private void write(String source, File target, HashMap<String, String> filters, boolean unixTarget) throws IOException
+   {
+      if (target.exists() && !force)
+      {
+         throw new RuntimeException(String.format("The file '%s' already exists.  Use --force to overwrite.", target));
+      }
+
+      String content = readTextFile(source);
+
+      if (filters != null)
+      {
+         for (Map.Entry<String, String> entry : filters.entrySet())
+         {
+            content = replace(content, entry.getKey(), entry.getValue());
+         }
+      }
+
+      // and then writing out in the new target encoding..  Let's also replace \n with the values
+      // that is correct for the current platform.
+      String separator = unixTarget && IS_CYGWIN ? "\n" : System.getProperty("line.separator");
+      content = content.replaceAll("\\r?\\n", Matcher.quoteReplacement(separator));
+      ByteArrayInputStream in = new ByteArrayInputStream(content.getBytes(encoding));
+
+      try (FileOutputStream fout = new FileOutputStream(target))
+      {
+         copy(in, fout);
+      }
+   }
+
+   private String readTextFile(String source) throws IOException
+   {
+      ByteArrayOutputStream out = new ByteArrayOutputStream();
+      try (InputStream in = this.getClass().getResourceAsStream(source))
+      {
+         copy(in, out);
+      }
+      return new String(out.toByteArray(), "UTF-8");
+   }
+
+   private void write(String source) throws IOException
+   {
+      File target = new File(directory, source);
+      if (target.exists() && !force)
+      {
+         throw new RuntimeException(String.format("The file '%s' already exists.  Use --force to overwrite.", target));
+      }
+      try (FileOutputStream fout = new FileOutputStream(target))
+      {
+         try (InputStream in = this.getClass().getResourceAsStream(source))
+         {
+            copy(in, fout);
+         }
+      }
+   }
+
+   private boolean canLoad(String name)
+   {
+      try
+      {
+         this.getClass().getClassLoader().loadClass(name);
+         return true;
+      }
+      catch (Throwable e)
+      {
+         return false;
+      }
+   }
+
+   private String replace(String content, String key, String value)
+   {
+      return content.replaceAll(Pattern.quote(key), Matcher.quoteReplacement(value));
+   }
+
+   private int system(File wd, String... command) throws IOException, InterruptedException
+   {
+      Process process = Runtime.getRuntime().exec(command, null, wd);
+      process.getOutputStream().close();
+      drain(command[0], process.getInputStream(), context.out);
+      drain(command[0], process.getErrorStream(), context.err);
+      process.waitFor();
+      return process.exitValue();
+   }
+
+   private void drain(String threadName, final InputStream is, final OutputStream os)
+   {
+      new Thread(threadName)
+      {
+         {
+            setDaemon(true);
+         }
+
+         @Override
+         public void run()
+         {
+            try
+            {
+               copy(is, os);
+            }
+            catch (Throwable e)
+            {
+            }
+         }
+      }.start();
+   }
+
+   private void copy(InputStream is, OutputStream os) throws IOException
+   {
+      byte[] buffer = new byte[1024 * 4];
+      int c = is.read(buffer);
+      while (c >= 0)
+      {
+         os.write(buffer, 0, c);
+         c = is.read(buffer);
+      }
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ea3370b3/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/HelpAction.java
----------------------------------------------------------------------
diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/HelpAction.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/HelpAction.java
new file mode 100644
index 0000000..a5d467c
--- /dev/null
+++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/HelpAction.java
@@ -0,0 +1,30 @@
+/**
+ * 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.artemis.cli.commands;
+
+import io.airlift.command.Help;
+
+public class HelpAction extends Help implements Action
+{
+
+   @Override
+   public Object execute(ActionContext context) throws Exception
+   {
+      super.run();
+      return null;
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ea3370b3/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Run.java
----------------------------------------------------------------------
diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Run.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Run.java
new file mode 100644
index 0000000..360ed3b
--- /dev/null
+++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Run.java
@@ -0,0 +1,152 @@
+/**
+ * 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.artemis.cli.commands;
+
+import io.airlift.command.Arguments;
+import io.airlift.command.Command;
+
+import org.apache.activemq.artemis.cli.Artemis;
+import org.apache.activemq.artemis.components.ExternalComponent;
+import org.apache.activemq.artemis.core.server.ActiveMQComponent;
+import org.apache.activemq.artemis.dto.BrokerDTO;
+import org.apache.activemq.artemis.dto.ComponentDTO;
+import org.apache.activemq.artemis.factory.BrokerFactory;
+import org.apache.activemq.artemis.factory.SecurityManagerFactory;
+import org.apache.activemq.artemis.integration.Broker;
+import org.apache.activemq.artemis.integration.bootstrap.ActiveMQBootstrapLogger;
+import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManager;
+
+import java.io.File;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Timer;
+import java.util.TimerTask;
+
+@Command(name = "run", description = "runs the broker instance")
+public class Run implements Action
+{
+
+   @Arguments(description = "Broker Configuration URI, default 'xml:${ARTEMIS_INSTANCE}/etc/bootstrap.xml'")
+   String configuration;
+   private ArrayList<ActiveMQComponent> components = new ArrayList<>();
+
+   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
+   {
+
+      Artemis.printBanner();
+
+      /* We use File URI for locating files.  The ARTEMIS_HOME variable is used to determine file paths.  For Windows
+      the ARTEMIS_HOME variable will include back slashes (An invalid file URI character path separator).  For this
+      reason we overwrite the ARTEMIS_HOME variable with backslashes replaced with forward slashes. */
+      String activemqInstance = System.getProperty("artemis.instance").replace("\\", "/");
+      System.setProperty("artemis.instance", activemqInstance);
+
+      if (configuration == null)
+      {
+         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.
+      System.out.println("Loading configuration file: " + configuration);
+
+      BrokerDTO broker = BrokerFactory.createBrokerConfiguration(configuration);
+
+      String fileName = new URI(fixupFileURI(broker.server.configuration)).getSchemeSpecificPart();
+
+      addShutdownHook(new File(fileName).getParentFile());
+
+      ActiveMQSecurityManager security = SecurityManagerFactory.create(broker.security);
+
+      server = BrokerFactory.createServer(broker.server, security);
+
+      server.start();
+
+      if (broker.web != null)
+      {
+         broker.components.add(broker.web);
+      }
+
+      for (ComponentDTO componentDTO : broker.components)
+      {
+         Class clazz = this.getClass().getClassLoader().loadClass(componentDTO.componentClassName);
+         ExternalComponent component = (ExternalComponent)clazz.newInstance();
+         component.configure(componentDTO, activemqInstance);
+         component.start();
+         components.add(component);
+      }
+
+      return null;
+   }
+
+   /**
+    * Add a simple shutdown hook to stop the server.
+    * @param configurationDir
+    */
+   private void addShutdownHook(File configurationDir)
+   {
+      final File file = new File(configurationDir,"STOP_ME");
+      if (file.exists())
+      {
+         if (!file.delete())
+         {
+            ActiveMQBootstrapLogger.LOGGER.errorDeletingFile(file.getAbsolutePath());
+         }
+      }
+      final Timer timer = new Timer("ActiveMQ Artemis Server Shutdown Timer", true);
+      timer.scheduleAtFixedRate(new TimerTask()
+      {
+         @Override
+         public void run()
+         {
+            if (file.exists())
+            {
+               try
+               {
+                  try
+                  {
+                     //TODO stop components
+                     server.stop();
+                  }
+                  catch (Exception e)
+                  {
+                     e.printStackTrace();
+                  }
+                  timer.cancel();
+               }
+               finally
+               {
+                  Runtime.getRuntime().exit(0);
+               }
+            }
+         }
+      }, 500, 500);
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ea3370b3/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Stop.java
----------------------------------------------------------------------
diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Stop.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Stop.java
new file mode 100644
index 0000000..90cddb3
--- /dev/null
+++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Stop.java
@@ -0,0 +1,62 @@
+/**
+ * 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.artemis.cli.commands;
+
+import io.airlift.command.Arguments;
+import io.airlift.command.Command;
+import org.apache.activemq.artemis.dto.BrokerDTO;
+import org.apache.activemq.artemis.factory.BrokerFactory;
+
+import java.io.File;
+import java.net.URI;
+
+@Command(name = "stop", description = "stops the broker instance")
+public class Stop implements Action
+{
+   @Arguments(description = "Broker Configuration URI, default 'xml:${ARTEMIS_INSTANCE}/etc/bootstrap.xml'")
+   String configuration;
+
+   @Override
+   public Object execute(ActionContext context) throws Exception
+   {
+      /* We use File URI for locating files.  The ARTEMIS_HOME variable is used to determine file paths.  For Windows
+      the ARTEMIS_HOME variable will include back slashes (An invalid file URI character path separator).  For this
+      reason we overwrite the ARTEMIS_HOME variable with backslashes replaced with forward slashes. */
+      String activemqHome = System.getProperty("artemis.instance").replace("\\", "/");
+      System.setProperty("artemis.instance", activemqHome);
+
+      if (configuration == null)
+      {
+         configuration = "xml:" + activemqHome + "/etc/bootstrap.xml";
+      }
+
+      // To support Windows paths as explained above.
+      configuration = configuration.replace("\\", "/");
+
+      BrokerDTO broker = BrokerFactory.createBrokerConfiguration(configuration);
+
+      String fileName = new URI(broker.server.configuration).getSchemeSpecificPart();
+
+      File file = new File(fileName).getParentFile();
+
+      File stopFile = new File(file, "STOP_ME");
+
+      stopFile.createNewFile();
+
+      return null;
+   }
+}


Mime
View raw message