ace-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ange...@apache.org
Subject svn commit: r1083632 - /incubator/ace/trunk/ace-launcher/src/main/java/org/apache/ace/launcher/Main.java
Date Mon, 21 Mar 2011 00:27:50 GMT
Author: angelos
Date: Mon Mar 21 00:27:49 2011
New Revision: 1083632

URL: http://svn.apache.org/viewvc?rev=1083632&view=rev
Log:
Added a help message to the launcher.

Modified:
    incubator/ace/trunk/ace-launcher/src/main/java/org/apache/ace/launcher/Main.java

Modified: incubator/ace/trunk/ace-launcher/src/main/java/org/apache/ace/launcher/Main.java
URL: http://svn.apache.org/viewvc/incubator/ace/trunk/ace-launcher/src/main/java/org/apache/ace/launcher/Main.java?rev=1083632&r1=1083631&r2=1083632&view=diff
==============================================================================
--- incubator/ace/trunk/ace-launcher/src/main/java/org/apache/ace/launcher/Main.java (original)
+++ incubator/ace/trunk/ace-launcher/src/main/java/org/apache/ace/launcher/Main.java Mon Mar
21 00:27:49 2011
@@ -40,6 +40,11 @@ import java.util.regex.Pattern;
  */
 public class Main {
     public static void main(String[] args) throws Exception {
+        if (helpNecessary()) {
+            showHelp();
+            return;
+        }
+
         FrameworkFactory factory = (FrameworkFactory) Class.forName("org.apache.felix.framework.FrameworkFactory").newInstance();
 
         List activators = new ArrayList();
@@ -59,6 +64,25 @@ public class Main {
         factory.newFramework(frameworkProperties).start();
     }
 
+    private static boolean helpNecessary() {
+        return (System.getProperty("identification") == null) || (System.getProperty("discovery")
== null);
+    }
+
+    private static void showHelp() {
+        System.out.println("Apache ACE Launcher\n"
+                + "Usage:\n"
+                + "  java -jar -Didentification=<id> -Ddiscovery=<ace-server>
ace-launcher.jar <options>\n"
+                + "  in which\n"
+                + "    - <id> is the name of the target (targetID)\n"
+                + "    - <ace-server> is a URL to the ACE server this target should
connect to\n"
+                + "    - <options> is a set of startup options\n"
+                + "The options:\n"
+                + "  fwOption: a framework option, to pass into the OSGi framework to be
created. This option can be repeated."
+                + "Example:\n"
+                + "  java -jar -Didentification=MyTarget -Ddiscovery=http://provisioning.company.com:8080
ace-launcher.jar "
+                + "fwOption=org.osgi.framework.system.packages.extra=sun.misc,com.sun.management");
+    }
+
     static Map findFrameworkProperties(String[] args) {
         Pattern pattern = Pattern.compile("--(\\w*)=([.\\w]*)=(.*)");
         Map result = new HashMap();



Mime
View raw message