You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ch...@apache.org on 2005/09/14 05:17:56 UTC

svn commit: r280750 - in /webservices/axis2/trunk/java/modules/core/src/org/apache/axis2: ./ clientapi/ context/ description/ engine/

Author: chinthaka
Date: Tue Sep 13 20:17:38 2005
New Revision: 280750

URL: http://svn.apache.org/viewcvs?rev=280750&view=rev
Log: (empty)

Modified:
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/InstanceDispatcher.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/Call.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ConfigurationContext.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ServiceContext.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ServiceGroupContext.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/OperationDescription.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/ServiceDescription.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/ServiceGroupDescription.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisConfiguration.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisConfigurationImpl.java

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/InstanceDispatcher.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/InstanceDispatcher.java?rev=280750&r1=280749&r2=280750&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/InstanceDispatcher.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/InstanceDispatcher.java Tue Sep 13 20:17:38 2005
@@ -44,6 +44,7 @@
         //  1. look up opCtxt using mc.addressingHeaders.relatesTo[0]
         OperationContext operationContext = operationDesc.findForExistingOperationContext(msgContext);
         if (operationContext != null) {
+            // register operation context and message context
             operationDesc.registerOperationContext(msgContext, operationContext);
             ServiceContext serviceContext = (ServiceContext) operationContext.getParent();
             ServiceGroupContext serviceGroupContext = (ServiceGroupContext) serviceContext.getParent();

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/Call.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/Call.java?rev=280750&r1=280749&r2=280750&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/Call.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/Call.java Tue Sep 13 20:17:38 2005
@@ -25,6 +25,7 @@
 import org.apache.axis2.deployment.util.PhasesInfo;
 import org.apache.axis2.description.OperationDescription;
 import org.apache.axis2.description.ServiceDescription;
+import org.apache.axis2.description.ServiceGroupDescription;
 import org.apache.axis2.engine.AxisConfigurationImpl;
 import org.apache.axis2.om.OMElement;
 import org.apache.axis2.soap.SOAPEnvelope;
@@ -210,6 +211,7 @@
                 new ServiceDescription(assumedServiceName);
         operationTemplate =
                 new OperationDescription(new QName("TemplateOperation"));
+        ServiceGroupDescription serviceGroupDescription = new ServiceGroupDescription(sysContext.getAxisConfiguration());
 
         PhasesInfo info =((AxisConfigurationImpl)sysContext.getAxisConfiguration()).getPhasesinfo();
         //to set the operation flows
@@ -217,7 +219,7 @@
             info.setOperationPhases(operationTemplate);
         }
         axisService.addOperation(operationTemplate);
-        sysContext.getAxisConfiguration().addService(axisService);
+        serviceGroupDescription.addService(axisService);
         return sysContext.createServiceContext(assumedServiceName);
     }
 

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ConfigurationContext.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ConfigurationContext.java?rev=280750&r1=280749&r2=280750&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ConfigurationContext.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ConfigurationContext.java Tue Sep 13 20:17:38 2005
@@ -19,7 +19,6 @@
  */
 
 import org.apache.axis2.AxisFault;
-import org.apache.axis2.description.ServiceDescription;
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.storage.AxisStorage;
 import org.apache.axis2.util.UUIDGenerator;
@@ -144,16 +143,16 @@
         this.storage = storage;
     }
 
-    public ServiceContext createServiceContext(QName serviceName)
-            throws AxisFault {
-        ServiceDescription service = axisConfiguration.getService(serviceName);
-        if (service != null) {
-            return new ServiceContext(service, this);
-        } else {
-            throw new AxisFault(
-                    "Service not found service name = " + serviceName);
-        }
-    }
+//    public ServiceContext createServiceContext(QName serviceName)
+//            throws AxisFault {
+//        ServiceDescription service = axisConfiguration.getService(serviceName);
+//        if (service != null) {
+//            return new ServiceContext(service, this);
+//        } else {
+//            throw new AxisFault(
+//                    "Service not found service name = " + serviceName);
+//        }
+//    }
 
     /**
      * @return the Gloal ThradPool
@@ -200,18 +199,21 @@
      * @param messageContext
      * @return
      */
-    public ServiceGroupContext fillServiceContextAndServiceGroupContext(MessageContext messageContext) {
+    public ServiceGroupContext fillServiceContextAndServiceGroupContext(MessageContext messageContext) throws AxisFault {
         String serviceGroupContextId = messageContext.getServiceGroupContextId();
 
         ServiceGroupContext serviceGroupContext = null;
         ServiceContext serviceContext = null;
         if (!isNull(serviceGroupContextId) && serviceGroupContextMap.get(serviceGroupContextId) != null) {
+            // SGC is already there
             serviceGroupContext = (ServiceGroupContext) serviceGroupContextMap.get(serviceGroupContextId);
+
+            // check service context is there or not
             serviceContext = serviceGroupContext.getServiceContext(messageContext.getServiceDescription().getName().
                     getLocalPart());
             if (serviceContext == null) {
-                serviceContext = messageContext.getServiceDescription().findServiceContext(messageContext);
-                serviceContext.setParent(serviceGroupContext);
+                serviceContext = new ServiceContext(messageContext.getServiceDescription(), serviceGroupContext);
+                serviceGroupContext.registerServiceContext(serviceContext);
             }
         } else {
             // either the key is null or no SGC is found from the give key
@@ -220,15 +222,24 @@
                 messageContext.setServiceGroupContextId(serviceGroupContextId);
             }
             serviceGroupContext = new ServiceGroupContext(this);
-            serviceGroupContextMap.put(serviceGroupContextId, serviceGroupContext);
-            serviceContext = messageContext.getServiceDescription().findServiceContext(messageContext);
-            serviceContext.setParent(serviceGroupContext);
+            this.registerServiceGroupContext(serviceGroupContext);
+            serviceContext = new ServiceContext(messageContext.getServiceDescription(), serviceGroupContext);
+            serviceGroupContext.registerServiceContext(serviceContext);
         }
 
+        // when you come here operation context MUST already been assigned to the message context
         messageContext.getOperationContext().setParent(serviceContext);
         messageContext.setServiceContext(serviceContext);
         messageContext.setServiceGroupContext(serviceGroupContext);
         return serviceGroupContext;
+    }
+
+    public void registerServiceGroupContext(ServiceGroupContext serviceGroupContext) {
+        String id = serviceGroupContext.getId();
+        if (serviceGroupContextMap.get(id) == null) {
+            serviceGroupContextMap.put(id, serviceGroupContext);
+            serviceGroupContext.setParent(this);
+        }
     }
 
     private boolean isNull(String string) {

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ServiceContext.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ServiceContext.java?rev=280750&r1=280749&r2=280750&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ServiceContext.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ServiceContext.java Tue Sep 13 20:17:38 2005
@@ -34,8 +34,8 @@
 
     public ServiceContext(
         ServiceDescription serviceConfig,
-        ConfigurationContext engineContext) {
-        super(engineContext);
+        ServiceGroupContext serviceGroupContext) {
+        super(serviceGroupContext);
         this.serviceConfig = serviceConfig;
 
     }

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ServiceGroupContext.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ServiceGroupContext.java?rev=280750&r1=280749&r2=280750&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ServiceGroupContext.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ServiceGroupContext.java Tue Sep 13 20:17:38 2005
@@ -1,5 +1,7 @@
 package org.apache.axis2.context;
 
+import org.apache.axis2.AxisFault;
+
 import java.util.HashMap;
 import java.util.Map;
 /*
@@ -22,14 +24,14 @@
 
 /**
  * Author: Deepal Jayasinghe
- *       : Eran Chinthaka
+ * : Eran Chinthaka
  */
-public class ServiceGroupContext extends AbstractContext{
+public class ServiceGroupContext extends AbstractContext {
 
     private String id;
     private Map serviceContextMap;
 
-    protected ServiceGroupContext(AbstractContext parent) {
+    public ServiceGroupContext(ConfigurationContext parent) {
         super(parent);
         serviceContextMap = new HashMap();
     }
@@ -42,7 +44,17 @@
         this.id = id;
     }
 
-    public ServiceContext getServiceContext(String serviceName){
+    public ServiceContext getServiceContext(String serviceName) {
         return (ServiceContext) serviceContextMap.get(serviceName);
+    }
+
+    public void registerServiceContext(ServiceContext serviceContext) throws AxisFault {
+        String serviceName = serviceContext.getServiceConfig().
+                getName().getLocalPart();
+        ServiceContext serviceContextAlreadyRegistered = (ServiceContext) serviceContextMap.get(serviceName);
+        if (serviceContextAlreadyRegistered == null) {
+            serviceContextMap.put(serviceName, serviceContext);
+            serviceContext.setParent(this);
+        }
     }
 }

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/OperationDescription.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/OperationDescription.java?rev=280750&r1=280749&r2=280750&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/OperationDescription.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/OperationDescription.java Tue Sep 13 20:17:38 2005
@@ -227,13 +227,7 @@
         OperationContext operationContext = null;
 
         if (null == msgContext.getRelatesTo()) {
-//            //Its a new incomming message so get the factory to create a new
-//            // one
-//            operationContext =
-//                    OperationContextFactory.createOperationContext(
-//                            getAxisSpecifMEPConstant(), this);
             return null;
-
         } else {
             // So this message is part of an ongoing MEP
             //			operationContext =

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/ServiceDescription.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/ServiceDescription.java?rev=280750&r1=280749&r2=280750&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/ServiceDescription.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/ServiceDescription.java Tue Sep 13 20:17:38 2005
@@ -29,7 +29,10 @@
 import org.apache.wsdl.impl.WSDLInterfaceImpl;
 import org.apache.wsdl.impl.WSDLServiceImpl;
 
-import javax.wsdl.*;
+import javax.wsdl.Definition;
+import javax.wsdl.Port;
+import javax.wsdl.Service;
+import javax.wsdl.WSDLException;
 import javax.wsdl.extensions.soap.SOAPAddress;
 import javax.wsdl.factory.WSDLFactory;
 import javax.xml.namespace.QName;
@@ -51,7 +54,7 @@
 
     private HashMap moduleConfigmap;
 
-    private  AxisConfiguration parent;
+    private  ServiceGroupDescription parent;
     //to store the wsdl definition , which is build at the deployment time
 
     //to keep the time that last update time of the service
@@ -581,10 +584,12 @@
      * @return
      */
     public ServiceContext findServiceContext(MessageContext msgContext) {
+        // TODO : Fix me. Can't look up a service context in the system context
+
         ServiceContext serviceContext = null;
-        if (null == msgContext.getServiceContextID()) {
+        if (null == msgContext.getServiceGroupContextId()) {
             serviceContext =
-                    new ServiceContext(this, msgContext.getSystemContext());
+                    new ServiceContext(this, msgContext.getServiceGroupContext());
             //TODO Once the ServiceContext is bound to an incomming serviceContext ID(like a cookie,reference Property) FIX this
             //			msgContext.getSystemContext().registerServiceContext(serviceContext.getServiceContextID(),
             // serviceContext);
@@ -771,11 +776,11 @@
      * To get the parent (which is AxisConfiguration in this case)
      * @return <code>AxisConfiguration</code>
      */
-    public AxisConfiguration getParent() {
+    public ServiceGroupDescription getParent() {
         return parent;
     }
 
-    public void setParent(AxisConfiguration parent) {
+    public void setParent(ServiceGroupDescription parent) {
         this.parent = parent;
     }
 
@@ -785,7 +790,7 @@
         boolean loscked = false;
 
         if (getParent() !=null) {
-            loscked =  getParent().isParamterLocked(paramterName);
+            loscked =  getParent().getAxisDescription().isParamterLocked(paramterName);
         }
         if(loscked){
             return true;

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/ServiceGroupDescription.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/ServiceGroupDescription.java?rev=280750&r1=280749&r2=280750&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/ServiceGroupDescription.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/ServiceGroupDescription.java Tue Sep 13 20:17:38 2005
@@ -1,4 +1,12 @@
 package org.apache.axis2.description;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.axis2.engine.AxisEvent;
+import org.apache.axis2.phaseresolver.PhaseResolver;
+
+import javax.xml.namespace.QName;
+import java.util.HashMap;
 /*
 * Copyright 2004,2005 The Apache Software Foundation.
 *
@@ -17,10 +25,46 @@
 *
 */
 
-/**
- * Author: Deepal Jayasinghe
- * Date: Sep 13, 2005
- * Time: 9:53:55 AM
- */
 public class ServiceGroupDescription {
+    private final HashMap services = new HashMap();
+    private AxisConfiguration axisDescription;
+
+
+    public ServiceGroupDescription(AxisConfiguration axisDescription) {
+        this.axisDescription = axisDescription;
+    }
+
+    public synchronized void addService(ServiceDescription service) throws AxisFault {
+        services.put(service.getName(), service);
+        PhaseResolver handlerResolver = new PhaseResolver(this.axisDescription, service);
+        handlerResolver.buildchains();
+        service.setLastupdate();
+        this.axisDescription.notifyObservers(AxisEvent.SERVICE_DEPLOY ,service);
+        service.setParent(this);
+    }
+
+    public AxisConfiguration getAxisDescription() {
+        return axisDescription;
+    }
+
+    public void setAxisDescription(AxisConfiguration axisDescription) {
+        this.axisDescription = axisDescription;
+    }
+
+    public ServiceDescription getService(QName name) throws AxisFault {
+        return (ServiceDescription) services.get(name);
+    }
+
+    public HashMap getServices() {
+        return services;
+    }
+
+
+    public synchronized void removeService(QName name) throws AxisFault {
+        ServiceDescription service = getService(name);
+        if (service != null) {
+            this.axisDescription.notifyObservers(AxisEvent.SERVICE_DEPLOY , service);
+        }
+        services.remove(name);
+    }
 }

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisConfiguration.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisConfiguration.java?rev=280750&r1=280749&r2=280750&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisConfiguration.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisConfiguration.java Tue Sep 13 20:17:38 2005
@@ -49,29 +49,12 @@
     public static final int FAULT_OUT_FLOW = 10006;
 
     /**
-     * Method getService
-     *
-     * @param name
-     * @return
-     * @throws AxisFault
-     */
-    public ServiceDescription getService(QName name) throws AxisFault;
-
-    /**
-     * Method addService
-     *
-     * @param service
-     * @throws AxisFault
-     */
-    public void addService(ServiceDescription service) throws AxisFault;
-
-    /**
      * Method removeService
      *
      * @param name
      * @throws AxisFault
      */
-    public void removeService(QName name) throws AxisFault;
+//    public void removeService(QName name) throws AxisFault;
 
     /**
      * Modules is read only as they can not deployed while runing
@@ -112,7 +95,7 @@
      *
      * @return
      */
-    public HashMap getServices();
+//    public HashMap getServices();
 
     public Hashtable getFaultyServices();
 
@@ -139,4 +122,6 @@
     public boolean isParamterLocked(String paramterName);
 
     public ServiceGroupDescription getServiceGroup(String serviceNameAndGroupString);
+
+    public void notifyObservers(int event_type , ServiceDescription service);
 }

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisConfigurationImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisConfigurationImpl.java?rev=280750&r1=280749&r2=280750&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisConfigurationImpl.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisConfigurationImpl.java Tue Sep 13 20:17:38 2005
@@ -202,7 +202,6 @@
     /**
      * Method getServices
      *
-     * @return
      */
     public HashMap getServices() {
         return services;
@@ -233,59 +232,31 @@
      * @param service
      * @throws AxisFault
      */
-    public synchronized void addService(ServiceDescription service) throws AxisFault {
-        services.put(service.getName(), service);
-        PhaseResolver handlerResolver = new PhaseResolver(this, service);
-        handlerResolver.buildchains();
-        service.setLastupdate();
-        notifyObserves(AxisEvent.SERVICE_DEPLOY ,service);
-        service.setParent(this);
-    }
+//    public synchronized void addService(ServiceDescription service) throws AxisFault {
+//        services.put(service.getName(), service);
+//        PhaseResolver handlerResolver = new PhaseResolver(this, service);
+//        handlerResolver.buildchains();
+//        service.setLastupdate();
+//        notifyObservers(AxisEvent.SERVICE_DEPLOY ,service);
+//        service.setParent(this);
+//    }
 
     /**
      * Method getModule
      *
      * @param name
-     * @return
      */
     public ModuleDescription getModule(QName name) {
         return (ModuleDescription) modules.get(name);
     }
 
     /**
-     * @return
      */
     public HashMap getModules() {
         return modules;
     }
 
 
-    /**
-     * Method getService
-     *
-     * @param name
-     * @return
-     * @throws AxisFault
-     */
-    public ServiceDescription getService(QName name) throws AxisFault {
-        return (ServiceDescription) services.get(name);
-    }
-
-    /**
-     * Method removeService
-     *
-     * @param name
-     * @throws AxisFault
-     */
-    public synchronized void removeService(QName name) throws AxisFault {
-        ServiceDescription service = getService(name);
-        if (service != null) {
-            notifyObserves(AxisEvent.SERVICE_DEPLOY , service);
-        }
-        services.remove(name);
-    }
-
-
     public TransportInDescription getTransportIn(QName name) throws AxisFault {
         return (TransportInDescription) transportsIn.get(name);
     }
@@ -367,14 +338,12 @@
 
 
     /**
-     * @return
      */
     public ArrayList getInFaultFlow() {
         return inFaultPhases;
     }
 
     /**
-     * @return
      */
     public ArrayList getOutFaultFlow() {
         return outFaultPhases;
@@ -409,7 +378,6 @@
      * Method getParameter
      *
      * @param name
-     * @return
      */
     public Parameter getParameter(String name) {
         return paramInclude.getParameter(name);
@@ -435,7 +403,6 @@
     /**
      * Method getEngadgedModules
      *
-     * @return
      */
     public Collection getEngadgedModules() {
         return engagedModules;
@@ -499,7 +466,7 @@
         this.axis2Repository = axis2Repository;
     }
 
-    private void notifyObserves(int event_type , ServiceDescription service){
+    public void notifyObservers(int event_type , ServiceDescription service){
         AxisEvent event = new AxisEvent(service,event_type);
         for (int i = 0; i < observersList.size(); i++) {
             AxisObserver axisObserver = (AxisObserver) observersList.get(i);