Title: [2506] trunk/openejb1/modules/core/src/java/org/openejb/cli: Changed the command line overrides to happen after the config file overrides
Revision
2506
Author
dblevins
Date
2006-02-25 02:10:56 -0500 (Sat, 25 Feb 2006)

Log Message

Changed the command line overrides to happen after the config file overrides
Updated the start help and examples to reflect

Modified Paths

Diff

Modified: trunk/openejb1/modules/core/src/META-INF/org.openejb.cli/start.examples (2505 => 2506)

--- trunk/openejb1/modules/core/src/META-INF/org.openejb.cli/start.examples	2006-02-25 05:31:23 UTC (rev 2505)
+++ trunk/openejb1/modules/core/src/META-INF/org.openejb.cli/start.examples	2006-02-25 07:10:56 UTC (rev 2506)
@@ -4,105 +4,148 @@
 
  openejb start
 
- That's it.  The server will start up and bind to IP 127.0.0.1 and port 4201.
+ That's it.  The ejbd will start up and bind to IP 127.0.0.1 and port 4201.
 
  The following properties would then be used to get an InitialContext
  from the Remote Server.
         
-   java.naming.factory.initial      = org.openejb.client.JNDIContext
-   java.naming.provider.url         = ""
+   java.naming.factory.initial      = org.openejb.client.RemoteInitialContextFactory
+   java.naming.provider.url         = ""
    java.naming.security.principal   = myuser
    java.naming.security.credentials = mypass
 
-Example: -h
+Example: -conf file
 
- openejb start -h 10.45.67.8
+ openejb start -conf C:\openejb\conf\mytest.conf
+ 
+ Sets the openejb.configuration system variable to the file 
+ C:\openejb\conf\mytest.conf.  When the server starts up and
+ the initializes OpenEJB, this configuration will be
+ used to assemble the container system and load beans. 
 
- This is the most common way to use the OpenEJB Remote Server.  The server will start 
+Example: --local-copy
+
+ openejb start --local-copy=true
+            
+ Instructs the container system to marshal (ie, copy) all
+ calls between beans are required by the EJB 1.1 specification.  
+ 
+ openejb start --local-copy=false
+ 
+ Instructs the container system to not marshal (copy) calls 
+ between beans. The container system as will pass parameters 
+ and return values without copying or marshalling as is 
+ required for EJB 2.0 Local interfaces.
+
+
+CONFIG OVERRIDE EXAMPLES
+
+
+Example: -D<service>.bind=<address>
+
+ openejb start -Dejbd.bind=10.45.67.8
+
+ This is the most common way to use the EJBd Server Service.  The service will start
  up and bind to IP 10.45.67.8 and port 4201.
 
  The following properties would then be used to get an InitialContext
- from the Remote Server.
+ from the EJBd Server Service.
 
-   java.naming.factory.initial      = org.openejb.client.JNDIContext
-   java.naming.provider.url         = ""
+   java.naming.factory.initial      = org.openejb.client.RemoteInitialContextFactory
+   java.naming.provider.url         = ""
    java.naming.security.principal   = myuser
    java.naming.security.credentials = mypass
 
  DNS names can also be used.
 
- openejb start -h myhost.foo.com
+ openejb start -Dejbd.bind=myhost.foo.com
 
  The following properties would then be used to get an InitialContext
  from the Remote Server.
 
-   java.naming.factory.initial      = org.openejb.client.JNDIContext
-   java.naming.provider.url         = ""
+   java.naming.factory.initial      = org.openejb.client.RemoteInitialContextFactory
+   java.naming.provider.url         = ""
    java.naming.security.principal   = myuser
    java.naming.security.credentials = mypass
 
-Example: -p
+ openejb start -Dtelnet.bind=myhost.foo.com
 
- openejb start -p 8765
- 
+ The following properties would then be used to log into the server
+ via a telnet client as such:
+
+   telnet myhost.foo.com 4202
+
+
+Example: -D<service>.port=<port>
+
+ openejb start -Dejbd.port=8765
+
  The server will start up and bind to IP 127.0.0.1 and port 8765.
 
  The following properties would then be used to get an InitialContext
  from the Remote Server.
-        
-   java.naming.factory.initial      = org.openejb.client.JNDIContext
-   java.naming.provider.url         = ""
+
+   java.naming.factory.initial      = org.openejb.client.RemoteInitialContextFactory
+   java.naming.provider.url         = ""
    java.naming.security.principal   = myuser
    java.naming.security.credentials = mypass
 
-Example: -conf file   
+ openejb start -Dhttpejbd.port=8888
 
- openejb start -conf C:\openejb\conf\mytest.conf
- 
- Sets the openejb.configuration system variable to the file 
- C:\openejb\conf\mytest.conf.  When the server starts up and
- the initializes OpenEJB, this configuration will be
- used to assemble the container system and load beans. 
+ The server will start up and the EJB over HTTP service will bind
+ to IP 127.0.0.1 and port 8888.
 
-Example: --admin-ip addresses   
+ The following properties would then be used to get an InitialContext
+ from the HTTP/Remote Server.
 
- openejb start --admin-ip 192.168.1.12
- 
- Adds 192.168.1.12 to the list of IP addresses that are 
+   java.naming.factory.initial      = org.openejb.client.RemoteInitialContextFactory
+   java.naming.provider.url         = ""
+   java.naming.security.principal   = myuser
+   java.naming.security.credentials = mypass
+
+
+Example: -D<service>.
+
+ openejb start -Dadmin.
+
+ Adds 192.168.1.12 to the list of IP addresses that are
  authorized to shutdown the server or access the server
- via a telnet client.  The host that this server was 
+ via a telnet client.  The host that this server was
  started on is always allowed to administer the server.
- 
+
  Multiple hosts can be given administrative access to
  this server by listing all the host names separated
  by commas as such:
 
- openejb start --admin-ip 192.168.1.12,joe.foo.com,robert
- 
- The first host in the string names the host explicitly 
- using an IP address (192.168.1.12). 
- 
+ openejb start -Dadmin.
+
+ The first host in the string names the host explicitly
+ using an IP address (192.168.1.12).
+
  The second host in uses a DNS name (joe.foo.com) to refer
- to the hosts IP address.  The DNS name will be resolved 
- and the IP will be added to the admin list. 
- 
+ to the hosts IP address.  The DNS name will be resolved
+ and the IP will be added to the admin list.
+
  The third address refers to a the host by a name (robert)
  that the opperating system is able to resolve into a valid
  IP address.  This is usually done via a hosts file, interal
- DNS server, or Windows Domain Server. 
+ DNS server, or Windows Domain Server.
 
-Example: --local-copy
 
- openejb start --local-copy=true
-            
- Instructs the container system to marshal (ie, copy) all
- calls between beans are required by the EJB 1.1 specification.  
- 
- openejb start --local-copy=false
- 
- Instructs the container system to not marshal (copy) calls 
- between beans. The container system as will pass parameters 
- and return values without copying or marshalling as is 
- required for EJB 2.0 Local interfaces.
-            
+Example: -D<service>.threads=<max>
+
+ openejb start -Dejbd.threads=200
+
+ Sets the max number of concurrent threads that can enter the
+ EJBd Server Service to 200.
+
+
+Example: -D<service>.disabled=<true/false>
+
+ openejb start -Dtelnet.disabled=true
+
+ Prevents the Telnet Server Service from starting when the
+ OpenEJB Server starts.
+
+
 Bug Reports to <[email protected]>

Modified: trunk/openejb1/modules/core/src/META-INF/org.openejb.cli/start.help (2505 => 2506)

--- trunk/openejb1/modules/core/src/META-INF/org.openejb.cli/start.help	2006-02-25 05:31:23 UTC (rev 2505)
+++ trunk/openejb1/modules/core/src/META-INF/org.openejb.cli/start.help	2006-02-25 07:10:56 UTC (rev 2506)
@@ -11,16 +11,7 @@
 let you know something may not work as you expected it.
 
 OPTIONS
- -h host    Binds the Remote Server to the specified host address.     
-            Default host address is 127.0.0.1.
-  
- -p port    Binds the Remote Server to the specified port. 
-            Default port is 4201.
-  
- -t int     Sets the number of concurrent threads the Remote 
-            server should use to service requests from clients.
-            Default number of threads is 20.
-  
+
  -d dir     Sets the OPENEJB_HOME to the specified directory.
 
  -l file    Sets the log4j configuration to the specified file.
@@ -33,9 +24,6 @@
 
  -examples  Show examples of how to use the options.
 
- --admin-ip A comma delimited list of hosts and IP addresses that
-            are allowed to administer this server.
-
  --local-copy=[true|false]
             
             When set to true, the container system will marshall
@@ -45,7 +33,32 @@
             values without copying or marshalling as is required
             for EJB 2.0 Local interfaces.  Default is true.
 
+CONFIG OVERRIDES
 
+The following -D are available for each Server Service available,
+such as ejbd, httpejb, admin, webadmin.  Each service has a set
+of standard properties available.  These can be set with the
+format as such:
+
+ -D<service>.<property>=<value>
+
+The following properties are can be configured:
+
+ bind       Binds the service to the specified host address.
+            Default host address is 127.0.0.1.
+
+ port       Binds the service to the specified port.
+            Default port depends on the service.
+
+ threads    Sets the number of concurrent threads the service
+            should use to service requests from clients.
+            Default number of threads is depends on the service.
+
+ only_from  A comma delimited list of hosts and IP addresses that
+            are allowed to administer this server.
+
+ disabled   When set to "true" ensures the serivce is not started.
+
 See http://www.openejb.org/remote-server.html for more information.
 
 OpenEJB -- EJB Container System and EJB Server.

Modified: trunk/openejb1/modules/core/src/java/org/openejb/cli/Main.java (2505 => 2506)

--- trunk/openejb1/modules/core/src/java/org/openejb/cli/Main.java	2006-02-25 05:31:23 UTC (rev 2505)
+++ trunk/openejb1/modules/core/src/java/org/openejb/cli/Main.java	2006-02-25 07:10:56 UTC (rev 2506)
@@ -68,11 +68,12 @@
         ArrayList argsList = new ArrayList();
 
         for (int i = 0; i < args.length; i++) {
-            if (args[i].indexOf("-D") == -1) {
-                argsList.add(args[i]);
+            String arg = args[i];
+            if (arg.indexOf("-D") == -1) {
+                argsList.add(arg);
             } else {
-                String prop = args[i].substring(args[i].indexOf("-D") + 2, args[i].indexOf("="));
-                String val = args[i].substring(args[i].indexOf("=") + 1);
+                String prop = arg.substring(arg.indexOf("-D") + 2, arg.indexOf("="));
+                String val = arg.substring(arg.indexOf("=") + 1);
 
                 System.setProperty(prop, val);
             }

Modified: trunk/openejb1/modules/core/src/java/org/openejb/server/ServiceManager.java (2505 => 2506)

--- trunk/openejb1/modules/core/src/java/org/openejb/server/ServiceManager.java	2006-02-25 05:31:23 UTC (rev 2505)
+++ trunk/openejb1/modules/core/src/java/org/openejb/server/ServiceManager.java	2006-02-25 07:10:56 UTC (rev 2506)
@@ -54,7 +54,6 @@
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import java.io.IOException;
-import java.io.OutputStream;
 import java.net.InetAddress;
 import java.util.HashMap;
 import java.util.Properties;
@@ -163,18 +162,6 @@
                 String rawProperties = resourceFinder.findString(interfase.getName() + "/" + name);
                 properties.put(Properties.class, rawProperties);
 
-                // Override with system properties
-                String prefix = name + ".";
-                Properties sysProps = System.getProperties();
-                for (Iterator iterator1 = sysProps.entrySet().iterator(); iterator1.hasNext();) {
-                    Map.Entry entry1 = (Map.Entry) iterator1.next();
-                    String key = (String) entry1.getKey();
-                    String value = (String) entry1.getValue();
-                    if (key.startsWith(prefix)){
-                        key = key.replaceFirst(prefix, "");
-                        properties.setProperty(key, value);
-                    }
-                }
             }
             return services;
         }
@@ -233,6 +220,7 @@
     private void overrideProperties(String serviceName, Properties serviceProperties) throws IOException {
         FileUtils base = SystemInstance.get().getBase();
 
+        // Override with file from conf dir
         File conf = base.getDirectory("conf");
         if (conf.exists()) {
             File serviceConfig = new File(conf, serviceName + ".properties");
@@ -253,13 +241,27 @@
                 }
             }
         }
+
+        // Override with system properties
+        String prefix = serviceName + ".";
+        Properties sysProps = System.getProperties();
+        for (Iterator iterator1 = sysProps.entrySet().iterator(); iterator1.hasNext();) {
+            Map.Entry entry1 = (Map.Entry) iterator1.next();
+            String key = (String) entry1.getKey();
+            String value = (String) entry1.getValue();
+            if (key.startsWith(prefix)){
+                key = key.replaceFirst(prefix, "");
+                serviceProperties.setProperty(key, value);
+            }
+        }
+
     }
 
     private boolean isEnabled(Properties props) throws ServiceException {
         // if it should be started, continue
-        String dissabled = props.getProperty("dissabled", "");
+        String disabled = props.getProperty("disabled", "");
 
-        if (dissabled.equalsIgnoreCase("yes") || dissabled.equalsIgnoreCase("true")) {
+        if (disabled.equalsIgnoreCase("yes") || disabled.equalsIgnoreCase("true")) {
             return false;
         } else {
             return true;

Reply via email to