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 04:46:16 UTC

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

Author: dims
Date: Fri Jun 15 19:46:15 2007
New Revision: 547848

URL: http://svn.apache.org/viewvc?view=rev&rev=547848
Log:
- Actually use the AxisServer somewhere relevent :)
- No, i would not want to start as a side effect of a deployService
- Make configContext protected so that folks can easily extend the class
- Add a createDefaultConfigurationContext for easy extensibility as well 
- Don't use short cuts in method names.
- getConfigurationContext creates one using createDefaultConfigurationContext if configContext is null.


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=547848&r1=547847&r2=547848
==============================================================================
--- 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 19:46:15 2007
@@ -29,7 +29,15 @@
  */
 public class AxisServer {
 
-    private ConfigurationContext configContext;
+    protected ConfigurationContext configContext;
+    protected ListenerManager listenerManager;
+
+    public AxisServer() throws Exception {
+    }
+
+    protected ConfigurationContext createDefaultConfigurationContext() throws AxisFault {
+        return ConfigurationContextFactory.createConfigurationContextFromFileSystem(null);
+    }
 
     /**
      * Will create a configuration context from the avialable data and then it
@@ -37,9 +45,8 @@
      * @throws AxisFault if something went wrong
      */
     public void start()throws AxisFault {
-        configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(null);
-        ListenerManager listenerManager = new ListenerManager();
-        listenerManager.startSystem(configContext);
+        listenerManager = new ListenerManager();
+        listenerManager.startSystem(getConfigurationContext());
     }
 
     /**
@@ -48,10 +55,7 @@
      * @throws AxisFault : If something went wrong
      */
     public void deployService(String serviceClassName) throws AxisFault{
-        if(configContext==null){
-            start();
-        }
-        AxisConfiguration axisConfig = configContext.getAxisConfiguration();
+        AxisConfiguration axisConfig = getConfigurationContext().getAxisConfiguration();
         AxisService service = AxisService.createService(serviceClassName,axisConfig);
         axisConfig.addService(service);
     }
@@ -62,12 +66,25 @@
         }
     }
 
-
-    public ConfigurationContext getConfigContext() {
+    /**
+     * 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();
+        }
         return configContext;
     }
 
-    public void setConfigContext(ConfigurationContext configContext) {
+    /**
+     * Set the configuration context. Please call this before you call deployService or start method
+     * 
+     * @param configContext
+     */
+    public void setConfigurationContext(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=547848&r1=547847&r2=547848
==============================================================================
--- 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 19:46:15 2007
@@ -19,10 +19,12 @@
 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;
 
@@ -30,7 +32,7 @@
 import java.util.List;
 import java.util.Map;
 
-public class SimpleAxis2Server {
+public class SimpleAxis2Server extends AxisServer {
 
     private static final Log log = LogFactory.getLog(SimpleHTTPServer.class);
 
@@ -38,6 +40,13 @@
 
     public static int DEFAULT_PORT = 8080;
 
+    public SimpleAxis2Server (
+            String repoLocation,
+            String confLocation) throws Exception {
+       configContext = ConfigurationContextFactory
+                    .createConfigurationContextFromFileSystem(repoLocation,
+                                                              confLocation);
+    }
 
     /**
      * @param args
@@ -82,12 +91,8 @@
         }
 
         try {
-            ConfigurationContext configctx = ConfigurationContextFactory
-                    .createConfigurationContextFromFileSystem(repoLocation,
-                                                              confLocation);
-            ListenerManager listenerManager = new ListenerManager();
-            listenerManager.init(configctx);
-            listenerManager.start();
+            SimpleAxis2Server server = new SimpleAxis2Server(repoLocation, confLocation);
+            server.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: r547848 - in /webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2: engine/AxisServer.java transport/SimpleAxis2Server.java

Posted by Deepal Jayasinghe <de...@opensource.lk>.
> What's the complication 2 lines instead of one? can we rename start to
> something else then? and not make it a public method?
+1

Actually I wanted start method to be private , but unfortunately I have
committed the code with public method.

Thanks
Deepal


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


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

Posted by Davanum Srinivas <da...@gmail.com>.
What's the complication 2 lines instead of one? can we rename start to
something else then? and not make it a public method?

-- dims

On 6/15/07, Deepal Jayasinghe <de...@opensource.lk> wrote:
> Hi dims,
>
> He still can do that , when he call deployService in the first time it
> will create configuration and keep that inside that , and when someone
> call deployService second time , since the configuration context is
> there it wont create a new one and will use the old one. So we can keep
> on adding service  w,o having any problem ,b4 committing the code I
> called that method two times and add two services.
>
> So PLEASE ,  PLEASE do not make this simple thing too complicated , keep
> the deployService method as it is.
>
> Thanks
> Deepal
>
> > Deepal,
> >
> > What if someone wants to deploy 2 services?
> >
> > thanks,
> > dims
> >
> > On 6/15/07, Deepal Jayasinghe <de...@opensource.lk> wrote:
> >> Hi Dims,
> >>
> >> Why did you do this change  , now if I want to deploy the service how
> >> many additional step I have to do  , why dont we make this simple as
> >> possible. The whole idea of this class is to make the simple case so
> >> simple. So as we had before , when some one call deployService , if the
> >> service is not running pls start that else just deploy the service.
> >>
> >> As I can see now we have make the simple thing too complicated , what I
> >> really wanted was the following and that is why I introduced the class.
> >>
> >> *new AxisServer().deployService("className");
> >>
> >> *I am ok with the following changes , since is it the right thing
> >>
> >> public void start()throws AxisFault {
> >>       listenerManager = new ListenerManager();
> >>       listenerManager.startSystem(getConfigurationContext());
> >> }
> >>
> >>
> >>  public ConfigurationContext getConfigurationContext() throws
> >> AxisFault {
> >>         if(configContext == null){
> >>             configContext = createDefaultConfigurationContext();
> >>         }
> >>          return configContext;
> >>   }
> >>
> >>
> >> ButI am -1 on the other changes to AxisServer , specially removing
> >> start method from the deployService()
> >>
> >> *
> >> *Thanks
> >> Deepal
> >>
> >> > Author: dims
> >> > Date: Fri Jun 15 19:46:15 2007
> >> > New Revision: 547848
> >> >
> >> > URL: http://svn.apache.org/viewvc?view=rev&rev=547848
> >> > Log:
> >> > - Actually use the AxisServer somewhere relevent :)
> >> > - No, i would not want to start as a side effect of a deployService
> >> > - Make configContext protected so that folks can easily extend the
> >> class
> >> > - Add a createDefaultConfigurationContext for easy extensibility as
> >> well
> >> > - Don't use short cuts in method names.
> >> > - getConfigurationContext creates one using
> >> createDefaultConfigurationContext if configContext is null.
> >> >
> >> >
> >> > 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=547848&r1=547847&r2=547848
> >>
> >> >
> >> ==============================================================================
> >>
> >> > ---
> >> 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 19:46:15 2007
> >> > @@ -29,7 +29,15 @@
> >> >   */
> >> >  public class AxisServer {
> >> >
> >> > -    private ConfigurationContext configContext;
> >> > +    protected ConfigurationContext configContext;
> >> > +    protected ListenerManager listenerManager;
> >> > +
> >> > +    public AxisServer() throws Exception {
> >> > +    }
> >> > +
> >> > +    protected ConfigurationContext
> >> createDefaultConfigurationContext() throws AxisFault {
> >> > +        return
> >> ConfigurationContextFactory.createConfigurationContextFromFileSystem(null);
> >>
> >> > +    }
> >> >
> >> >      /**
> >> >       * Will create a configuration context from the avialable data
> >> and then it
> >> > @@ -37,9 +45,8 @@
> >> >       * @throws AxisFault if something went wrong
> >> >       */
> >> >      public void start()throws AxisFault {
> >> > -        configContext =
> >> ConfigurationContextFactory.createConfigurationContextFromFileSystem(null);
> >>
> >> > -        ListenerManager listenerManager = new ListenerManager();
> >> > -        listenerManager.startSystem(configContext);
> >> > +        listenerManager = new ListenerManager();
> >> > +        listenerManager.startSystem(getConfigurationContext());
> >> >      }
> >> >
> >> >      /**
> >> > @@ -48,10 +55,7 @@
> >> >       * @throws AxisFault : If something went wrong
> >> >       */
> >> >      public void deployService(String serviceClassName) throws
> >> AxisFault{
> >> > -        if(configContext==null){
> >> > -            start();
> >> > -        }
> >> > -        AxisConfiguration axisConfig =
> >> configContext.getAxisConfiguration();
> >> > +        AxisConfiguration axisConfig =
> >> getConfigurationContext().getAxisConfiguration();
> >> >          AxisService service =
> >> AxisService.createService(serviceClassName,axisConfig);
> >> >          axisConfig.addService(service);
> >> >      }
> >> > @@ -62,12 +66,25 @@
> >> >          }
> >> >      }
> >> >
> >> > -
> >> > -    public ConfigurationContext getConfigContext() {
> >> > +    /**
> >> > +     * 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();
> >> > +        }
> >> >          return configContext;
> >> >      }
> >> >
> >> > -    public void setConfigContext(ConfigurationContext
> >> configContext) {
> >> > +    /**
> >> > +     * Set the configuration context. Please call this before you
> >> call deployService or start method
> >> > +     *
> >> > +     * @param configContext
> >> > +     */
> >> > +    public void setConfigurationContext(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=547848&r1=547847&r2=547848
> >>
> >> >
> >> ==============================================================================
> >>
> >> > ---
> >> 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 19:46:15 2007
> >> > @@ -19,10 +19,12 @@
> >> >  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;
> >> >
> >> > @@ -30,7 +32,7 @@
> >> >  import java.util.List;
> >> >  import java.util.Map;
> >> >
> >> > -public class SimpleAxis2Server {
> >> > +public class SimpleAxis2Server extends AxisServer {
> >> >
> >> >      private static final Log log =
> >> LogFactory.getLog(SimpleHTTPServer.class);
> >> >
> >> > @@ -38,6 +40,13 @@
> >> >
> >> >      public static int DEFAULT_PORT = 8080;
> >> >
> >> > +    public SimpleAxis2Server (
> >> > +            String repoLocation,
> >> > +            String confLocation) throws Exception {
> >> > +       configContext = ConfigurationContextFactory
> >> > +
> >> .createConfigurationContextFromFileSystem(repoLocation,
> >> > +
> >> confLocation);
> >> > +    }
> >> >
> >> >      /**
> >> >       * @param args
> >> > @@ -82,12 +91,8 @@
> >> >          }
> >> >
> >> >          try {
> >> > -            ConfigurationContext configctx =
> >> ConfigurationContextFactory
> >> > -
> >> .createConfigurationContextFromFileSystem(repoLocation,
> >> > -
> >> confLocation);
> >> > -            ListenerManager listenerManager = new ListenerManager();
> >> > -            listenerManager.init(configctx);
> >> > -            listenerManager.start();
> >> > +            SimpleAxis2Server server = new
> >> SimpleAxis2Server(repoLocation, confLocation);
> >> > +            server.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
> >> >
> >> >
> >> >
> >> >
> >>
> >> --
> >> Thanks,
> >> Deepal
> >> ................................................................
> >> "The highest tower is built one brick at a time"
> >>
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
> >> For additional commands, e-mail: axis-cvs-help@ws.apache.org
> >>
> >>
> >
> >
>
> --
> Thanks,
> Deepal
> ................................................................
> "The highest tower is built one brick at a time"
>
>
>
> ---------------------------------------------------------------------
> 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


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

Posted by Deepal Jayasinghe <de...@opensource.lk>.
Hi dims,

He still can do that , when he call deployService in the first time it
will create configuration and keep that inside that , and when someone
call deployService second time , since the configuration context is
there it wont create a new one and will use the old one. So we can keep
on adding service  w,o having any problem ,b4 committing the code I
called that method two times and add two services.

So PLEASE ,  PLEASE do not make this simple thing too complicated , keep
the deployService method as it is.

Thanks
Deepal

> Deepal,
>
> What if someone wants to deploy 2 services?
>
> thanks,
> dims
>
> On 6/15/07, Deepal Jayasinghe <de...@opensource.lk> wrote:
>> Hi Dims,
>>
>> Why did you do this change  , now if I want to deploy the service how
>> many additional step I have to do  , why dont we make this simple as
>> possible. The whole idea of this class is to make the simple case so
>> simple. So as we had before , when some one call deployService , if the
>> service is not running pls start that else just deploy the service.
>>
>> As I can see now we have make the simple thing too complicated , what I
>> really wanted was the following and that is why I introduced the class.
>>
>> *new AxisServer().deployService("className");
>>
>> *I am ok with the following changes , since is it the right thing
>>
>> public void start()throws AxisFault {
>>       listenerManager = new ListenerManager();
>>       listenerManager.startSystem(getConfigurationContext());
>> }
>>
>>
>>  public ConfigurationContext getConfigurationContext() throws
>> AxisFault {
>>         if(configContext == null){
>>             configContext = createDefaultConfigurationContext();
>>         }
>>          return configContext;
>>   }
>>
>>
>> ButI am -1 on the other changes to AxisServer , specially removing
>> start method from the deployService()
>>
>> *
>> *Thanks
>> Deepal
>>
>> > Author: dims
>> > Date: Fri Jun 15 19:46:15 2007
>> > New Revision: 547848
>> >
>> > URL: http://svn.apache.org/viewvc?view=rev&rev=547848
>> > Log:
>> > - Actually use the AxisServer somewhere relevent :)
>> > - No, i would not want to start as a side effect of a deployService
>> > - Make configContext protected so that folks can easily extend the
>> class
>> > - Add a createDefaultConfigurationContext for easy extensibility as
>> well
>> > - Don't use short cuts in method names.
>> > - getConfigurationContext creates one using
>> createDefaultConfigurationContext if configContext is null.
>> >
>> >
>> > 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=547848&r1=547847&r2=547848
>>
>> >
>> ==============================================================================
>>
>> > ---
>> 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 19:46:15 2007
>> > @@ -29,7 +29,15 @@
>> >   */
>> >  public class AxisServer {
>> >
>> > -    private ConfigurationContext configContext;
>> > +    protected ConfigurationContext configContext;
>> > +    protected ListenerManager listenerManager;
>> > +
>> > +    public AxisServer() throws Exception {
>> > +    }
>> > +
>> > +    protected ConfigurationContext
>> createDefaultConfigurationContext() throws AxisFault {
>> > +        return
>> ConfigurationContextFactory.createConfigurationContextFromFileSystem(null);
>>
>> > +    }
>> >
>> >      /**
>> >       * Will create a configuration context from the avialable data
>> and then it
>> > @@ -37,9 +45,8 @@
>> >       * @throws AxisFault if something went wrong
>> >       */
>> >      public void start()throws AxisFault {
>> > -        configContext =
>> ConfigurationContextFactory.createConfigurationContextFromFileSystem(null);
>>
>> > -        ListenerManager listenerManager = new ListenerManager();
>> > -        listenerManager.startSystem(configContext);
>> > +        listenerManager = new ListenerManager();
>> > +        listenerManager.startSystem(getConfigurationContext());
>> >      }
>> >
>> >      /**
>> > @@ -48,10 +55,7 @@
>> >       * @throws AxisFault : If something went wrong
>> >       */
>> >      public void deployService(String serviceClassName) throws
>> AxisFault{
>> > -        if(configContext==null){
>> > -            start();
>> > -        }
>> > -        AxisConfiguration axisConfig =
>> configContext.getAxisConfiguration();
>> > +        AxisConfiguration axisConfig =
>> getConfigurationContext().getAxisConfiguration();
>> >          AxisService service =
>> AxisService.createService(serviceClassName,axisConfig);
>> >          axisConfig.addService(service);
>> >      }
>> > @@ -62,12 +66,25 @@
>> >          }
>> >      }
>> >
>> > -
>> > -    public ConfigurationContext getConfigContext() {
>> > +    /**
>> > +     * 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();
>> > +        }
>> >          return configContext;
>> >      }
>> >
>> > -    public void setConfigContext(ConfigurationContext
>> configContext) {
>> > +    /**
>> > +     * Set the configuration context. Please call this before you
>> call deployService or start method
>> > +     *
>> > +     * @param configContext
>> > +     */
>> > +    public void setConfigurationContext(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=547848&r1=547847&r2=547848
>>
>> >
>> ==============================================================================
>>
>> > ---
>> 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 19:46:15 2007
>> > @@ -19,10 +19,12 @@
>> >  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;
>> >
>> > @@ -30,7 +32,7 @@
>> >  import java.util.List;
>> >  import java.util.Map;
>> >
>> > -public class SimpleAxis2Server {
>> > +public class SimpleAxis2Server extends AxisServer {
>> >
>> >      private static final Log log =
>> LogFactory.getLog(SimpleHTTPServer.class);
>> >
>> > @@ -38,6 +40,13 @@
>> >
>> >      public static int DEFAULT_PORT = 8080;
>> >
>> > +    public SimpleAxis2Server (
>> > +            String repoLocation,
>> > +            String confLocation) throws Exception {
>> > +       configContext = ConfigurationContextFactory
>> > +                   
>> .createConfigurationContextFromFileSystem(repoLocation,
>> > +                                                             
>> confLocation);
>> > +    }
>> >
>> >      /**
>> >       * @param args
>> > @@ -82,12 +91,8 @@
>> >          }
>> >
>> >          try {
>> > -            ConfigurationContext configctx =
>> ConfigurationContextFactory
>> > -                   
>> .createConfigurationContextFromFileSystem(repoLocation,
>> > -                                                             
>> confLocation);
>> > -            ListenerManager listenerManager = new ListenerManager();
>> > -            listenerManager.init(configctx);
>> > -            listenerManager.start();
>> > +            SimpleAxis2Server server = new
>> SimpleAxis2Server(repoLocation, confLocation);
>> > +            server.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
>> >
>> >
>> >
>> >
>>
>> -- 
>> Thanks,
>> Deepal
>> ................................................................
>> "The highest tower is built one brick at a time"
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
>> For additional commands, e-mail: axis-cvs-help@ws.apache.org
>>
>>
>
>

-- 
Thanks,
Deepal
................................................................
"The highest tower is built one brick at a time"



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


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

Posted by Deepal Jayasinghe <de...@opensource.lk>.
Hi dims,

He still can do that , when he call deployService in the first time it
will create configuration and keep that inside that , and when someone
call deployService second time , since the configuration context is
there it wont create a new one and will use the old one. So we can keep
on adding service  w,o having any problem ,b4 committing the code I
called that method two times and add two services.

So PLEASE ,  PLEASE do not make this simple thing too complicated , keep
the deployService method as it is.

Thanks
Deepal

> Deepal,
>
> What if someone wants to deploy 2 services?
>
> thanks,
> dims
>
> On 6/15/07, Deepal Jayasinghe <de...@opensource.lk> wrote:
>> Hi Dims,
>>
>> Why did you do this change  , now if I want to deploy the service how
>> many additional step I have to do  , why dont we make this simple as
>> possible. The whole idea of this class is to make the simple case so
>> simple. So as we had before , when some one call deployService , if the
>> service is not running pls start that else just deploy the service.
>>
>> As I can see now we have make the simple thing too complicated , what I
>> really wanted was the following and that is why I introduced the class.
>>
>> *new AxisServer().deployService("className");
>>
>> *I am ok with the following changes , since is it the right thing
>>
>> public void start()throws AxisFault {
>>       listenerManager = new ListenerManager();
>>       listenerManager.startSystem(getConfigurationContext());
>> }
>>
>>
>>  public ConfigurationContext getConfigurationContext() throws
>> AxisFault {
>>         if(configContext == null){
>>             configContext = createDefaultConfigurationContext();
>>         }
>>          return configContext;
>>   }
>>
>>
>> ButI am -1 on the other changes to AxisServer , specially removing
>> start method from the deployService()
>>
>> *
>> *Thanks
>> Deepal
>>
>> > Author: dims
>> > Date: Fri Jun 15 19:46:15 2007
>> > New Revision: 547848
>> >
>> > URL: http://svn.apache.org/viewvc?view=rev&rev=547848
>> > Log:
>> > - Actually use the AxisServer somewhere relevent :)
>> > - No, i would not want to start as a side effect of a deployService
>> > - Make configContext protected so that folks can easily extend the
>> class
>> > - Add a createDefaultConfigurationContext for easy extensibility as
>> well
>> > - Don't use short cuts in method names.
>> > - getConfigurationContext creates one using
>> createDefaultConfigurationContext if configContext is null.
>> >
>> >
>> > 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=547848&r1=547847&r2=547848
>>
>> >
>> ==============================================================================
>>
>> > ---
>> 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 19:46:15 2007
>> > @@ -29,7 +29,15 @@
>> >   */
>> >  public class AxisServer {
>> >
>> > -    private ConfigurationContext configContext;
>> > +    protected ConfigurationContext configContext;
>> > +    protected ListenerManager listenerManager;
>> > +
>> > +    public AxisServer() throws Exception {
>> > +    }
>> > +
>> > +    protected ConfigurationContext
>> createDefaultConfigurationContext() throws AxisFault {
>> > +        return
>> ConfigurationContextFactory.createConfigurationContextFromFileSystem(null);
>>
>> > +    }
>> >
>> >      /**
>> >       * Will create a configuration context from the avialable data
>> and then it
>> > @@ -37,9 +45,8 @@
>> >       * @throws AxisFault if something went wrong
>> >       */
>> >      public void start()throws AxisFault {
>> > -        configContext =
>> ConfigurationContextFactory.createConfigurationContextFromFileSystem(null);
>>
>> > -        ListenerManager listenerManager = new ListenerManager();
>> > -        listenerManager.startSystem(configContext);
>> > +        listenerManager = new ListenerManager();
>> > +        listenerManager.startSystem(getConfigurationContext());
>> >      }
>> >
>> >      /**
>> > @@ -48,10 +55,7 @@
>> >       * @throws AxisFault : If something went wrong
>> >       */
>> >      public void deployService(String serviceClassName) throws
>> AxisFault{
>> > -        if(configContext==null){
>> > -            start();
>> > -        }
>> > -        AxisConfiguration axisConfig =
>> configContext.getAxisConfiguration();
>> > +        AxisConfiguration axisConfig =
>> getConfigurationContext().getAxisConfiguration();
>> >          AxisService service =
>> AxisService.createService(serviceClassName,axisConfig);
>> >          axisConfig.addService(service);
>> >      }
>> > @@ -62,12 +66,25 @@
>> >          }
>> >      }
>> >
>> > -
>> > -    public ConfigurationContext getConfigContext() {
>> > +    /**
>> > +     * 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();
>> > +        }
>> >          return configContext;
>> >      }
>> >
>> > -    public void setConfigContext(ConfigurationContext
>> configContext) {
>> > +    /**
>> > +     * Set the configuration context. Please call this before you
>> call deployService or start method
>> > +     *
>> > +     * @param configContext
>> > +     */
>> > +    public void setConfigurationContext(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=547848&r1=547847&r2=547848
>>
>> >
>> ==============================================================================
>>
>> > ---
>> 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 19:46:15 2007
>> > @@ -19,10 +19,12 @@
>> >  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;
>> >
>> > @@ -30,7 +32,7 @@
>> >  import java.util.List;
>> >  import java.util.Map;
>> >
>> > -public class SimpleAxis2Server {
>> > +public class SimpleAxis2Server extends AxisServer {
>> >
>> >      private static final Log log =
>> LogFactory.getLog(SimpleHTTPServer.class);
>> >
>> > @@ -38,6 +40,13 @@
>> >
>> >      public static int DEFAULT_PORT = 8080;
>> >
>> > +    public SimpleAxis2Server (
>> > +            String repoLocation,
>> > +            String confLocation) throws Exception {
>> > +       configContext = ConfigurationContextFactory
>> > +                   
>> .createConfigurationContextFromFileSystem(repoLocation,
>> > +                                                             
>> confLocation);
>> > +    }
>> >
>> >      /**
>> >       * @param args
>> > @@ -82,12 +91,8 @@
>> >          }
>> >
>> >          try {
>> > -            ConfigurationContext configctx =
>> ConfigurationContextFactory
>> > -                   
>> .createConfigurationContextFromFileSystem(repoLocation,
>> > -                                                             
>> confLocation);
>> > -            ListenerManager listenerManager = new ListenerManager();
>> > -            listenerManager.init(configctx);
>> > -            listenerManager.start();
>> > +            SimpleAxis2Server server = new
>> SimpleAxis2Server(repoLocation, confLocation);
>> > +            server.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
>> >
>> >
>> >
>> >
>>
>> -- 
>> Thanks,
>> Deepal
>> ................................................................
>> "The highest tower is built one brick at a time"
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
>> For additional commands, e-mail: axis-cvs-help@ws.apache.org
>>
>>
>
>

-- 
Thanks,
Deepal
................................................................
"The highest tower is built one brick at a time"



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


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

Posted by Davanum Srinivas <da...@gmail.com>.
Deepal,

What if someone wants to deploy 2 services?

thanks,
dims

On 6/15/07, Deepal Jayasinghe <de...@opensource.lk> wrote:
> Hi Dims,
>
> Why did you do this change  , now if I want to deploy the service how
> many additional step I have to do  , why dont we make this simple as
> possible. The whole idea of this class is to make the simple case so
> simple. So as we had before , when some one call deployService , if the
> service is not running pls start that else just deploy the service.
>
> As I can see now we have make the simple thing too complicated , what I
> really wanted was the following and that is why I introduced the class.
>
> *new AxisServer().deployService("className");
>
> *I am ok with the following changes , since is it the right thing
>
> public void start()throws AxisFault {
>       listenerManager = new ListenerManager();
>       listenerManager.startSystem(getConfigurationContext());
> }
>
>
>  public ConfigurationContext getConfigurationContext() throws AxisFault {
>         if(configContext == null){
>             configContext = createDefaultConfigurationContext();
>         }
>          return configContext;
>   }
>
>
> ButI am -1 on the other changes to AxisServer , specially removing start method from the deployService()
>
> *
> *Thanks
> Deepal
>
> > Author: dims
> > Date: Fri Jun 15 19:46:15 2007
> > New Revision: 547848
> >
> > URL: http://svn.apache.org/viewvc?view=rev&rev=547848
> > Log:
> > - Actually use the AxisServer somewhere relevent :)
> > - No, i would not want to start as a side effect of a deployService
> > - Make configContext protected so that folks can easily extend the class
> > - Add a createDefaultConfigurationContext for easy extensibility as well
> > - Don't use short cuts in method names.
> > - getConfigurationContext creates one using createDefaultConfigurationContext if configContext is null.
> >
> >
> > 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=547848&r1=547847&r2=547848
> > ==============================================================================
> > --- 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 19:46:15 2007
> > @@ -29,7 +29,15 @@
> >   */
> >  public class AxisServer {
> >
> > -    private ConfigurationContext configContext;
> > +    protected ConfigurationContext configContext;
> > +    protected ListenerManager listenerManager;
> > +
> > +    public AxisServer() throws Exception {
> > +    }
> > +
> > +    protected ConfigurationContext createDefaultConfigurationContext() throws AxisFault {
> > +        return ConfigurationContextFactory.createConfigurationContextFromFileSystem(null);
> > +    }
> >
> >      /**
> >       * Will create a configuration context from the avialable data and then it
> > @@ -37,9 +45,8 @@
> >       * @throws AxisFault if something went wrong
> >       */
> >      public void start()throws AxisFault {
> > -        configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(null);
> > -        ListenerManager listenerManager = new ListenerManager();
> > -        listenerManager.startSystem(configContext);
> > +        listenerManager = new ListenerManager();
> > +        listenerManager.startSystem(getConfigurationContext());
> >      }
> >
> >      /**
> > @@ -48,10 +55,7 @@
> >       * @throws AxisFault : If something went wrong
> >       */
> >      public void deployService(String serviceClassName) throws AxisFault{
> > -        if(configContext==null){
> > -            start();
> > -        }
> > -        AxisConfiguration axisConfig = configContext.getAxisConfiguration();
> > +        AxisConfiguration axisConfig = getConfigurationContext().getAxisConfiguration();
> >          AxisService service = AxisService.createService(serviceClassName,axisConfig);
> >          axisConfig.addService(service);
> >      }
> > @@ -62,12 +66,25 @@
> >          }
> >      }
> >
> > -
> > -    public ConfigurationContext getConfigContext() {
> > +    /**
> > +     * 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();
> > +        }
> >          return configContext;
> >      }
> >
> > -    public void setConfigContext(ConfigurationContext configContext) {
> > +    /**
> > +     * Set the configuration context. Please call this before you call deployService or start method
> > +     *
> > +     * @param configContext
> > +     */
> > +    public void setConfigurationContext(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=547848&r1=547847&r2=547848
> > ==============================================================================
> > --- 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 19:46:15 2007
> > @@ -19,10 +19,12 @@
> >  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;
> >
> > @@ -30,7 +32,7 @@
> >  import java.util.List;
> >  import java.util.Map;
> >
> > -public class SimpleAxis2Server {
> > +public class SimpleAxis2Server extends AxisServer {
> >
> >      private static final Log log = LogFactory.getLog(SimpleHTTPServer.class);
> >
> > @@ -38,6 +40,13 @@
> >
> >      public static int DEFAULT_PORT = 8080;
> >
> > +    public SimpleAxis2Server (
> > +            String repoLocation,
> > +            String confLocation) throws Exception {
> > +       configContext = ConfigurationContextFactory
> > +                    .createConfigurationContextFromFileSystem(repoLocation,
> > +                                                              confLocation);
> > +    }
> >
> >      /**
> >       * @param args
> > @@ -82,12 +91,8 @@
> >          }
> >
> >          try {
> > -            ConfigurationContext configctx = ConfigurationContextFactory
> > -                    .createConfigurationContextFromFileSystem(repoLocation,
> > -                                                              confLocation);
> > -            ListenerManager listenerManager = new ListenerManager();
> > -            listenerManager.init(configctx);
> > -            listenerManager.start();
> > +            SimpleAxis2Server server = new SimpleAxis2Server(repoLocation, confLocation);
> > +            server.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
> >
> >
> >
> >
>
> --
> Thanks,
> Deepal
> ................................................................
> "The highest tower is built one brick at a time"
>
>
>
> ---------------------------------------------------------------------
> 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-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org


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

Posted by Davanum Srinivas <da...@gmail.com>.
Deepal,

What if someone wants to deploy 2 services?

thanks,
dims

On 6/15/07, Deepal Jayasinghe <de...@opensource.lk> wrote:
> Hi Dims,
>
> Why did you do this change  , now if I want to deploy the service how
> many additional step I have to do  , why dont we make this simple as
> possible. The whole idea of this class is to make the simple case so
> simple. So as we had before , when some one call deployService , if the
> service is not running pls start that else just deploy the service.
>
> As I can see now we have make the simple thing too complicated , what I
> really wanted was the following and that is why I introduced the class.
>
> *new AxisServer().deployService("className");
>
> *I am ok with the following changes , since is it the right thing
>
> public void start()throws AxisFault {
>       listenerManager = new ListenerManager();
>       listenerManager.startSystem(getConfigurationContext());
> }
>
>
>  public ConfigurationContext getConfigurationContext() throws AxisFault {
>         if(configContext == null){
>             configContext = createDefaultConfigurationContext();
>         }
>          return configContext;
>   }
>
>
> ButI am -1 on the other changes to AxisServer , specially removing start method from the deployService()
>
> *
> *Thanks
> Deepal
>
> > Author: dims
> > Date: Fri Jun 15 19:46:15 2007
> > New Revision: 547848
> >
> > URL: http://svn.apache.org/viewvc?view=rev&rev=547848
> > Log:
> > - Actually use the AxisServer somewhere relevent :)
> > - No, i would not want to start as a side effect of a deployService
> > - Make configContext protected so that folks can easily extend the class
> > - Add a createDefaultConfigurationContext for easy extensibility as well
> > - Don't use short cuts in method names.
> > - getConfigurationContext creates one using createDefaultConfigurationContext if configContext is null.
> >
> >
> > 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=547848&r1=547847&r2=547848
> > ==============================================================================
> > --- 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 19:46:15 2007
> > @@ -29,7 +29,15 @@
> >   */
> >  public class AxisServer {
> >
> > -    private ConfigurationContext configContext;
> > +    protected ConfigurationContext configContext;
> > +    protected ListenerManager listenerManager;
> > +
> > +    public AxisServer() throws Exception {
> > +    }
> > +
> > +    protected ConfigurationContext createDefaultConfigurationContext() throws AxisFault {
> > +        return ConfigurationContextFactory.createConfigurationContextFromFileSystem(null);
> > +    }
> >
> >      /**
> >       * Will create a configuration context from the avialable data and then it
> > @@ -37,9 +45,8 @@
> >       * @throws AxisFault if something went wrong
> >       */
> >      public void start()throws AxisFault {
> > -        configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(null);
> > -        ListenerManager listenerManager = new ListenerManager();
> > -        listenerManager.startSystem(configContext);
> > +        listenerManager = new ListenerManager();
> > +        listenerManager.startSystem(getConfigurationContext());
> >      }
> >
> >      /**
> > @@ -48,10 +55,7 @@
> >       * @throws AxisFault : If something went wrong
> >       */
> >      public void deployService(String serviceClassName) throws AxisFault{
> > -        if(configContext==null){
> > -            start();
> > -        }
> > -        AxisConfiguration axisConfig = configContext.getAxisConfiguration();
> > +        AxisConfiguration axisConfig = getConfigurationContext().getAxisConfiguration();
> >          AxisService service = AxisService.createService(serviceClassName,axisConfig);
> >          axisConfig.addService(service);
> >      }
> > @@ -62,12 +66,25 @@
> >          }
> >      }
> >
> > -
> > -    public ConfigurationContext getConfigContext() {
> > +    /**
> > +     * 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();
> > +        }
> >          return configContext;
> >      }
> >
> > -    public void setConfigContext(ConfigurationContext configContext) {
> > +    /**
> > +     * Set the configuration context. Please call this before you call deployService or start method
> > +     *
> > +     * @param configContext
> > +     */
> > +    public void setConfigurationContext(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=547848&r1=547847&r2=547848
> > ==============================================================================
> > --- 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 19:46:15 2007
> > @@ -19,10 +19,12 @@
> >  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;
> >
> > @@ -30,7 +32,7 @@
> >  import java.util.List;
> >  import java.util.Map;
> >
> > -public class SimpleAxis2Server {
> > +public class SimpleAxis2Server extends AxisServer {
> >
> >      private static final Log log = LogFactory.getLog(SimpleHTTPServer.class);
> >
> > @@ -38,6 +40,13 @@
> >
> >      public static int DEFAULT_PORT = 8080;
> >
> > +    public SimpleAxis2Server (
> > +            String repoLocation,
> > +            String confLocation) throws Exception {
> > +       configContext = ConfigurationContextFactory
> > +                    .createConfigurationContextFromFileSystem(repoLocation,
> > +                                                              confLocation);
> > +    }
> >
> >      /**
> >       * @param args
> > @@ -82,12 +91,8 @@
> >          }
> >
> >          try {
> > -            ConfigurationContext configctx = ConfigurationContextFactory
> > -                    .createConfigurationContextFromFileSystem(repoLocation,
> > -                                                              confLocation);
> > -            ListenerManager listenerManager = new ListenerManager();
> > -            listenerManager.init(configctx);
> > -            listenerManager.start();
> > +            SimpleAxis2Server server = new SimpleAxis2Server(repoLocation, confLocation);
> > +            server.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
> >
> >
> >
> >
>
> --
> Thanks,
> Deepal
> ................................................................
> "The highest tower is built one brick at a time"
>
>
>
> ---------------------------------------------------------------------
> 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-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org


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

Posted by Deepal Jayasinghe <de...@opensource.lk>.
Hi dims all.,
>
>
> Dims, I think you've made a good point here about -1'ing.  Deepal,
> could you please revert your -1 after the discussion (assuming you're
> OK with AxisServer having the boolean constructor param to allow
> controlling the auto-start)?  I'd really like to see dims' cleanup and
> API addition re-committed.  And all of us in the future should be VERY
> careful about -1's to commits.
>
> I was going to suggest using something like a (VETO) suffix to
> distinguish "conversational" -1s from real vetos, but after some
> thought, the presence of a -1 on a reply to a commit message really
> should be enough, and we should be very aware of the veto power of a
> -1 IN THAT CONTEXT.
>
> So a) Deepal, I for one would like to see your -1 reverted, and 
I will revert my -1 , and I am ok with having parameter to control
whether we need to start the server or not. But please do not enforce to
call the start method.
> b) thanks for the demonstration of what you were really getting at,
> dims. :)
of course .

Thanks
Deeapl


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


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

Posted by Glen Daniels <gl...@thoughtcraft.com>.
(adding axis2 prefix)

>> Does this work for you? please see svn revision 547859.
>>
>> *new AxisServer(true).deployService("className");
>>
> This seems reasonable to me. I have to agree that it would be better
> to explicitly state the conditions in this case.

+1!

Dims, I think you've made a good point here about -1'ing.  Deepal, could 
you please revert your -1 after the discussion (assuming you're OK with 
AxisServer having the boolean constructor param to allow controlling the 
auto-start)?  I'd really like to see dims' cleanup and API addition 
re-committed.  And all of us in the future should be VERY careful about 
-1's to commits.

I was going to suggest using something like a (VETO) suffix to 
distinguish "conversational" -1s from real vetos, but after some 
thought, the presence of a -1 on a reply to a commit message really 
should be enough, and we should be very aware of the veto power of a -1 
IN THAT CONTEXT.

So a) Deepal, I for one would like to see your -1 reverted, and b) 
thanks for the demonstration of what you were really getting at, dims. :)

--Glen

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


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

Posted by Ajith Ranabahu <aj...@gmail.com>.
Hi,
Ok here is a brief explantion of what we discussed during the
hackathon and since it was not extensively recorded in IRC i believe
it will do good to know the thought process and perhaps it will cool
down this heated discussion :)

We were discussing the user guide .The general consensus was that the
current documentation lacks a 'quick starter guide'. Right now one has
to scan through at least 4 pages to get to the first code block which
will be annoying if you are looking to use Axis2 quickly. Most of the
OSS projects (and even products!) tend to have a quick starter guide
which is a one page guide of doing the most common tasks. This is
lacking in Axis2 and we ended up outlining this quick starter guide.
After all the quality matters more than the quantity in this case.

Anyway one important topic that came up in this discussion was the
importance of having simple ways of doing the basic things. So
inspired by Glens shortest possible service deployment testing effort
Deepal wrote this AxisServer. IMO its more of a utility (which
provides a convenience) rather than an API change or a new
functionality addition. If others think it should not be pushed right
now I'm also fine with that but IMHO its a collection of things you
would anyway do to programmatically deploy a service. (Maybe a name
change to something like AxisServerUtility would make it obvious ?)


> Does this work for you? please see svn revision 547859.
>
> *new AxisServer(true).deployService("className");
>
This seems reasonable to me. I have to agree that it would be better
to explicitly state the conditions in this case.


-- 
Ajith Ranabahu

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


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

Posted by Davanum Srinivas <da...@gmail.com>.
Deepal,

Does this work for you? please see svn revision 547859.

*new AxisServer(true).deployService("className");

thanks,
dims

On 6/16/07, Deepal Jayasinghe <de...@opensource.lk> wrote:
> Ok I will give up  :) ,
>
> However this is not the API  what we (the ppl at the hackathon ) wanted
> . We did not want someone to extend the class and do some crazy stuff
> with that. What we really wanted was to provide as much as easy API to
> deploy a service.
>
> If someone want to create a configuration with his data  , he can do so
> by passing system properties (I have mentioned that in the comments ).
>
> If user knows about the repository and configuration context , then he
> can not be simple user , in that case he does not want to use this API.
>
>
> *** Why did I add this simple class, which make a such a war in the
> list  :)  (poor me) **
>
> Thanks
> Deepal
>
> Davanum Srinivas wrote:
> > Deepal,
> >
> > #1: start() has a well known connotation and has to be called after
> > one deploy's all the services that they want. ie deployService can be
> > called multiple times
> > #2: Just look at the API now for AxisServer.
> >     - There are protected variables so that one can easily extend the
> > class
> :)
> >     - There is a createDefaultConfigurationContext which can be
> > overriden to supply the configuration context when one extends this
> > class. Or one can use setConfigurationContext to set it.
> >     - There is a start/stop which can be used to run/stop the AxisServer
> >     - There is a deployService to deploy however many services that
> > needed to be deployed.
> >   What's wrong with the API? Other than the fact that it does not
> > support your one liner?
> Its not simple for me    :)
>
>


-- 
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


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

Posted by Deepal Jayasinghe <de...@opensource.lk>.
Ok I will give up  :) ,

However this is not the API  what we (the ppl at the hackathon ) wanted
. We did not want someone to extend the class and do some crazy stuff
with that. What we really wanted was to provide as much as easy API to
deploy a service.

If someone want to create a configuration with his data  , he can do so
by passing system properties (I have mentioned that in the comments ).

If user knows about the repository and configuration context , then he
can not be simple user , in that case he does not want to use this API.


*** Why did I add this simple class, which make a such a war in the
list  :)  (poor me) **

Thanks
Deepal

Davanum Srinivas wrote:
> Deepal,
>
> #1: start() has a well known connotation and has to be called after
> one deploy's all the services that they want. ie deployService can be
> called multiple times
> #2: Just look at the API now for AxisServer.
>     - There are protected variables so that one can easily extend the
> class
:)
>     - There is a createDefaultConfigurationContext which can be
> overriden to supply the configuration context when one extends this
> class. Or one can use setConfigurationContext to set it.
>     - There is a start/stop which can be used to run/stop the AxisServer
>     - There is a deployService to deploy however many services that
> needed to be deployed.
>   What's wrong with the API? Other than the fact that it does not
> support your one liner?
Its not simple for me    :)


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


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

Posted by Davanum Srinivas <da...@gmail.com>.
Deepal,

#1: start() has a well known connotation and has to be called after
one deploy's all the services that they want. ie deployService can be
called multiple times
#2: Just look at the API now for AxisServer.
     - There are protected variables so that one can easily extend the class
     - There is a createDefaultConfigurationContext which can be
overriden to supply the configuration context when one extends this
class. Or one can use setConfigurationContext to set it.
     - There is a start/stop which can be used to run/stop the AxisServer
     - There is a deployService to deploy however many services that
needed to be deployed.
   What's wrong with the API? Other than the fact that it does not
support your one liner?
#3: Repeating myself, What' the big deal / fixation with this one
liner scenario?

thanks,
dims

On 6/15/07, Deepal Jayasinghe <de...@opensource.lk> wrote:
> Hi Dims,
>
> Why did you do this change  , now if I want to deploy the service how
> many additional step I have to do  , why dont we make this simple as
> possible. The whole idea of this class is to make the simple case so
> simple. So as we had before , when some one call deployService , if the
> service is not running pls start that else just deploy the service.
>
> As I can see now we have make the simple thing too complicated , what I
> really wanted was the following and that is why I introduced the class.
>
> *new AxisServer().deployService("className");
>
> *I am ok with the following changes , since is it the right thing
>
> public void start()throws AxisFault {
>       listenerManager = new ListenerManager();
>       listenerManager.startSystem(getConfigurationContext());
> }
>
>
>  public ConfigurationContext getConfigurationContext() throws AxisFault {
>         if(configContext == null){
>             configContext = createDefaultConfigurationContext();
>         }
>          return configContext;
>   }
>
>
> ButI am -1 on the other changes to AxisServer , specially removing start method from the deployService()
>
> *
> *Thanks
> Deepal
>
> > Author: dims
> > Date: Fri Jun 15 19:46:15 2007
> > New Revision: 547848
> >
> > URL: http://svn.apache.org/viewvc?view=rev&rev=547848
> > Log:
> > - Actually use the AxisServer somewhere relevent :)
> > - No, i would not want to start as a side effect of a deployService
> > - Make configContext protected so that folks can easily extend the class
> > - Add a createDefaultConfigurationContext for easy extensibility as well
> > - Don't use short cuts in method names.
> > - getConfigurationContext creates one using createDefaultConfigurationContext if configContext is null.
> >
> >
> > 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=547848&r1=547847&r2=547848
> > ==============================================================================
> > --- 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 19:46:15 2007
> > @@ -29,7 +29,15 @@
> >   */
> >  public class AxisServer {
> >
> > -    private ConfigurationContext configContext;
> > +    protected ConfigurationContext configContext;
> > +    protected ListenerManager listenerManager;
> > +
> > +    public AxisServer() throws Exception {
> > +    }
> > +
> > +    protected ConfigurationContext createDefaultConfigurationContext() throws AxisFault {
> > +        return ConfigurationContextFactory.createConfigurationContextFromFileSystem(null);
> > +    }
> >
> >      /**
> >       * Will create a configuration context from the avialable data and then it
> > @@ -37,9 +45,8 @@
> >       * @throws AxisFault if something went wrong
> >       */
> >      public void start()throws AxisFault {
> > -        configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(null);
> > -        ListenerManager listenerManager = new ListenerManager();
> > -        listenerManager.startSystem(configContext);
> > +        listenerManager = new ListenerManager();
> > +        listenerManager.startSystem(getConfigurationContext());
> >      }
> >
> >      /**
> > @@ -48,10 +55,7 @@
> >       * @throws AxisFault : If something went wrong
> >       */
> >      public void deployService(String serviceClassName) throws AxisFault{
> > -        if(configContext==null){
> > -            start();
> > -        }
> > -        AxisConfiguration axisConfig = configContext.getAxisConfiguration();
> > +        AxisConfiguration axisConfig = getConfigurationContext().getAxisConfiguration();
> >          AxisService service = AxisService.createService(serviceClassName,axisConfig);
> >          axisConfig.addService(service);
> >      }
> > @@ -62,12 +66,25 @@
> >          }
> >      }
> >
> > -
> > -    public ConfigurationContext getConfigContext() {
> > +    /**
> > +     * 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();
> > +        }
> >          return configContext;
> >      }
> >
> > -    public void setConfigContext(ConfigurationContext configContext) {
> > +    /**
> > +     * Set the configuration context. Please call this before you call deployService or start method
> > +     *
> > +     * @param configContext
> > +     */
> > +    public void setConfigurationContext(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=547848&r1=547847&r2=547848
> > ==============================================================================
> > --- 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 19:46:15 2007
> > @@ -19,10 +19,12 @@
> >  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;
> >
> > @@ -30,7 +32,7 @@
> >  import java.util.List;
> >  import java.util.Map;
> >
> > -public class SimpleAxis2Server {
> > +public class SimpleAxis2Server extends AxisServer {
> >
> >      private static final Log log = LogFactory.getLog(SimpleHTTPServer.class);
> >
> > @@ -38,6 +40,13 @@
> >
> >      public static int DEFAULT_PORT = 8080;
> >
> > +    public SimpleAxis2Server (
> > +            String repoLocation,
> > +            String confLocation) throws Exception {
> > +       configContext = ConfigurationContextFactory
> > +                    .createConfigurationContextFromFileSystem(repoLocation,
> > +                                                              confLocation);
> > +    }
> >
> >      /**
> >       * @param args
> > @@ -82,12 +91,8 @@
> >          }
> >
> >          try {
> > -            ConfigurationContext configctx = ConfigurationContextFactory
> > -                    .createConfigurationContextFromFileSystem(repoLocation,
> > -                                                              confLocation);
> > -            ListenerManager listenerManager = new ListenerManager();
> > -            listenerManager.init(configctx);
> > -            listenerManager.start();
> > +            SimpleAxis2Server server = new SimpleAxis2Server(repoLocation, confLocation);
> > +            server.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
> >
> >
> >
> >
>
> --
> Thanks,
> Deepal
> ................................................................
> "The highest tower is built one brick at a time"
>
>
>
> ---------------------------------------------------------------------
> 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


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

Posted by Deepal Jayasinghe <de...@opensource.lk>.
Hi Dims,

Why did you do this change  , now if I want to deploy the service how
many additional step I have to do  , why dont we make this simple as
possible. The whole idea of this class is to make the simple case so
simple. So as we had before , when some one call deployService , if the
service is not running pls start that else just deploy the service.

As I can see now we have make the simple thing too complicated , what I
really wanted was the following and that is why I introduced the class.

*new AxisServer().deployService("className");

*I am ok with the following changes , since is it the right thing

public void start()throws AxisFault {
      listenerManager = new ListenerManager();
      listenerManager.startSystem(getConfigurationContext());
}


 public ConfigurationContext getConfigurationContext() throws AxisFault {
        if(configContext == null){
            configContext = createDefaultConfigurationContext();
        }
         return configContext;
  }


ButI am -1 on the other changes to AxisServer , specially removing start method from the deployService() 

*
*Thanks
Deepal

> Author: dims
> Date: Fri Jun 15 19:46:15 2007
> New Revision: 547848
>
> URL: http://svn.apache.org/viewvc?view=rev&rev=547848
> Log:
> - Actually use the AxisServer somewhere relevent :)
> - No, i would not want to start as a side effect of a deployService
> - Make configContext protected so that folks can easily extend the class
> - Add a createDefaultConfigurationContext for easy extensibility as well 
> - Don't use short cuts in method names.
> - getConfigurationContext creates one using createDefaultConfigurationContext if configContext is null.
>
>
> 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=547848&r1=547847&r2=547848
> ==============================================================================
> --- 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 19:46:15 2007
> @@ -29,7 +29,15 @@
>   */
>  public class AxisServer {
>  
> -    private ConfigurationContext configContext;
> +    protected ConfigurationContext configContext;
> +    protected ListenerManager listenerManager;
> +
> +    public AxisServer() throws Exception {
> +    }
> +
> +    protected ConfigurationContext createDefaultConfigurationContext() throws AxisFault {
> +        return ConfigurationContextFactory.createConfigurationContextFromFileSystem(null);
> +    }
>  
>      /**
>       * Will create a configuration context from the avialable data and then it
> @@ -37,9 +45,8 @@
>       * @throws AxisFault if something went wrong
>       */
>      public void start()throws AxisFault {
> -        configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(null);
> -        ListenerManager listenerManager = new ListenerManager();
> -        listenerManager.startSystem(configContext);
> +        listenerManager = new ListenerManager();
> +        listenerManager.startSystem(getConfigurationContext());
>      }
>  
>      /**
> @@ -48,10 +55,7 @@
>       * @throws AxisFault : If something went wrong
>       */
>      public void deployService(String serviceClassName) throws AxisFault{
> -        if(configContext==null){
> -            start();
> -        }
> -        AxisConfiguration axisConfig = configContext.getAxisConfiguration();
> +        AxisConfiguration axisConfig = getConfigurationContext().getAxisConfiguration();
>          AxisService service = AxisService.createService(serviceClassName,axisConfig);
>          axisConfig.addService(service);
>      }
> @@ -62,12 +66,25 @@
>          }
>      }
>  
> -
> -    public ConfigurationContext getConfigContext() {
> +    /**
> +     * 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();
> +        }
>          return configContext;
>      }
>  
> -    public void setConfigContext(ConfigurationContext configContext) {
> +    /**
> +     * Set the configuration context. Please call this before you call deployService or start method
> +     * 
> +     * @param configContext
> +     */
> +    public void setConfigurationContext(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=547848&r1=547847&r2=547848
> ==============================================================================
> --- 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 19:46:15 2007
> @@ -19,10 +19,12 @@
>  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;
>  
> @@ -30,7 +32,7 @@
>  import java.util.List;
>  import java.util.Map;
>  
> -public class SimpleAxis2Server {
> +public class SimpleAxis2Server extends AxisServer {
>  
>      private static final Log log = LogFactory.getLog(SimpleHTTPServer.class);
>  
> @@ -38,6 +40,13 @@
>  
>      public static int DEFAULT_PORT = 8080;
>  
> +    public SimpleAxis2Server (
> +            String repoLocation,
> +            String confLocation) throws Exception {
> +       configContext = ConfigurationContextFactory
> +                    .createConfigurationContextFromFileSystem(repoLocation,
> +                                                              confLocation);
> +    }
>  
>      /**
>       * @param args
> @@ -82,12 +91,8 @@
>          }
>  
>          try {
> -            ConfigurationContext configctx = ConfigurationContextFactory
> -                    .createConfigurationContextFromFileSystem(repoLocation,
> -                                                              confLocation);
> -            ListenerManager listenerManager = new ListenerManager();
> -            listenerManager.init(configctx);
> -            listenerManager.start();
> +            SimpleAxis2Server server = new SimpleAxis2Server(repoLocation, confLocation);
> +            server.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
>
>
>
>   

-- 
Thanks,
Deepal
................................................................
"The highest tower is built one brick at a time"



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


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

Posted by Deepal Jayasinghe <de...@opensource.lk>.
Hi Dims,

Why did you do this change  , now if I want to deploy the service how
many additional step I have to do  , why dont we make this simple as
possible. The whole idea of this class is to make the simple case so
simple. So as we had before , when some one call deployService , if the
service is not running pls start that else just deploy the service.

As I can see now we have make the simple thing too complicated , what I
really wanted was the following and that is why I introduced the class.

*new AxisServer().deployService("className");

*I am ok with the following changes , since is it the right thing

public void start()throws AxisFault {
      listenerManager = new ListenerManager();
      listenerManager.startSystem(getConfigurationContext());
}


 public ConfigurationContext getConfigurationContext() throws AxisFault {
        if(configContext == null){
            configContext = createDefaultConfigurationContext();
        }
         return configContext;
  }


ButI am -1 on the other changes to AxisServer , specially removing start method from the deployService() 

*
*Thanks
Deepal

> Author: dims
> Date: Fri Jun 15 19:46:15 2007
> New Revision: 547848
>
> URL: http://svn.apache.org/viewvc?view=rev&rev=547848
> Log:
> - Actually use the AxisServer somewhere relevent :)
> - No, i would not want to start as a side effect of a deployService
> - Make configContext protected so that folks can easily extend the class
> - Add a createDefaultConfigurationContext for easy extensibility as well 
> - Don't use short cuts in method names.
> - getConfigurationContext creates one using createDefaultConfigurationContext if configContext is null.
>
>
> 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=547848&r1=547847&r2=547848
> ==============================================================================
> --- 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 19:46:15 2007
> @@ -29,7 +29,15 @@
>   */
>  public class AxisServer {
>  
> -    private ConfigurationContext configContext;
> +    protected ConfigurationContext configContext;
> +    protected ListenerManager listenerManager;
> +
> +    public AxisServer() throws Exception {
> +    }
> +
> +    protected ConfigurationContext createDefaultConfigurationContext() throws AxisFault {
> +        return ConfigurationContextFactory.createConfigurationContextFromFileSystem(null);
> +    }
>  
>      /**
>       * Will create a configuration context from the avialable data and then it
> @@ -37,9 +45,8 @@
>       * @throws AxisFault if something went wrong
>       */
>      public void start()throws AxisFault {
> -        configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(null);
> -        ListenerManager listenerManager = new ListenerManager();
> -        listenerManager.startSystem(configContext);
> +        listenerManager = new ListenerManager();
> +        listenerManager.startSystem(getConfigurationContext());
>      }
>  
>      /**
> @@ -48,10 +55,7 @@
>       * @throws AxisFault : If something went wrong
>       */
>      public void deployService(String serviceClassName) throws AxisFault{
> -        if(configContext==null){
> -            start();
> -        }
> -        AxisConfiguration axisConfig = configContext.getAxisConfiguration();
> +        AxisConfiguration axisConfig = getConfigurationContext().getAxisConfiguration();
>          AxisService service = AxisService.createService(serviceClassName,axisConfig);
>          axisConfig.addService(service);
>      }
> @@ -62,12 +66,25 @@
>          }
>      }
>  
> -
> -    public ConfigurationContext getConfigContext() {
> +    /**
> +     * 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();
> +        }
>          return configContext;
>      }
>  
> -    public void setConfigContext(ConfigurationContext configContext) {
> +    /**
> +     * Set the configuration context. Please call this before you call deployService or start method
> +     * 
> +     * @param configContext
> +     */
> +    public void setConfigurationContext(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=547848&r1=547847&r2=547848
> ==============================================================================
> --- 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 19:46:15 2007
> @@ -19,10 +19,12 @@
>  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;
>  
> @@ -30,7 +32,7 @@
>  import java.util.List;
>  import java.util.Map;
>  
> -public class SimpleAxis2Server {
> +public class SimpleAxis2Server extends AxisServer {
>  
>      private static final Log log = LogFactory.getLog(SimpleHTTPServer.class);
>  
> @@ -38,6 +40,13 @@
>  
>      public static int DEFAULT_PORT = 8080;
>  
> +    public SimpleAxis2Server (
> +            String repoLocation,
> +            String confLocation) throws Exception {
> +       configContext = ConfigurationContextFactory
> +                    .createConfigurationContextFromFileSystem(repoLocation,
> +                                                              confLocation);
> +    }
>  
>      /**
>       * @param args
> @@ -82,12 +91,8 @@
>          }
>  
>          try {
> -            ConfigurationContext configctx = ConfigurationContextFactory
> -                    .createConfigurationContextFromFileSystem(repoLocation,
> -                                                              confLocation);
> -            ListenerManager listenerManager = new ListenerManager();
> -            listenerManager.init(configctx);
> -            listenerManager.start();
> +            SimpleAxis2Server server = new SimpleAxis2Server(repoLocation, confLocation);
> +            server.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
>
>
>
>   

-- 
Thanks,
Deepal
................................................................
"The highest tower is built one brick at a time"



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