activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bsny...@apache.org
Subject svn commit: r1079638 - in /activemq/trunk: NOTICE activemq-console/pom.xml activemq-console/src/main/java/org/apache/activemq/console/ActiveMQLauncher.java pom.xml
Date Wed, 09 Mar 2011 01:42:37 GMT
Author: bsnyder
Date: Wed Mar  9 01:42:36 2011
New Revision: 1079638

URL: http://svn.apache.org/viewvc?rev=1079638&view=rev
Log:
AMQ-2968 - Add Apache commons daemon (jsvc/procrun) start/stop support.

Added:
    activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/ActiveMQLauncher.java
Modified:
    activemq/trunk/NOTICE
    activemq/trunk/activemq-console/pom.xml
    activemq/trunk/pom.xml

Modified: activemq/trunk/NOTICE
URL: http://svn.apache.org/viewvc/activemq/trunk/NOTICE?rev=1079638&r1=1079637&r2=1079638&view=diff
==============================================================================
--- activemq/trunk/NOTICE (original)
+++ activemq/trunk/NOTICE Wed Mar  9 01:42:36 2011
@@ -42,3 +42,8 @@ Some portions of the code are Copyright:
   1999 Jason Gilbert.
 
 The jboss integration module contains some LGPL code.
+
+This product includes software developed by
+   Yahoo! Inc. (www.yahoo.com)
+   Copyright (c) 2010 Yahoo! Inc.  All rights reserved.
+

Modified: activemq/trunk/activemq-console/pom.xml
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-console/pom.xml?rev=1079638&r1=1079637&r2=1079638&view=diff
==============================================================================
--- activemq/trunk/activemq-console/pom.xml (original)
+++ activemq/trunk/activemq-console/pom.xml Wed Mar  9 01:42:36 2011
@@ -125,7 +125,13 @@
     <dependency>
       <groupId>com.ibm.icu</groupId>
       <artifactId>icu4j</artifactId>
-    </dependency>  
+    </dependency> 
+    
+    <dependency>
+      <groupId>commons-daemon</groupId>
+      <artifactId>commons-daemon</artifactId>
+    </dependency> 
+
   </dependencies>
 
   <build>

Added: activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/ActiveMQLauncher.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/ActiveMQLauncher.java?rev=1079638&view=auto
==============================================================================
--- activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/ActiveMQLauncher.java
(added)
+++ activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/ActiveMQLauncher.java
Wed Mar  9 01:42:36 2011
@@ -0,0 +1,103 @@
+/**
+ * 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.console;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.activemq.console.command.Command;
+import org.apache.activemq.console.command.ShutdownCommand;
+import org.apache.activemq.console.command.StartCommand;
+import org.apache.activemq.console.CommandContext;
+import org.apache.activemq.console.Main;
+import org.apache.activemq.console.formatter.CommandShellOutputFormatter;
+import org.apache.commons.daemon.Daemon;
+import org.apache.commons.daemon.DaemonContext;
+
+/**
+ * This class launches activemq under Apache JSVC {@link http://commons.apache.org/daemon/jsvc.html}
+ * 
+ * @author areese
+ * 
+ */
+public class ActiveMQLauncher implements Daemon {
+    private List<String> args;
+
+    /**
+     * 
+     */
+    public ActiveMQLauncher() {
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.commons.daemon.Daemon#destroy()
+     */
+    public void destroy() {
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * org.apache.commons.daemon.Daemon#init(org.apache.commons.daemon.DaemonContext
+     * )
+     */
+    public void init(DaemonContext arg0) throws Exception {
+        // we need to save the args we started with.
+        args = Arrays.asList(arg0.getArguments());
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.commons.daemon.Daemon#start()
+     */
+    public void start() throws Exception {
+        CommandContext context = new CommandContext();
+        context.setFormatter(new CommandShellOutputFormatter(System.out));
+
+        Command command = new StartCommand();
+        command.setCommandContext(context);
+
+        command.execute(args);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.commons.daemon.Daemon#stop()
+     */
+    public void stop() throws Exception {
+        CommandContext context = new CommandContext();
+        context.setFormatter(new CommandShellOutputFormatter(System.out));
+
+        Command command = new ShutdownCommand();
+        command.setCommandContext(context);
+
+        List<String> tokens = new ArrayList<String>(Arrays.asList(new String[]
{
+                "--jmxlocal", "--all", }));
+
+        command.execute(tokens);
+    }
+
+}

Modified: activemq/trunk/pom.xml
URL: http://svn.apache.org/viewvc/activemq/trunk/pom.xml?rev=1079638&r1=1079637&r2=1079638&view=diff
==============================================================================
--- activemq/trunk/pom.xml (original)
+++ activemq/trunk/pom.xml Wed Mar  9 01:42:36 2011
@@ -449,6 +449,13 @@
         <version>3.0.0</version>
         <optional>true</optional>
       </dependency>
+      
+    <!-- For jsvc support -->
+    <dependency>
+      <groupId>commons-daemon</groupId>
+      <artifactId>commons-daemon</artifactId>
+      <version>1.0.3</version>
+    </dependency> 
 
       <!-- for the XML parsing -->
       <dependency>
@@ -941,11 +948,11 @@
       </dependency>
       
       <!-- FTP support for BlobMessages -->
-    	<dependency>
-    	    <groupId>commons-net</groupId>
-    	    <artifactId>commons-net</artifactId>
-    	    <version>${commons-net-version}</version>
-    	</dependency>
+        <dependency>
+            <groupId>commons-net</groupId>
+            <artifactId>commons-net</artifactId>
+            <version>${commons-net-version}</version>
+        </dependency>
 
       <dependency>
         <groupId>org.apache.velocity</groupId>



Mime
View raw message