You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by sa...@apache.org on 2014/06/14 09:14:53 UTC

git commit: ODE-1013: Context information has been retianed in the Endpoint by using the same ConfigurationContext created during start of ODE

Repository: ode
Updated Branches:
  refs/heads/ode-1.3.x 7627e95ad -> f5dbc94e2


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/f5dbc94e
Tree: http://git-wip-us.apache.org/repos/asf/ode/tree/f5dbc94e
Diff: http://git-wip-us.apache.org/repos/asf/ode/diff/f5dbc94e

Branch: refs/heads/ode-1.3.x
Commit: f5dbc94e21fdab808c0ce1aa3236a073eeb60cba
Parents: 7627e95
Author: sathwik <sa...@apache.org>
Authored: Sat Jun 14 11:24:14 2014 +0530
Committer: sathwik <sa...@apache.org>
Committed: Sat Jun 14 11:24:14 2014 +0530

----------------------------------------------------------------------
 .../org/apache/ode/axis2/Axis2TestBase.java     | 13 +++++++++----
 .../apache/ode/axis2/BindingContextImpl.java    | 20 ++++++++++----------
 .../java/org/apache/ode/axis2/ODEServer.java    | 15 ++++++++-------
 .../apache/ode/axis2/SoapExternalService.java   |  9 +++++----
 .../apache/ode/axis2/hooks/ODEAxisServlet.java  |  2 +-
 5 files changed, 33 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ode/blob/f5dbc94e/axis2-war/src/test/java/org/apache/ode/axis2/Axis2TestBase.java
----------------------------------------------------------------------
diff --git a/axis2-war/src/test/java/org/apache/ode/axis2/Axis2TestBase.java b/axis2-war/src/test/java/org/apache/ode/axis2/Axis2TestBase.java
index e5a57f6..9734bd1 100644
--- a/axis2-war/src/test/java/org/apache/ode/axis2/Axis2TestBase.java
+++ b/axis2-war/src/test/java/org/apache/ode/axis2/Axis2TestBase.java
@@ -39,15 +39,20 @@ import javax.wsdl.WSDLException;
 import javax.xml.namespace.QName;
 
 import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
+import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.ConfigurationContextFactory;
 import org.apache.axis2.deployment.DeploymentEngine;
 import org.apache.axis2.deployment.repository.util.ArchiveReader;
 import org.apache.axis2.description.AxisOperation;
 import org.apache.axis2.description.AxisService;
 import org.apache.axis2.description.Parameter;
+import org.apache.axis2.description.TransportInDescription;
 import org.apache.axis2.description.WSDL11ToAxisServiceBuilder;
+import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.engine.AxisServer;
 import org.apache.axis2.engine.MessageReceiver;
+import org.apache.axis2.transport.http.SimpleHTTPServer;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -253,7 +258,7 @@ public abstract class Axis2TestBase {
             super.start();
             _ode = new ODEServer();
             try {
-                _ode.init(odeRootDir, configContext.getAxisConfiguration());
+                _ode.init(odeRootDir, new ConfigurationContext(configContext.getAxisConfiguration()));
             } catch (ServletException e) {
                 e.printStackTrace();
             }
@@ -288,7 +293,7 @@ public abstract class Axis2TestBase {
             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();
@@ -297,9 +302,9 @@ public abstract class Axis2TestBase {
             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/f5dbc94e/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 af620f1..07f017a 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);
@@ -134,7 +134,7 @@ public class BindingContextImpl implements BindingContext {
         }
 
         // We're public!
-        _server._axisConfig.addService(axisService);
+        _server._configContext.getAxisConfiguration().addService(axisService);
         __log.debug("Created Axis2 service " + serviceName);
         return odeService;
     }
@@ -146,7 +146,7 @@ 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);
                 // first, de-allocate its schemas
                 axisService.releaseSchemaList();
                 // then, de-allocate its parameters
@@ -157,15 +157,15 @@ public class BindingContextImpl implements BindingContext {
                     axisService.removeParameter(parameter);
                 }
                 // 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();
 
@@ -189,11 +189,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();) {
@@ -215,7 +215,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/f5dbc94e/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 b164275..9020353 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.params.HttpConnectionManagerParams;
@@ -105,7 +106,7 @@ public class ODEServer {
 
     protected ODEConfigProperties _odeConfig;
 
-    protected AxisConfiguration _axisConfig;
+    protected ConfigurationContext _configContext;
 
     protected TransactionManager _txMgr;
 
@@ -130,12 +131,12 @@ public class ODEServer {
     protected MultiThreadedHttpConnectionManager httpConnectionManager;
     protected IdleConnectionTimeoutThread idleConnectionTimeoutThread;
     
-    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 {
-        _axisConfig = axisConf;
+    public void init(String contextPath, ConfigurationContext configContext) throws ServletException {
+        _configContext = configContext;
         String rootDir = System.getProperty("org.apache.ode.rootDir");
         if (rootDir != null) _appRoot = new File(rootDir);
         else _appRoot = new File(contextPath);
@@ -204,11 +205,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/f5dbc94e/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 f7a5e05..f01886e 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,8 +122,8 @@ 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);
+
+        _configContext.setProperty(HTTPConstants.MULTITHREAD_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/f5dbc94e/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 bb6cf71..ec872d7 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());
     }