Author: dims Date: Fri Jun 15 21:28:51 2007 New Revision: 547859 URL: http://svn.apache.org/viewvc?view=rev&rev=547859 Log: add a parameter in the constructor for the user to take a decision on whether deploying a service should start the server
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=547859&r1=547858&r2=547859 ============================================================================== --- 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 21:28:51 2007 @@ -31,10 +31,22 @@ protected ConfigurationContext configContext; protected ListenerManager listenerManager; + private boolean startOnDeploy; + private boolean started = false; - public AxisServer() throws Exception { + /** + * @param startOnDeploy - Should the server be started automatically when the first service is deployed + * @throws Exception + */ + public AxisServer(boolean startOnDeploy) throws Exception { + this.startOnDeploy = startOnDeploy; } + /** + * Users extending this class can override this method to supply a custom ConfigurationContext + * @return + * @throws AxisFault + */ protected ConfigurationContext createDefaultConfigurationContext() throws AxisFault { return ConfigurationContextFactory.createConfigurationContextFromFileSystem(null); } @@ -47,6 +59,7 @@ public void start()throws AxisFault { listenerManager = new ListenerManager(); listenerManager.startSystem(getConfigurationContext()); + started = true; } /** @@ -58,8 +71,15 @@ AxisConfiguration axisConfig = getConfigurationContext().getAxisConfiguration(); AxisService service = AxisService.createService(serviceClassName,axisConfig); axisConfig.addService(service); + if(!started && startOnDeploy){ + start(); + } } + /** + * Stop the server, automatically terminates the listener manager as well. + * @throws AxisFault + */ public void stop() throws AxisFault{ if(configContext!=null){ configContext.terminate(); 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=547859&r1=547858&r2=547859 ============================================================================== --- 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 21:28:51 2007 @@ -43,9 +43,10 @@ public SimpleAxis2Server ( String repoLocation, String confLocation) throws Exception { - configContext = ConfigurationContextFactory - .createConfigurationContextFromFileSystem(repoLocation, - confLocation); + super(false); + configContext = ConfigurationContextFactory + .createConfigurationContextFromFileSystem(repoLocation, + confLocation); } /** --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]