axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r289289 [21/134] - in /webservices/axis2/trunk/java: ./ etc/ modules/addressing/ modules/addressing/src/META-INF/ modules/addressing/src/org/apache/axis2/handlers/addressing/ modules/addressing/test-resources/ modules/addressing/test/org/ap...
Date Thu, 15 Sep 2005 19:07:03 GMT
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/phaseresolver/PhaseResolver.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/phaseresolver/PhaseResolver.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/phaseresolver/PhaseResolver.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/phaseresolver/PhaseResolver.java Thu Sep 15 11:52:11 2005
@@ -1,622 +1,622 @@
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-*      http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-package org.apache.axis2.phaseresolver;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.deployment.DeploymentErrorMsgs;
-import org.apache.axis2.description.*;
-import org.apache.axis2.engine.AxisConfiguration;
-import org.apache.axis2.engine.AxisConfigurationImpl;
-import org.apache.axis2.engine.Phase;
-import org.apache.axis2.i18n.Messages;
-import org.apache.axis2.phaseresolver.util.PhaseValidator;
-
-import javax.xml.namespace.QName;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-
-/**
- * Class PhaseResolver
- */
-public class PhaseResolver {
-    /**
-     * Field axisConfig
-     */
-    private AxisConfiguration axisConfig;
-
-    /**
-     * Field axisService
-     */
-    private ServiceDescription axisService;
-
-
-    /**
-     * Field phaseHolder
-     */
-    private PhaseHolder phaseHolder;
-
-    public PhaseResolver() {
-    }
-
-    /**
-     * default constructor , to obuild chains for GlobalDescription
-     *
-     * @param engineConfig
-     */
-    public PhaseResolver(AxisConfiguration engineConfig) {
-        this.axisConfig = engineConfig;
-    }
-
-    /**
-     * Constructor PhaseResolver
-     *
-     * @param axisConfig
-     * @param serviceContext
-     */
-    public PhaseResolver(AxisConfiguration axisConfig,
-                         ServiceDescription serviceContext) {
-        this.axisConfig = axisConfig;
-        this.axisService = serviceContext;
-    }
-
-    /**
-     * Method buildchains
-     *
-     * @throws PhaseException
-     * @throws AxisFault
-     */
-    public void buildchains() throws PhaseException, AxisFault {
-        HashMap operations = axisService.getOperations();
-        Collection col = operations.values();
-        for (Iterator iterator = col.iterator(); iterator.hasNext();) {
-            OperationDescription operation = (OperationDescription) iterator.next();
-            for (int i = 1; i < 5; i++) {
-                buildExcutionChains(i, operation);
-            }
-        }
-    }
-
-    /**
-     * To build the opration for the opeartion which the module going to be added
-     *
-     * @param opartion <code>OperationDescription</code>
-     * @throws AxisFault
-     */
-    public void buildModuleOperation(OperationDescription opartion) throws AxisFault {
-        for (int i = 1; i < 5; i++) {
-            buildExcutionChains(i, opartion);
-        }
-    }
-
-    /**
-     * this opeartion is used to build all the three cahins ,
-     * so type varible is used to difrenciate them
-     * type = 1 inflow
-     * type = 2 out flow
-     * type = 3 fault flow
-     *
-     * @param type
-     * @throws AxisFault
-     * @throws PhaseException
-     */
-    private void buildExcutionChains(int type, OperationDescription operation)
-            throws AxisFault, PhaseException {
-        ArrayList allHandlers = new ArrayList();
-        ModuleDescription module;
-        Flow flow = null;
-        ///////////////////////////////////////////////////////////////////////////////////////////
-        ////////////////////////// Handlers from   axis2.xml from modules/////////////////////////
-        ArrayList modulqnames = (ArrayList) ((AxisConfigurationImpl) axisConfig).getEngadgedModules();
-        for (int i = 0; i < modulqnames.size(); i++) {
-            QName modulename = (QName) modulqnames.get(i);
-            module = axisConfig.getModule(modulename);
-            if (module != null) {
-                switch (type) {
-                    case PhaseMetadata.IN_FLOW:
-                    {
-                        flow = module.getInFlow();
-                        break;
-                    }
-                    case PhaseMetadata.OUT_FLOW:
-                    {
-                        flow = module.getOutFlow();
-                        break;
-                    }
-                    case PhaseMetadata.FAULT_IN_FLOW:
-                    {
-                        flow = module.getFaultInFlow();
-                        break;
-                    }
-                    case PhaseMetadata.FAULT_OUT_FLOW:
-                    {
-                        flow = module.getFaultOutFlow();
-                        break;
-                    }
-                }
-                axisService.addToEngagModuleList(module);
-                operation.addToEngageModuleList(module);
-            } else {
-                throw new PhaseException(Messages.getMessage(
-                        DeploymentErrorMsgs.INVALID_MODULE_REF, modulename.getLocalPart()));
-            }
-
-            if (flow != null) {
-                for (int j = 0; j < flow.getHandlerCount(); j++) {
-                    HandlerDescription metadata = flow.getHandler(j);
-
-                    if (!PhaseValidator.isSystemPhases(metadata.getRules().getPhaseName())) {
-                        allHandlers.add(metadata);
-                    } else {
-                        /**
-                         *This handler is trying to added to system pre defined phases , but those handlers
-                         * are already added to global chain which run irrespective of the service
-                         *
-                         */
-                    }
-                }
-            }
-
-        }
-
-        ///////////////////////////////////////////////////////////////////////////////////////////
-        ////////////////////////// SERVICE HANDLERS ///////////////////////////////////////////////
-        switch (type) {
-            case PhaseMetadata.IN_FLOW:
-            {
-                flow = axisService.getInFlow();
-                break;
-            }
-            case PhaseMetadata.OUT_FLOW:
-            {
-                flow = axisService.getOutFlow();
-                break;
-            }
-            case PhaseMetadata.FAULT_IN_FLOW:
-            {
-                flow = axisService.getFaultInFlow();
-                break;
-            }
-            case PhaseMetadata.FAULT_OUT_FLOW:
-            {
-                flow = axisService.getFaultOutFlow();
-                break;
-            }
-        }
-        if (flow != null) {
-            for (int j = 0; j < flow.getHandlerCount(); j++) {
-                HandlerDescription metadata = flow.getHandler(j);
-
-                // todo change this in properway
-                if (metadata.getRules().getPhaseName().equals("")) {
-                    throw new PhaseException(
-                            Messages.getMessage(DeploymentErrorMsgs.PHASE_DOES_NOT_SPECIFED,
-                                    metadata.getName().getLocalPart()));
-                } else if(PhaseValidator.isSystemPhases(metadata.getRules().getPhaseName())){
-                    throw new PhaseException(Messages.getMessage(
-                            DeploymentErrorMsgs.SERVICE_MODULE_CAN_NOT_REFER_GLOBAL_PHASE,
-                            metadata.getRules().getPhaseName()));
-                } else {
-                    allHandlers.add(metadata);
-                }
-            }
-        }
-        switch (type) {
-            case PhaseMetadata.IN_FLOW:
-            {
-                phaseHolder =
-                        new PhaseHolder(operation.getRemainingPhasesInFlow());
-                break;
-            }
-            case PhaseMetadata.OUT_FLOW:
-            {
-                phaseHolder =
-                        new PhaseHolder(operation.getPhasesOutFlow());
-                break;
-            }
-            case PhaseMetadata.FAULT_IN_FLOW:
-            {
-                phaseHolder =
-                        new PhaseHolder(operation.getPhasesInFaultFlow());
-                break;
-            }
-            case PhaseMetadata.FAULT_OUT_FLOW:
-            {
-                phaseHolder =
-                        new PhaseHolder(operation.getPhasesOutFaultFlow());
-                break;
-            }
-        }
-        for (int i = 0; i < allHandlers.size(); i++) {
-            HandlerDescription handlerMetaData =
-                    (HandlerDescription) allHandlers.get(i);
-            phaseHolder.addHandler(handlerMetaData);
-        }
-    }
-
-    /**
-     * Method buildTranspotsChains
-     *
-     * @throws PhaseException
-     */
-    public void buildTranspotsChains() throws PhaseException {
-        HashMap axisTransportIn = axisConfig.getTransportsIn();
-        HashMap axisTransportOut = axisConfig.getTransportsOut();
-
-        Collection colintrnsport = axisTransportIn.values();
-        for (Iterator iterator = colintrnsport.iterator();
-             iterator.hasNext();) {
-            TransportInDescription transport = (TransportInDescription) iterator.next();
-            buildINTransportChains(transport);
-        }
-
-        Collection colouttrnsport = axisTransportOut.values();
-        for (Iterator iterator = colouttrnsport.iterator();
-             iterator.hasNext();) {
-            TransportOutDescription transport = (TransportOutDescription) iterator.next();
-            buildOutTransportChains(transport);
-        }
-    }
-
-
-    private void buildINTransportChains(TransportInDescription transport)
-            throws PhaseException {
-        Flow flow = null;
-        Phase phase = null;
-        for (int type = 1; type < 4; type++) {
-            switch (type) {
-                case PhaseMetadata.IN_FLOW:
-                {
-                    flow = transport.getInFlow();
-                    phase = transport.getInPhase();
-                    break;
-                }
-                case PhaseMetadata.FAULT_IN_FLOW:
-                {
-                    flow = transport.getFaultFlow();
-                    phase = transport.getFaultPhase();
-                    break;
-                }
-            }
-            if (flow != null) {
-                ArrayList handlers = new ArrayList();
-                for (int j = 0; j < flow.getHandlerCount(); j++) {
-                    HandlerDescription metadata = flow.getHandler(j);
-                    metadata.getRules().setPhaseName(PhaseMetadata.TRANSPORT_PHASE);
-                    handlers.add(metadata);
-                }
-                new PhaseHolder().buildTransportHandlerChain(phase, handlers);
-            } else {
-            }
-        }
-    }
-
-
-    /**
-     * Method buildTransportChains
-     *
-     * @param transport
-     * @throws PhaseException
-     */
-    private void buildOutTransportChains(TransportOutDescription transport)
-            throws PhaseException {
-        Flow flow = null;
-        Phase phase = null;
-        for (int type = 1; type < 5; type++) {
-            switch (type) {
-                case PhaseMetadata.OUT_FLOW:
-                {
-                    flow = transport.getOutFlow();
-                    phase = transport.getOutPhase();
-                    break;
-                }
-                case PhaseMetadata.FAULT_OUT_FLOW:
-                {
-                    flow = transport.getFaultFlow();
-                    phase = transport.getFaultPhase();
-                    break;
-                }
-            }
-            if (flow != null) {
-                ArrayList handlers = new ArrayList();
-                for (int j = 0; j < flow.getHandlerCount(); j++) {
-                    HandlerDescription metadata = flow.getHandler(j);
-                    metadata.getRules().setPhaseName(PhaseMetadata.TRANSPORT_PHASE);
-                    handlers.add(metadata);
-                }
-                new PhaseHolder().buildTransportHandlerChain(phase, handlers);
-            } else {
-            }
-        }
-    }
-
-
-    public void engageModuleGlobally(ModuleDescription module) throws AxisFault {
-        enageToGlobalChain(module);
-        Iterator servicegroups = axisConfig.getServiceGroups();
-        while (servicegroups.hasNext()) {
-            ServiceGroupDescription sericeGroup = (ServiceGroupDescription) servicegroups.next();
-            Iterator services = sericeGroup.getServices();
-            while (services.hasNext()) {
-                ServiceDescription serviceDescription = (ServiceDescription) services.next();
-                serviceDescription.addModuleOperations(module, axisConfig);
-                engageModuleToServiceFromGlobal(serviceDescription, module);
-                serviceDescription.addToEngagModuleList(module);
-            }
-            sericeGroup.addModule(module.getName());
-        }
-    }
-
-    /**
-     * To engage modules come form global
-     *
-     * @param service
-     * @param module
-     * @throws PhaseException
-     */
-    public void engageModuleToServiceFromGlobal(ServiceDescription service,
-                                                ModuleDescription module) throws PhaseException {
-        HashMap opeartions = service.getOperations();
-        Collection opCol = opeartions.values();
-        boolean engaged = false;
-        for (Iterator iterator = opCol.iterator(); iterator.hasNext();) {
-            OperationDescription opDesc = (OperationDescription) iterator.next();
-            Collection modules = opDesc.getModules();
-            for (Iterator iterator1 = modules.iterator();
-                 iterator1.hasNext();) {
-                ModuleDescription description = (ModuleDescription) iterator1.next();
-                if (description.getName().equals(module.getName())) {
-                    engaged = true;
-                    break;
-                }
-            }
-            if (engaged) {
-                continue;
-            }
-            Flow flow = null;
-            for (int type = 1; type < 5; type++) {
-                switch (type) {
-                    case PhaseMetadata.IN_FLOW:
-                    {
-                        phaseHolder =
-                                new PhaseHolder(opDesc.getRemainingPhasesInFlow());
-                        break;
-                    }
-                    case PhaseMetadata.OUT_FLOW:
-                    {
-                        phaseHolder =
-                                new PhaseHolder(opDesc.getPhasesOutFlow());
-                        break;
-                    }
-                    case PhaseMetadata.FAULT_IN_FLOW:
-                    {
-                        phaseHolder =
-                                new PhaseHolder(opDesc.getPhasesInFaultFlow());
-                        break;
-                    }
-                    case PhaseMetadata.FAULT_OUT_FLOW:
-                    {
-                        phaseHolder =
-                                new PhaseHolder(opDesc.getPhasesOutFaultFlow());
-                        break;
-                    }
-                }
-                ////////////////////////////////////////////////////////////////////////////////////
-                /////////////////// Modules refered by axis2.xml //////////////////////////////////
-                ////////////////////////////////////////////////////////////////////////////////////
-                switch (type) {
-                    case PhaseMetadata.IN_FLOW:
-                    {
-                        flow = module.getInFlow();
-                        break;
-                    }
-                    case PhaseMetadata.OUT_FLOW:
-                    {
-                        flow = module.getOutFlow();
-                        break;
-                    }
-                    case PhaseMetadata.FAULT_IN_FLOW:
-                    {
-                        flow = module.getFaultInFlow();
-                        break;
-                    }
-                    case PhaseMetadata.FAULT_OUT_FLOW:
-                    {
-                        flow = module.getFaultOutFlow();
-                        break;
-                    }
-                }
-                if (flow != null) {
-                    for (int j = 0; j < flow.getHandlerCount(); j++) {
-                        HandlerDescription metadata = flow.getHandler(j);
-                        if (!PhaseValidator.isSystemPhases(metadata.getRules().getPhaseName())) {
-                            phaseHolder.addHandler(metadata);
-                        }
-                    }
-                }
-            }
-            opDesc.addToEngageModuleList(module);
-        }
-    }
-
-
-    private void enageToGlobalChain(ModuleDescription module) throws PhaseException {
-        Flow flow = null;
-        for (int type = 1; type < 5; type++) {
-            switch (type) {
-                case PhaseMetadata.IN_FLOW:
-                {
-                    phaseHolder =
-                            new PhaseHolder(axisConfig.
-                                    getInPhasesUptoAndIncludingPostDispatch());
-                    break;
-                }
-                case PhaseMetadata.OUT_FLOW:
-                {
-                    phaseHolder =
-                            new PhaseHolder(((AxisConfigurationImpl) axisConfig).getOutFlow());
-                    break;
-                }
-                case PhaseMetadata.FAULT_IN_FLOW:
-                {
-                    phaseHolder =
-                            new PhaseHolder(axisConfig.getInFaultFlow());
-                    break;
-                }
-                case PhaseMetadata.FAULT_OUT_FLOW:
-                {
-                    phaseHolder =
-                            new PhaseHolder(((AxisConfigurationImpl) axisConfig).getOutFaultFlow());
-                    break;
-                }
-            }
-            ////////////////////////////////////////////////////////////////////////////////////
-            /////////////////// Modules refered by axis2.xml //////////////////////////////////
-            ////////////////////////////////////////////////////////////////////////////////////
-            switch (type) {
-                case PhaseMetadata.IN_FLOW:
-                {
-                    flow = module.getInFlow();
-                    break;
-                }
-                case PhaseMetadata.OUT_FLOW:
-                {
-                    flow = module.getOutFlow();
-                    break;
-                }
-                case PhaseMetadata.FAULT_IN_FLOW:
-                {
-                    flow = module.getFaultInFlow();
-                    break;
-                }
-                case PhaseMetadata.FAULT_OUT_FLOW:
-                {
-                    flow = module.getFaultOutFlow();
-                    break;
-                }
-            }
-            if (flow != null) {
-                for (int j = 0; j < flow.getHandlerCount(); j++) {
-                    HandlerDescription metadata = flow.getHandler(j);
-                    if (PhaseValidator.isSystemPhases(metadata.getRules().getPhaseName())) {
-                        phaseHolder.addHandler(metadata);
-                    } else {
-                        /**
-                         * These handlers will go to operation's handler chains , since the module
-                         * try to add handlres to both sytem predefined phases and user defined phase
-                         * so global module can do that. here the global module are the module which are
-                         * reffred by axis2.xml
-                         */
-                    }
-                }
-            }
-        }
-    }
-
-
-    public void engageModuleToService(ServiceDescription service,
-                                      ModuleDescription module) throws AxisFault {
-        HashMap opeartions = service.getOperations();
-        Collection opCol = opeartions.values();
-        boolean engaged = false;
-        service.addModuleOperations(module, axisConfig);
-        for (Iterator iterator = opCol.iterator(); iterator.hasNext();) {
-            OperationDescription opDesc = (OperationDescription) iterator.next();
-            Collection modules = opDesc.getModules();
-            for (Iterator iterator1 = modules.iterator();
-                 iterator1.hasNext();) {
-                ModuleDescription description = (ModuleDescription) iterator1.next();
-                if (description.getName().equals(module.getName())) {
-                    engaged = true;
-                    break;
-                }
-            }
-            if (!engaged) {
-                engageModuleToOperation(opDesc, module);
-                opDesc.addToEngageModuleList(module);
-            }
-        }
-    }
-
-
-    public void engageModuleToOperation(OperationDescription operation,
-                                        ModuleDescription module) throws PhaseException {
-        Flow flow = null;
-        for (int type = 1; type < 5; type++) {
-            switch (type) {
-                case PhaseMetadata.IN_FLOW:
-                {
-                    phaseHolder =
-                            new PhaseHolder(operation.getRemainingPhasesInFlow());
-                    break;
-                }
-                case PhaseMetadata.OUT_FLOW:
-                {
-                    phaseHolder =
-                            new PhaseHolder(operation.getPhasesOutFlow());
-                    break;
-                }
-                case PhaseMetadata.FAULT_IN_FLOW:
-                {
-                    phaseHolder =
-                            new PhaseHolder(operation.getPhasesInFaultFlow());
-                    break;
-                }
-                case PhaseMetadata.FAULT_OUT_FLOW:
-                {
-                    phaseHolder =
-                            new PhaseHolder(operation.getPhasesOutFaultFlow());
-                    break;
-                }
-            }
-
-            switch (type) {
-                case PhaseMetadata.IN_FLOW:
-                {
-                    flow = module.getInFlow();
-                    break;
-                }
-                case PhaseMetadata.OUT_FLOW:
-                {
-                    flow = module.getOutFlow();
-                    break;
-                }
-                case PhaseMetadata.FAULT_IN_FLOW:
-                {
-                    flow = module.getFaultInFlow();
-                    break;
-                }
-                case PhaseMetadata.FAULT_OUT_FLOW:
-                {
-                    flow = module.getFaultOutFlow();
-                    break;
-                }
-            }
-            if (flow != null) {
-                for (int j = 0; j < flow.getHandlerCount(); j++) {
-                    HandlerDescription metadata = flow.getHandler(j);
-                    if (!PhaseValidator.isSystemPhases(metadata.getRules().getPhaseName())) {
-                        phaseHolder.addHandler(metadata);
-                    } else {
-                        throw new PhaseException(Messages.getMessage(DeploymentErrorMsgs.SERVICE_MODULE_CAN_NOT_REFER_GLOBAL_PHASE,
-                                metadata.getRules().getPhaseName()));
-                    }
-                }
-            }
-        }
-    }
-}
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*      http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.apache.axis2.phaseresolver;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.deployment.DeploymentErrorMsgs;
+import org.apache.axis2.description.*;
+import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.axis2.engine.AxisConfigurationImpl;
+import org.apache.axis2.engine.Phase;
+import org.apache.axis2.i18n.Messages;
+import org.apache.axis2.phaseresolver.util.PhaseValidator;
+
+import javax.xml.namespace.QName;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+
+/**
+ * Class PhaseResolver
+ */
+public class PhaseResolver {
+    /**
+     * Field axisConfig
+     */
+    private AxisConfiguration axisConfig;
+
+    /**
+     * Field axisService
+     */
+    private ServiceDescription axisService;
+
+
+    /**
+     * Field phaseHolder
+     */
+    private PhaseHolder phaseHolder;
+
+    public PhaseResolver() {
+    }
+
+    /**
+     * default constructor , to obuild chains for GlobalDescription
+     *
+     * @param engineConfig
+     */
+    public PhaseResolver(AxisConfiguration engineConfig) {
+        this.axisConfig = engineConfig;
+    }
+
+    /**
+     * Constructor PhaseResolver
+     *
+     * @param axisConfig
+     * @param serviceContext
+     */
+    public PhaseResolver(AxisConfiguration axisConfig,
+                         ServiceDescription serviceContext) {
+        this.axisConfig = axisConfig;
+        this.axisService = serviceContext;
+    }
+
+    /**
+     * Method buildchains
+     *
+     * @throws PhaseException
+     * @throws AxisFault
+     */
+    public void buildchains() throws PhaseException, AxisFault {
+        HashMap operations = axisService.getOperations();
+        Collection col = operations.values();
+        for (Iterator iterator = col.iterator(); iterator.hasNext();) {
+            OperationDescription operation = (OperationDescription) iterator.next();
+            for (int i = 1; i < 5; i++) {
+                buildExcutionChains(i, operation);
+            }
+        }
+    }
+
+    /**
+     * To build the opration for the opeartion which the module going to be added
+     *
+     * @param opartion <code>OperationDescription</code>
+     * @throws AxisFault
+     */
+    public void buildModuleOperation(OperationDescription opartion) throws AxisFault {
+        for (int i = 1; i < 5; i++) {
+            buildExcutionChains(i, opartion);
+        }
+    }
+
+    /**
+     * this opeartion is used to build all the three cahins ,
+     * so type varible is used to difrenciate them
+     * type = 1 inflow
+     * type = 2 out flow
+     * type = 3 fault flow
+     *
+     * @param type
+     * @throws AxisFault
+     * @throws PhaseException
+     */
+    private void buildExcutionChains(int type, OperationDescription operation)
+            throws AxisFault, PhaseException {
+        ArrayList allHandlers = new ArrayList();
+        ModuleDescription module;
+        Flow flow = null;
+        ///////////////////////////////////////////////////////////////////////////////////////////
+        ////////////////////////// Handlers from   axis2.xml from modules/////////////////////////
+        ArrayList modulqnames = (ArrayList) ((AxisConfigurationImpl) axisConfig).getEngadgedModules();
+        for (int i = 0; i < modulqnames.size(); i++) {
+            QName modulename = (QName) modulqnames.get(i);
+            module = axisConfig.getModule(modulename);
+            if (module != null) {
+                switch (type) {
+                    case PhaseMetadata.IN_FLOW:
+                    {
+                        flow = module.getInFlow();
+                        break;
+                    }
+                    case PhaseMetadata.OUT_FLOW:
+                    {
+                        flow = module.getOutFlow();
+                        break;
+                    }
+                    case PhaseMetadata.FAULT_IN_FLOW:
+                    {
+                        flow = module.getFaultInFlow();
+                        break;
+                    }
+                    case PhaseMetadata.FAULT_OUT_FLOW:
+                    {
+                        flow = module.getFaultOutFlow();
+                        break;
+                    }
+                }
+                axisService.addToEngagModuleList(module);
+                operation.addToEngageModuleList(module);
+            } else {
+                throw new PhaseException(Messages.getMessage(
+                        DeploymentErrorMsgs.INVALID_MODULE_REF, modulename.getLocalPart()));
+            }
+
+            if (flow != null) {
+                for (int j = 0; j < flow.getHandlerCount(); j++) {
+                    HandlerDescription metadata = flow.getHandler(j);
+
+                    if (!PhaseValidator.isSystemPhases(metadata.getRules().getPhaseName())) {
+                        allHandlers.add(metadata);
+                    } else {
+                        /**
+                         *This handler is trying to added to system pre defined phases , but those handlers
+                         * are already added to global chain which run irrespective of the service
+                         *
+                         */
+                    }
+                }
+            }
+
+        }
+
+        ///////////////////////////////////////////////////////////////////////////////////////////
+        ////////////////////////// SERVICE HANDLERS ///////////////////////////////////////////////
+        switch (type) {
+            case PhaseMetadata.IN_FLOW:
+            {
+                flow = axisService.getInFlow();
+                break;
+            }
+            case PhaseMetadata.OUT_FLOW:
+            {
+                flow = axisService.getOutFlow();
+                break;
+            }
+            case PhaseMetadata.FAULT_IN_FLOW:
+            {
+                flow = axisService.getFaultInFlow();
+                break;
+            }
+            case PhaseMetadata.FAULT_OUT_FLOW:
+            {
+                flow = axisService.getFaultOutFlow();
+                break;
+            }
+        }
+        if (flow != null) {
+            for (int j = 0; j < flow.getHandlerCount(); j++) {
+                HandlerDescription metadata = flow.getHandler(j);
+
+                // todo change this in properway
+                if (metadata.getRules().getPhaseName().equals("")) {
+                    throw new PhaseException(
+                            Messages.getMessage(DeploymentErrorMsgs.PHASE_DOES_NOT_SPECIFED,
+                                    metadata.getName().getLocalPart()));
+                } else if(PhaseValidator.isSystemPhases(metadata.getRules().getPhaseName())){
+                    throw new PhaseException(Messages.getMessage(
+                            DeploymentErrorMsgs.SERVICE_MODULE_CAN_NOT_REFER_GLOBAL_PHASE,
+                            metadata.getRules().getPhaseName()));
+                } else {
+                    allHandlers.add(metadata);
+                }
+            }
+        }
+        switch (type) {
+            case PhaseMetadata.IN_FLOW:
+            {
+                phaseHolder =
+                        new PhaseHolder(operation.getRemainingPhasesInFlow());
+                break;
+            }
+            case PhaseMetadata.OUT_FLOW:
+            {
+                phaseHolder =
+                        new PhaseHolder(operation.getPhasesOutFlow());
+                break;
+            }
+            case PhaseMetadata.FAULT_IN_FLOW:
+            {
+                phaseHolder =
+                        new PhaseHolder(operation.getPhasesInFaultFlow());
+                break;
+            }
+            case PhaseMetadata.FAULT_OUT_FLOW:
+            {
+                phaseHolder =
+                        new PhaseHolder(operation.getPhasesOutFaultFlow());
+                break;
+            }
+        }
+        for (int i = 0; i < allHandlers.size(); i++) {
+            HandlerDescription handlerMetaData =
+                    (HandlerDescription) allHandlers.get(i);
+            phaseHolder.addHandler(handlerMetaData);
+        }
+    }
+
+    /**
+     * Method buildTranspotsChains
+     *
+     * @throws PhaseException
+     */
+    public void buildTranspotsChains() throws PhaseException {
+        HashMap axisTransportIn = axisConfig.getTransportsIn();
+        HashMap axisTransportOut = axisConfig.getTransportsOut();
+
+        Collection colintrnsport = axisTransportIn.values();
+        for (Iterator iterator = colintrnsport.iterator();
+             iterator.hasNext();) {
+            TransportInDescription transport = (TransportInDescription) iterator.next();
+            buildINTransportChains(transport);
+        }
+
+        Collection colouttrnsport = axisTransportOut.values();
+        for (Iterator iterator = colouttrnsport.iterator();
+             iterator.hasNext();) {
+            TransportOutDescription transport = (TransportOutDescription) iterator.next();
+            buildOutTransportChains(transport);
+        }
+    }
+
+
+    private void buildINTransportChains(TransportInDescription transport)
+            throws PhaseException {
+        Flow flow = null;
+        Phase phase = null;
+        for (int type = 1; type < 4; type++) {
+            switch (type) {
+                case PhaseMetadata.IN_FLOW:
+                {
+                    flow = transport.getInFlow();
+                    phase = transport.getInPhase();
+                    break;
+                }
+                case PhaseMetadata.FAULT_IN_FLOW:
+                {
+                    flow = transport.getFaultFlow();
+                    phase = transport.getFaultPhase();
+                    break;
+                }
+            }
+            if (flow != null) {
+                ArrayList handlers = new ArrayList();
+                for (int j = 0; j < flow.getHandlerCount(); j++) {
+                    HandlerDescription metadata = flow.getHandler(j);
+                    metadata.getRules().setPhaseName(PhaseMetadata.TRANSPORT_PHASE);
+                    handlers.add(metadata);
+                }
+                new PhaseHolder().buildTransportHandlerChain(phase, handlers);
+            } else {
+            }
+        }
+    }
+
+
+    /**
+     * Method buildTransportChains
+     *
+     * @param transport
+     * @throws PhaseException
+     */
+    private void buildOutTransportChains(TransportOutDescription transport)
+            throws PhaseException {
+        Flow flow = null;
+        Phase phase = null;
+        for (int type = 1; type < 5; type++) {
+            switch (type) {
+                case PhaseMetadata.OUT_FLOW:
+                {
+                    flow = transport.getOutFlow();
+                    phase = transport.getOutPhase();
+                    break;
+                }
+                case PhaseMetadata.FAULT_OUT_FLOW:
+                {
+                    flow = transport.getFaultFlow();
+                    phase = transport.getFaultPhase();
+                    break;
+                }
+            }
+            if (flow != null) {
+                ArrayList handlers = new ArrayList();
+                for (int j = 0; j < flow.getHandlerCount(); j++) {
+                    HandlerDescription metadata = flow.getHandler(j);
+                    metadata.getRules().setPhaseName(PhaseMetadata.TRANSPORT_PHASE);
+                    handlers.add(metadata);
+                }
+                new PhaseHolder().buildTransportHandlerChain(phase, handlers);
+            } else {
+            }
+        }
+    }
+
+
+    public void engageModuleGlobally(ModuleDescription module) throws AxisFault {
+        enageToGlobalChain(module);
+        Iterator servicegroups = axisConfig.getServiceGroups();
+        while (servicegroups.hasNext()) {
+            ServiceGroupDescription sericeGroup = (ServiceGroupDescription) servicegroups.next();
+            Iterator services = sericeGroup.getServices();
+            while (services.hasNext()) {
+                ServiceDescription serviceDescription = (ServiceDescription) services.next();
+                serviceDescription.addModuleOperations(module, axisConfig);
+                engageModuleToServiceFromGlobal(serviceDescription, module);
+                serviceDescription.addToEngagModuleList(module);
+            }
+            sericeGroup.addModule(module.getName());
+        }
+    }
+
+    /**
+     * To engage modules come form global
+     *
+     * @param service
+     * @param module
+     * @throws PhaseException
+     */
+    public void engageModuleToServiceFromGlobal(ServiceDescription service,
+                                                ModuleDescription module) throws PhaseException {
+        HashMap opeartions = service.getOperations();
+        Collection opCol = opeartions.values();
+        boolean engaged = false;
+        for (Iterator iterator = opCol.iterator(); iterator.hasNext();) {
+            OperationDescription opDesc = (OperationDescription) iterator.next();
+            Collection modules = opDesc.getModules();
+            for (Iterator iterator1 = modules.iterator();
+                 iterator1.hasNext();) {
+                ModuleDescription description = (ModuleDescription) iterator1.next();
+                if (description.getName().equals(module.getName())) {
+                    engaged = true;
+                    break;
+                }
+            }
+            if (engaged) {
+                continue;
+            }
+            Flow flow = null;
+            for (int type = 1; type < 5; type++) {
+                switch (type) {
+                    case PhaseMetadata.IN_FLOW:
+                    {
+                        phaseHolder =
+                                new PhaseHolder(opDesc.getRemainingPhasesInFlow());
+                        break;
+                    }
+                    case PhaseMetadata.OUT_FLOW:
+                    {
+                        phaseHolder =
+                                new PhaseHolder(opDesc.getPhasesOutFlow());
+                        break;
+                    }
+                    case PhaseMetadata.FAULT_IN_FLOW:
+                    {
+                        phaseHolder =
+                                new PhaseHolder(opDesc.getPhasesInFaultFlow());
+                        break;
+                    }
+                    case PhaseMetadata.FAULT_OUT_FLOW:
+                    {
+                        phaseHolder =
+                                new PhaseHolder(opDesc.getPhasesOutFaultFlow());
+                        break;
+                    }
+                }
+                ////////////////////////////////////////////////////////////////////////////////////
+                /////////////////// Modules refered by axis2.xml //////////////////////////////////
+                ////////////////////////////////////////////////////////////////////////////////////
+                switch (type) {
+                    case PhaseMetadata.IN_FLOW:
+                    {
+                        flow = module.getInFlow();
+                        break;
+                    }
+                    case PhaseMetadata.OUT_FLOW:
+                    {
+                        flow = module.getOutFlow();
+                        break;
+                    }
+                    case PhaseMetadata.FAULT_IN_FLOW:
+                    {
+                        flow = module.getFaultInFlow();
+                        break;
+                    }
+                    case PhaseMetadata.FAULT_OUT_FLOW:
+                    {
+                        flow = module.getFaultOutFlow();
+                        break;
+                    }
+                }
+                if (flow != null) {
+                    for (int j = 0; j < flow.getHandlerCount(); j++) {
+                        HandlerDescription metadata = flow.getHandler(j);
+                        if (!PhaseValidator.isSystemPhases(metadata.getRules().getPhaseName())) {
+                            phaseHolder.addHandler(metadata);
+                        }
+                    }
+                }
+            }
+            opDesc.addToEngageModuleList(module);
+        }
+    }
+
+
+    private void enageToGlobalChain(ModuleDescription module) throws PhaseException {
+        Flow flow = null;
+        for (int type = 1; type < 5; type++) {
+            switch (type) {
+                case PhaseMetadata.IN_FLOW:
+                {
+                    phaseHolder =
+                            new PhaseHolder(axisConfig.
+                                    getInPhasesUptoAndIncludingPostDispatch());
+                    break;
+                }
+                case PhaseMetadata.OUT_FLOW:
+                {
+                    phaseHolder =
+                            new PhaseHolder(((AxisConfigurationImpl) axisConfig).getOutFlow());
+                    break;
+                }
+                case PhaseMetadata.FAULT_IN_FLOW:
+                {
+                    phaseHolder =
+                            new PhaseHolder(axisConfig.getInFaultFlow());
+                    break;
+                }
+                case PhaseMetadata.FAULT_OUT_FLOW:
+                {
+                    phaseHolder =
+                            new PhaseHolder(((AxisConfigurationImpl) axisConfig).getOutFaultFlow());
+                    break;
+                }
+            }
+            ////////////////////////////////////////////////////////////////////////////////////
+            /////////////////// Modules refered by axis2.xml //////////////////////////////////
+            ////////////////////////////////////////////////////////////////////////////////////
+            switch (type) {
+                case PhaseMetadata.IN_FLOW:
+                {
+                    flow = module.getInFlow();
+                    break;
+                }
+                case PhaseMetadata.OUT_FLOW:
+                {
+                    flow = module.getOutFlow();
+                    break;
+                }
+                case PhaseMetadata.FAULT_IN_FLOW:
+                {
+                    flow = module.getFaultInFlow();
+                    break;
+                }
+                case PhaseMetadata.FAULT_OUT_FLOW:
+                {
+                    flow = module.getFaultOutFlow();
+                    break;
+                }
+            }
+            if (flow != null) {
+                for (int j = 0; j < flow.getHandlerCount(); j++) {
+                    HandlerDescription metadata = flow.getHandler(j);
+                    if (PhaseValidator.isSystemPhases(metadata.getRules().getPhaseName())) {
+                        phaseHolder.addHandler(metadata);
+                    } else {
+                        /**
+                         * These handlers will go to operation's handler chains , since the module
+                         * try to add handlres to both sytem predefined phases and user defined phase
+                         * so global module can do that. here the global module are the module which are
+                         * reffred by axis2.xml
+                         */
+                    }
+                }
+            }
+        }
+    }
+
+
+    public void engageModuleToService(ServiceDescription service,
+                                      ModuleDescription module) throws AxisFault {
+        HashMap opeartions = service.getOperations();
+        Collection opCol = opeartions.values();
+        boolean engaged = false;
+        service.addModuleOperations(module, axisConfig);
+        for (Iterator iterator = opCol.iterator(); iterator.hasNext();) {
+            OperationDescription opDesc = (OperationDescription) iterator.next();
+            Collection modules = opDesc.getModules();
+            for (Iterator iterator1 = modules.iterator();
+                 iterator1.hasNext();) {
+                ModuleDescription description = (ModuleDescription) iterator1.next();
+                if (description.getName().equals(module.getName())) {
+                    engaged = true;
+                    break;
+                }
+            }
+            if (!engaged) {
+                engageModuleToOperation(opDesc, module);
+                opDesc.addToEngageModuleList(module);
+            }
+        }
+    }
+
+
+    public void engageModuleToOperation(OperationDescription operation,
+                                        ModuleDescription module) throws PhaseException {
+        Flow flow = null;
+        for (int type = 1; type < 5; type++) {
+            switch (type) {
+                case PhaseMetadata.IN_FLOW:
+                {
+                    phaseHolder =
+                            new PhaseHolder(operation.getRemainingPhasesInFlow());
+                    break;
+                }
+                case PhaseMetadata.OUT_FLOW:
+                {
+                    phaseHolder =
+                            new PhaseHolder(operation.getPhasesOutFlow());
+                    break;
+                }
+                case PhaseMetadata.FAULT_IN_FLOW:
+                {
+                    phaseHolder =
+                            new PhaseHolder(operation.getPhasesInFaultFlow());
+                    break;
+                }
+                case PhaseMetadata.FAULT_OUT_FLOW:
+                {
+                    phaseHolder =
+                            new PhaseHolder(operation.getPhasesOutFaultFlow());
+                    break;
+                }
+            }
+
+            switch (type) {
+                case PhaseMetadata.IN_FLOW:
+                {
+                    flow = module.getInFlow();
+                    break;
+                }
+                case PhaseMetadata.OUT_FLOW:
+                {
+                    flow = module.getOutFlow();
+                    break;
+                }
+                case PhaseMetadata.FAULT_IN_FLOW:
+                {
+                    flow = module.getFaultInFlow();
+                    break;
+                }
+                case PhaseMetadata.FAULT_OUT_FLOW:
+                {
+                    flow = module.getFaultOutFlow();
+                    break;
+                }
+            }
+            if (flow != null) {
+                for (int j = 0; j < flow.getHandlerCount(); j++) {
+                    HandlerDescription metadata = flow.getHandler(j);
+                    if (!PhaseValidator.isSystemPhases(metadata.getRules().getPhaseName())) {
+                        phaseHolder.addHandler(metadata);
+                    } else {
+                        throw new PhaseException(Messages.getMessage(DeploymentErrorMsgs.SERVICE_MODULE_CAN_NOT_REFER_GLOBAL_PHASE,
+                                metadata.getRules().getPhaseName()));
+                    }
+                }
+            }
+        }
+    }
+}

Propchange: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/phaseresolver/PhaseResolver.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/phaseresolver/util/PhaseValidator.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/phaseresolver/util/PhaseValidator.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/phaseresolver/util/PhaseValidator.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/phaseresolver/util/PhaseValidator.java Thu Sep 15 11:52:11 2005
@@ -1,39 +1,39 @@
-package org.apache.axis2.phaseresolver.util;
-
-import org.apache.axis2.phaseresolver.PhaseMetadata;
-
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-*      http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*
-*
-*/
-
-/**
- * Author : Deepal Jayasinghe
- * Date: May 12, 2005
- * Time: 7:49:43 PM
- */
-public class PhaseValidator {
-
-    public static int SYSTEM_MODULE = 0;
-    public static int SERVICE_MODULE = 1;
-
-    public static boolean isSystemPhases(String phaseName) {
-        return ((PhaseMetadata.PHASE_TRANSPORTIN.equals(phaseName)) ||
-                (PhaseMetadata.PHASE_DISPATCH.equals(phaseName)) ||
-                (PhaseMetadata.PHASE_POST_DISPATCH.equals(phaseName)) ||
-                (PhaseMetadata.PHASE_PRE_DISPATCH.equals(phaseName)));
-    }
-}
+package org.apache.axis2.phaseresolver.util;
+
+import org.apache.axis2.phaseresolver.PhaseMetadata;
+
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*      http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+*
+*/
+
+/**
+ * Author : Deepal Jayasinghe
+ * Date: May 12, 2005
+ * Time: 7:49:43 PM
+ */
+public class PhaseValidator {
+
+    public static int SYSTEM_MODULE = 0;
+    public static int SERVICE_MODULE = 1;
+
+    public static boolean isSystemPhases(String phaseName) {
+        return ((PhaseMetadata.PHASE_TRANSPORTIN.equals(phaseName)) ||
+                (PhaseMetadata.PHASE_DISPATCH.equals(phaseName)) ||
+                (PhaseMetadata.PHASE_POST_DISPATCH.equals(phaseName)) ||
+                (PhaseMetadata.PHASE_PRE_DISPATCH.equals(phaseName)));
+    }
+}

Propchange: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/phaseresolver/util/PhaseValidator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/receivers/AbstractInMessageReceiver.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/receivers/AbstractInMessageReceiver.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/receivers/AbstractInMessageReceiver.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/receivers/AbstractInMessageReceiver.java Thu Sep 15 11:52:11 2005
@@ -1,36 +1,36 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.axis2.receivers;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.context.MessageContext;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * This is takes care of the IN-OUT sync MEP in the server side
- */
-public abstract class AbstractInMessageReceiver
-        extends AbstractMessageReceiver {
-    protected Log log = LogFactory.getLog(getClass());
-
-    public abstract void invokeBusinessLogic(MessageContext inMessage) throws AxisFault;
-
-    public final void receive(final MessageContext messgeCtx) throws AxisFault {
-        invokeBusinessLogic(messgeCtx);
-    }
-
-}
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.axis2.receivers;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.MessageContext;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * This is takes care of the IN-OUT sync MEP in the server side
+ */
+public abstract class AbstractInMessageReceiver
+        extends AbstractMessageReceiver {
+    protected Log log = LogFactory.getLog(getClass());
+
+    public abstract void invokeBusinessLogic(MessageContext inMessage) throws AxisFault;
+
+    public final void receive(final MessageContext messgeCtx) throws AxisFault {
+        invokeBusinessLogic(messgeCtx);
+    }
+
+}

Propchange: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/receivers/AbstractInMessageReceiver.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/receivers/AbstractInOutAsyncMessageReceiver.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/receivers/AbstractInOutAsyncMessageReceiver.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/receivers/AbstractInOutAsyncMessageReceiver.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/receivers/AbstractInOutAsyncMessageReceiver.java Thu Sep 15 11:52:11 2005
@@ -1,103 +1,103 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.axis2.receivers;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.addressing.AddressingConstants;
-import org.apache.axis2.addressing.MessageInformationHeaders;
-import org.apache.axis2.addressing.miheaders.RelatesTo;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.engine.AxisEngine;
-import org.apache.axis2.transport.http.HTTPConstants;
-import org.apache.axis2.util.UUIDGenerator;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * This is takes care of the IN-OUT sync MEP in the server side
- */
-public abstract class AbstractInOutAsyncMessageReceiver extends AbstractMessageReceiver {
-    protected Log log = LogFactory.getLog(getClass());
-
-    public abstract void invokeBusinessLogic(MessageContext inMessage, MessageContext outMessage, ServerCallback callback)
-        throws AxisFault;
-
-    public final void receive(final MessageContext messgeCtx) throws AxisFault {
-    	
-        final ServerCallback callback = new ServerCallback() {
-            public void handleResult(MessageContext result) throws AxisFault {
-                AxisEngine engine =
-                    new AxisEngine(
-                        messgeCtx.getOperationContext().getServiceContext().getEngineContext());
-                engine.send(messgeCtx);
-            }
-            public void handleFault(AxisFault fault) throws AxisFault {
-                AxisEngine engine =
-                    new AxisEngine(
-                        messgeCtx.getOperationContext().getServiceContext().getEngineContext());
-                MessageContext faultContext = engine.createFaultMessageContext(messgeCtx, fault);
-                engine.sendFault(faultContext);
-            }
-        };
-        Runnable theadedTask = new Runnable() {
-            public void run() {
-                try {
-                	
-                    MessageContext newmsgCtx =
-                        new MessageContext(messgeCtx.getSystemContext(),
-                                messgeCtx.getSessionContext(),
-                                messgeCtx.getTransportIn(),
-                                messgeCtx.getTransportOut());
-                    
-                    MessageInformationHeaders oldMessageInfoHeaders =
-                            messgeCtx.getMessageInformationHeaders();
-                    MessageInformationHeaders messageInformationHeaders =
-                            new MessageInformationHeaders();
-                    messageInformationHeaders.setMessageId(UUIDGenerator.getUUID());
-                    messageInformationHeaders.setTo(oldMessageInfoHeaders.getReplyTo());
-                    messageInformationHeaders.setFaultTo(
-                            oldMessageInfoHeaders.getFaultTo());
-                    messageInformationHeaders.setFrom(oldMessageInfoHeaders.getTo());
-                    messageInformationHeaders.setRelatesTo(
-                            new RelatesTo(oldMessageInfoHeaders.getMessageId(),
-                                    AddressingConstants.Submission.WSA_RELATES_TO_RELATIONSHIP_TYPE_DEFAULT_VALUE));
-                    messageInformationHeaders.setAction(oldMessageInfoHeaders.getAction());
-                    newmsgCtx.setMessageInformationHeaders(messageInformationHeaders);
-                    newmsgCtx.setOperationContext(messgeCtx.getOperationContext());
-                    newmsgCtx.setServiceContext(messgeCtx.getServiceContext());
-                    newmsgCtx.setProperty(MessageContext.TRANSPORT_OUT,
-                            messgeCtx.getProperty(MessageContext.TRANSPORT_OUT));
-                    newmsgCtx.setProperty(HTTPConstants.HTTPOutTransportInfo,
-                            messgeCtx.getProperty(HTTPConstants.HTTPOutTransportInfo));
-                    
-                    //Setting the charater set encoding
-                    newmsgCtx.setProperty(MessageContext.CHARACTER_SET_ENCODING, messgeCtx
-            				.getProperty(MessageContext.CHARACTER_SET_ENCODING));
-                    
-                    newmsgCtx.setDoingREST(messgeCtx.isDoingREST());
-                    newmsgCtx.setDoingMTOM(messgeCtx.isDoingMTOM());
-                    newmsgCtx.setServerSide(messgeCtx.isServerSide());
-                	
-                    invokeBusinessLogic(messgeCtx, newmsgCtx, callback);
-                } catch (AxisFault e) {
-                    log.error(e);
-                }
-            }
-        };
-        (new Thread(theadedTask)).start();
-    }
-
-}
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.axis2.receivers;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.AddressingConstants;
+import org.apache.axis2.addressing.MessageInformationHeaders;
+import org.apache.axis2.addressing.miheaders.RelatesTo;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.engine.AxisEngine;
+import org.apache.axis2.transport.http.HTTPConstants;
+import org.apache.axis2.util.UUIDGenerator;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * This is takes care of the IN-OUT sync MEP in the server side
+ */
+public abstract class AbstractInOutAsyncMessageReceiver extends AbstractMessageReceiver {
+    protected Log log = LogFactory.getLog(getClass());
+
+    public abstract void invokeBusinessLogic(MessageContext inMessage, MessageContext outMessage, ServerCallback callback)
+        throws AxisFault;
+
+    public final void receive(final MessageContext messgeCtx) throws AxisFault {
+    	
+        final ServerCallback callback = new ServerCallback() {
+            public void handleResult(MessageContext result) throws AxisFault {
+                AxisEngine engine =
+                    new AxisEngine(
+                        messgeCtx.getOperationContext().getServiceContext().getEngineContext());
+                engine.send(messgeCtx);
+            }
+            public void handleFault(AxisFault fault) throws AxisFault {
+                AxisEngine engine =
+                    new AxisEngine(
+                        messgeCtx.getOperationContext().getServiceContext().getEngineContext());
+                MessageContext faultContext = engine.createFaultMessageContext(messgeCtx, fault);
+                engine.sendFault(faultContext);
+            }
+        };
+        Runnable theadedTask = new Runnable() {
+            public void run() {
+                try {
+                	
+                    MessageContext newmsgCtx =
+                        new MessageContext(messgeCtx.getSystemContext(),
+                                messgeCtx.getSessionContext(),
+                                messgeCtx.getTransportIn(),
+                                messgeCtx.getTransportOut());
+                    
+                    MessageInformationHeaders oldMessageInfoHeaders =
+                            messgeCtx.getMessageInformationHeaders();
+                    MessageInformationHeaders messageInformationHeaders =
+                            new MessageInformationHeaders();
+                    messageInformationHeaders.setMessageId(UUIDGenerator.getUUID());
+                    messageInformationHeaders.setTo(oldMessageInfoHeaders.getReplyTo());
+                    messageInformationHeaders.setFaultTo(
+                            oldMessageInfoHeaders.getFaultTo());
+                    messageInformationHeaders.setFrom(oldMessageInfoHeaders.getTo());
+                    messageInformationHeaders.setRelatesTo(
+                            new RelatesTo(oldMessageInfoHeaders.getMessageId(),
+                                    AddressingConstants.Submission.WSA_RELATES_TO_RELATIONSHIP_TYPE_DEFAULT_VALUE));
+                    messageInformationHeaders.setAction(oldMessageInfoHeaders.getAction());
+                    newmsgCtx.setMessageInformationHeaders(messageInformationHeaders);
+                    newmsgCtx.setOperationContext(messgeCtx.getOperationContext());
+                    newmsgCtx.setServiceContext(messgeCtx.getServiceContext());
+                    newmsgCtx.setProperty(MessageContext.TRANSPORT_OUT,
+                            messgeCtx.getProperty(MessageContext.TRANSPORT_OUT));
+                    newmsgCtx.setProperty(HTTPConstants.HTTPOutTransportInfo,
+                            messgeCtx.getProperty(HTTPConstants.HTTPOutTransportInfo));
+                    
+                    //Setting the charater set encoding
+                    newmsgCtx.setProperty(MessageContext.CHARACTER_SET_ENCODING, messgeCtx
+            				.getProperty(MessageContext.CHARACTER_SET_ENCODING));
+                    
+                    newmsgCtx.setDoingREST(messgeCtx.isDoingREST());
+                    newmsgCtx.setDoingMTOM(messgeCtx.isDoingMTOM());
+                    newmsgCtx.setServerSide(messgeCtx.isServerSide());
+                	
+                    invokeBusinessLogic(messgeCtx, newmsgCtx, callback);
+                } catch (AxisFault e) {
+                    log.error(e);
+                }
+            }
+        };
+        (new Thread(theadedTask)).start();
+    }
+
+}

Propchange: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/receivers/AbstractInOutAsyncMessageReceiver.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/receivers/AbstractInOutSyncMessageReceiver.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/receivers/AbstractInOutSyncMessageReceiver.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/receivers/AbstractInOutSyncMessageReceiver.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/receivers/AbstractInOutSyncMessageReceiver.java Thu Sep 15 11:52:11 2005
@@ -1,80 +1,80 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.axis2.receivers;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.addressing.AddressingConstants;
-import org.apache.axis2.addressing.MessageInformationHeaders;
-import org.apache.axis2.addressing.miheaders.RelatesTo;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.engine.AxisEngine;
-import org.apache.axis2.transport.http.HTTPConstants;
-import org.apache.axis2.util.UUIDGenerator;
-
-/**
- * This is the Absract IN-OUT MEP MessageReceiver. The
- * protected abstract methods are only for the sake of breaking down the logic
- */
-public abstract class AbstractInOutSyncMessageReceiver extends AbstractMessageReceiver {
-    public abstract void invokeBusinessLogic(MessageContext inMessage,
-                                             MessageContext outMessage)
-            throws AxisFault;
-
-    public final void receive(MessageContext msgContext) throws AxisFault {
-        MessageContext outMsgContext =
-                new MessageContext(msgContext.getSystemContext(),
-                        msgContext.getSessionContext(),
-                        msgContext.getTransportIn(),
-                        msgContext.getTransportOut());
-
-        MessageInformationHeaders oldMessageInfoHeaders =
-                msgContext.getMessageInformationHeaders();
-        MessageInformationHeaders messageInformationHeaders =
-                new MessageInformationHeaders();
-        messageInformationHeaders.setMessageId(UUIDGenerator.getUUID());
-        messageInformationHeaders.setTo(oldMessageInfoHeaders.getReplyTo());
-        messageInformationHeaders.setFaultTo(
-                oldMessageInfoHeaders.getFaultTo());
-        messageInformationHeaders.setFrom(oldMessageInfoHeaders.getTo());
-        messageInformationHeaders.setRelatesTo(
-                new RelatesTo(oldMessageInfoHeaders.getMessageId(),
-                        AddressingConstants.Submission.WSA_RELATES_TO_RELATIONSHIP_TYPE_DEFAULT_VALUE));
-        messageInformationHeaders.setAction(oldMessageInfoHeaders.getAction());
-        outMsgContext.setMessageInformationHeaders(messageInformationHeaders);
-        outMsgContext.setOperationContext(msgContext.getOperationContext());
-        outMsgContext.setServiceContext(msgContext.getServiceContext());
-        outMsgContext.setProperty(MessageContext.TRANSPORT_OUT,
-                msgContext.getProperty(MessageContext.TRANSPORT_OUT));
-        outMsgContext.setProperty(HTTPConstants.HTTPOutTransportInfo,
-                msgContext.getProperty(HTTPConstants.HTTPOutTransportInfo));
-        
-        //Setting the charater set encoding
-        outMsgContext.setProperty(MessageContext.CHARACTER_SET_ENCODING, msgContext
-				.getProperty(MessageContext.CHARACTER_SET_ENCODING));
-        
-        outMsgContext.setDoingREST(msgContext.isDoingREST());
-        outMsgContext.setDoingMTOM(msgContext.isDoingMTOM());
-        outMsgContext.setServerSide(msgContext.isServerSide());
-
-        invokeBusinessLogic(msgContext, outMsgContext);
-
-        AxisEngine engine =
-                new AxisEngine(
-                        msgContext.getOperationContext().getServiceContext()
-                .getEngineContext());
-        engine.send(outMsgContext);
-    }
-}
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.axis2.receivers;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.AddressingConstants;
+import org.apache.axis2.addressing.MessageInformationHeaders;
+import org.apache.axis2.addressing.miheaders.RelatesTo;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.engine.AxisEngine;
+import org.apache.axis2.transport.http.HTTPConstants;
+import org.apache.axis2.util.UUIDGenerator;
+
+/**
+ * This is the Absract IN-OUT MEP MessageReceiver. The
+ * protected abstract methods are only for the sake of breaking down the logic
+ */
+public abstract class AbstractInOutSyncMessageReceiver extends AbstractMessageReceiver {
+    public abstract void invokeBusinessLogic(MessageContext inMessage,
+                                             MessageContext outMessage)
+            throws AxisFault;
+
+    public final void receive(MessageContext msgContext) throws AxisFault {
+        MessageContext outMsgContext =
+                new MessageContext(msgContext.getSystemContext(),
+                        msgContext.getSessionContext(),
+                        msgContext.getTransportIn(),
+                        msgContext.getTransportOut());
+
+        MessageInformationHeaders oldMessageInfoHeaders =
+                msgContext.getMessageInformationHeaders();
+        MessageInformationHeaders messageInformationHeaders =
+                new MessageInformationHeaders();
+        messageInformationHeaders.setMessageId(UUIDGenerator.getUUID());
+        messageInformationHeaders.setTo(oldMessageInfoHeaders.getReplyTo());
+        messageInformationHeaders.setFaultTo(
+                oldMessageInfoHeaders.getFaultTo());
+        messageInformationHeaders.setFrom(oldMessageInfoHeaders.getTo());
+        messageInformationHeaders.setRelatesTo(
+                new RelatesTo(oldMessageInfoHeaders.getMessageId(),
+                        AddressingConstants.Submission.WSA_RELATES_TO_RELATIONSHIP_TYPE_DEFAULT_VALUE));
+        messageInformationHeaders.setAction(oldMessageInfoHeaders.getAction());
+        outMsgContext.setMessageInformationHeaders(messageInformationHeaders);
+        outMsgContext.setOperationContext(msgContext.getOperationContext());
+        outMsgContext.setServiceContext(msgContext.getServiceContext());
+        outMsgContext.setProperty(MessageContext.TRANSPORT_OUT,
+                msgContext.getProperty(MessageContext.TRANSPORT_OUT));
+        outMsgContext.setProperty(HTTPConstants.HTTPOutTransportInfo,
+                msgContext.getProperty(HTTPConstants.HTTPOutTransportInfo));
+        
+        //Setting the charater set encoding
+        outMsgContext.setProperty(MessageContext.CHARACTER_SET_ENCODING, msgContext
+				.getProperty(MessageContext.CHARACTER_SET_ENCODING));
+        
+        outMsgContext.setDoingREST(msgContext.isDoingREST());
+        outMsgContext.setDoingMTOM(msgContext.isDoingMTOM());
+        outMsgContext.setServerSide(msgContext.isServerSide());
+
+        invokeBusinessLogic(msgContext, outMsgContext);
+
+        AxisEngine engine =
+                new AxisEngine(
+                        msgContext.getOperationContext().getServiceContext()
+                .getEngineContext());
+        engine.send(outMsgContext);
+    }
+}

Propchange: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/receivers/AbstractInOutSyncMessageReceiver.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/receivers/AbstractMessageReceiver.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/receivers/AbstractMessageReceiver.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/receivers/AbstractMessageReceiver.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/receivers/AbstractMessageReceiver.java Thu Sep 15 11:52:11 2005
@@ -1,140 +1,140 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.axis2.receivers;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.Constants;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.context.SessionContext;
-import org.apache.axis2.description.Parameter;
-import org.apache.axis2.description.ServiceDescription;
-import org.apache.axis2.engine.MessageReceiver;
-import org.apache.axis2.i18n.Messages;
-import org.apache.axis2.om.OMAbstractFactory;
-import org.apache.axis2.soap.SOAP11Constants;
-import org.apache.axis2.soap.SOAP12Constants;
-import org.apache.axis2.soap.SOAPFactory;
-
-import javax.xml.namespace.QName;
-
-public abstract class AbstractMessageReceiver implements MessageReceiver {
-    public static final String SERVICE_CLASS = "ServiceClass";
-    public static final String SCOPE = "scope";
-
-    protected SOAPFactory fac;
-
-    /**
-     * Method makeNewServiceObject
-     *
-     * @param msgContext
-     * @return
-     * @throws AxisFault
-     */
-    protected Object makeNewServiceObject(MessageContext msgContext)
-        throws AxisFault {
-        try {
-
-            String nsURI = msgContext.getEnvelope().getNamespace().getName();
-            if (SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(nsURI)) {
-                fac = OMAbstractFactory.getSOAP12Factory();
-            } else if (
-                SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(nsURI)) {
-                fac = OMAbstractFactory.getSOAP11Factory();
-            } else {
-                throw new AxisFault(Messages.getMessage("invalidSOAPversion"));
-            }
-
-            ServiceDescription service =
-                msgContext
-                    .getOperationContext()
-                    .getServiceContext()
-                    .getServiceConfig();
-            ClassLoader classLoader = service.getClassLoader();
-            Parameter implInfoParam = service.getParameter(SERVICE_CLASS);
-            if (implInfoParam != null) {
-                Class implClass =
-                    Class.forName(
-                        (String) implInfoParam.getValue(),
-                        true,
-                        classLoader);
-                return implClass.newInstance();
-            } else {
-                throw new AxisFault(
-                    Messages.getMessage(
-                        "paramIsNotSpecified",
-                        "SERVICE_CLASS"));
-            }
-            
-        } catch (Exception e) {
-            throw AxisFault.makeFault(e);
-        }
-    }
-
-    /**
-     * Method getTheImplementationObject
-     *
-     * @param msgContext
-     * @return
-     * @throws AxisFault
-     */
-    protected Object getTheImplementationObject(MessageContext msgContext)
-        throws AxisFault {
-        ServiceDescription service =
-            msgContext
-                .getOperationContext()
-                .getServiceContext()
-                .getServiceConfig();
-
-        Parameter scopeParam = service.getParameter(SCOPE);
-        QName serviceName = service.getName();
-        if (scopeParam != null
-            && Constants.SESSION_SCOPE.equals(scopeParam.getValue())) {
-            SessionContext sessionContext = msgContext.getSessionContext();
-            synchronized (sessionContext) {
-                Object obj =
-                    sessionContext.getProperty(serviceName.getLocalPart());
-                if (obj == null) {
-                    obj = makeNewServiceObject(msgContext);
-                    sessionContext.setProperty(serviceName.getLocalPart(), obj);
-                }
-                return obj;
-            }
-        } else if (
-            scopeParam != null
-                && Constants.APPLICATION_SCOPE.equals(scopeParam.getValue())) {
-            ConfigurationContext globalContext = msgContext.getSystemContext();
-            synchronized (globalContext) {
-                Object obj =
-                    globalContext.getProperty(serviceName.getLocalPart());
-                if (obj == null) {
-                    obj = makeNewServiceObject(msgContext);
-                    globalContext.setProperty(serviceName.getLocalPart(), obj);
-                }
-                return obj;
-            }
-        } else {
-            return makeNewServiceObject(msgContext);
-        }
-    }
-
-    public SOAPFactory getSOAPFactory() {
-        return fac;
-    }
-    
-
-}
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axis2.receivers;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.context.SessionContext;
+import org.apache.axis2.description.Parameter;
+import org.apache.axis2.description.ServiceDescription;
+import org.apache.axis2.engine.MessageReceiver;
+import org.apache.axis2.i18n.Messages;
+import org.apache.axis2.om.OMAbstractFactory;
+import org.apache.axis2.soap.SOAP11Constants;
+import org.apache.axis2.soap.SOAP12Constants;
+import org.apache.axis2.soap.SOAPFactory;
+
+import javax.xml.namespace.QName;
+
+public abstract class AbstractMessageReceiver implements MessageReceiver {
+    public static final String SERVICE_CLASS = "ServiceClass";
+    public static final String SCOPE = "scope";
+
+    protected SOAPFactory fac;
+
+    /**
+     * Method makeNewServiceObject
+     *
+     * @param msgContext
+     * @return
+     * @throws AxisFault
+     */
+    protected Object makeNewServiceObject(MessageContext msgContext)
+        throws AxisFault {
+        try {
+
+            String nsURI = msgContext.getEnvelope().getNamespace().getName();
+            if (SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(nsURI)) {
+                fac = OMAbstractFactory.getSOAP12Factory();
+            } else if (
+                SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(nsURI)) {
+                fac = OMAbstractFactory.getSOAP11Factory();
+            } else {
+                throw new AxisFault(Messages.getMessage("invalidSOAPversion"));
+            }
+
+            ServiceDescription service =
+                msgContext
+                    .getOperationContext()
+                    .getServiceContext()
+                    .getServiceConfig();
+            ClassLoader classLoader = service.getClassLoader();
+            Parameter implInfoParam = service.getParameter(SERVICE_CLASS);
+            if (implInfoParam != null) {
+                Class implClass =
+                    Class.forName(
+                        (String) implInfoParam.getValue(),
+                        true,
+                        classLoader);
+                return implClass.newInstance();
+            } else {
+                throw new AxisFault(
+                    Messages.getMessage(
+                        "paramIsNotSpecified",
+                        "SERVICE_CLASS"));
+            }
+            
+        } catch (Exception e) {
+            throw AxisFault.makeFault(e);
+        }
+    }
+
+    /**
+     * Method getTheImplementationObject
+     *
+     * @param msgContext
+     * @return
+     * @throws AxisFault
+     */
+    protected Object getTheImplementationObject(MessageContext msgContext)
+        throws AxisFault {
+        ServiceDescription service =
+            msgContext
+                .getOperationContext()
+                .getServiceContext()
+                .getServiceConfig();
+
+        Parameter scopeParam = service.getParameter(SCOPE);
+        QName serviceName = service.getName();
+        if (scopeParam != null
+            && Constants.SESSION_SCOPE.equals(scopeParam.getValue())) {
+            SessionContext sessionContext = msgContext.getSessionContext();
+            synchronized (sessionContext) {
+                Object obj =
+                    sessionContext.getProperty(serviceName.getLocalPart());
+                if (obj == null) {
+                    obj = makeNewServiceObject(msgContext);
+                    sessionContext.setProperty(serviceName.getLocalPart(), obj);
+                }
+                return obj;
+            }
+        } else if (
+            scopeParam != null
+                && Constants.APPLICATION_SCOPE.equals(scopeParam.getValue())) {
+            ConfigurationContext globalContext = msgContext.getSystemContext();
+            synchronized (globalContext) {
+                Object obj =
+                    globalContext.getProperty(serviceName.getLocalPart());
+                if (obj == null) {
+                    obj = makeNewServiceObject(msgContext);
+                    globalContext.setProperty(serviceName.getLocalPart(), obj);
+                }
+                return obj;
+            }
+        } else {
+            return makeNewServiceObject(msgContext);
+        }
+    }
+
+    public SOAPFactory getSOAPFactory() {
+        return fac;
+    }
+    
+
+}

Propchange: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/receivers/AbstractMessageReceiver.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message