You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by pr...@apache.org on 2008/01/15 17:22:27 UTC

svn commit: r612147 [11/17] - in /webservices/axis2/branches/java/jaxws21: ./ modules/adb-codegen/ modules/adb-codegen/src/org/apache/axis2/schema/ modules/adb-codegen/src/org/apache/axis2/schema/template/ modules/adb-codegen/src/org/apache/axis2/schem...

Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/test/org/apache/axis2/jaxws/security/BasicAuthSecurityTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/test/org/apache/axis2/jaxws/security/BasicAuthSecurityTests.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/test/org/apache/axis2/jaxws/security/BasicAuthSecurityTests.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/test/org/apache/axis2/jaxws/security/BasicAuthSecurityTests.java Tue Jan 15 08:21:22 2008
@@ -35,8 +35,8 @@
     private QName SERVICE_QNAME = new QName("http://ws.apache.org/axis2", "BasicAuthSecurityService");
     private QName PORT_QNAME = new QName("http://ws.apache.org/axis2", "SimpleProviderServiceSOAP11port0");
 
-	private String USER_ID = "testid";
-	private String PASSWORD = "testid";
+    private String USER_ID = "testid";
+    private String PASSWORD = "testid";
 
     protected void setUp() throws Exception {
             super.setUp();
@@ -61,6 +61,8 @@
         TestLogger.logger.debug(">> Invoking Dispatch<String> BasicAuthSecurityService");
         String retVal = dispatch.invoke(xmlString);
         TestLogger.logger.debug(">> Response [" + retVal + "]");
+        
+        assertTrue(retVal != null);
     }
     
     public void testBasicAuth_uid_pwd() throws Exception {
@@ -77,6 +79,8 @@
         TestLogger.logger.debug(">> Invoking Dispatch<String> BasicAuthSecurityService");
         String retVal = dispatch.invoke(xmlString);
         TestLogger.logger.debug(">> Response [" + retVal + "]");
+        
+        assertTrue(retVal != null);
     }
     
     public void testBasicAuth_uid()throws Exception{
@@ -90,16 +94,8 @@
         dispatch.getRequestContext().put(BindingProvider.USERNAME_PROPERTY, USER_ID);
 
         TestLogger.logger.debug(">> Invoking Dispatch<String> BasicAuthSecurityService");
-        
-        try{
-        	String retVal = dispatch.invoke(xmlString);
-            TestLogger.logger.debug(">> Response [" + retVal + "]");
-            
-            fail("Set USERID with no PASSWORD: WebServiceException is expected");
-        }
-        catch(WebServiceException wse){
-            TestLogger.logger.debug(getName() + ": " + wse);
-        }
+        String retVal = dispatch.invoke(xmlString);
+       	TestLogger.logger.debug(">> Response [" + retVal + "]");
     }
     
     public void testBasicAuth_pwd()throws Exception{

Copied: webservices/axis2/branches/java/jaxws21/modules/jaxws/test/org/apache/axis2/jaxws/spi/ClientMetadataPortTest.java (from r611653, webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/spi/ClientMetadataPortTest.java)
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/test/org/apache/axis2/jaxws/spi/ClientMetadataPortTest.java?p2=webservices/axis2/branches/java/jaxws21/modules/jaxws/test/org/apache/axis2/jaxws/spi/ClientMetadataPortTest.java&p1=webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/spi/ClientMetadataPortTest.java&r1=611653&r2=612147&rev=612147&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/spi/ClientMetadataPortTest.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/test/org/apache/axis2/jaxws/spi/ClientMetadataPortTest.java Tue Jan 15 08:21:22 2008
@@ -303,9 +303,8 @@
         String endpointAddress1 = (String) requestContext1.get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY);
         assertNotNull(endpointAddress1);
         // FIXME: We should get the first port in the WSDL, but that isn't working
+        // Depending on the JDK in use, the 2nd or 3rd port is returned
 //        assertTrue(endpointAddress.endsWith(multiPortWsdl_portLocalPart1));
-        // FIXME: This isnt working either
-//        assertTrue(endpointAddress1.endsWith(multiPortWsdl_portLocalPart3));
         
         // Set a prefered port and create the service
         QName portQN2 = new QName(namespaceURI, multiPortWsdl_portLocalPart2);
@@ -348,9 +347,8 @@
             String endpointAddress1 = (String) requestContext1.get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY);
             assertNotNull(endpointAddress1);
             // FIXME: We should get the first port in the WSDL, but that isn't working
+            // Depending on the JDK in use, the 2nd or 3rd port is returned
 //            assertTrue(endpointAddress.endsWith(multiPortWsdl_portLocalPart1));
-            // FIXME: This isnt working either
-//            assertTrue(endpointAddress1.endsWith(multiPortWsdl_portLocalPart3));
             
             // Set a prefered port and create the service
             QName portQN2 = new QName(namespaceURI, multiPortWsdl_portLocalPart2);
@@ -388,9 +386,8 @@
             String endpointAddress3 = (String) requestContext3.get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY);
             assertNotNull(endpointAddress1);
             // FIXME: We should get the first port in the WSDL, but that isn't working
+            // Depending on the JDK in use, the 2nd or 3rd port is returned
 //            assertTrue(endpointAddress.endsWith(multiPortWsdl_portLocalPart1));
-            // FIXME: This isnt working either
-//            assertTrue(endpointAddress1.endsWith(multiPortWsdl_portLocalPart3));
 
         } finally {
             ClientMetadataTest.restoreOriginalFactory();

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/conf/axis2.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/conf/axis2.xml?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/conf/axis2.xml (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/conf/axis2.xml Tue Jan 15 08:21:22 2008
@@ -144,6 +144,8 @@
     <messageBuilders>
         <messageBuilder contentType="application/xml"
                          class="org.apache.axis2.builder.ApplicationXMLBuilder"/>
+        <messageBuilder contentType="application/xml"
+                         class="org.apache.axis2.builder.ApplicationXMLBuilder"/>
         <messageBuilder contentType="application/x-www-form-urlencoded"
                          class="org.apache.axis2.builder.XFormURLEncodedBuilder"/>
         <messageBuilder contentType="multipart/form-data"
@@ -348,6 +350,8 @@
     <cluster class="org.apache.axis2.cluster.tribes.TribesClusterManager">
         <parameter name="param1">value1</parameter>
         <parameter name="domain">apache.axis2.domain</parameter>
+        <parameter name="synchronizeAll">true</parameter>
+        <parameter name="maxRetries">10</parameter>
     	<configurationManager class="org.apache.axis2.cluster.configuration.TribesConfigurationManager">
     	    <listener class="org.apache.axis2.cluster.configuration.DefaultConfigurationManagerListener"/>
     	</configurationManager>

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/AxisFault.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/AxisFault.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/AxisFault.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/AxisFault.java Tue Jan 15 08:21:22 2008
@@ -139,6 +139,20 @@
         this(faultReason, cause);
         setFaultCode(faultCode);
     }
+    
+    /**
+     * Constructor
+     *
+     * @param faultCode       - fault code of the message as a QName
+     * @param faultSubCodes   - list sub fault codes as a list if QNames
+     * @param faultReason - the reason for the fault. The language will be defaulted to 'en'
+     * @param cause embedded fault which caused this one
+     */
+    public AxisFault(QName faultCode,List faultSubCodes, String faultReason, Throwable cause) {
+        this(faultReason, cause);
+        setFaultCode(faultCode);
+        setFaultSubCodes(faultSubCodes);
+    }
 
     /**
      * Constructor
@@ -496,7 +510,11 @@
     public void setFaultCode(QName soapFaultCode) {
         this.faultCode = soapFaultCode;
     }
-
+    
+    public void setFaultSubCodes(List faultSubCodes) {
+        this.faultSubCodes = faultSubCodes;
+    }
+    
     public void setFaultCode(String soapFaultCode) {
         // TODO: is it really safe to assume that the passed string is always the localpart?
         // What if someone passes soapenv:Sender?

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/addressing/AddressingConstants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/addressing/AddressingConstants.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/addressing/AddressingConstants.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/addressing/AddressingConstants.java Tue Jan 15 08:21:22 2008
@@ -54,6 +54,7 @@
     // ====================== Addressing Requirement Levels ==================
     // These are used to represent the requirement level on WS-Addressing indicated
     // in a services.xml or a WSDL file.
+    static final String ADDRESSING_REQUIREMENT_PARAMETER = "addressingRequirementParameter";
     // ADDRESSING_UNSPECIFIED is the equivalent of no UsingAddressing flag in a
     // WSDL file and the default of the WSAddressingRequred attribute in service.xml
     static final String ADDRESSING_UNSPECIFIED = "unspecified";
@@ -103,6 +104,12 @@
     static final String DISABLE_OUTBOUND_ADDRESSING_VALIDATION =
             "disableAddressingOutboundValidation";
 
+    /**
+     * This parameter is used to attach OMElement ReferenceParameters found in an EPR embedded in a
+     * WSDL to an AxisEndpoint object.
+     */
+    static final String REFERENCE_PARAMETER_PARAMETER = "referenceParameters";
+    
     static final String WSAM_INVOCATION_PATTERN_PARAMETER_NAME = "wsamInvocationPattern";
     static final String WSAM_INVOCATION_PATTERN_SYNCHRONOUS = "synchronous";
     static final String WSAM_INVOCATION_PATTERN_ASYNCHRONOUS = "asynchronous";
@@ -173,6 +180,7 @@
         static final QName WSAW_USING_ADDRESSING =
                 new QName(WSAW_NAMESPACE, USING_ADDRESSING);
         static final QName WSAW_ANONYMOUS = new QName(WSAW_NAMESPACE, USING_ADDRESSING);
+        static final QName WSA_ENDPOINT_REFERENCE = new QName(WSA_NAMESPACE,"EndpointReference");
 
         final QName QNAME_WSA_TO = new QName(WSA_NAMESPACE, WSA_TO);
         final QName QNAME_WSA_FROM = new QName(WSA_NAMESPACE, WSA_FROM);

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/addressing/AddressingHelper.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/addressing/AddressingHelper.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/addressing/AddressingHelper.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/addressing/AddressingHelper.java Tue Jan 15 08:21:22 2008
@@ -22,6 +22,7 @@
 import org.apache.axis2.Constants;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.description.AxisOperation;
+import org.apache.axis2.description.AxisService;
 import org.apache.axis2.description.Parameter;
 import org.apache.axis2.util.LoggingControl;
 import org.apache.axis2.util.Utils;
@@ -86,7 +87,7 @@
         // there are some information  that the fault thrower wants to pass to the fault path.
         // Means that the fault is a ws-addressing one hence use the ws-addressing fault action.
         Object faultInfoForHeaders =
-                messageContext.getProperty(Constants.FAULT_INFORMATION_FOR_HEADERS);
+                messageContext.getLocalProperty(Constants.FAULT_INFORMATION_FOR_HEADERS);
         // if the exception is due to a problem in the faultTo header itself, we can not use those
         // fault informatio to send the error. Try to send using replyTo, leave it to transport
         boolean doNotSendFaultUsingFaultTo = false;
@@ -101,6 +102,25 @@
         return !doNotSendFaultUsingFaultTo;
     }
 
+    public static String getAddressingRequirementParemeterValue(AxisService axisService){
+    	String value = "";
+        if (axisService != null) {
+            value = Utils.getParameterValue(
+            		axisService.getParameter(AddressingConstants.ADDRESSING_REQUIREMENT_PARAMETER));
+            if(value !=null){
+            	value = value.trim();
+            }
+            if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) {
+                log.debug("getAddressingRequirementParemeterValue: value: '" + value + "'");
+            }
+        }
+
+        if (value == null || "".equals(value)) {
+            value = AddressingConstants.ADDRESSING_UNSPECIFIED;
+        }
+        return value;
+    }
+    
     /**
      * Extract the parameter representing the Anonymous flag from the AxisOperation
      * and return the String value. Return the default of "optional" if not specified.
@@ -116,7 +136,7 @@
             	value = value.trim();
             }
             if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) {
-                log.debug("getAnonymousParameterValue: value: '" + value + "'");
+                log.debug("getInvocationPatternParameterValue: value: '" + value + "'");
             }
         }
 
@@ -184,4 +204,55 @@
             }
         }
     }
+
+	public static void setAddressingRequirementParemeterValue(AxisService axisService, String value) {
+		if (value == null) {
+            if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) {
+                log.debug("getAddressingRequirementParemeterValue: value passed in is null. return");
+            }
+            return;
+        }
+
+        Parameter param =
+                axisService.getParameter(AddressingConstants.ADDRESSING_REQUIREMENT_PARAMETER);
+        // If an existing parameter exists
+        if (param != null) {
+            if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) {
+                log.debug("setAddressingRequirementParemeterValue: Parameter already exists");
+            }
+            // and is not locked
+            if (!param.isLocked()) {
+                if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) {
+                    log.debug("setAddressingRequirementParemeterValue: Parameter not locked. Setting value: " +
+                            value);
+                }
+                // set the value
+                param.setValue(value);
+            }
+        } else {
+            // otherwise, if no Parameter exists
+            if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) {
+                log.debug("setAddressingRequirementParemeterValue: Parameter does not exist");
+            }
+            // Create new Parameter with correct name/value
+            param = new Parameter();
+            param.setName(AddressingConstants.ADDRESSING_REQUIREMENT_PARAMETER);
+            param.setValue(value);
+            try {
+                if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) {
+                    log.debug("setAddressingRequirementParemeterValue: Adding parameter with value: " + value);
+                }
+                // and add it to the AxisOperation object
+                axisService.addParameter(param);
+            } catch (AxisFault af) {
+                // This should not happen. AxisFault is only ever thrown when a locked Parameter
+                // of the same name already exists and this should be dealt with by the outer
+                // if statement.
+                if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) {
+                    log.debug(
+                            "setAddressingRequirementParemeterValue: addParameter failed: " + af.getMessage());
+                }
+            }
+        }
+	}
 }

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/addressing/wsdl/WSDL11DefaultActionPatternHelper.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/addressing/wsdl/WSDL11DefaultActionPatternHelper.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/addressing/wsdl/WSDL11DefaultActionPatternHelper.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/addressing/wsdl/WSDL11DefaultActionPatternHelper.java Tue Jan 15 08:21:22 2008
@@ -130,7 +130,7 @@
                                                                 String portTypeName,
                                                                 String operationName,
                                                                 String inputName) {
-        if (messageExchangePattern == null && inputName == null) {
+    	if (messageExchangePattern == null && inputName == null) {
             throw new IllegalArgumentException(
                     "One of messageExchangePattern or inputName must the non-null to generate an action.");
         }
@@ -144,10 +144,15 @@
             delimiter = COLON;
         }
 
+        // N.B. Unlike core Axis2 processing WSDL, JAX-WS accotation processing passes in the
+        // out-in MEP when constructing the client, hence we need to take account of it here
+        // in addition to the expected in-out
         if (inputName == null) {
             inputName = operationName;
             if (messageExchangePattern.indexOf("in-out") >= 0) {
                 inputName += REQUEST;
+            } else if (messageExchangePattern.indexOf("out-in") >= 0) {
+                inputName += REQUEST;
             }
         }
 
@@ -270,6 +275,9 @@
             delimiter = COLON;
         }
 
+        // N.B. Unlike core Axis2 processing WSDL, JAX-WS annotation processing passes in the
+        // out-in MEP when constructing the client, hence we need to take account of it here
+        // in addition to the expected in-out
         if (outputName == null) {
             outputName = operationName;
             if (messageExchangePattern.indexOf("in-out") >= 0) {

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/builder/BuilderUtil.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/builder/BuilderUtil.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/builder/BuilderUtil.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/builder/BuilderUtil.java Tue Jan 15 08:21:22 2008
@@ -25,6 +25,7 @@
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMException;
 import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.om.OMText;
 import org.apache.axiom.om.impl.MTOMConstants;
 import org.apache.axiom.om.impl.builder.StAXBuilder;
 import org.apache.axiom.om.impl.builder.StAXOMBuilder;
@@ -60,6 +61,7 @@
 import org.apache.ws.commons.schema.XmlSchemaSequence;
 import org.apache.ws.commons.schema.XmlSchemaType;
 
+import javax.activation.DataHandler;
 import javax.xml.namespace.QName;
 import javax.xml.parsers.FactoryConfigurationError;
 import javax.xml.stream.XMLStreamException;
@@ -136,16 +138,17 @@
                         boolean nillable = innerElement.isNillable();
                         String name =
                                 qName != null ? qName.getLocalPart() : innerElement.getName();
-                        String value;
+                            Object value;
                         OMNamespace ns = (qName == null ||
                                 qName.getNamespaceURI() == null
                                 || qName.getNamespaceURI().length() == 0) ?
                                 null : soapFactory.createOMNamespace(
                                 qName.getNamespaceURI(), null);
-                        while ((value = (String) requestParameterMap.get(name)) != null) {
 
-                            soapFactory.createOMElement(name, ns,
-                                                        bodyFirstChild).setText(value);
+                            // FIXME changed
+                            while ((value = requestParameterMap.get(name)) != null) {
+                                addRequestParameter(soapFactory,
+                                        bodyFirstChild, ns, name, value);
                             minOccurs--;
                         }
                         if (minOccurs > 0) {
@@ -182,15 +185,34 @@
             Iterator requestParamMapIter = requestParameterMap.keySet().iterator();
             while (requestParamMapIter.hasNext()) {
                 String key = (String) requestParamMapIter.next();
-                String value = (String) requestParameterMap.get(key);
+                Object value = requestParameterMap.get(key);
                 if (value != null) {
-                    soapFactory.createOMElement(key, null, bodyFirstChild).setText(value);
+                    addRequestParameter(soapFactory, bodyFirstChild, null, key,
+                            value);
                 }
 
             }
         }
     }
 
+    private static void addRequestParameter(SOAPFactory soapFactory,
+                                            OMElement bodyFirstChild,
+                                            OMNamespace ns,
+                                            String key,
+                                            Object parameter) {
+        if (parameter instanceof DataHandler) {
+            DataHandler dataHandler = (DataHandler)parameter;
+            OMText dataText = bodyFirstChild.getOMFactory().createOMText(
+                    dataHandler, true);
+            soapFactory.createOMElement(key, ns, bodyFirstChild).addChild(
+                    dataText);
+        } else {
+            String textValue = parameter.toString();
+            soapFactory.createOMElement(key, ns, bodyFirstChild).setText(
+                    textValue);
+        }
+    }
+
     public static StAXBuilder getPOXBuilder(InputStream inStream, String charSetEnc)
             throws XMLStreamException {
         StAXBuilder builder;
@@ -213,7 +235,7 @@
         String encoding = getCharSetEncoding(is2, charSetEncoding);
         return new BufferedReader(new InputStreamReader(is2, encoding));
     }
-    
+
     /**
      * Convenience method to get a PushbackInputStream so that we can read the BOM
      * @param is
@@ -222,7 +244,7 @@
     public static PushbackInputStream getPushbackInputStream(InputStream is) {
         return new PushbackInputStream(is, BOM_SIZE);
     }
-    
+
     /**
      * Use the BOM Mark to identify the encoding to be used. Fall back to
      * default encoding specified
@@ -235,9 +257,9 @@
         String encoding;
         byte bom[] = new byte[BOM_SIZE];
         int n, unread;
-        
+
         n = is2.read(bom, 0, bom.length);
-        
+
         if ((bom[0] == (byte) 0xEF) && (bom[1] == (byte) 0xBB) && (bom[2] == (byte) 0xBF)) {
             encoding = "UTF-8";
             if (log.isDebugEnabled()) {
@@ -271,7 +293,7 @@
             }
             unread = n - 4;
         } else {
-            
+
             // Unicode BOM mark not found, unread all bytes
             encoding = defaultEncoding;
             if (log.isDebugEnabled()) {
@@ -279,7 +301,7 @@
             }
             unread = n;
         }
-        
+
         if (unread > 0) {
             is2.unread(bom, (n - unread), unread);
         }
@@ -375,7 +397,7 @@
         try {
             PushbackInputStream pis = getPushbackInputStream(attachments.getSOAPPartInputStream());
             String actualCharSetEncoding = getCharSetEncoding(pis, charSetEncoding);
-            
+
             streamReader = StAXUtils.createXMLStreamReader(pis, actualCharSetEncoding);
         } catch (IOException e) {
             throw new XMLStreamException(e);
@@ -504,7 +526,7 @@
             if (log.isDebugEnabled()) {
                 log.debug("Creating an Attachments map.  The content-length is" + contentLength);
             }
-            attachments = 
+            attachments =
                 new Attachments(inStream,
                                 contentTypeString,
                                 fileCacheForAttachments,
@@ -515,14 +537,14 @@
             if (log.isDebugEnabled()) {
                 log.debug("Creating an Attachments map.");
             }
-            attachments = 
+            attachments =
                 new Attachments(inStream,
                                 contentTypeString,
                                 fileCacheForAttachments,
                                 attachmentRepoDir,
                                 attachmentSizeThreshold);
         }
-            
+
         return attachments;
     }
 

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/builder/MultipartFormDataBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/builder/MultipartFormDataBuilder.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/builder/MultipartFormDataBuilder.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/builder/MultipartFormDataBuilder.java Tue Jan 15 08:21:22 2008
@@ -19,9 +19,12 @@
 
 package org.apache.axis2.builder;
 
+import org.apache.axiom.attachments.ByteArrayDataSource;
+import org.apache.axiom.attachments.CachedFileDataSource;
 import org.apache.axiom.om.OMAbstractFactory;
 import org.apache.axiom.om.OMElement;
 import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.transport.http.HTTPConstants;
 import org.apache.axis2.util.MultipleEntryHashMap;
@@ -32,6 +35,8 @@
 import org.apache.commons.fileupload.servlet.ServletFileUpload;
 import org.apache.commons.fileupload.servlet.ServletRequestContext;
 
+import javax.activation.DataHandler;
+import javax.activation.DataSource;
 import javax.servlet.http.HttpServletRequest;
 import java.io.InputStream;
 import java.util.Iterator;
@@ -51,8 +56,19 @@
         if (request == null) {
             throw new AxisFault("Cannot create DocumentElement without HttpServletRequest");
         }
+
+        // TODO: Do check ContentLength for the max size,
+        //       but it can't be configured anywhere.
+        //       I think that it cant be configured at web.xml or axis2.xml.
+        
+        // FIXME changed
+        String charSetEncoding = (String)messageContext.getProperty(Constants.Configuration.CHARACTER_SET_ENCODING);
+        if (charSetEncoding == null) {
+            charSetEncoding = request.getCharacterEncoding();
+        }
+
         try {
-            parameterMap = getParameterMap(request);
+            parameterMap = getParameterMap(request, charSetEncoding);
             return BuilderUtil.buildsoapMessage(messageContext, parameterMap,
                                                 OMAbstractFactory.getSOAP12Factory());
 
@@ -63,7 +79,8 @@
     }
 
 
-    private MultipleEntryHashMap getParameterMap(HttpServletRequest request)
+    private MultipleEntryHashMap getParameterMap(HttpServletRequest request,
+                                                 String charSetEncoding)
             throws FileUploadException {
 
         MultipleEntryHashMap parameterMap = new MultipleEntryHashMap();
@@ -71,9 +88,22 @@
         List items = parseRequest(new ServletRequestContext(request));
         Iterator iter = items.iterator();
         while (iter.hasNext()) {
-            String[] value = new String[1];
-            DiskFileItem diskFileItem = (DiskFileItem) iter.next();
-            value[0] = diskFileItem.getString();
+            DiskFileItem diskFileItem = (DiskFileItem)iter.next();
+
+            // FIXME changed
+            boolean isFormField = diskFileItem.isFormField();
+
+            Object value;
+            try {
+                if (isFormField) {
+                    value = getTextParameter(diskFileItem, charSetEncoding);
+                } else {
+                    value = getFileParameter(diskFileItem);
+                }
+            } catch (Exception ex) {
+                // TODO: handle exception
+                throw new FileUploadException(ex.getLocalizedMessage());
+            }
             parameterMap.put(diskFileItem.getFieldName(), value);
         }
 
@@ -88,6 +118,42 @@
         ServletFileUpload upload = new ServletFileUpload(factory);
         // Parse the request
         return upload.parseRequest(requestContext);
+    }
+
+    private String getTextParameter(DiskFileItem diskFileItem,
+                                    String characterEncoding) throws Exception {
+
+        String encoding = diskFileItem.getCharSet();
+
+        if (encoding == null) {
+            encoding = characterEncoding;
+}
+
+        String textValue;
+        if (encoding == null) {
+            textValue = new String(diskFileItem.get());
+        } else {
+            textValue = new String(diskFileItem.get(), encoding);
+        }
+
+        return textValue;
+    }
+
+    private DataHandler getFileParameter(DiskFileItem diskFileItem)
+            throws Exception {
+
+        DataSource dataSource;
+        if (diskFileItem.isInMemory()) {
+            dataSource = new ByteArrayDataSource(diskFileItem.get());
+        } else {
+            // TODO: must create the original DataSource,
+            //       because the cache file is deleted.
+            //       maybe, the diskFileItem is not referenced from any object.
+            dataSource = new CachedFileDataSource(diskFileItem.getStoreLocation());
+        }
+        DataHandler dataHandler = new DataHandler(dataSource);
+
+        return dataHandler;
     }
 
 }

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/builder/XFormURLEncodedBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/builder/XFormURLEncodedBuilder.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/builder/XFormURLEncodedBuilder.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/builder/XFormURLEncodedBuilder.java Tue Jan 15 08:21:22 2008
@@ -152,8 +152,9 @@
                                 WSDL20DefaultValueHolder.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR_DEFAULT);
                         for (int i = 0; i < parts.length; i++) {
                             int separator = parts[i].indexOf("=");
+                            String value = parts[i].substring(separator + 1);
                             parameterMap.put(parts[i].substring(0, separator),
-                                             parts[i].substring(separator + 1));
+                                             URIEncoderDecoder.decode(value));
                         }
                     } else {
                         break;

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/clustering/ClusterManager.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/clustering/ClusterManager.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/clustering/ClusterManager.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/clustering/ClusterManager.java Tue Jan 15 08:21:22 2008
@@ -21,9 +21,8 @@
 
 import org.apache.axis2.clustering.configuration.ConfigurationManager;
 import org.apache.axis2.clustering.context.ContextManager;
-import org.apache.axis2.description.ParameterInclude;
 import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.engine.Handler;
+import org.apache.axis2.description.ParameterInclude;
 
 /**
  * This is the main interface in the Axis2 clustering implementation.

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/clustering/ClusteringConstants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/clustering/ClusteringConstants.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/clustering/ClusteringConstants.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/clustering/ClusteringConstants.java Tue Jan 15 08:21:22 2008
@@ -20,17 +20,32 @@
 
 package org.apache.axis2.clustering;
 
+/**
+ * All constants used by the Axis2 clustering implementation
+ */
 public final class ClusteringConstants {
 
     private ClusteringConstants() {
     }
 
     public static final String AVOID_INITIATION_KEY = "AvoidInitiation";
+
+    /**
+     * The clustering domain/group. Nodes in the same group will belong to the same multicast domain.
+     * There will not be interference between nodes in different group.
+     */
     public static final String DOMAIN = "domain";
+
     public static final String NODE_MANAGER_SERVICE = "Axis2NodeManager";
     public static final String REQUEST_BLOCKING_HANDLER = "RequestBlockingHandler";
     public static final String CLUSTER_INITIALIZED = "local_cluster.initialized";
-    public static final String TIME_TO_SEND = "local_cluster.time.to.send";
+    public static final String RECD_CONFIG_INIT_MSG = "local_recd.config.init.method";
+    public static final String RECD_STATE_INIT_MSG = "local_recd.state.init.method";
     public static final String BLOCK_ALL_REQUESTS = "local_wso2wsas.block.requests";
-    public static final String LOCAL_IP_ADDRESS = "local.ip.address";
+    public static final String LOCAL_IP_ADDRESS = "axis2.local.ip.address";
+
+    /**
+     * Synchronize the states of all members in the cluster
+     */
+    public static final String SYNCHRONIZE_ALL_MEMBERS = "synchronizeAll";
 }

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/clustering/MessageSender.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/clustering/MessageSender.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/clustering/MessageSender.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/clustering/MessageSender.java Tue Jan 15 08:21:22 2008
@@ -23,7 +23,7 @@
  */
 public interface MessageSender {
 
-    public long sendToGroup(ClusteringCommand msg) throws ClusteringFault;
+    public void sendToGroup(ClusteringCommand msg) throws ClusteringFault;
 
     public void sendToSelf(ClusteringCommand msg) throws ClusteringFault;
 

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/clustering/context/ContextClusteringCommand.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/clustering/context/ContextClusteringCommand.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/clustering/context/ContextClusteringCommand.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/clustering/context/ContextClusteringCommand.java Tue Jan 15 08:21:22 2008
@@ -25,15 +25,6 @@
 
 public abstract class ContextClusteringCommand extends ClusteringCommand {
 
-    protected String uniqueId;
-
     public abstract void execute(ConfigurationContext configContext) throws ClusteringFault;
 
-    public String getUniqueId() {
-        return uniqueId;
-    }
-
-    public void setUniqueId(String uniqueId) {
-        this.uniqueId = uniqueId;
-    }
 }

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/clustering/context/ContextManager.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/clustering/context/ContextManager.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/clustering/context/ContextManager.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/clustering/context/ContextManager.java Tue Jan 15 08:21:22 2008
@@ -34,34 +34,41 @@
      * This could be addition of new properties, modifications of existing properties or
      * removal of properties.
      *
-     * @param context
-     * @return The UUID of the message that was sent to the group communications framework
-     * @throws ClusteringFault
+     * @param context The context to be replicated
+     * @throws ClusteringFault If replication fails
      */
-    String updateContext(AbstractContext context) throws ClusteringFault;
+    void updateContext(AbstractContext context) throws ClusteringFault;
+
+    /**
+     * This method is called when one need to update/replicate only certains properties in the
+     * specified <code>context</code>
+     *
+     * @param context       The AbstractContext containing the properties to be replicated
+     * @param propertyNames The names of the specific properties that should be replicated
+     * @throws ClusteringFault If replication fails
+     */
+    void updateContext(AbstractContext context, String[] propertyNames) throws ClusteringFault;
 
     /**
      * This method is called when properties in a collection of {@link AbstractContext}s are updated.
      * This could be addition of new properties, modifications of existing properties or
      * removal of properties.
      *
-     * @param contexts
-     * @return The UUID of the message that was sent to the group communications framework
-     * @throws ClusteringFault
+     * @param contexts The AbstractContexts containing the properties to be replicated
+     * @throws ClusteringFault If replication fails
      */
-    String updateContexts(AbstractContext[] contexts) throws ClusteringFault;
+    void updateContexts(AbstractContext[] contexts) throws ClusteringFault;
 
     /**
-     * This method is called when a new {@link AbstractContext} is removed from the system
+     * This method is called when {@link AbstractContext} is removed from the system
      *
-     * @param context
-     * @return The UUID of the message that was sent to the group communications framework
-     * @throws ClusteringFault
+     * @param context The AbstractContext to be removed
+     * @throws ClusteringFault If context removal fails
      */
-    String removeContext(AbstractContext context) throws ClusteringFault;
+    void removeContext(AbstractContext context) throws ClusteringFault;
 
     /**
-     * @param context
+     * @param context AbstractContext
      * @return True - if the provided {@link AbstractContext}  is clusterable
      */
     boolean isContextClusterable(AbstractContext context);
@@ -69,20 +76,20 @@
     /**
      * Indicates whether a particular message has been ACKed by all members of a cluster
      *
-     * @param messageUniqueId
+     * @param messageUniqueId The UUID of the message in concern
      * @return true - if all memebers have ACKed the message with ID <code>messageUniqueId</code>
      *         false - otherwise
-     * @throws ClusteringFault
+     * @throws ClusteringFault If an error occurs while checking whether a message is ACKed
      */
-    boolean isMessageAcknowledged(String messageUniqueId) throws ClusteringFault;
+//    boolean isMessageAcknowledged(String messageUniqueId) throws ClusteringFault;
 
     /**
-     * @param listener
+     * @param listener ContextManagerListener
      */
     void setContextManagerListener(ContextManagerListener listener);
 
     /**
-     * @param configurationContext
+     * @param configurationContext ConfigurationContext
      */
     void setConfigurationContext(ConfigurationContext configurationContext);
 
@@ -92,7 +99,11 @@
      * <p/>
      * Generally, we can use the context class name as the context type.
      *
-     * @param contextType
+     * @param contextType The type of the context such as
+     *                    org.apache.axis2.context.ConfigurationContext,
+     *                    org.apache.axis2.context.ServiceGroupContext &
+     *                    org.apache.axis2.context.ServiceContext.
+     *                    Also "defaults" is a special type, which will apply to all contexts
      * @param patterns    The patterns
      */
     void setReplicationExcludePatterns(String contextType, List patterns);

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/clustering/context/Replicator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/clustering/context/Replicator.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/clustering/context/Replicator.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/clustering/context/Replicator.java Tue Jan 15 08:21:22 2008
@@ -21,159 +21,140 @@
 
 import org.apache.axis2.clustering.ClusterManager;
 import org.apache.axis2.clustering.ClusteringFault;
-import org.apache.axis2.clustering.ClusteringConstants;
 import org.apache.axis2.context.AbstractContext;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.context.ServiceContext;
 import org.apache.axis2.context.ServiceGroupContext;
-import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
 import java.util.ArrayList;
 import java.util.List;
 
+/**
+ * Replicates serializable properties
+ */
 public final class Replicator {
 
     private static final Log log = LogFactory.getLog(Replicator.class);
 
+    /**
+     * Replicates all serializable properties in the ConfigurationContext, ServiceGroupContext &
+     * ServiceContext
+     *
+     * @param msgContext The MessageContext associated with the ServiceContext,
+     *                   ServiceGroupContext and ConfigurationContext to be replicated
+     * @throws ClusteringFault If replication fails
+     */
     public static void replicate(MessageContext msgContext) throws ClusteringFault {
-        if (!doReplication(msgContext)) {
+        if (!canReplicate(msgContext)) {
             return;
         }
-        log.debug("Going to replicate state...");
-        try {
-            replicateState(msgContext);
-        } catch (Exception e) {
-            String message = "Could not replicate the state";
-            log.error(message, e);
-            throw new ClusteringFault(message, e);
+        log.debug("Going to replicate state stored in ConfigurationContext," +
+                  " ServiceGroupContext, ServiceContext associated with " + msgContext + "...");
+        ConfigurationContext configurationContext = msgContext.getConfigurationContext();
+        ContextManager contextManager = getContextManager(msgContext);
+        List contexts = new ArrayList();
+
+        // Do we need to replicate state stored in ConfigurationContext?
+        if (!configurationContext.getPropertyDifferences().isEmpty()) {
+            contexts.add(configurationContext);
+        }
+
+        // Do we need to replicate state stored in ServiceGroupContext?
+        ServiceGroupContext sgContext = msgContext.getServiceGroupContext();
+        if (sgContext != null && !sgContext.getPropertyDifferences().isEmpty()) {
+            contexts.add(sgContext);
+        }
+
+        // Do we need to replicate state stored in ServiceContext?
+        ServiceContext serviceContext = msgContext.getServiceContext();
+        if (serviceContext != null && !serviceContext.getPropertyDifferences().isEmpty()) {
+            contexts.add(serviceContext);
+        }
+
+        // Do the actual replication here
+        if (!contexts.isEmpty()) {
+            AbstractContext[] contextArray =
+                    (AbstractContext[]) contexts.toArray(new AbstractContext[contexts.size()]);
+            contextManager.updateContexts(contextArray);
         }
     }
 
+    /**
+     * Replicate all serializable properties stored in the given <code>abstractContext</code>.
+     *
+     * @param abstractContext The AbstractContext which holds the properties to be replicated
+     * @throws ClusteringFault If replication fails
+     */
     public static void replicate(AbstractContext abstractContext) throws ClusteringFault {
-        if (!doReplication(abstractContext)) {
+        if (!canReplicate(abstractContext)) {
             return;
         }
-        log.debug("Going to replicate state...");
-        try {
-            replicateState(abstractContext);
-        } catch (Exception e) {
-            String message = "Could not replicate the state";
-            log.error(message, e);
-            throw new ClusteringFault(message, e);
+        log.debug("Going to replicate state in " + abstractContext + "...");
+        ContextManager contextManager = getContextManager(abstractContext);
+        if (!abstractContext.getPropertyDifferences().isEmpty()) {
+            contextManager.updateContext(abstractContext);
         }
     }
 
     /**
-     * Do replication only if context replication is enabled.
+     * Replicate all the properties given in <code>propertyNames</code>
+     * in the specified <code>abstractContext</code>
+     *
+     * @param abstractContext The context to be replicated
+     * @param propertyNames   The names of the properties to be replicated
+     * @throws ClusteringFault IF replication fails
+     */
+    public static void replicate(AbstractContext abstractContext,
+                                 String[] propertyNames) throws ClusteringFault {
+        if (!canReplicate(abstractContext)) {
+            return;
+        }
+        log.debug("Going to replicate selected properties in " + abstractContext + "...");
+        ContextManager contextManager = getContextManager(abstractContext);
+        contextManager.updateContext(abstractContext, propertyNames);
+    }
+
+    private static ClusterManager getClusterManager(AbstractContext abstractContext) {
+        return abstractContext.getRootContext().getAxisConfiguration().getClusterManager();
+    }
+
+    private static ContextManager getContextManager(AbstractContext abstractContext) {
+        return getClusterManager(abstractContext).getContextManager();
+    }
+
+    /**
+     * Check whether the state store in the specified <code>abstractContext</code> can be replicated.
      * Also note that if there are no members, we need not do any replication
      *
-     * @param abstractContext
+     * @param abstractContext The context to be subjected to this test
      * @return true - State needs to be replicated
      *         false - otherwise
      */
-    private static boolean doReplication(AbstractContext abstractContext) {
+    private static boolean canReplicate(AbstractContext abstractContext) {
         ClusterManager clusterManager =
                 abstractContext.getRootContext().getAxisConfiguration().getClusterManager();
-        return clusterManager != null &&
-               clusterManager.getContextManager() != null;
-    }
-
-    private static void replicateState(AbstractContext abstractContext) throws ClusteringFault {
-        ClusterManager clusterManager =
-                abstractContext.getRootContext().getAxisConfiguration().getClusterManager();
-        if (clusterManager != null) {
-            ContextManager contextManager = clusterManager.getContextManager();
-            if (contextManager == null) {
-                String msg = "Cannot replicate contexts since " +
-                             "ContextManager is not specified in the axis2.xml file.";
-                throw new ClusteringFault(msg);
-            }
-            if (!abstractContext.getPropertyDifferences().isEmpty()) {
-                String msgUUID = contextManager.updateContext(abstractContext);
-                waitForACKs(contextManager, msgUUID, abstractContext.getRootContext());
-            }
-        } else {
-            String msg = "Cannot replicate contexts since " +
-                         "ClusterManager is not specified in the axis2.xml file.";
-            throw new ClusteringFault(msg);
+        boolean canReplicate = false;
+        if (clusterManager != null && clusterManager.getContextManager() != null) {
+            canReplicate =
+                    clusterManager.getContextManager().isContextClusterable(abstractContext);
         }
+        return canReplicate;
     }
 
-    private static void replicateState(MessageContext msgContext) throws ClusteringFault {
-        ConfigurationContext configurationContext = msgContext.getConfigurationContext();
-        AxisConfiguration axisConfiguration = configurationContext.getAxisConfiguration();
-        ClusterManager clusterManager = axisConfiguration.getClusterManager();
-
-        if (clusterManager != null) {
-
-            ContextManager contextManager = clusterManager.getContextManager();
-            if (contextManager == null) {
-                String msg = "Cannot replicate contexts since " +
-                             "ContextManager is not specified in the axis2.xml file.";
-                throw new ClusteringFault(msg);
-            }
-
-            List contexts = new ArrayList();
-
-            // Do we need to replicate state stored in ConfigurationContext?
-            if (!configurationContext.getPropertyDifferences().isEmpty()) {
-                contexts.add(configurationContext);
-            }
-
-            // Do we need to replicate state stored in ServiceGroupContext?
-            ServiceGroupContext sgContext = msgContext.getServiceGroupContext();
-            if (sgContext != null && !sgContext.getPropertyDifferences().isEmpty()) {
-                contexts.add(sgContext);
-            }
-
-            // Do we need to replicate state stored in ServiceContext?
-            ServiceContext serviceContext = msgContext.getServiceContext();
-            if (serviceContext != null && !serviceContext.getPropertyDifferences().isEmpty()) {
-                contexts.add(serviceContext);
-            }
-
-            // Do the actual replication here
-            if (!contexts.isEmpty()) {
-                AbstractContext[] contextArray =
-                        (AbstractContext[]) contexts.toArray(new AbstractContext[contexts.size()]);
-                String msgUUID = contextManager.updateContexts(contextArray);
-                waitForACKs(contextManager, msgUUID, msgContext.getRootContext());
-            }
-
-        } else {
-            String msg = "Cannot replicate contexts since " +
-                         "ClusterManager is not specified in the axis2.xml file.";
-            throw new ClusteringFault(msg);
-        }
-    }
-
-    private static void waitForACKs(ContextManager contextManager,
-                                    String msgUUID,
-                                    ConfigurationContext configCtx) throws ClusteringFault {
-        long start = System.currentTimeMillis();
-
-        // Wait till all members have ACKed receipt & successful processing of
-        // the message with UUID 'msgUUID'
-        do {
-
-            // Wait sometime before checking whether message is ACKed
-            try {
-                Long tts =
-                        (Long) configCtx.getPropertyNonReplicable(ClusteringConstants.TIME_TO_SEND);
-                if (tts == null) {
-                    Thread.sleep(5);
-                } else if (tts.longValue() >= 0) {
-                    Thread.sleep(tts.longValue() + 5); // Time to recv ACK + time in queue & processing replication request
-                }
-            } catch (InterruptedException ignored) {
-            }
-            if (System.currentTimeMillis() - start > 45000) {
-                throw new ClusteringFault("ACKs not received from all members within 45 sec. " +
-                                          "Aborting wait.");
-            }
-        } while (!contextManager.isMessageAcknowledged(msgUUID));
+    /**
+     * Check whether the state store in the specified <code>messageContext</code> can be replicated.
+     * Also note that if there are no members, we need not do any replication
+     *
+     * @param messageContext The MessageContext to be subjected to this test
+     * @return true - State needs to be replicated
+     *         false - otherwise
+     */
+    private static boolean canReplicate(MessageContext messageContext) {
+        ClusterManager clusterManager =
+                messageContext.getRootContext().getAxisConfiguration().getClusterManager();
+        return clusterManager != null && clusterManager.getContextManager() != null;
     }
 }

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/context/AbstractContext.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/context/AbstractContext.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/context/AbstractContext.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/context/AbstractContext.java Tue Jan 15 08:21:22 2008
@@ -42,7 +42,7 @@
 
     protected transient AbstractContext parent;
     protected transient Map properties;
-    private transient Map propertyDifferences = new HashMap();
+    private transient Map propertyDifferences;
 
     protected AbstractContext(AbstractContext parent) {
         this.parent = parent;
@@ -59,6 +59,24 @@
     }
 
     /**
+     * @param context
+     * @return true if the context is an ancestor
+     */
+    public boolean isAncestor(AbstractContext context) {
+        if (context == null) {
+            return false;
+        }
+        for (AbstractContext ancestor = getParent();
+            ancestor != null;
+            ancestor = ancestor.getParent()) {
+            if (ancestor == context) {
+                return true;
+            }
+        }
+        return false;
+    }
+    
+    /**
      * @return The properties
      * @deprecated Use {@link #getPropertyNames()}, {@link #getProperty(String)},
      *             {@link #setProperty(String, Object)} & {@link #removeProperty(String)}instead.
@@ -97,7 +115,7 @@
 
             // Assume that a property is which is read may be updated.
             // i.e. The object pointed to by 'value' may be modified after it is read
-            addPropertyDifference(key);
+            addPropertyDifference(key, obj, false);
         }
         return obj;
     }
@@ -119,7 +137,7 @@
 
             // Assume that a property is which is read may be updated.
             // i.e. The object pointed to by 'value' may be modified after it is read
-            addPropertyDifference(key);
+            addPropertyDifference(key, obj, false);
         }
         return obj;
     }
@@ -150,26 +168,46 @@
             this.properties = new HashMap();
         }
         properties.put(key, value);
-        addPropertyDifference(key);
+        addPropertyDifference(key, value, false);
     }
 
-    private void addPropertyDifference(String key) {
+    private void addPropertyDifference(String key, Object value,  boolean isRemoved) {
+        
+        if (!needPropertyDifferences()) {
+            return;
+        }
+        // Narrowed the synchronization so that we only wait
+        // if a property difference is added.
+        synchronized(this) {
+            // Lazizly create propertyDifferences map
+            if (propertyDifferences == null) {
+                propertyDifferences = new HashMap();
+            }
+            propertyDifferences.put(key, new PropertyDifference(key, value, isRemoved));
+        }
+    }
+    
+    /**
+     * @return true if we need to store property differences for this 
+     * context in this scenario.
+     */
+    private boolean needPropertyDifferences() {
+        
+        // Don't store property differences if there are no 
+        // cluster members.
+        
         ConfigurationContext cc = getRootContext();
         if (cc == null) {
-            return;
+            return false;
         }
         // Add the property differences only if Context replication is enabled,
         // and there are members in the cluster
         ClusterManager clusterManager = cc.getAxisConfiguration().getClusterManager();
         if (clusterManager == null ||
             clusterManager.getContextManager() == null) {
-            return;
-        }
-        // Narrowed the synchronization so that we only wait
-        // if a property difference is added.
-        synchronized(this) {
-            propertyDifferences.put(key, new PropertyDifference(key, false));
+            return false;
         }
+        return true;
     }
 
     /**
@@ -193,10 +231,13 @@
      * @param key
      */
     public synchronized void removeProperty(String key) {
-        if (properties != null) {
-            properties.remove(key);
+        Object value = properties.get(key);
+        if (value != null) {
+            if (properties != null) {
+                properties.remove(key);
+            }
+            addPropertyDifference(key, value, true);
         }
-        propertyDifferences.put(key, new PropertyDifference(key, true));
     }
 
     /**
@@ -219,6 +260,9 @@
      * @return The property differences
      */
     public synchronized Map getPropertyDifferences() {
+        if (propertyDifferences == null) {
+            propertyDifferences = new HashMap();
+        }
         return propertyDifferences;
     }
 
@@ -228,7 +272,9 @@
      * been sent.
      */
     public synchronized void clearPropertyDifferences() {
-        propertyDifferences.clear();
+        if (propertyDifferences != null) {
+            propertyDifferences.clear();
+        }
     }
 
     /**

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/context/ConfigurationContext.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/context/ConfigurationContext.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/context/ConfigurationContext.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/context/ConfigurationContext.java Tue Jan 15 08:21:22 2008
@@ -40,6 +40,8 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
+import edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap;
+
 import java.io.File;
 import java.net.URL;
 import java.util.ArrayList;
@@ -48,7 +50,6 @@
 import java.util.Hashtable;
 import java.util.Iterator;
 import java.util.List;
-import java.util.Map;
 
 /**
  * <p>Axis2 states are held in two information models, called description hierarchy
@@ -70,7 +71,7 @@
      * Map containing <code>MessageID</code> to
      * <code>OperationContext</code> mapping.
      */
-    private final Map operationContextMap = new HashMap();
+    private final ConcurrentHashMap operationContextMap = new ConcurrentHashMap();
     private Hashtable serviceGroupContextMap = new Hashtable();
     private Hashtable applicationSessionServiceGroupContexts = new Hashtable();
     private AxisConfiguration axisConfiguration;
@@ -309,26 +310,34 @@
     public boolean registerOperationContext(String messageID, 
                                             OperationContext mepContext, 
                                             boolean override) {
-        boolean alreadyInMap;
+    	
+    	if(messageID == null){
+    		if(log.isDebugEnabled()){
+    			log.debug("messageID is null. Returning false");
+    		}
+    		return false;
+    	}
+    	
+        boolean alreadyInMap = false;
         mepContext.setKey(messageID);
-        synchronized (operationContextMap) {
-            alreadyInMap = operationContextMap.containsKey(messageID);
-            if (!alreadyInMap || override) {
-                this.operationContextMap.put(messageID, mepContext);
-            }
 
-            if (log.isDebugEnabled())
-            {
-                log.debug("registerOperationContext ("+override+"): "+
-                          mepContext+" with key: "+messageID);
-                HashMap msgContextMap = mepContext.getMessageContexts();
-                Iterator msgContextIterator = msgContextMap.values().iterator();
-                while (msgContextIterator.hasNext())
-                {
-                    MessageContext msgContext = (MessageContext)msgContextIterator.next();
-                    log.debug("msgContext: "+msgContext+" action: "+msgContext.getWSAAction());
-                }
-            }
+        if(override){
+        	operationContextMap.put(messageID, mepContext);
+        }else{
+        	Object previous = operationContextMap.putIfAbsent(messageID, mepContext);
+        	alreadyInMap = (previous!=null);
+        }
+        if (log.isDebugEnabled())
+        {
+        	log.debug("registerOperationContext ("+override+"): "+
+        			mepContext+" with key: "+messageID);
+        	HashMap msgContextMap = mepContext.getMessageContexts();
+        	Iterator msgContextIterator = msgContextMap.values().iterator();
+        	while (msgContextIterator.hasNext())
+        	{
+        		MessageContext msgContext = (MessageContext)msgContextIterator.next();
+        		log.debug("msgContext: "+msgContext+" action: "+msgContext.getWSAAction());
+        	}
         }
         return (!alreadyInMap || override);
     }
@@ -338,13 +347,20 @@
      * @param key
      */
     public void unregisterOperationContext(String key) {
-        synchronized (operationContextMap) {
-            OperationContext opCtx = (OperationContext) operationContextMap.get(key);
-            operationContextMap.remove(key);
-            contextRemoved(opCtx);
-        }
+    	if(key == null){
+    		if(log.isDebugEnabled()){
+    			log.debug("key is null.");
+    		}
+    	}else{
+    		OperationContext opCtx = (OperationContext) operationContextMap.remove(key);
+    		contextRemoved(opCtx);
+    	}
     }
 
+    public boolean isAnyOperationContextRegistered(){
+    	return !operationContextMap.isEmpty();
+    }
+    
     /**
      * Adds the given ServiceGroupContext into the SOAP session table
      * 
@@ -402,14 +418,7 @@
      * @param id
      */
     public OperationContext getOperationContext(String id) {
-        OperationContext opCtx;
-        synchronized (operationContextMap) {
-            if (operationContextMap == null) {
-                return null;
-            }
-            opCtx = (OperationContext) this.operationContextMap.get(id);
-        }
-
+        OperationContext opCtx = (OperationContext) this.operationContextMap.get(id);
         return opCtx;
     }
 
@@ -434,39 +443,36 @@
         // group name is not necessarily a prereq
         // but if the group name is non-null, then it has to match
 
-        synchronized (operationContextMap) {
-            Iterator it = operationContextMap.keySet().iterator();
+        Iterator it = operationContextMap.values().iterator();
 
-            while (it.hasNext()) {
-                Object key = it.next();
-                OperationContext value = (OperationContext) operationContextMap.get(key);
-
-                String valueOperationName;
-                String valueServiceName;
-                String valueServiceGroupName;
-
-                if (value != null) {
-                    valueOperationName = value.getOperationName();
-                    valueServiceName = value.getServiceName();
-                    valueServiceGroupName = value.getServiceGroupName();
-
-                    if ((valueOperationName != null) && (valueOperationName.equals(operationName))) {
-                        if ((valueServiceName != null) && (valueServiceName.equals(serviceName))) {
-                            if ((valueServiceGroupName != null) && (serviceGroupName != null)
-                                && (valueServiceGroupName.equals(serviceGroupName))) {
-                                // match
-                                return value;
-                            }
-
-                            // or, both need to be null
-                            if ((valueServiceGroupName == null) && (serviceGroupName == null)) {
-                                // match
-                                return value;
-                            }
-                        }
-                    }
-                }
-            }
+        while (it.hasNext()) {
+        	OperationContext value = (OperationContext) it.next();
+
+        	String valueOperationName;
+        	String valueServiceName;
+        	String valueServiceGroupName;
+
+        	if (value != null) {
+        		valueOperationName = value.getOperationName();
+        		valueServiceName = value.getServiceName();
+        		valueServiceGroupName = value.getServiceGroupName();
+
+        		if ((valueOperationName != null) && (valueOperationName.equals(operationName))) {
+        			if ((valueServiceName != null) && (valueServiceName.equals(serviceName))) {
+        				if ((valueServiceGroupName != null) && (serviceGroupName != null)
+        						&& (valueServiceGroupName.equals(serviceGroupName))) {
+        					// match
+        					return value;
+        				}
+
+        				// or, both need to be null
+        				if ((valueServiceGroupName == null) && (serviceGroupName == null)) {
+        					// match
+        					return value;
+        				}
+        			}
+        		}
+        	}
         }
 
         // if we got here, we did not find an operation context

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/context/MessageContext.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/context/MessageContext.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/context/MessageContext.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/context/MessageContext.java Tue Jan 15 08:21:22 2008
@@ -919,21 +919,29 @@
 
         // My own context hierarchy may not all be present. So look for whatever
         // nearest level is present and ask that to find the property.
+        //
+        // If the context is already an ancestor, it was checked during
+        // the super.getProperty call.  In such cases, the second check 
+        // is not performed.
         if (operationContext != null) {
-            return operationContext.getProperty(name);
-        }
-        if (serviceContext != null) {
-            return serviceContext.getProperty(name);
-        }
-        if (serviceGroupContext != null) {
-            return serviceGroupContext.getProperty(name);
-        }
-        if (configurationContext != null) {
-            return configurationContext.getProperty(name);
+            if (!isAncestor(operationContext)) {
+                obj = operationContext.getProperty(name);
+            }
+        } else if (serviceContext != null) {
+            if (!isAncestor(serviceContext)) {
+                obj = serviceContext.getProperty(name);
+            }
+        } else if (serviceGroupContext != null) {
+            if (!isAncestor(serviceGroupContext)) {
+                obj =  serviceGroupContext.getProperty(name);
+            }
+        } else if (configurationContext != null) {
+            if (!isAncestor(configurationContext)) {
+                obj = configurationContext.getProperty(name);
+            }
         }
 
-        // tough
-        return null;
+        return obj;
     }
 
     /**
@@ -1618,7 +1626,7 @@
      * if SOAP with Attachments is enabled.
      *
      * @param contentID   :
-     *                    will be the content ID of the MIME part
+     *                    will be the content ID of the MIME part (without the "cid:" prefix)
      * @param dataHandler
      */
     public void addAttachment(String contentID, DataHandler dataHandler) {
@@ -1648,7 +1656,7 @@
      * content ID. Returns "NULL" if a attachment cannot be found by the given content ID.
      *
      * @param contentID :
-     *                  Content ID of the MIME attachment
+     *                  Content ID of the MIME attachment (without the "cid:" prefix)
      * @return Data handler of the attachment
      */
     public DataHandler getAttachment(String contentID) {
@@ -1662,7 +1670,7 @@
      * Removes the attachment with the given content ID from the Attachments Map
      * Do nothing if a attachment cannot be found by the given content ID.
      *
-     * @param contentID of the attachment
+     * @param contentID of the attachment (without the "cid:" prefix)
      */
     public void removeAttachment(String contentID) {
         if (attachments != null) {

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/context/PropertyDifference.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/context/PropertyDifference.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/context/PropertyDifference.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/context/PropertyDifference.java Tue Jan 15 08:21:22 2008
@@ -30,11 +30,6 @@
     private Object value;
     private boolean isRemoved;
 
-    public PropertyDifference(String key, boolean isRemoved) {
-        this.key = key;
-        this.isRemoved = isRemoved;
-    }
-
     public PropertyDifference(String key, Object value, boolean isRemoved) {
         this.key = key;
         this.value = value;

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/context/externalize/DebugObjectOutputStream.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/context/externalize/DebugObjectOutputStream.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/context/externalize/DebugObjectOutputStream.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/context/externalize/DebugObjectOutputStream.java Tue Jan 15 08:21:22 2008
@@ -18,8 +18,6 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-import java.io.Closeable;
-import java.io.Flushable;
 import java.io.IOException;
 import java.io.ObjectOutput;
 import java.io.ObjectStreamConstants;
@@ -28,8 +26,8 @@
  * DebugObjectOutputStream delegates to an ObjectOutput object.
  * Each method logs in/out trace information
  */
-public class DebugObjectOutputStream implements ObjectStreamConstants, ObjectOutput, Closeable,
-        Flushable {
+public class DebugObjectOutputStream implements ObjectStreamConstants, ObjectOutput
+        {
     private static final Log log = LogFactory.getLog(DebugObjectOutputStream.class);
     private static final boolean isDebug = log.isDebugEnabled();
     ObjectOutput out;

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/context/externalize/SafeObjectOutputStream.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/context/externalize/SafeObjectOutputStream.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/context/externalize/SafeObjectOutputStream.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/context/externalize/SafeObjectOutputStream.java Tue Jan 15 08:21:22 2008
@@ -19,8 +19,6 @@
 import org.apache.commons.logging.LogFactory;
 
 import java.io.ByteArrayOutputStream;
-import java.io.Closeable;
-import java.io.Flushable;
 import java.io.IOException;
 import java.io.NotSerializableException;
 import java.io.ObjectOutput;
@@ -50,7 +48,7 @@
  * @see SafeObjectInputStream
  *
  */
-public class SafeObjectOutputStream implements Closeable, Flushable, ObjectOutput,
+public class SafeObjectOutputStream implements ObjectOutput,
         ObjectStreamConstants, ExternalizeConstants {
     
     private static final Log log = LogFactory.getLog(SafeObjectOutputStream.class);
@@ -682,7 +680,7 @@
             return;
         }
         if (obj != null) {
-            String name = obj.getClass().getCanonicalName();
+            String name = obj.getClass().getName();
             Object value = notSerializableList.get(name);
             if (value == null) {
                 notSerializableList.put(name, name);

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/DeploymentConstants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/DeploymentConstants.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/DeploymentConstants.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/DeploymentConstants.java Tue Jan 15 08:21:22 2008
@@ -36,7 +36,6 @@
 
     String TAG_AXISCONFIG = "axisconfig";
     String TAG_PHASE_ORDER = "phaseOrder";
-    String TAG_PHASE = "phase";
     String TAG_PARAMETER = "parameter";
     String TAG_MAPPING = "mapping";
     String TAG_PACKAGE_NAME = "packageName";
@@ -60,6 +59,7 @@
     String TAG_PHASE_FIRST = "phaseFirst";
     String TAG_ORDER = "order";           // to resolve the order tag
     String TAG_OPERATION = "operation";       // operation start tag
+    String TAG_PHASE = "phase";       // operation start tag
     String TAG_OBJECT_SUPPLIER = "ObjectSupplier";       // operation start tag
     String TAG_EXCLUDE_OPERATIONS = "excludeOperations";
     String TAG_MESSAGE_RECEIVER = "messageReceiver";
@@ -91,6 +91,8 @@
     String TAG_DISPATCHER = "dispatcher";
     String TAG_DESCRIPTION = "Description";
     String TAG_CLASS_NAME = "class";
+    String TAG_EXCLUDE_PROPERTIES= "excludeProperties";
+    String TAG_INCLUDE_PROPERTIES= "includeProperties";
     String TAG_AFTER = "after";
     String TAG_BEFORE = "before";
     String TAG_SUPPORTED_POLICY_NAMESPACES = "supported-policy-namespaces";

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/ModuleBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/ModuleBuilder.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/ModuleBuilder.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/ModuleBuilder.java Tue Jan 15 08:21:22 2008
@@ -23,14 +23,12 @@
 import org.apache.axiom.om.OMAttribute;
 import org.apache.axiom.om.OMElement;
 import org.apache.axis2.AxisFault;
+import org.apache.axis2.phaseresolver.PhaseMetadata;
 import org.apache.axis2.deployment.util.PhasesInfo;
-import org.apache.axis2.description.AxisModule;
-import org.apache.axis2.description.AxisOperation;
-import org.apache.axis2.description.AxisOperationFactory;
-import org.apache.axis2.description.InOnlyAxisOperation;
-import org.apache.axis2.description.PolicyInclude;
+import org.apache.axis2.description.*;
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.engine.MessageReceiver;
+import org.apache.axis2.engine.Deployable;
 import org.apache.axis2.i18n.Messages;
 import org.apache.axis2.java.security.AccessController;
 import org.apache.axis2.modules.Module;
@@ -88,7 +86,11 @@
             OMElement moduleElement = buildOM();
             // Setting Module Class , if it is there
             OMAttribute moduleClassAtt = moduleElement.getAttribute(new QName(TAG_CLASS_NAME));
+            // processing Parameters
+            // Processing service level parameters
+            Iterator itr = moduleElement.getChildrenWithName(new QName(TAG_PARAMETER));
 
+            processParameters(itr, module, module.getParent());
             if (moduleClassAtt != null) {
                 String moduleClass = moduleClassAtt.getAttributeValue();
 
@@ -130,6 +132,10 @@
                 module.setModuleDescription("module description not found");
             }
 
+            // Processing Dynamic Phase
+            Iterator phaseItr = moduleElement.getChildrenWithName(new QName(TAG_PHASE));
+            processModulePhase(phaseItr);
+            
             // setting the PolicyInclude
 
             // processing <wsp:Policy> .. </..> elements
@@ -150,12 +156,6 @@
                                          module.getPolicyInclude());
             }
 
-            // processing Parameters
-            // Processing service level parameters
-            Iterator itr = moduleElement.getChildrenWithName(new QName(TAG_PARAMETER));
-
-            processParameters(itr, module, module.getParent());
-
             // process INFLOW
             OMElement inFlow = moduleElement.getFirstChildWithName(new QName(TAG_FLOW_IN));
 
@@ -212,8 +212,11 @@
 
                 module.addOperation(operation);
             }
+
         } catch (XMLStreamException e) {
             throw new DeploymentException(e);
+        } catch(AxisFault e) {
+            throw new DeploymentException(e);
         }
     }
 
@@ -296,7 +299,7 @@
             // processing <wsp:PolicyReference> .. </..> elements
             Iterator policyRefElements = operation.getChildrenWithName(new QName(POLICY_NS_URI, TAG_POLICY_REF));
 
-            if (policyRefElements != null && policyElements.hasNext()) {
+            if (policyRefElements != null && policyRefElements.hasNext()) {
                 processPolicyRefElements(PolicyInclude.AXIS_MODULE_OPERATION_POLICY, policyRefElements, module.getPolicyInclude());
             }
 
@@ -314,5 +317,56 @@
         }
 
         return operations;
+    }
+
+    /**
+     * This will process the phase list and then added the phases specified in module.xml to
+     * axisConfiguration. The format of a phase element will something like
+     *  <phase name="Foo" after="After_phase_Name" before="Before_Phase_Name"
+     *  flow="[InFlow,OutFlow,OutFaultFlow,InFaultFlow]"/>
+     *  Here before and after can be null
+     * @param phases : OMElement iterator
+     * @throws AxisFault : If something went wrong
+     */
+    private void processModulePhase(Iterator phases) throws AxisFault {
+        if (phases == null){
+            return;
+        }
+        while (phases.hasNext()) {
+            OMElement element = (OMElement) phases.next();
+            String phaseName = element.getAttributeValue(new QName(ATTRIBUTE_NAME));
+
+            Deployable d = new Deployable(phaseName);
+            String after = element.getAttributeValue(new QName(TAG_AFTER));
+            if (after != null) {
+                String [] afters = after.split(",");
+                for (int i = 0; i < afters.length; i++) {
+                    String s = afters[i];
+                    d.addPredecessor(s);
+                }
+            }
+            String before = element.getAttributeValue(new QName(TAG_BEFORE));
+            if (before != null) {
+                String [] befores = before.split(",");
+                for (int i = 0; i < befores.length; i++) {
+                    String s = befores[i];
+                    d.addSuccessor(s);
+                }
+            }
+            String flowName = element.getAttributeValue(new QName("flow"));
+            int flowIndex ;
+            if (TAG_FLOW_IN.equals(flowName)){
+                flowIndex = PhaseMetadata.IN_FLOW ;
+            } else if (TAG_FLOW_OUT.equals(flowName)) {
+                flowIndex = PhaseMetadata.OUT_FLOW ;
+            } else if (TAG_FLOW_OUT_FAULT.equals(flowName)) {
+                flowIndex = PhaseMetadata.FAULT_OUT_FLOW;
+            } else if (TAG_FLOW_IN_FAULT.equals(flowName)) {
+                flowIndex = PhaseMetadata.FAULT_IN_FLOW;
+            } else {
+                throw new DeploymentException(" Flow can not be null for the phase name " + phaseName);
+            }
+            axisConfig.insertPhase(d, flowIndex);
+        }
     }
 }

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/POJODeployer.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/POJODeployer.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/POJODeployer.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/POJODeployer.java Tue Jan 15 08:21:22 2008
@@ -269,8 +269,9 @@
                                   configCtx.getAxisConfiguration(),
                                   new ArrayList(),
                                   new ArrayList());
-            setMessageReceivers(axisService);
-
+            //Not needed at this case, the message receivers always set to RPC if this executes
+            //setMessageReceivers(axisService);
+            
         } catch (Exception e) {
             // Seems like the jax-ws jars missin in the class path .
             // lets tryu annogen
@@ -351,6 +352,7 @@
     }
 
     public void unDeploy(String fileName) {
+        fileName = Utils.getShortFileName(fileName);
         if (fileName.endsWith(".class")) {
             String className = fileName.replaceAll(".class", "");
             try {

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/RepositoryListener.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/RepositoryListener.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/RepositoryListener.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/RepositoryListener.java Tue Jan 15 08:21:22 2008
@@ -37,14 +37,13 @@
 import java.net.URLDecoder;
 import java.util.ArrayList;
 import java.util.Enumeration;
-import java.util.HashMap;
 import java.util.Iterator;
+import java.util.Map;
 
 public class RepositoryListener implements DeploymentConstants {
     protected static final Log log = LogFactory.getLog(RepositoryListener.class);
 
     protected DeploymentEngine deploymentEngine;
-    private HashMap directoryToExtensionMappingMap;
 
     /** Reference to a WSInfoList */
     protected WSInfoList wsInfoList;
@@ -235,13 +234,13 @@
     public void init() {
         wsInfoList.init();
         checkModules();
-        directoryToExtensionMappingMap = deploymentEngine.getDirectoryToExtensionMappingMap();
         deploymentEngine.doDeploy();
     }
 
     //This will load the files from the directories
     // specified by axis2.xml (As <deployer>)
     private void loadOtherDirectories() {
+        Map directoryToExtensionMappingMap = deploymentEngine.getDirectoryToExtensionMappingMap();
         if (directoryToExtensionMappingMap.size() > 0) {
             Iterator keys = directoryToExtensionMappingMap.keySet().iterator();
             while (keys.hasNext()) {
@@ -258,7 +257,12 @@
 
     private void findFileForGivenDirectory(String dir, String extension) {
         try {
-            File directory = new File(deploymentEngine.getRepositoryDir(), dir);
+            File directory = deploymentEngine.getRepositoryDir();
+            String[] strings = dir.split("/");
+            for (int i = 0; i < strings.length; i++) {
+                directory = new File(directory, strings[i]);
+            }
+
             if (directory.exists()) {
                 File[] files = directory.listFiles();
                 if (files != null && files.length > 0) {



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org