ODE-1013: Context information has been retianed in the Endpoint by using the same ConfigurationContext created during start of ODE
Project: http://git-wip-us.apache.org/repos/asf/ode/repo Commit: http://git-wip-us.apache.org/repos/asf/ode/commit/c0b7490f Tree: http://git-wip-us.apache.org/repos/asf/ode/tree/c0b7490f Diff: http://git-wip-us.apache.org/repos/asf/ode/diff/c0b7490f Branch: refs/heads/master Commit: c0b7490f67294e5f2dd6602a151b74b2640cadde Parents: e8e69cf Author: sathwik <[email protected]> Authored: Tue Jun 17 09:16:49 2014 +0530 Committer: sathwik <[email protected]> Committed: Tue Jun 17 09:16:49 2014 +0530 ---------------------------------------------------------------------- .../apache/ode/axis2/BindingContextImpl.java | 22 ++++++++++---------- .../org/apache/ode/axis2/ODEAxis2Server.java | 9 ++++---- .../java/org/apache/ode/axis2/ODEServer.java | 19 +++++++++-------- .../apache/ode/axis2/SoapExternalService.java | 6 +++--- .../apache/ode/axis2/hooks/ODEAxisServlet.java | 2 +- 5 files changed, 30 insertions(+), 28 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ode/blob/c0b7490f/axis2/src/main/java/org/apache/ode/axis2/BindingContextImpl.java ---------------------------------------------------------------------- diff --git a/axis2/src/main/java/org/apache/ode/axis2/BindingContextImpl.java b/axis2/src/main/java/org/apache/ode/axis2/BindingContextImpl.java index 0aea970..0941904 100644 --- a/axis2/src/main/java/org/apache/ode/axis2/BindingContextImpl.java +++ b/axis2/src/main/java/org/apache/ode/axis2/BindingContextImpl.java @@ -117,7 +117,7 @@ public class BindingContextImpl implements BindingContext { } protected ODEService createService(ProcessConf pconf, QName serviceName, String portName) throws AxisFault { - AxisService axisService = ODEAxisService.createService(_server._axisConfig, pconf, serviceName, portName); + AxisService axisService = ODEAxisService.createService(_server._configContext.getAxisConfiguration(), pconf, serviceName, portName); ODEService odeService = new ODEService(axisService, pconf, serviceName, portName, _server._bpelServer, _server._txMgr); destroyService(serviceName, portName); @@ -135,7 +135,7 @@ public class BindingContextImpl implements BindingContext { } // We're public! - _server._axisConfig.addService(axisService); + _server._configContext.getAxisConfiguration().addService(axisService); if (__log.isDebugEnabled()) { __log.debug("Created Axis2 service " + serviceName); } @@ -151,8 +151,8 @@ public class BindingContextImpl implements BindingContext { // try to clean up the service after itself try { String axisServiceName = service.getAxisService().getName(); - AxisService axisService = _server._axisConfig.getService(axisServiceName); - + AxisService axisService = _server._configContext.getAxisConfiguration().getService(axisServiceName); + //axisService might be null if it could not be properly activated before. if (axisService != null) { // first, de-allocate its schemas @@ -166,15 +166,15 @@ public class BindingContextImpl implements BindingContext { } } // now, stop the service - _server._axisConfig.stopService(axisServiceName); + _server._configContext.getAxisConfiguration().stopService(axisServiceName); // if only this method did a good job of cleaning up after itself - _server._axisConfig.removeService(service.getName()); + _server._configContext.getAxisConfiguration().removeService(service.getName()); completeCleanup(axisService); //ODE-994: commenting the cleanup on axisConfig as it cleansup everything on axis2 1.6 //_server._axisConfig.cleanup(); //For backward compatibility with older versions of axis2 that is below 1.6 - AxisConfigurator configurator = _server._axisConfig.getConfigurator(); + AxisConfigurator configurator = _server._configContext.getAxisConfiguration().getConfigurator(); if(configurator != null) configurator.cleanup(); @@ -200,11 +200,11 @@ public class BindingContextImpl implements BindingContext { */ private void completeCleanup(AxisService service) { try { - Field field= _server._axisConfig.getClass().getDeclaredField("allEndpoints"); + Field field= _server._configContext.getAxisConfiguration().getClass().getDeclaredField("allEndpoints"); field.setAccessible(true); - synchronized (_server._axisConfig) { + synchronized (_server._configContext.getAxisConfiguration()) { //removes the endpoints to this service - Map allEndpoints = (Map) field.get(_server._axisConfig); + Map allEndpoints = (Map) field.get(_server._configContext.getAxisConfiguration()); //removes the service endpoints for (Iterator<String> iter = service.getEndpoints().keySet().iterator(); iter.hasNext();) { @@ -226,7 +226,7 @@ public class BindingContextImpl implements BindingContext { extService = new HttpExternalService(pconf, serviceName, portName, _server._executorService, _server._scheduler, _server._bpelServer, _server.httpConnectionManager, _server._clusterUrlTransformer); } else if (WsdlUtils.useSOAPBinding(def, serviceName, portName)) { if (__log.isDebugEnabled()) __log.debug("Creating SOAP-bound external service " + serviceName); - extService = new SoapExternalService(pconf, serviceName, portName, _server._executorService, _server._axisConfig, _server._scheduler, _server._bpelServer, _server.httpConnectionManager, _server._clusterUrlTransformer); + extService = new SoapExternalService(pconf, serviceName, portName, _server._executorService, _server._configContext, _server._scheduler, _server._bpelServer, _server.httpConnectionManager, _server._clusterUrlTransformer); } } catch (Exception ex) { __log.error("Could not create external service.", ex); http://git-wip-us.apache.org/repos/asf/ode/blob/c0b7490f/axis2/src/main/java/org/apache/ode/axis2/ODEAxis2Server.java ---------------------------------------------------------------------- diff --git a/axis2/src/main/java/org/apache/ode/axis2/ODEAxis2Server.java b/axis2/src/main/java/org/apache/ode/axis2/ODEAxis2Server.java index c377726..55dbea6 100644 --- a/axis2/src/main/java/org/apache/ode/axis2/ODEAxis2Server.java +++ b/axis2/src/main/java/org/apache/ode/axis2/ODEAxis2Server.java @@ -35,6 +35,7 @@ import javax.wsdl.WSDLException; import javax.xml.namespace.QName; import org.apache.axis2.AxisFault; +import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.context.ConfigurationContextFactory; import org.apache.axis2.description.AxisOperation; import org.apache.axis2.description.AxisService; @@ -89,7 +90,7 @@ public class ODEAxis2Server extends AxisServer { _ode = new ODEServer(); _ode.txMgrCreatedCallback = txMgrCreatedCallback; try { - _ode.init(odeRootDir, configContext.getAxisConfiguration(), config); + _ode.init(odeRootDir, new ConfigurationContext(configContext.getAxisConfiguration()), config); } catch (ServletException e) { throw new RuntimeException(e.getRootCause()); } @@ -124,7 +125,7 @@ public class ODEAxis2Server extends AxisServer { WSDL11ToAxisServiceBuilder serviceBuilder = new ODEAxisService.WSDL11ToAxisPatchedBuilder(is, serviceName, port); serviceBuilder.setBaseUri(wsdlUri.toString()); serviceBuilder.setCustomResolver(new Axis2UriResolver()); - serviceBuilder.setCustomWSLD4JResolver(new Axis2WSDLLocator(wsdlUri)); + serviceBuilder.setCustomWSDLResolver(new Axis2WSDLLocator(wsdlUri)); serviceBuilder.setServerSide(true); AxisService axisService = serviceBuilder.populateService(); @@ -133,9 +134,9 @@ public class ODEAxis2Server extends AxisServer { axisService.setCustomWsdl(true); axisService.setClassLoader(getConfigurationContext().getAxisConfiguration().getServiceClassLoader()); - Iterator operations = axisService.getOperations(); + Iterator<AxisOperation> operations = axisService.getOperations(); while (operations.hasNext()) { - AxisOperation operation = (AxisOperation) operations.next(); + AxisOperation operation = operations.next(); if (operation.getMessageReceiver() == null) { operation.setMessageReceiver(receiver); } http://git-wip-us.apache.org/repos/asf/ode/blob/c0b7490f/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java ---------------------------------------------------------------------- diff --git a/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java b/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java index 7ed6483..7cbf142 100644 --- a/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java +++ b/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java @@ -47,6 +47,7 @@ import javax.transaction.TransactionManager; import javax.transaction.xa.XAResource; import org.apache.axis2.AxisFault; +import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.engine.AxisConfiguration; import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager; import org.apache.commons.httpclient.util.IdleConnectionTimeoutThread; @@ -105,7 +106,7 @@ public class ODEServer { protected ODEConfigProperties _odeConfig; - protected AxisConfiguration _axisConfig; + protected ConfigurationContext _configContext; protected TransactionManager _txMgr; @@ -132,16 +133,16 @@ public class ODEServer { public Runnable txMgrCreatedCallback; - public void init(ServletConfig config, AxisConfiguration axisConf) throws ServletException { - init(config.getServletContext().getRealPath("/WEB-INF"), axisConf); + public void init(ServletConfig config, ConfigurationContext configContext) throws ServletException { + init(config.getServletContext().getRealPath("/WEB-INF"), configContext); } - public void init(String contextPath, AxisConfiguration axisConf) throws ServletException { - init(contextPath, axisConf, null); + public void init(String contextPath, ConfigurationContext configContext) throws ServletException { + init(contextPath, configContext, null); } - public void init(String contextPath, AxisConfiguration axisConf, ODEConfigProperties config) throws ServletException { - _axisConfig = axisConf; + public void init(String contextPath, ConfigurationContext configContext, ODEConfigProperties config) throws ServletException { + _configContext = configContext; String rootDir = System.getProperty("org.apache.ode.rootDir"); if (rootDir != null) _appRoot = new File(rootDir); else _appRoot = new File(contextPath); @@ -216,11 +217,11 @@ public class ODEServer { } _mgtService = new ManagementService(); - _mgtService.enableService(_axisConfig, _bpelServer, _store, _appRoot.getAbsolutePath()); + _mgtService.enableService(_configContext.getAxisConfiguration(), _bpelServer, _store, _appRoot.getAbsolutePath()); try { __log.debug("Initializing Deployment Web Service"); - new DeploymentWebService().enableService(_axisConfig, _store, _poller, _appRoot.getAbsolutePath(), _workRoot.getAbsolutePath()); + new DeploymentWebService().enableService(_configContext.getAxisConfiguration(), _store, _poller, _appRoot.getAbsolutePath(), _workRoot.getAbsolutePath()); } catch (Exception e) { throw new ServletException(e); } http://git-wip-us.apache.org/repos/asf/ode/blob/c0b7490f/axis2/src/main/java/org/apache/ode/axis2/SoapExternalService.java ---------------------------------------------------------------------- diff --git a/axis2/src/main/java/org/apache/ode/axis2/SoapExternalService.java b/axis2/src/main/java/org/apache/ode/axis2/SoapExternalService.java index 64d3fe6..6a785ed 100644 --- a/axis2/src/main/java/org/apache/ode/axis2/SoapExternalService.java +++ b/axis2/src/main/java/org/apache/ode/axis2/SoapExternalService.java @@ -106,12 +106,13 @@ public class SoapExternalService implements ExternalService { private String endpointUrl; public SoapExternalService(ProcessConf pconf, QName serviceName, String portName, ExecutorService executorService, - AxisConfiguration axisConfig, Scheduler sched, BpelServer server, MultiThreadedHttpConnectionManager connManager, ClusterUrlTransformer clusterUrlTransformer) throws AxisFault { + ConfigurationContext configContext, Scheduler sched, BpelServer server, MultiThreadedHttpConnectionManager connManager, ClusterUrlTransformer clusterUrlTransformer) throws AxisFault { _definition = pconf.getDefinitionForService(serviceName); _serviceName = serviceName; _portName = portName; _executorService = executorService; - _axisConfig = axisConfig; + _configContext = configContext; + _axisConfig = _configContext.getAxisConfiguration(); _sched = sched; _converter = new SoapMessageConverter(_definition, serviceName, portName); _server = server; @@ -121,7 +122,6 @@ public class SoapExternalService implements ExternalService { File fileToWatch = new File(_pconf.getBaseURI().resolve(_serviceName.getLocalPart() + ".axis2")); _axisServiceWatchDog = WatchDog.watchFile(fileToWatch, new ServiceFileObserver(fileToWatch)); _axisOptionsWatchDog = new WatchDog<Map, OptionsObserver>(new EndpointPropertiesMutable(), new OptionsObserver()); - _configContext = new ConfigurationContext(_axisConfig); _configContext.setProperty(HTTPConstants.MUTTITHREAD_HTTP_CONNECTION_MANAGER, connManager); // make sure the client is not shared, see also org.apache.ode.axis2.Properties.Axis2 _configContext.setProperty(HTTPConstants.REUSE_HTTP_CLIENT, "false"); http://git-wip-us.apache.org/repos/asf/ode/blob/c0b7490f/axis2/src/main/java/org/apache/ode/axis2/hooks/ODEAxisServlet.java ---------------------------------------------------------------------- diff --git a/axis2/src/main/java/org/apache/ode/axis2/hooks/ODEAxisServlet.java b/axis2/src/main/java/org/apache/ode/axis2/hooks/ODEAxisServlet.java index 4d4d11c..4a167a9 100644 --- a/axis2/src/main/java/org/apache/ode/axis2/hooks/ODEAxisServlet.java +++ b/axis2/src/main/java/org/apache/ode/axis2/hooks/ODEAxisServlet.java @@ -50,7 +50,7 @@ public class ODEAxisServlet extends AxisServlet { public void init(ServletConfig config) throws ServletException { super.init(config); _odeServer = createODEServer(); - _odeServer.init(config, axisConfiguration); + _odeServer.init(config, configContext); _browser = new DeploymentBrowser(_odeServer.getProcessStore(), axisConfiguration, _odeServer.getAppRoot()); }
