Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 2C3C2200D37 for ; Thu, 9 Nov 2017 21:00:02 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 2ABFD1609C8; Thu, 9 Nov 2017 20:00:02 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 7D4C0160C0B for ; Thu, 9 Nov 2017 20:59:59 +0100 (CET) Received: (qmail 57254 invoked by uid 500); 9 Nov 2017 19:59:58 -0000 Mailing-List: contact notifications-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list notifications@commons.apache.org Received: (qmail 57135 invoked by uid 99); 9 Nov 2017 19:59:58 -0000 Received: from Unknown (HELO svn01-us-west.apache.org) (209.188.14.144) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 Nov 2017 19:59:58 +0000 Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id AC3BF3A0CF5 for ; Thu, 9 Nov 2017 19:59:53 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1020621 [9/25] - in /websites/production/commons/content/proper/commons-daemon: ./ apidocs/ apidocs/org/apache/commons/daemon/ apidocs/org/apache/commons/daemon/class-use/ apidocs/org/apache/commons/daemon/support/ apidocs/org/apache/commo... Date: Thu, 09 Nov 2017 19:59:50 -0000 To: notifications@commons.apache.org From: markt@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20171109195953.AC3BF3A0CF5@svn01-us-west.apache.org> archived-at: Thu, 09 Nov 2017 20:00:02 -0000 Modified: websites/production/commons/content/proper/commons-daemon/apidocs/src-html/org/apache/commons/daemon/support/DaemonWrapper.html ============================================================================== --- websites/production/commons/content/proper/commons-daemon/apidocs/src-html/org/apache/commons/daemon/support/DaemonWrapper.html (original) +++ websites/production/commons/content/proper/commons-daemon/apidocs/src-html/org/apache/commons/daemon/support/DaemonWrapper.html Thu Nov 9 19:59:49 2017 @@ -23,274 +23,261 @@ 015 * limitations under the License. 016 */ 017 -018package org.apache.commons.daemon.support; +018/* @version $Id: DaemonWrapper.java 1453245 2013-03-06 09:54:38Z mturk $ */ 019 -020import java.lang.reflect.Method; -021import java.lang.reflect.Modifier; -022import java.util.ArrayList; -023import java.util.Arrays; -024import org.apache.commons.daemon.Daemon; -025import org.apache.commons.daemon.DaemonContext; -026 -027/** -028 * Implementation of the Daemon that allows running -029 * standard applications as daemons. -030 * The applications must have the mechanism to manage -031 * the application lifecycle. -032 * -033 */ -034public class DaemonWrapper implements Daemon -035{ -036 -037 private final static String ARGS = "args"; -038 private final static String START_CLASS = "start"; -039 private final static String START_METHOD = "start.method"; -040 private final static String STOP_CLASS = "stop"; -041 private final static String STOP_METHOD = "stop.method"; -042 private final static String STOP_ARGS = "stop.args"; -043 private String configFileName = null; -044 private final DaemonConfiguration config; -045 -046 private final Invoker startup; -047 private final Invoker shutdown; -048 -049 public DaemonWrapper() -050 { -051 super(); -052 config = new DaemonConfiguration(); -053 startup = new Invoker(); -054 shutdown = new Invoker(); -055 } -056 -057 /** -058 * Called from DaemonLoader on init stage. -059 * <p> -060 * Accepts the following configuration arguments: -061 * <ul> -062 * <li>-daemon-properties: - load DaemonConfiguration properties from the specified file to act as defaults</li> -063 * <li>-start: set start class name</li> -064 * <li>-start-method: set start method name</li> -065 * <li>-stop: set stop class name</li> -066 * <li>-stop-method: set stop method name</li> -067 * <li>-stop-argument: set optional argument to stop method</li> -068 * <li>Anything else is treated as a startup argument</li> -069 * </ul> -070 * <p> -071 * The following "-daemon-properties" are recognized: -072 * <ul> -073 * <li>args (startup argument)</li> -074 * <li>start</li> -075 * <li>start.method</li> -076 * <li>stop</li> -077 * <li>stop.method</li> -078 * <li>stop.args</li> -079 * </ul> -080 * These are used to set the corresponding item if it has not already been -081 * set by the command arguments. <b>However, note that args and stop.args are -082 * appended to any existing values.</b> -083 */ -084 @Override -085 public void init(final DaemonContext context) -086 throws Exception -087 { -088 final String[] args = context.getArguments(); -089 -090 if (args != null) { -091 int i; -092 // Parse our arguments and remove them -093 // from the final argument array we are -094 // passing to our child. -095 for (i = 0; i < args.length; i++) { -096 if (args[i].equals("--")) { -097 // Done with argument processing -098 break; -099 } -100 else if (args[i].equals("-daemon-properties")) { -101 if (++i == args.length) { -102 throw new IllegalArgumentException(args[i - 1]); -103 } -104 configFileName = args[i]; -105 } -106 else if (args[i].equals("-start")) { -107 if (++i == args.length) { -108 throw new IllegalArgumentException(args[i - 1]); -109 } -110 startup.setClassName(args[i]); -111 } -112 else if (args[i].equals("-start-method")) { -113 if (++i == args.length) { -114 throw new IllegalArgumentException(args[i - 1]); -115 } +020package org.apache.commons.daemon.support; +021 +022import java.lang.reflect.Method; +023import java.lang.reflect.Modifier; +024import java.util.ArrayList; +025import java.util.Arrays; +026import org.apache.commons.daemon.Daemon; +027import org.apache.commons.daemon.DaemonContext; +028 +029/** +030 * Implementation of the Daemon that allows running +031 * standard applications as daemons. +032 * The applications must have the mechanism to manage +033 * the application lifecycle. +034 * +035 * @version $Id: DaemonWrapper.java 1453245 2013-03-06 09:54:38Z mturk $ +036 * @author Mladen Turk +037 */ +038public class DaemonWrapper implements Daemon +039{ +040 +041 private final static String ARGS = "args"; +042 private final static String START_CLASS = "start"; +043 private final static String START_METHOD = "start.method"; +044 private final static String STOP_CLASS = "stop"; +045 private final static String STOP_METHOD = "stop.method"; +046 private final static String STOP_ARGS = "stop.args"; +047 private String configFileName = null; +048 private final DaemonConfiguration config; +049 +050 private final Invoker startup; +051 private final Invoker shutdown; +052 +053 public DaemonWrapper() +054 { +055 super(); +056 config = new DaemonConfiguration(); +057 startup = new Invoker(); +058 shutdown = new Invoker(); +059 } +060 +061 /** +062 * Called from DaemonLoader on init stage. +063 * <p> +064 * Accepts the following configuration arguments: +065 * <ul> +066 * <li>-daemon-properties: - load DaemonConfiguration properties from the specified file to act as defaults</li> +067 * <li>-start: set start class name</li> +068 * <li>-start-method: set start method name</li> +069 * <li>-stop: set stop class name</li> +070 * <li>-stop-method: set stop method name</li> +071 * <li>-stop-argument: set optional argument to stop method</li> +072 * <li>Anything else is treated as a startup argument</li> +073 * </ul> +074 * <p> +075 * The following "-daemon-properties" are recognised: +076 * <ul> +077 * <li>args (startup argument)</li> +078 * <li>start</li> +079 * <li>start.method</li> +080 * <li>stop</li> +081 * <li>stop.method</li> +082 * <li>stop.args</li> +083 * </ul> +084 * These are used to set the corresponding item if it has not already been +085 * set by the command arguments. <b>However, note that args and stop.args are +086 * appended to any existing values.</b> +087 */ +088 public void init(DaemonContext context) +089 throws Exception +090 { +091 String[] args = context.getArguments(); +092 +093 if (args != null) { +094 int i; +095 // Parse our arguments and remove them +096 // from the final argument array we are +097 // passing to our child. +098 for (i = 0; i < args.length; i++) { +099 if (args[i].equals("--")) { +100 // Done with argument processing +101 break; +102 } +103 else if (args[i].equals("-daemon-properties")) { +104 if (++i == args.length) +105 throw new IllegalArgumentException(args[i - 1]); +106 configFileName = args[i]; +107 } +108 else if (args[i].equals("-start")) { +109 if (++i == args.length) +110 throw new IllegalArgumentException(args[i - 1]); +111 startup.setClassName(args[i]); +112 } +113 else if (args[i].equals("-start-method")) { +114 if (++i == args.length) +115 throw new IllegalArgumentException(args[i - 1]); 116 startup.setMethodName(args[i]); 117 } 118 else if (args[i].equals("-stop")) { -119 if (++i == args.length) { +119 if (++i == args.length) 120 throw new IllegalArgumentException(args[i - 1]); -121 } -122 shutdown.setClassName(args[i]); -123 } -124 else if (args[i].equals("-stop-method")) { -125 if (++i == args.length) { -126 throw new IllegalArgumentException(args[i - 1]); -127 } -128 shutdown.setMethodName(args[i]); -129 } -130 else if (args[i].equals("-stop-argument")) { -131 if (++i == args.length) { -132 throw new IllegalArgumentException(args[i - 1]); -133 } -134 final String[] aa = new String[1]; -135 aa[0] = args[i]; -136 shutdown.addArguments(aa); -137 } -138 else { -139 // This is not our option. -140 // Everything else will be forwarded to the main -141 break; -142 } -143 } -144 if (args.length > i) { -145 final String[] copy = new String[args.length - i]; -146 System.arraycopy(args, i, copy, 0, copy.length); -147 startup.addArguments(copy); -148 } -149 } -150 if (config.load(configFileName)) { -151 // Setup params if not set via cmdline. -152 startup.setClassName(config.getProperty(START_CLASS)); -153 startup.setMethodName(config.getProperty(START_METHOD)); -154 // Merge the config with command line arguments -155 startup.addArguments(config.getPropertyArray(ARGS)); -156 -157 shutdown.setClassName(config.getProperty(STOP_CLASS)); -158 shutdown.setMethodName(config.getProperty(STOP_METHOD)); -159 shutdown.addArguments(config.getPropertyArray(STOP_ARGS)); -160 } -161 startup.validate(); -162 shutdown.validate(); -163 } -164 -165 /** -166 */ -167 @Override -168 public void start() -169 throws Exception -170 { -171 startup.invoke(); -172 } -173 -174 /** -175 */ -176 @Override -177 public void stop() -178 throws Exception -179 { -180 shutdown.invoke(); -181 } -182 -183 /** -184 */ -185 @Override -186 public void destroy() -187 { -188 // Nothing for the moment -189 System.err.println("DaemonWrapper: instance " + this.hashCode() + " destroy"); -190 } -191 -192 // Internal class for wrapping the start/stop methods -193 class Invoker -194 { -195 private String name = null; -196 private String call = null; -197 private String[] args = null; -198 private Method inst = null; -199 private Class<?> main = null; -200 -201 protected Invoker() -202 { +121 shutdown.setClassName(args[i]); +122 } +123 else if (args[i].equals("-stop-method")) { +124 if (++i == args.length) +125 throw new IllegalArgumentException(args[i - 1]); +126 shutdown.setMethodName(args[i]); +127 } +128 else if (args[i].equals("-stop-argument")) { +129 if (++i == args.length) +130 throw new IllegalArgumentException(args[i - 1]); +131 String[] aa = new String[1]; +132 aa[0] = args[i]; +133 shutdown.addArguments(aa); +134 } +135 else { +136 // This is not our option. +137 // Everything else will be forwarded to the main +138 break; +139 } +140 } +141 if (args.length > i) { +142 String[] copy = new String[args.length - i]; +143 System.arraycopy(args, i, copy, 0, copy.length); +144 startup.addArguments(copy); +145 } +146 } +147 if (config.load(configFileName)) { +148 // Setup params if not set via cmdline. +149 startup.setClassName(config.getProperty(START_CLASS)); +150 startup.setMethodName(config.getProperty(START_METHOD)); +151 // Merge the config with command line arguments +152 startup.addArguments(config.getPropertyArray(ARGS)); +153 +154 shutdown.setClassName(config.getProperty(STOP_CLASS)); +155 shutdown.setMethodName(config.getProperty(STOP_METHOD)); +156 shutdown.addArguments(config.getPropertyArray(STOP_ARGS)); +157 } +158 startup.validate(); +159 shutdown.validate(); +160 } +161 +162 /** +163 */ +164 public void start() +165 throws Exception +166 { +167 startup.invoke(); +168 } +169 +170 /** +171 */ +172 public void stop() +173 throws Exception +174 { +175 shutdown.invoke(); +176 } +177 +178 /** +179 */ +180 public void destroy() +181 { +182 // Nothing for the moment +183 System.err.println("DaemonWrapper: instance " + this.hashCode() + " destroy"); +184 } +185 +186 // Internal class for wrapping the start/stop methods +187 class Invoker +188 { +189 private String name = null; +190 private String call = null; +191 private String[] args = null; +192 private Method inst = null; +193 private Class main = null; +194 +195 protected Invoker() +196 { +197 } +198 +199 protected void setClassName(String name) +200 { +201 if (this.name == null) +202 this.name = name; 203 } -204 -205 protected void setClassName(final String name) -206 { -207 if (this.name == null) { -208 this.name = name; -209 } -210 } -211 protected void setMethodName(final String name) -212 { -213 if (this.call == null) { -214 this.call = name; -215 } -216 } -217 protected void addArguments(final String[] args) -218 { -219 if (args != null) { -220 final ArrayList<String> aa = new ArrayList<String>(); -221 if (this.args != null) { -222 aa.addAll(Arrays.asList(this.args)); -223 } -224 aa.addAll(Arrays.asList(args)); -225 this.args = aa.toArray(new String[aa.size()]); -226 } -227 } -228 -229 protected void invoke() -230 throws Exception -231 { -232 if (name.equals("System") && call.equals("exit")) { -233 // Just call a System.exit() -234 // The start method was probably installed -235 // a shutdown hook. -236 System.exit(0); -237 } -238 else { -239 Object obj = null; -240 if ((inst.getModifiers() & Modifier.STATIC) == 0) { -241 // We only need object instance for non-static methods. -242 obj = main.newInstance(); -243 } -244 final Object arg[] = new Object[1]; -245 -246 arg[0] = args; -247 inst.invoke(obj, arg); -248 } -249 } -250 // Load the class using reflection -251 protected void validate() -252 throws Exception -253 { -254 /* Check the class name */ -255 if (name == null) { -256 name = "System"; -257 call = "exit"; -258 return; -259 } -260 if (args == null) { -261 args = new String[0]; -262 } -263 if (call == null) { -264 call = "main"; -265 } -266 -267 // Get the ClassLoader loading this class -268 final ClassLoader cl = DaemonWrapper.class.getClassLoader(); -269 if (cl == null) { -270 throw new NullPointerException("Cannot retrieve ClassLoader instance"); -271 } -272 final Class<?>[] ca = new Class[1]; -273 ca[0] = args.getClass(); -274 // Find the required class -275 main = cl.loadClass(name); -276 if (main == null) { -277 throw new ClassNotFoundException(name); -278 } -279 // Find the required method. -280 // NoSuchMethodException will be thrown if matching method -281 // is not found. -282 inst = main.getMethod(call, ca); -283 } -284 } -285} +204 protected void setMethodName(String name) +205 { +206 if (this.call == null) +207 this.call = name; +208 } +209 protected void addArguments(String[] args) +210 { +211 if (args != null) { +212 ArrayList aa = new ArrayList(); +213 if (this.args != null) +214 aa.addAll(Arrays.asList(this.args)); +215 aa.addAll(Arrays.asList(args)); +216 this.args = (String[])aa.toArray(new String[aa.size()]); +217 } +218 } +219 +220 protected void invoke() +221 throws Exception +222 { +223 if (name.equals("System") && call.equals("exit")) { +224 // Just call a System.exit() +225 // The start method was probably installed +226 // a shutdown hook. +227 System.exit(0); +228 } +229 else { +230 Object obj = null; +231 if ((inst.getModifiers() & Modifier.STATIC) == 0) { +232 // We only need object instance for non-static methods. +233 obj = main.newInstance(); +234 } +235 Object arg[] = new Object[1]; +236 +237 arg[0] = args; +238 inst.invoke(obj, arg); +239 } +240 } +241 // Load the class using reflection +242 protected void validate() +243 throws Exception +244 { +245 /* Check the class name */ +246 if (name == null) { +247 name = "System"; +248 call = "exit"; +249 return; +250 } +251 if (args == null) +252 args = new String[0]; +253 if (call == null) +254 call = "main"; +255 +256 // Get the ClassLoader loading this class +257 ClassLoader cl = DaemonWrapper.class.getClassLoader(); +258 if (cl == null) +259 throw new NullPointerException("Cannot retrieve ClassLoader instance"); +260 Class[] ca = new Class[1]; +261 ca[0] = args.getClass(); +262 // Find the required class +263 main = cl.loadClass(name); +264 if (main == null) +265 throw new ClassNotFoundException(name); +266 // Find the required method. +267 // NoSuchMethodException will be thrown if matching method +268 // is not found. +269 inst = main.getMethod(call, ca); +270 } +271 } +272} @@ -354,4 +341,4 @@ - \ No newline at end of file + Modified: websites/production/commons/content/proper/commons-daemon/apidocs/stylesheet.css ============================================================================== --- websites/production/commons/content/proper/commons-daemon/apidocs/stylesheet.css (original) +++ websites/production/commons/content/proper/commons-daemon/apidocs/stylesheet.css Thu Nov 9 19:59:49 2017 @@ -471,4 +471,4 @@ h1.hidden { } .strong { font-weight:bold; -} \ No newline at end of file +} Modified: websites/production/commons/content/proper/commons-daemon/binaries.html ============================================================================== --- websites/production/commons/content/proper/commons-daemon/binaries.html (original) +++ websites/production/commons/content/proper/commons-daemon/binaries.html Thu Nov 9 19:59:49 2017 @@ -1,234 +1,181 @@ - - - - - - - - - - Daemon – Daemon : binaries - - - - - - - - - - - - - + + + + + + + + Daemon : binaries + + + + + + + + - - - - - Apache Commons logo - - - Commons Daemon - -
- - - -
- - - - - -
- +
+ + Commons Daemon + +
+
+
+
+ + +
+ +
+
+
+ -
-

What to download?

- +

What to download?

In the directory binaries @@ -255,31 +200,20 @@ corresponding to your operating system.

- -
-

How do I get the executable?

- -
-

procrun

- +

How do I get the executable?

+

procrun

-The Windows archive (e.g. commons-daemon-1.1.0-bin-windows.zip) contains 2 different executables: -

-
    - +The Windows archive (e.g. commons-daemon-1.0.15-bin-windows.zip) contains 2 different executables: +

    • prunsrv.exe - service application for running applications as services.
    • -
    • prunmgr.exe - the GUI manager application used to monitor and configure installed services.
    There is only one prunmgr.exe application for all architectures. The prunsrv.exe executable is available in 3 different versions for different architectures. The version in the top-level directory is for 32-bit (x86) architectures. The lower level directories are for 64-bit systems: -
      -
    • amd64 - AMD/EMT 64-bit
    • -
    • ia64 - Intel Itanium 64-bit
    The Windows application prunsrv.exe is used to install an application as a service. @@ -292,20 +226,24 @@ The Windows binary zip archive should be
- -
-
- - + +
+
+
+ - - - \ No newline at end of file + All other marks mentioned may be trademarks or registered trademarks of their respective owners. +
+
+
+ + +