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 <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED]
>> > For additional commands, e-mail: [EMAIL PROTECTED]
>> >
>> >
>> >
>> >
>>
>> --
>> Thanks,
>> Deepal
>> ................................................................
>> "The highest tower is built one brick at a time"
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>
>
--
Thanks,
Deepal
................................................................
"The highest tower is built one brick at a time"
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
Davanum Srinivas :: http://davanum.wordpress.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]