You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ch...@apache.org on 2011/06/02 17:53:19 UTC

svn commit: r1130615 - in /activemq/activemq-apollo/trunk/apollo-cli: pom.xml src/main/resources/org/apache/activemq/apollo/cli/commands/bin/apollo-broker-service.xml src/main/scala/org/apache/activemq/apollo/cli/commands/Create.scala

Author: chirino
Date: Thu Jun  2 15:53:19 2011
New Revision: 1130615

URL: http://svn.apache.org/viewvc?rev=1130615&view=rev
Log:
Fixes https://issues.apache.org/jira/browse/APLO-35 : Support installing as a background windows service

Added:
    activemq/activemq-apollo/trunk/apollo-cli/src/main/resources/org/apache/activemq/apollo/cli/commands/bin/apollo-broker-service.xml
Modified:
    activemq/activemq-apollo/trunk/apollo-cli/pom.xml
    activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/commands/Create.scala

Modified: activemq/activemq-apollo/trunk/apollo-cli/pom.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-cli/pom.xml?rev=1130615&r1=1130614&r2=1130615&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-cli/pom.xml (original)
+++ activemq/activemq-apollo/trunk/apollo-cli/pom.xml Thu Jun  2 15:53:19 2011
@@ -27,7 +27,7 @@
   <groupId>org.apache.activemq</groupId>
   <artifactId>apollo-cli</artifactId>
   <version>1.0-SNAPSHOT</version>
-  <packaging>bundle</packaging>
+  <packaging>jar</packaging>
 
   <name>${project.artifactId}</name>
 
@@ -78,6 +78,15 @@
       <version>${jasypt-version}</version>
     </dependency>
 
+    <dependency>
+      <groupId>com.sun.winsw</groupId>
+      <artifactId>winsw</artifactId>
+      <version>1.8</version>
+      <classifier>bin</classifier>
+      <type>exe</type>
+      <scope>test</scope>
+    </dependency>
+    
     <!-- Testing Dependencies -->
     <dependency>
       <groupId>org.scalatest</groupId>
@@ -153,6 +162,35 @@
     </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.8</version>
+                  <classifier>bin</classifier>
+                  <type>exe</type>
+                  <outputDirectory>${basedir}/target/classes/org/apache/activemq/apollo/cli/commands/bin</outputDirectory>
+                  <destFileName>apollo-broker-service.exe</destFileName>
+                </artifactItem>
+              </artifactItems>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+            
       <plugin>
         <groupId>org.codehaus.mojo</groupId>
         <artifactId>exec-maven-plugin</artifactId>

Added: activemq/activemq-apollo/trunk/apollo-cli/src/main/resources/org/apache/activemq/apollo/cli/commands/bin/apollo-broker-service.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-cli/src/main/resources/org/apache/activemq/apollo/cli/commands/bin/apollo-broker-service.xml?rev=1130615&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-cli/src/main/resources/org/apache/activemq/apollo/cli/commands/bin/apollo-broker-service.xml (added)
+++ activemq/activemq-apollo/trunk/apollo-cli/src/main/resources/org/apache/activemq/apollo/cli/commands/bin/apollo-broker-service.xml Thu Jun  2 15:53:19 2011
@@ -0,0 +1,24 @@
+<service>
+  <id>org.apache.activemq.apollo.${host}</id>
+  <name>Apollo: ${host}</name>
+  <description>Apache Apollo is a reliable messaging broker</description>
+
+  <logpath>${base}\log</logpath>
+  <logmode>roll</logmode>
+
+  <executable>java.exe</executable>
+  <argument>-server</argument>
+  <argument>-Xrs</argument>
+  <argument>-Xmx1G</argument>
+  <argument>-Dcom.sun.management.jmxremote</argument>
+  <argument>-Djava.util.logging.config.file=${home}\etc\jul.properties</argument>
+  <argument>-Dapollo.base=${base}</argument>
+  <argument>-Dapollo.home=${home}</argument>
+  <argument>-classpath</argument>
+  <argument>${base}\etc;${home}\lib\apollo-boot.jar</argument>
+  <argument>org.apache.activemq.apollo.boot.Boot</argument>
+  <argument>${base}\lib:${home}\lib</argument>
+  <argument>org.apache.activemq.apollo.cli.Apollo</argument>
+  <argument>run</argument>
+
+</service>
\ No newline at end of file

Modified: activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/commands/Create.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/commands/Create.scala?rev=1130615&r1=1130614&r2=1130615&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/commands/Create.scala (original)
+++ activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/commands/Create.scala Thu Jun  2 15:53:19 2011
@@ -103,6 +103,13 @@ class Create extends Action {
       if( IS_WINDOWS ) {
         target = bin / "apollo-broker.cmd"
         write("bin/apollo-broker.cmd", target, true)
+
+        target = bin / "apollo-broker-service.exe"
+        write("bin/apollo-broker-service.exe", target)
+
+        target = bin / "apollo-broker-service.xml"
+        write("bin/apollo-broker-service.xml", target, true)
+
       } else {
         target = bin / "apollo-broker"
         write("bin/apollo-broker", target, true)
@@ -124,17 +131,19 @@ class Create extends Action {
 
       val home = new File(System.getProperty("apollo.home"))
 
+      println("")
       println("You can now start the broker by executing:  ")
       println("")
       println("   %s run".format((bin/"apollo-broker").getCanonicalPath))
+
+      val service = bin / "apollo-broker-service"
+      println("")
+      
       if( !IS_WINDOWS ) {
-        val service = bin / "apollo-broker-service"
-        println("")
 
         // Does it look like we are on a System V init system?
         if( new File("/etc/init.d/").isDirectory ) {
 
-
           println("Or you can setup the broker as system service and run it in the background:")
           println("")
           println("   sudo ln -s %s /etc/init.d/".format(service.getCanonicalPath))
@@ -148,6 +157,13 @@ class Create extends Action {
 
         }
 
+      } else {
+      
+        println("Or you can setup the broker as system service and run it in the background:")
+        println("")
+        println("   %s install".format(service.getCanonicalPath))
+        println("   %s start".format(service.getCanonicalPath))
+
       }
       println("")
 
@@ -187,6 +203,7 @@ class Create extends Action {
         content = content.replaceAll(Pattern.quote("${version}"), Matcher.quoteReplacement(Broker.version))
         val home = new File(System.getProperty("apollo.home"))
         content = content.replaceAll(Pattern.quote("${home}"), Matcher.quoteReplacement(home.getCanonicalPath))
+        content = content.replaceAll(Pattern.quote("${base}"), Matcher.quoteReplacement(directory.getCanonicalPath))
       }
 
       // and then writing out in the new target encoding.