axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Davanum Srinivas" <dava...@gmail.com>
Subject Re: svn commit: r547848 - in /webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2: engine/AxisServer.java transport/SimpleAxis2Server.java
Date Sat, 16 Jun 2007 03:59:28 GMT
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 <deepal@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


Mime
View raw message