incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r1172545 - in /sling/trunk/launchpad/base/src: main/java/org/apache/sling/launchpad/app/Main.java test/java/org/apache/sling/launchpad/app/MainTest.java
Date Mon, 19 Sep 2011 09:53:37 GMT
Author: fmeschbe
Date: Mon Sep 19 09:53:37 2011
New Revision: 1172545

URL: http://svn.apache.org/viewvc?rev=1172545&view=rev
Log:
SLING-2225 Use sling.control.socket instead of "j" as the property name for the control socket
specification

Modified:
    sling/trunk/launchpad/base/src/main/java/org/apache/sling/launchpad/app/Main.java
    sling/trunk/launchpad/base/src/test/java/org/apache/sling/launchpad/app/MainTest.java

Modified: sling/trunk/launchpad/base/src/main/java/org/apache/sling/launchpad/app/Main.java
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/base/src/main/java/org/apache/sling/launchpad/app/Main.java?rev=1172545&r1=1172544&r2=1172545&view=diff
==============================================================================
--- sling/trunk/launchpad/base/src/main/java/org/apache/sling/launchpad/app/Main.java (original)
+++ sling/trunk/launchpad/base/src/main/java/org/apache/sling/launchpad/app/Main.java Mon
Sep 19 09:53:37 2011
@@ -60,6 +60,14 @@ public class Main {
      */
     protected static final String PROP_CONTROL_ACTION = "sling.control.action";
 
+    /**
+     * The name of the configuration property indicating the socket to use for
+     * the control connection. The value of this property is either just a port
+     * number (in which case the host is assumed to be <code>localhost</code>)
+     * or a host name (or IP address) and port number separated by a colon.
+     */
+    protected static final String PROP_CONTROL_SOCKET = "sling.control.socket";
+
     /** The Sling configuration property name setting the initial log level */
     private static final String PROP_LOG_LEVEL = "org.apache.sling.commons.log.level";
 
@@ -167,7 +175,7 @@ public class Main {
      * <p>
      * <table>
      * <tr>
-     * <td><code>j</code></td>
+     * <td><code>{@value #PROP_CONTROL_SOCKET}</code></td>
      * <td>Specifies the socket to use for the control connection. This
      * specification is of the form <i>host:port</i> where the host can be a
      * host name or IP Address and may be omitted (along with the separating
@@ -217,14 +225,10 @@ public class Main {
      *         (Programm Not Running), 4 (Unknown Problem).
      */
     protected int doControlAction() {
-        String commandSocketSpec = commandLineArgs.remove("j");
-        if ("j".equals(commandSocketSpec)) {
-            commandSocketSpec = null;
-        }
-
         ControlAction action = getControlAction();
         if (action != null) {
-            ControlListener sl = new ControlListener(this, commandSocketSpec);
+            ControlListener sl = new ControlListener(this,
+                commandLineArgs.remove(PROP_CONTROL_SOCKET));
             switch (action) {
                 case START:
                     sl.listen();
@@ -592,8 +596,12 @@ public class Main {
                 String value = arg.getValue();
                 switch (arg.getKey().charAt(0)) {
                     case 'j':
-                        // copy control connection spec unchecked
-                        props.put(arg.getKey(), arg.getValue());
+                        if (value == arg.getKey()) {
+                            errorArg("-j", "Missing host:port value");
+                            errorArg = true;
+                            continue;
+                        }
+                        props.put(PROP_CONTROL_SOCKET, value);
                         break;
 
                     case 'l':

Modified: sling/trunk/launchpad/base/src/test/java/org/apache/sling/launchpad/app/MainTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/base/src/test/java/org/apache/sling/launchpad/app/MainTest.java?rev=1172545&r1=1172544&r2=1172545&view=diff
==============================================================================
--- sling/trunk/launchpad/base/src/test/java/org/apache/sling/launchpad/app/MainTest.java
(original)
+++ sling/trunk/launchpad/base/src/test/java/org/apache/sling/launchpad/app/MainTest.java
Mon Sep 19 09:53:37 2011
@@ -166,9 +166,16 @@ public class MainTest extends TestCase {
                 put("j", "j");
             }
         });
-        assertNotNull(props);
-        assertEquals(1, props.size());
-        assertEquals("j", props.get("j"));
+        assertNull(props);
+
+        Map<String, String> props1 = Main.convertCommandLineArgs(new HashMap<String,
String>() {
+            {
+                put("j", "host:port");
+            }
+        });
+        assertNotNull(props1);
+        assertEquals(1, props1.size());
+        assertEquals("host:port", props1.get("sling.control.socket"));
 
         Map<String, String> propsStart = Main.convertCommandLineArgs(new HashMap<String,
String>() {
             {



Mime
View raw message