You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by di...@apache.org on 2007/06/16 07:42:04 UTC

svn commit: r547870 - in /webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2: engine/AxisServer.java transport/SimpleAxis2Server.java

Author: dims
Date: Fri Jun 15 22:42:03 2007
New Revision: 547870

URL: http://svn.apache.org/viewvc?view=rev&rev=547870
Log:
back out all my changes as per -1 from deepal (http://marc.info/?l=axis-cvs&m=118196353513373&w=2)

Modified:
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisServer.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/SimpleAxis2Server.java

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisServer.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisServer.java?view=diff&rev=547870&r1=547869&r2=547870
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisServer.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisServer.java Fri Jun 15 22:42:03 2007
@@ -29,37 +29,17 @@
  */
 public class AxisServer {
 
-    protected ConfigurationContext configContext;
-    protected ListenerManager listenerManager;
-    private boolean startOnDeploy;
-    private boolean started = false;
-
-    /**
-     * @param startOnDeploy - Should the server be started automatically when the first service is deployed
-     * @throws Exception
-     */
-    public AxisServer(boolean startOnDeploy) throws Exception {
-        this.startOnDeploy = startOnDeploy;
-    }
-
-    /**
-     * Users extending this class can override this method to supply a custom ConfigurationContext
-     * @return
-     * @throws AxisFault
-     */
-    protected ConfigurationContext createDefaultConfigurationContext() throws AxisFault {
-        return ConfigurationContextFactory.createConfigurationContextFromFileSystem(null);
-    }
+    private ConfigurationContext configContext;
 
     /**
      * Will create a configuration context from the avialable data and then it
      * will start the listener manager
      * @throws AxisFault if something went wrong
      */
-    public void start()throws AxisFault {
-        listenerManager = new ListenerManager();
-        listenerManager.startSystem(getConfigurationContext());
-        started = true;
+    public void strat()throws AxisFault {
+        configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(null);
+        ListenerManager listenerManager = new ListenerManager();
+        listenerManager.startSystem(configContext);
     }
 
     /**
@@ -68,43 +48,26 @@
      * @throws AxisFault : If something went wrong
      */
     public void deployService(String serviceClassName) throws AxisFault{
-        AxisConfiguration axisConfig = getConfigurationContext().getAxisConfiguration();
+        if(configContext==null){
+            strat();
+        }
+        AxisConfiguration axisConfig = configContext.getAxisConfiguration();
         AxisService service = AxisService.createService(serviceClassName,axisConfig);
         axisConfig.addService(service);
-        if(!started && startOnDeploy){
-            start();
-        }
     }
 
-    /**
-     * Stop the server, automatically terminates the listener manager as well.
-     * @throws AxisFault
-     */
     public void stop() throws AxisFault{
         if(configContext!=null){
             configContext.terminate();
         }
     }
 
-    /**
-     * Creates a default configuration context if one is not set already via setConfigurationContext
-     * 
-     * @return
-     * @throws AxisFault
-     */
-    public ConfigurationContext getConfigurationContext() throws AxisFault {
-        if(configContext == null){
-            configContext = createDefaultConfigurationContext();
-        }
+
+    public ConfigurationContext getConfigContext() {
         return configContext;
     }
 
-    /**
-     * Set the configuration context. Please call this before you call deployService or start method
-     * 
-     * @param configContext
-     */
-    public void setConfigurationContext(ConfigurationContext configContext) {
+    public void setConfigContext(ConfigurationContext configContext) {
         this.configContext = configContext;
     }
 }

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/SimpleAxis2Server.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/SimpleAxis2Server.java?view=diff&rev=547870&r1=547869&r2=547870
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/SimpleAxis2Server.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/SimpleAxis2Server.java Fri Jun 15 22:42:03 2007
@@ -19,12 +19,10 @@
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.ConfigurationContextFactory;
 import org.apache.axis2.engine.ListenerManager;
-import org.apache.axis2.engine.AxisServer;
 import org.apache.axis2.transport.http.SimpleHTTPServer;
 import org.apache.axis2.util.CommandLineOption;
 import org.apache.axis2.util.CommandLineOptionParser;
 import org.apache.axis2.util.OptionsValidator;
-import org.apache.axis2.AxisFault;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -32,7 +30,7 @@
 import java.util.List;
 import java.util.Map;
 
-public class SimpleAxis2Server extends AxisServer {
+public class SimpleAxis2Server {
 
     private static final Log log = LogFactory.getLog(SimpleHTTPServer.class);
 
@@ -40,14 +38,6 @@
 
     public static int DEFAULT_PORT = 8080;
 
-    public SimpleAxis2Server (
-            String repoLocation,
-            String confLocation) throws Exception {
-        super(false);
-        configContext = ConfigurationContextFactory
-                .createConfigurationContextFromFileSystem(repoLocation,
-                        confLocation);
-    }
 
     /**
      * @param args
@@ -92,8 +82,12 @@
         }
 
         try {
-            SimpleAxis2Server server = new SimpleAxis2Server(repoLocation, confLocation);
-            server.start();
+            ConfigurationContext configctx = ConfigurationContextFactory
+                    .createConfigurationContextFromFileSystem(repoLocation,
+                                                              confLocation);
+            ListenerManager listenerManager = new ListenerManager();
+            listenerManager.init(configctx);
+            listenerManager.start();
             log.info("[SimpleAxisServer] Started");
         } catch (Throwable t) {
             log.fatal("[SimpleAxisServer] Shutting down. Error starting SimpleAxisServer", t);



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org


Re: svn commit: r547870 - in /webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2: engine/AxisServer.java transport/SimpleAxis2Server.java

Posted by Davanum Srinivas <da...@gmail.com>.
Due to overwhelming negative reactions associated with my changes to
clean this up, i reverted my changed.

thanks,
dims

On 6/16/07, dims@apache.org <di...@apache.org> wrote:
> Author: dims
> Date: Fri Jun 15 22:42:03 2007
> New Revision: 547870
>
> URL: http://svn.apache.org/viewvc?view=rev&rev=547870
> Log:
> back out all my changes as per -1 from deepal (http://marc.info/?l=axis-cvs&m=118196353513373&w=2)
>
> Modified:
>     webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisServer.java
>     webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/SimpleAxis2Server.java
>
> Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisServer.java
> URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisServer.java?view=diff&rev=547870&r1=547869&r2=547870
> ==============================================================================
> --- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisServer.java (original)
> +++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisServer.java Fri Jun 15 22:42:03 2007
> @@ -29,37 +29,17 @@
>   */
>  public class AxisServer {
>
> -    protected ConfigurationContext configContext;
> -    protected ListenerManager listenerManager;
> -    private boolean startOnDeploy;
> -    private boolean started = false;
> -
> -    /**
> -     * @param startOnDeploy - Should the server be started automatically when the first service is deployed
> -     * @throws Exception
> -     */
> -    public AxisServer(boolean startOnDeploy) throws Exception {
> -        this.startOnDeploy = startOnDeploy;
> -    }
> -
> -    /**
> -     * Users extending this class can override this method to supply a custom ConfigurationContext
> -     * @return
> -     * @throws AxisFault
> -     */
> -    protected ConfigurationContext createDefaultConfigurationContext() throws AxisFault {
> -        return ConfigurationContextFactory.createConfigurationContextFromFileSystem(null);
> -    }
> +    private ConfigurationContext configContext;
>
>      /**
>       * Will create a configuration context from the avialable data and then it
>       * will start the listener manager
>       * @throws AxisFault if something went wrong
>       */
> -    public void start()throws AxisFault {
> -        listenerManager = new ListenerManager();
> -        listenerManager.startSystem(getConfigurationContext());
> -        started = true;
> +    public void strat()throws AxisFault {
> +        configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(null);
> +        ListenerManager listenerManager = new ListenerManager();
> +        listenerManager.startSystem(configContext);
>      }
>
>      /**
> @@ -68,43 +48,26 @@
>       * @throws AxisFault : If something went wrong
>       */
>      public void deployService(String serviceClassName) throws AxisFault{
> -        AxisConfiguration axisConfig = getConfigurationContext().getAxisConfiguration();
> +        if(configContext==null){
> +            strat();
> +        }
> +        AxisConfiguration axisConfig = configContext.getAxisConfiguration();
>          AxisService service = AxisService.createService(serviceClassName,axisConfig);
>          axisConfig.addService(service);
> -        if(!started && startOnDeploy){
> -            start();
> -        }
>      }
>
> -    /**
> -     * Stop the server, automatically terminates the listener manager as well.
> -     * @throws AxisFault
> -     */
>      public void stop() throws AxisFault{
>          if(configContext!=null){
>              configContext.terminate();
>          }
>      }
>
> -    /**
> -     * Creates a default configuration context if one is not set already via setConfigurationContext
> -     *
> -     * @return
> -     * @throws AxisFault
> -     */
> -    public ConfigurationContext getConfigurationContext() throws AxisFault {
> -        if(configContext == null){
> -            configContext = createDefaultConfigurationContext();
> -        }
> +
> +    public ConfigurationContext getConfigContext() {
>          return configContext;
>      }
>
> -    /**
> -     * Set the configuration context. Please call this before you call deployService or start method
> -     *
> -     * @param configContext
> -     */
> -    public void setConfigurationContext(ConfigurationContext configContext) {
> +    public void setConfigContext(ConfigurationContext configContext) {
>          this.configContext = configContext;
>      }
>  }
>
> Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/SimpleAxis2Server.java
> URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/SimpleAxis2Server.java?view=diff&rev=547870&r1=547869&r2=547870
> ==============================================================================
> --- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/SimpleAxis2Server.java (original)
> +++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/SimpleAxis2Server.java Fri Jun 15 22:42:03 2007
> @@ -19,12 +19,10 @@
>  import org.apache.axis2.context.ConfigurationContext;
>  import org.apache.axis2.context.ConfigurationContextFactory;
>  import org.apache.axis2.engine.ListenerManager;
> -import org.apache.axis2.engine.AxisServer;
>  import org.apache.axis2.transport.http.SimpleHTTPServer;
>  import org.apache.axis2.util.CommandLineOption;
>  import org.apache.axis2.util.CommandLineOptionParser;
>  import org.apache.axis2.util.OptionsValidator;
> -import org.apache.axis2.AxisFault;
>  import org.apache.commons.logging.Log;
>  import org.apache.commons.logging.LogFactory;
>
> @@ -32,7 +30,7 @@
>  import java.util.List;
>  import java.util.Map;
>
> -public class SimpleAxis2Server extends AxisServer {
> +public class SimpleAxis2Server {
>
>      private static final Log log = LogFactory.getLog(SimpleHTTPServer.class);
>
> @@ -40,14 +38,6 @@
>
>      public static int DEFAULT_PORT = 8080;
>
> -    public SimpleAxis2Server (
> -            String repoLocation,
> -            String confLocation) throws Exception {
> -        super(false);
> -        configContext = ConfigurationContextFactory
> -                .createConfigurationContextFromFileSystem(repoLocation,
> -                        confLocation);
> -    }
>
>      /**
>       * @param args
> @@ -92,8 +82,12 @@
>          }
>
>          try {
> -            SimpleAxis2Server server = new SimpleAxis2Server(repoLocation, confLocation);
> -            server.start();
> +            ConfigurationContext configctx = ConfigurationContextFactory
> +                    .createConfigurationContextFromFileSystem(repoLocation,
> +                                                              confLocation);
> +            ListenerManager listenerManager = new ListenerManager();
> +            listenerManager.init(configctx);
> +            listenerManager.start();
>              log.info("[SimpleAxisServer] Started");
>          } catch (Throwable t) {
>              log.fatal("[SimpleAxisServer] Shutting down. Error starting SimpleAxisServer", t);
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-cvs-help@ws.apache.org
>
>


-- 
Davanum Srinivas :: http://davanum.wordpress.com

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org