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 66BB8200D37 for ; Thu, 9 Nov 2017 21:00:03 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 631181609C8; Thu, 9 Nov 2017 20:00:03 +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 EB6AC160C05 for ; Thu, 9 Nov 2017 21:00:00 +0100 (CET) Received: (qmail 57679 invoked by uid 500); 9 Nov 2017 19:59:59 -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 57501 invoked by uid 99); 9 Nov 2017 19:59:59 -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:59 +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 65DF93A1701 for ; Thu, 9 Nov 2017 19:59:54 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1020621 [25/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/comm... 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: <20171109195954.65DF93A1701@svn01-us-west.apache.org> archived-at: Thu, 09 Nov 2017 20:00:03 -0000 Modified: websites/production/commons/content/proper/commons-daemon/xref/org/apache/commons/daemon/support/DaemonWrapper.html ============================================================================== --- websites/production/commons/content/proper/commons-daemon/xref/org/apache/commons/daemon/support/DaemonWrapper.html (original) +++ websites/production/commons/content/proper/commons-daemon/xref/org/apache/commons/daemon/support/DaemonWrapper.html Thu Nov 9 19:59:49 2017 @@ -1,298 +1,286 @@ - + + DaemonWrapper xref
-1   /*
-2    *  Licensed to the Apache Software Foundation (ASF) under one or more
-3    *  contributor license agreements.  See the NOTICE file distributed with
-4    *  this work for additional information regarding copyright ownership.
-5    *  The ASF licenses this file to You under the Apache License, Version 2.0
-6    *  (the "License"); you may not use this file except in compliance with
-7    *  the License.  You may obtain a copy of the License at
-8    *
-9    *      http://www.apache.org/licenses/LICENSE-2.0
-10   *
-11   *  Unless required by applicable law or agreed to in writing, software
-12   *  distributed under the License is distributed on an "AS IS" BASIS,
-13   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-14   *  See the License for the specific language governing permissions and
-15   *  limitations under the License.
-16   */
-17  
-18  package org.apache.commons.daemon.support;
-19  
-20  import java.lang.reflect.Method;
-21  import java.lang.reflect.Modifier;
-22  import java.util.ArrayList;
-23  import java.util.Arrays;
-24  import org.apache.commons.daemon.Daemon;
-25  import org.apache.commons.daemon.DaemonContext;
-26  
-27  /**
-28   * Implementation of the Daemon that allows running
-29   * standard applications as daemons.
-30   * The applications must have the mechanism to manage
-31   * the application lifecycle.
-32   *
-33   */
-34  public class DaemonWrapper implements Daemon
-35  {
-36  
-37      private final static String ARGS            = "args";
-38      private final static String START_CLASS     = "start";
-39      private final static String START_METHOD    = "start.method";
-40      private final static String STOP_CLASS      = "stop";
-41      private final static String STOP_METHOD     = "stop.method";
-42      private final static String STOP_ARGS       = "stop.args";
-43      private String              configFileName  = null;
-44      private final DaemonConfiguration config;
-45  
-46      private final Invoker             startup;
-47      private final Invoker             shutdown;
-48  
-49      public DaemonWrapper()
-50      {
-51          super();
-52          config   = new DaemonConfiguration();
-53          startup  = new Invoker();
-54          shutdown = new Invoker();
-55      }
-56  
-57      /**
-58       * Called from DaemonLoader on init stage.
-59       * <p>
-60       * Accepts the following configuration arguments:
-61       * <ul>
-62       * <li>-daemon-properties: - load DaemonConfiguration properties from the specified file to act as defaults</li>
-63       * <li>-start: set start class name</li>
-64       * <li>-start-method: set start method name</li>
-65       * <li>-stop: set stop class name</li>
-66       * <li>-stop-method: set stop method name</li>
-67       * <li>-stop-argument: set optional argument to stop method</li>
-68       * <li>Anything else is treated as a startup argument</li>
-69       * </ul>
-70       * <p>
-71       * The following "-daemon-properties" are recognized:
-72       * <ul>
-73       * <li>args (startup argument)</li>
-74       * <li>start</li>
-75       * <li>start.method</li>
-76       * <li>stop</li>
-77       * <li>stop.method</li>
-78       * <li>stop.args</li>
-79       * </ul>
-80       * These are used to set the corresponding item if it has not already been
-81       * set by the command arguments. <b>However, note that args and stop.args are
-82       * appended to any existing values.</b>
-83       */
-84      @Override
-85      public void init(final DaemonContext context)
-86          throws Exception
-87      {
-88          final String[] args = context.getArguments();
-89  
-90          if (args != null) {
-91              int i;
-92              // Parse our arguments and remove them
-93              // from the final argument array we are
-94              // passing to our child.
-95              for (i = 0; i < args.length; i++) {
-96                  if (args[i].equals("--")) {
-97                      // Done with argument processing
-98                      break;
-99                  }
-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                     }
-116                     startup.setMethodName(args[i]);
-117                 }
-118                 else if (args[i].equals("-stop")) {
-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         {
-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 }
+
+1   /*
+2    *  Licensed to the Apache Software Foundation (ASF) under one or more
+3    *  contributor license agreements.  See the NOTICE file distributed with
+4    *  this work for additional information regarding copyright ownership.
+5    *  The ASF licenses this file to You under the Apache License, Version 2.0
+6    *  (the "License"); you may not use this file except in compliance with
+7    *  the License.  You may obtain a copy of the License at
+8    *
+9    *      http://www.apache.org/licenses/LICENSE-2.0
+10   *
+11   *  Unless required by applicable law or agreed to in writing, software
+12   *  distributed under the License is distributed on an "AS IS" BASIS,
+13   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+14   *  See the License for the specific language governing permissions and
+15   *  limitations under the License.
+16   */
+17  
+18  /* @version $Id: DaemonWrapper.java 1453245 2013-03-06 09:54:38Z mturk $ */
+19  
+20  package org.apache.commons.daemon.support;
+21  
+22  import java.lang.reflect.Method;
+23  import java.lang.reflect.Modifier;
+24  import java.util.ArrayList;
+25  import java.util.Arrays;
+26  import org.apache.commons.daemon.Daemon;
+27  import org.apache.commons.daemon.DaemonContext;
+28  
+29  /**
+30   * Implementation of the Daemon that allows running
+31   * standard applications as daemons.
+32   * The applications must have the mechanism to manage
+33   * the application lifecycle.
+34   *
+35   * @version $Id: DaemonWrapper.java 1453245 2013-03-06 09:54:38Z mturk $
+36   * @author Mladen Turk
+37   */
+38  public class DaemonWrapper implements Daemon
+39  {
+40  
+41      private final static String ARGS            = "args";
+42      private final static String START_CLASS     = "start";
+43      private final static String START_METHOD    = "start.method";
+44      private final static String STOP_CLASS      = "stop";
+45      private final static String STOP_METHOD     = "stop.method";
+46      private final static String STOP_ARGS       = "stop.args";
+47      private String              configFileName  = null;
+48      private final DaemonConfiguration config;
+49  
+50      private final Invoker             startup;
+51      private final Invoker             shutdown;
+52  
+53      public DaemonWrapper()
+54      {
+55          super();
+56          config   = new DaemonConfiguration();
+57          startup  = new Invoker();
+58          shutdown = new Invoker();
+59      }
+60  
+61      /**
+62       * Called from DaemonLoader on init stage.
+63       * <p>
+64       * Accepts the following configuration arguments:
+65       * <ul>
+66       * <li>-daemon-properties: - load DaemonConfiguration properties from the specified file to act as defaults</li>
+67       * <li>-start: set start class name</li>
+68       * <li>-start-method: set start method name</li>
+69       * <li>-stop: set stop class name</li>
+70       * <li>-stop-method: set stop method name</li>
+71       * <li>-stop-argument: set optional argument to stop method</li>
+72       * <li>Anything else is treated as a startup argument</li>
+73       * </ul>
+74       * <p>
+75       * The following "-daemon-properties" are recognised:
+76       * <ul>
+77       * <li>args (startup argument)</li>
+78       * <li>start</li>
+79       * <li>start.method</li>
+80       * <li>stop</li>
+81       * <li>stop.method</li>
+82       * <li>stop.args</li>
+83       * </ul>
+84       * These are used to set the corresponding item if it has not already been
+85       * set by the command arguments. <b>However, note that args and stop.args are
+86       * appended to any existing values.</b>
+87       */
+88      public void init(DaemonContext context)
+89          throws Exception
+90      {
+91          String[] args = context.getArguments();
+92  
+93          if (args != null) {
+94              int i;
+95              // Parse our arguments and remove them
+96              // from the final argument array we are
+97              // passing to our child.
+98              for (i = 0; i < args.length; i++) {
+99                  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)
+120                         throw new IllegalArgumentException(args[i - 1]);
+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         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 }
 
-
- - - \ No newline at end of file +
+ + Modified: websites/production/commons/content/proper/commons-daemon/xref/org/apache/commons/daemon/support/package-frame.html ============================================================================== --- websites/production/commons/content/proper/commons-daemon/xref/org/apache/commons/daemon/support/package-frame.html (original) +++ websites/production/commons/content/proper/commons-daemon/xref/org/apache/commons/daemon/support/package-frame.html Thu Nov 9 19:59:49 2017 @@ -1,9 +1,9 @@ - + - Apache Commons Daemon 1.1.0 Reference Package org.apache.commons.daemon.support + Commons Daemon 1.0.15 Reference Package org.apache.commons.daemon.support Modified: websites/production/commons/content/proper/commons-daemon/xref/org/apache/commons/daemon/support/package-summary.html ============================================================================== --- websites/production/commons/content/proper/commons-daemon/xref/org/apache/commons/daemon/support/package-summary.html (original) +++ websites/production/commons/content/proper/commons-daemon/xref/org/apache/commons/daemon/support/package-summary.html Thu Nov 9 19:59:49 2017 @@ -1,9 +1,9 @@ - + - Apache Commons Daemon 1.1.0 Reference Package org.apache.commons.daemon.support + Commons Daemon 1.0.15 Reference Package org.apache.commons.daemon.support @@ -87,8 +87,6 @@
- + Copyright © 2002-2013 The Apache Software Foundation. All Rights Reserved. \ No newline at end of file Modified: websites/production/commons/content/proper/commons-daemon/xref/overview-frame.html ============================================================================== --- websites/production/commons/content/proper/commons-daemon/xref/overview-frame.html (original) +++ websites/production/commons/content/proper/commons-daemon/xref/overview-frame.html Thu Nov 9 19:59:49 2017 @@ -1,9 +1,9 @@ - + - Apache Commons Daemon 1.1.0 Reference + Commons Daemon 1.0.15 Reference @@ -25,3 +25,4 @@ + Modified: websites/production/commons/content/proper/commons-daemon/xref/overview-summary.html ============================================================================== --- websites/production/commons/content/proper/commons-daemon/xref/overview-summary.html (original) +++ websites/production/commons/content/proper/commons-daemon/xref/overview-summary.html Thu Nov 9 19:59:49 2017 @@ -1,9 +1,9 @@ - + - Apache Commons Daemon 1.1.0 Reference + Commons Daemon 1.0.15 Reference @@ -24,7 +24,7 @@ -

Apache Commons Daemon 1.1.0 Reference

+

Commons Daemon 1.0.15 Reference

@@ -64,8 +64,6 @@
- + Copyright © 2002-2013 The Apache Software Foundation. All Rights Reserved. \ No newline at end of file Modified: websites/production/commons/content/proper/commons-daemon/xref/stylesheet.css ============================================================================== --- websites/production/commons/content/proper/commons-daemon/xref/stylesheet.css (original) +++ websites/production/commons/content/proper/commons-daemon/xref/stylesheet.css Thu Nov 9 19:59:49 2017 @@ -82,7 +82,9 @@ em.comment { .string { color: #009; } - +div#footer { + text-align:center; +} #overview { padding:2px; } @@ -111,4 +113,4 @@ hr { .jxr_keyword { color: #000; -} \ No newline at end of file +}