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 am...@apache.org on 2009/03/27 07:35:01 UTC

svn commit: r759032 - in /webservices/axis2/trunk/java/modules/kernel: src/org/apache/axis2/deployment/ src/org/apache/axis2/engine/ src/org/apache/axis2/util/ test-resources/deployment/faultyServiceshandling/ test-resources/deployment/faultyServicesha...

Author: amilas
Date: Fri Mar 27 06:34:58 2009
New Revision: 759032

URL: http://svn.apache.org/viewvc?rev=759032&view=rev
Log:
commiting the patch for faulty service handling refer AXIS2-4286 and AXIS2-4281 

Added:
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/FaultyServiceData.java
    webservices/axis2/trunk/java/modules/kernel/test-resources/deployment/faultyServiceshandling/
    webservices/axis2/trunk/java/modules/kernel/test-resources/deployment/faultyServiceshandling/repo/
    webservices/axis2/trunk/java/modules/kernel/test-resources/deployment/faultyServiceshandling/repo/axis2.xml
    webservices/axis2/trunk/java/modules/kernel/test-resources/deployment/faultyServiceshandling/repo/services/
    webservices/axis2/trunk/java/modules/kernel/test-resources/deployment/faultyServiceshandling/repo/services/echo2/
    webservices/axis2/trunk/java/modules/kernel/test-resources/deployment/faultyServiceshandling/repo/services/echo2/META-INF/
    webservices/axis2/trunk/java/modules/kernel/test-resources/deployment/faultyServiceshandling/repo/services/echo2/META-INF/services.xml
    webservices/axis2/trunk/java/modules/kernel/test-resources/deployment/faultyServiceshandling/sample-logging/
    webservices/axis2/trunk/java/modules/kernel/test-resources/deployment/faultyServiceshandling/sample-logging/META-INF/
    webservices/axis2/trunk/java/modules/kernel/test-resources/deployment/faultyServiceshandling/sample-logging/META-INF/module.xml
    webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/deployment/FaultyServicesDueToModuleTest.java
    webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/sample/module/
    webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/sample/module/LogginModule.java
Modified:
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DescriptionBuilder.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ServiceBuilder.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ServiceDeployer.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ServiceGroupBuilder.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java?rev=759032&r1=759031&r2=759032&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java Fri Mar 27 06:34:58 2009
@@ -47,6 +47,7 @@
 import org.apache.axis2.engine.MessageReceiver;
 import org.apache.axis2.i18n.Messages;
 import org.apache.axis2.util.JavaUtils;
+import org.apache.axis2.util.FaultyServiceData;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -555,6 +556,30 @@
 
         axisConfiguration.addModule(modulemetadata);
         log.debug(Messages.getMessage(DeploymentErrorMsgs.ADDING_NEW_MODULE));
+
+        synchronized (axisConfiguration.getFaultyServicsDuetoModules()) {
+
+            //Check whether there are faulty services due to this module
+            HashMap<String, FaultyServiceData> faultyServices = axisConfiguration.getFaultyServicesDuetoModule(
+                    modulemetadata.getName());
+            faultyServices = (HashMap<String, FaultyServiceData>)faultyServices.clone();
+
+            // Here iterating a cloned hashmap and modifying the original hashmap.
+            // To avoid the ConcurrentModificationException.
+            for (Iterator<FaultyServiceData> itr = faultyServices.values().iterator(); itr.hasNext();) {
+
+                FaultyServiceData faultyServiceData = itr.next();
+                axisConfiguration.removeFaultyServiceDuetoModule(modulemetadata.getName(),
+                        faultyServiceData.getServiceGroup().getServiceGroupName());
+
+                //Recover the faulty serviceGroup.
+                addServiceGroup(faultyServiceData.getServiceGroup(),
+                        faultyServiceData.getServiceList(),
+                        faultyServiceData.getServiceLocation(),
+                        faultyServiceData.getCurrentDeploymentFile(),
+                        axisConfiguration);
+            }
+        }
     }
 
     public static void addServiceGroup(AxisServiceGroup serviceGroup,
@@ -562,12 +587,104 @@
                                        URL serviceLocation,
                                        DeploymentFileData currentDeploymentFile,
                                        AxisConfiguration axisConfiguration) throws AxisFault {
-        fillServiceGroup(serviceGroup, serviceList, serviceLocation, axisConfiguration);
-        axisConfiguration.addServiceGroup(serviceGroup);
-        if (currentDeploymentFile != null) {
-            addAsWebResources(currentDeploymentFile.getFile(),
-                              serviceGroup.getServiceGroupName(), serviceGroup);
+
+        if (isServiceGroupReadyToDeploy(serviceGroup, serviceList, serviceLocation,
+                currentDeploymentFile, axisConfiguration)) {
+
+            fillServiceGroup(serviceGroup, serviceList, serviceLocation, axisConfiguration);
+            axisConfiguration.addServiceGroup(serviceGroup);
+
+            if (currentDeploymentFile != null) {
+                addAsWebResources(currentDeploymentFile.getFile(),
+                        serviceGroup.getServiceGroupName(), serviceGroup);
+                log.info(Messages.getMessage(DeploymentErrorMsgs.DEPLOYING_WS,
+                                         currentDeploymentFile.getName(),
+                                         serviceLocation.toString()));
+            } else {
+                log.info(Messages.getMessage(DeploymentErrorMsgs.DEPLOYING_WS,
+                                         serviceGroup.getServiceGroupName()));
+            }
+
+        }
+    }
+
+    /**
+     * Performs a check routine, in order to identify whether all the serviceGroup, service and operation level
+     * modules are available. If a referenced module is not deployed yet, the serviceGroup is added as a faulty service.
+     * @param serviceGroup
+     * @param serviceList
+     * @param serviceLocation
+     * @param currentDeploymentFile
+     * @param axisConfig
+     * @return boolean
+     * @throws AxisFault
+     */
+    protected static boolean isServiceGroupReadyToDeploy(AxisServiceGroup serviceGroup,
+                                                         ArrayList serviceList,
+                                                         URL serviceLocation,
+                                                         DeploymentFileData currentDeploymentFile,
+                                                         AxisConfiguration axisConfig) throws AxisFault {
+        synchronized (axisConfig.getFaultyServicsDuetoModules()) {
+            String moduleName;
+            ArrayList groupModules = serviceGroup.getModuleRefs();
+            for (int i = 0; i < groupModules.size(); i++) {
+                moduleName = (String) groupModules.get(i);
+                AxisModule module = axisConfig.getModule(moduleName);
+
+                if (module == null) {
+                    axisConfig.addFaultyServiceDuetoModule(moduleName, new FaultyServiceData(serviceGroup, serviceList,
+                            serviceLocation, currentDeploymentFile));
+                    if (log.isDebugEnabled()) {
+                                log.debug("Service: " + serviceGroup.getServiceGroupName() +
+                                        " becomes faulty due to Module: " + moduleName);
+                            }
+                    return false;
+                }
+            }
+
+            for (Object aServiceList : serviceList) {
+                AxisService axisService = (AxisService) aServiceList;
+
+                // modules from <service>
+                ArrayList list = axisService.getModules();
+
+                for (int i = 0; i < list.size(); i++) {
+                    moduleName = (String) list.get(i);
+                    AxisModule module = axisConfig.getModule(moduleName);
+
+                    if (module == null) {
+                        axisConfig.addFaultyServiceDuetoModule(moduleName, new FaultyServiceData(serviceGroup, serviceList,
+                                serviceLocation, currentDeploymentFile));
+                        if (log.isDebugEnabled()) {
+                                log.debug("Service: " + serviceGroup.getServiceGroupName() +
+                                        " becomes faulty due to Module: " + moduleName);
+                            }
+                        return false;
+                    }
+                }
+
+                for (Iterator iterator = axisService.getOperations(); iterator.hasNext();) {
+                    AxisOperation opDesc = (AxisOperation) iterator.next();
+                    ArrayList modules = opDesc.getModuleRefs();
+
+                    for (int i = 0; i < modules.size(); i++) {
+                        moduleName = (String) modules.get(i);
+                        AxisModule module = axisConfig.getModule(moduleName);
+
+                        if (module == null) {
+                            axisConfig.addFaultyServiceDuetoModule(moduleName, new FaultyServiceData(serviceGroup,
+                                    serviceList, serviceLocation, currentDeploymentFile));
+                            if (log.isDebugEnabled()) {
+                                log.debug("Service: " + serviceGroup.getServiceGroupName() +
+                                        " becomes faulty due to Module: " + moduleName);
+                            }
+                            return false;
+                        }
+                    }
+                }
+            }
         }
+        return true;
     }
 
     protected static void fillServiceGroup(AxisServiceGroup serviceGroup,

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DescriptionBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DescriptionBuilder.java?rev=759032&r1=759031&r2=759032&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DescriptionBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DescriptionBuilder.java Fri Mar 27 06:34:58 2009
@@ -476,7 +476,7 @@
 
     protected void processOperationModuleRefs(Iterator moduleRefs,
                                               AxisOperation operation) throws DeploymentException {
-        try {
+//        try {
             while (moduleRefs.hasNext()) {
                 OMElement moduleref = (OMElement) moduleRefs.next();
                 OMAttribute moduleRefAttribute = moduleref
@@ -484,20 +484,21 @@
 
                 if (moduleRefAttribute != null) {
                     String refName = moduleRefAttribute.getAttributeValue();
+                    operation.addModule(refName);
 
-                    if (axisConfig.getModule(refName) == null) {
-                        throw new DeploymentException(Messages.getMessage(
-                                DeploymentErrorMsgs.MODULE_NOT_FOUND, refName));
-                    } else {
-                        operation.addModule(refName);
-                    }
+//                    if (axisConfig.getModule(refName) == null) {
+//                        throw new DeploymentException(Messages.getMessage(
+//                                DeploymentErrorMsgs.MODULE_NOT_FOUND, refName));
+//                    } else {
+//                        operation.addModule(refName);
+//                    }
                 }
             }
-        } catch (AxisFault axisFault) {
-            throw new DeploymentException(Messages.getMessage(
-                    DeploymentErrorMsgs.MODULE_NOT_FOUND, axisFault
-                    .getMessage()), axisFault);
-        }
+//        } catch (AxisFault axisFault) {
+//            throw new DeploymentException(Messages.getMessage(
+//                    DeploymentErrorMsgs.MODULE_NOT_FOUND, axisFault
+//                    .getMessage()), axisFault);
+//        }
     }
 
     /**

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ServiceBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ServiceBuilder.java?rev=759032&r1=759031&r2=759032&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ServiceBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ServiceBuilder.java Fri Mar 27 06:34:58 2009
@@ -657,7 +657,7 @@
 	 */
 	protected void processModuleRefs(Iterator moduleRefs)
 			throws DeploymentException {
-		try {
+//		try {
 			while (moduleRefs.hasNext()) {
 				OMElement moduleref = (OMElement) moduleRefs.next();
 				OMAttribute moduleRefAttribute = moduleref
@@ -665,18 +665,18 @@
 
 				if (moduleRefAttribute != null) {
 					String refName = moduleRefAttribute.getAttributeValue();
-
-					if (axisConfig.getModule(refName) == null) {
-						throw new DeploymentException(Messages.getMessage(
-								DeploymentErrorMsgs.MODULE_NOT_FOUND, refName));
-					} else {
-						service.addModuleref(refName);
-					}
+                    service.addModuleref(refName);
+//					if (axisConfig.getModule(refName) == null) {
+//						throw new DeploymentException(Messages.getMessage(
+//								DeploymentErrorMsgs.MODULE_NOT_FOUND, refName));
+//					} else {
+//						service.addModuleref(refName);
+//					}
 				}
 			}
-		} catch (AxisFault axisFault) {
-			throw new DeploymentException(axisFault);
-		}
+//		} catch (AxisFault axisFault) {
+//			throw new DeploymentException(axisFault);
+//		}
 	}
 
 	protected void processOperationModuleConfig(Iterator moduleConfigs,

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ServiceDeployer.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ServiceDeployer.java?rev=759032&r1=759031&r2=759032&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ServiceDeployer.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ServiceDeployer.java Fri Mar 27 06:34:58 2009
@@ -88,9 +88,7 @@
                                              location,
                                              deploymentFileData,
                                              axisConfig);
-            log.info(Messages.getMessage(DeploymentErrorMsgs.DEPLOYING_WS,
-                                         deploymentFileData.getName(),
-                                         location.toString()));
+
         } catch (DeploymentException de) {
             de.printStackTrace();
             log.error(Messages.getMessage(DeploymentErrorMsgs.INVALID_SERVICE,

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ServiceGroupBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ServiceGroupBuilder.java?rev=759032&r1=759031&r2=759032&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ServiceGroupBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ServiceGroupBuilder.java Fri Mar 27 06:34:58 2009
@@ -117,25 +117,26 @@
      */
     protected void processModuleRefs(Iterator moduleRefs, AxisServiceGroup axisServiceGroup)
             throws DeploymentException {
-        try {
+//        try {
             while (moduleRefs.hasNext()) {
                 OMElement moduleref = (OMElement) moduleRefs.next();
                 OMAttribute moduleRefAttribute = moduleref.getAttribute(new QName(TAG_REFERENCE));
 
                 if (moduleRefAttribute != null) {
                     String refName = moduleRefAttribute.getAttributeValue();
+                    axisServiceGroup.addModuleref(refName);
 
-                    if (axisConfig.getModule(refName) == null) {
-                        throw new DeploymentException(
-                                Messages.getMessage(DeploymentErrorMsgs.MODULE_NOT_FOUND, refName));
-                    } else {
-                        axisServiceGroup.addModuleref(refName);
-                    }
+//                    if (axisConfig.getModule(refName) == null) {
+//                        throw new DeploymentException(
+//                                Messages.getMessage(DeploymentErrorMsgs.MODULE_NOT_FOUND, refName));
+//                    } else {
+//                        axisServiceGroup.addModuleref(refName);
+//                    }
                 }
             }
-        } catch (AxisFault axisFault) {
-            throw new DeploymentException(axisFault);
-        }
+//        } catch (AxisFault axisFault) {
+//            throw new DeploymentException(axisFault);
+//        }
     }
 
     protected void processServiceModuleConfig(Iterator moduleConfigs, ParameterInclude parent,

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java?rev=759032&r1=759031&r2=759032&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java Fri Mar 27 06:34:58 2009
@@ -61,6 +61,7 @@
 import org.apache.axis2.transport.MessageFormatter;
 import org.apache.axis2.util.TargetResolver;
 import org.apache.axis2.util.Utils;
+import org.apache.axis2.util.FaultyServiceData;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -116,6 +117,10 @@
      */
     private Hashtable<String, String> faultyServices;
 
+    private final HashMap<String, HashMap<String, FaultyServiceData>> faultyServicesDueToModules = new HashMap<String,
+            HashMap<String, FaultyServiceData>>();
+
+
     private List<Phase> inFaultPhases;
 
     private List<Phase> inPhasesUptoAndIncludingPostDispatch;
@@ -642,6 +647,54 @@
         return faultyServices;
     }
 
+    /**
+     * Updates the map that keeps track of faulty services due to modules
+     * @param moduleName This service has become faulty due this module.
+     * @param faultyServiceData  Data that are required when recovering the faulty service.
+     */
+    public void addFaultyServiceDuetoModule(String moduleName, FaultyServiceData faultyServiceData) {
+        HashMap<String, FaultyServiceData> faultyServicesMap;
+
+        synchronized (faultyServicesDueToModules) {
+
+            if (faultyServicesDueToModules.containsKey(moduleName)) {
+                faultyServicesMap = faultyServicesDueToModules.get(moduleName);
+                faultyServicesMap.put(faultyServiceData.getServiceGroupName(), faultyServiceData);
+
+            } else {
+                faultyServicesMap = new HashMap<String, FaultyServiceData>();
+                faultyServicesMap.put(faultyServiceData.getServiceGroupName(), faultyServiceData);
+                faultyServicesDueToModules.put(moduleName, faultyServicesMap);
+            }
+        }
+    }
+
+    public HashMap<String, FaultyServiceData> getFaultyServicesDuetoModule(String moduleName) {
+        if (faultyServicesDueToModules.containsKey(moduleName)) {
+            return faultyServicesDueToModules.get(moduleName);
+
+        }
+        return new HashMap<String, FaultyServiceData>(1);
+    }
+
+    public HashMap<String, HashMap<String, FaultyServiceData>> getFaultyServicsDuetoModules(){
+        return faultyServicesDueToModules;
+    }
+
+    public void removeFaultyServiceDuetoModule(String moduleName, String serviceGroupName) {
+        synchronized (faultyServicesDueToModules) {
+            HashMap<String, FaultyServiceData> faultyServices = faultyServicesDueToModules.get(moduleName);
+
+            if(faultyServices != null){
+                faultyServices.remove(serviceGroupName);
+
+                if(faultyServices.isEmpty()){
+                    faultyServicesDueToModules.remove(moduleName);
+                }
+            }
+        }
+    }
+
     public void removeFaultyService(String key) {
         Iterator<String> itr = faultyServices.keySet().iterator();
         while (itr.hasNext()) {

Added: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/FaultyServiceData.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/FaultyServiceData.java?rev=759032&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/FaultyServiceData.java (added)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/FaultyServiceData.java Fri Mar 27 06:34:58 2009
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.util;
+
+import org.apache.axis2.description.AxisServiceGroup;
+import org.apache.axis2.deployment.repository.util.DeploymentFileData;
+
+import java.util.ArrayList;
+import java.net.URL;
+
+public class FaultyServiceData {
+
+    private String serviceGroupName;
+    private AxisServiceGroup serviceGroup;
+    private ArrayList serviceList;
+    private DeploymentFileData currentDeploymentFile;
+    private URL serviceLocation;
+
+    public FaultyServiceData(AxisServiceGroup serviceGroup,
+                             ArrayList serviceList,
+                             URL serviceLocation,
+                             DeploymentFileData currentDeploymentFile) {
+        serviceGroupName = serviceGroup.getServiceGroupName();
+        this.serviceGroup = serviceGroup;
+        this.serviceList = serviceList;
+        this.currentDeploymentFile = currentDeploymentFile;
+        this.serviceLocation = serviceLocation;
+
+    }
+
+    public AxisServiceGroup getServiceGroup() {
+        return serviceGroup;
+    }
+
+    public DeploymentFileData getCurrentDeploymentFile() {
+        return currentDeploymentFile;
+    }
+
+    public ArrayList getServiceList() {
+        return serviceList;
+    }
+
+    public URL getServiceLocation() {
+        return serviceLocation;
+    }
+
+    public String getServiceGroupName() {
+        return serviceGroupName;
+    }
+}

Added: webservices/axis2/trunk/java/modules/kernel/test-resources/deployment/faultyServiceshandling/repo/axis2.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test-resources/deployment/faultyServiceshandling/repo/axis2.xml?rev=759032&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test-resources/deployment/faultyServiceshandling/repo/axis2.xml (added)
+++ webservices/axis2/trunk/java/modules/kernel/test-resources/deployment/faultyServiceshandling/repo/axis2.xml Fri Mar 27 06:34:58 2009
@@ -0,0 +1,102 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements. See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership. The ASF licenses this file
+  ~ to you 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.
+  -->
+
+<axisconfig name="AxisJava2.0">
+    <!-- ================================================= -->
+    <!-- Parameters -->
+    <!-- ================================================= -->
+    <parameter name="hotdeployment">true</parameter>
+    <parameter name="hotupdate">false</parameter>
+    <parameter name="enableMTOM">true</parameter>
+
+    <parameter name="userName">admin</parameter>
+    <parameter name="password">axis2</parameter>
+
+    <parameter name="seralizeLocation">./target</parameter>
+
+
+    <!-- ================================================= -->
+    <!-- Message Receivers -->
+    <!-- ================================================= -->
+    <!-- This is the Deafult Message Receiver for the Request Response style Operations -->
+    <messageReceiver mep="INOUT" class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
+
+    <!-- ================================================= -->
+    <!-- Transport Ins -->
+    <!-- ================================================= -->
+
+    <phaseOrder type="InFlow">
+        <!--  System pre defined phases       -->
+         <phase name="Transport">
+            <handler name="RequestURIBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
+            <handler name="SOAPActionBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
+        </phase>
+        <phase name="Security"/>
+        <phase name="PreDispatch"/>
+        <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
+            <handler name="AddressingBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.AddressingBasedDispatcher"/>
+
+            <handler name="SOAPMessageBodyBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>
+        </phase>
+        <!--  System pre defined phases       -->
+        <!--   After Postdispatch phase module author or or service author can add any phase he want      -->
+        <phase name="OperationInPhase"/>
+	<phase name="loggingPhase"/>
+    </phaseOrder>
+    <phaseOrder type="OutFlow">
+        <!--      user can add his own phases to this area  -->
+        <phase name="OperationOutPhase"/>
+	<phase name="loggingPhase"/>
+        <!--system predefined phase-->
+        <!--these phase will run irrespective of the service-->
+        <phase name="PolicyDetermination"/>
+        <phase name="MessageOut"/>
+    </phaseOrder>
+    <phaseOrder type="InFaultFlow">
+        <phase name="PreDispatch"/>
+        <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
+            <handler name="RequestURIBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
+
+            <handler name="SOAPActionBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
+
+            <handler name="AddressingBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.AddressingBasedDispatcher"/>
+
+            <handler name="SOAPMessageBodyBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>
+        </phase>
+        <!--      user can add his own phases to this area  -->
+        <phase name="OperationInFaultPhase"/>
+	<phase name="loggingPhase"/>
+    </phaseOrder>
+    <phaseOrder type="OutFaultFlow">
+        <!--      user can add his own phases to this area  -->
+	<phase name="loggingPhase"/>
+        <phase name="OperationOutFaultPhase"/>
+        <phase name="PolicyDetermination"/>
+        <phase name="MessageOut"/>
+    </phaseOrder>
+</axisconfig>
+

Added: webservices/axis2/trunk/java/modules/kernel/test-resources/deployment/faultyServiceshandling/repo/services/echo2/META-INF/services.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test-resources/deployment/faultyServiceshandling/repo/services/echo2/META-INF/services.xml?rev=759032&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test-resources/deployment/faultyServiceshandling/repo/services/echo2/META-INF/services.xml (added)
+++ webservices/axis2/trunk/java/modules/kernel/test-resources/deployment/faultyServiceshandling/repo/services/echo2/META-INF/services.xml Fri Mar 27 06:34:58 2009
@@ -0,0 +1,6 @@
+<serviceGroup>
+    <service name="echo2">
+	<module ref="sample-logging"/>
+	<parameter name="ServiceClass">org.apache.axis2.Echo2</parameter>
+    </service>
+</serviceGroup>

Added: webservices/axis2/trunk/java/modules/kernel/test-resources/deployment/faultyServiceshandling/sample-logging/META-INF/module.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test-resources/deployment/faultyServiceshandling/sample-logging/META-INF/module.xml?rev=759032&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test-resources/deployment/faultyServiceshandling/sample-logging/META-INF/module.xml (added)
+++ webservices/axis2/trunk/java/modules/kernel/test-resources/deployment/faultyServiceshandling/sample-logging/META-INF/module.xml Fri Mar 27 06:34:58 2009
@@ -0,0 +1,44 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements. See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership. The ASF licenses this file
+  ~ to you 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.
+  -->
+
+<module name="sample-logging" class="org.apache.axis2.sample.module.LogginModule">
+    <InFlow>
+        <handler name="InFlowLogHandler" class="org.apache.axis2.sample.handlers.LoggingHandler">
+            <order phase="loggingPhase"/>
+        </handler>
+    </InFlow>
+
+    <OutFlow>
+        <handler name="OutFlowLogHandler" class="org.apache.axis2.sample.handlers.LoggingHandler">
+            <order phase="loggingPhase"/>
+        </handler>
+    </OutFlow>
+
+    <OutFaultFlow>
+        <handler name="FaultOutFlowLogHandler" class="org.apache.axis2.sample.handlers.LoggingHandler">
+            <order phase="loggingPhase"/>
+        </handler>
+    </OutFaultFlow>
+
+    <InFaultFlow>
+        <handler name="FaultInFlowLogHandler" class="org.apache.axis2.sample.handlers.LoggingHandler">
+            <order phase="loggingPhase"/>
+        </handler>
+    </InFaultFlow>
+</module>

Added: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/deployment/FaultyServicesDueToModuleTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/deployment/FaultyServicesDueToModuleTest.java?rev=759032&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/deployment/FaultyServicesDueToModuleTest.java (added)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/deployment/FaultyServicesDueToModuleTest.java Fri Mar 27 06:34:58 2009
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.deployment;
+
+import junit.framework.TestCase;
+import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.axis2.AbstractTestCase;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.deployment.repository.util.DeploymentFileData;
+import org.apache.axis2.util.FaultyServiceData;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.context.ConfigurationContextFactory;
+
+import java.util.HashMap;
+import java.io.File;
+
+public class FaultyServicesDueToModuleTest extends TestCase {
+    
+    AxisConfiguration axisConfig;
+    String repo = AbstractTestCase.basedir + "/test-resources/deployment/faultyServiceshandling/repo";
+
+    protected void setUp() throws Exception {
+        axisConfig = ConfigurationContextFactory.createConfigurationContextFromFileSystem(repo, repo + "/axis2.xml")
+                .getAxisConfiguration();
+    }
+
+    public void testFaultyServiceDueToModuleLogging() throws AxisFault {
+        AxisService axisService = axisConfig.getService("echo2");
+        assertNull(axisService);
+
+        HashMap<String, FaultyServiceData> faultyServicesMap = axisConfig.getFaultyServicesDuetoModule(
+                "sample-logging");
+        FaultyServiceData faultyServiceData = faultyServicesMap.get("echo2");
+        assertNotNull(faultyServiceData);
+    }
+
+    public void testFaultyServicesRecovery() throws AxisFault{
+        File moduleFile = new File(AbstractTestCase.basedir +
+                "/test-resources/deployment/faultyServiceshandling/sample-logging");
+        DeploymentFileData deploymentFileData = new DeploymentFileData(moduleFile, new ModuleDeployer(axisConfig));
+        deploymentFileData.deploy();
+
+        AxisService axisService = axisConfig.getService("echo2");
+        assertNotNull(axisService);
+
+        HashMap<String, FaultyServiceData> faultyServicesMap = axisConfig.getFaultyServicesDuetoModule(
+                "sample-logging");
+        FaultyServiceData faultyServiceData = faultyServicesMap.get("echo2");
+        assertNull(faultyServiceData);
+    }
+}

Added: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/sample/module/LogginModule.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/sample/module/LogginModule.java?rev=759032&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/sample/module/LogginModule.java (added)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/sample/module/LogginModule.java Fri Mar 27 06:34:58 2009
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.sample.module;
+
+import org.apache.axis2.description.AxisModule;
+import org.apache.axis2.description.AxisDescription;
+import org.apache.axis2.modules.Module;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.AxisFault;
+import org.apache.neethi.Assertion;
+import org.apache.neethi.Policy;
+
+public class LogginModule implements Module {
+    // initialize the module
+    public void init(ConfigurationContext configContext, AxisModule module) throws AxisFault {
+       
+    }
+
+    public void engageNotify(AxisDescription axisDescription) throws AxisFault {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public boolean canSupportAssertion(Assertion assertion) {
+        return false;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public void applyPolicy(Policy policy, AxisDescription axisDescription) throws AxisFault {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }// shutdown the module
+    public void shutdown(ConfigurationContext configurationContext) throws AxisFault {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+}