axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gdani...@apache.org
Subject svn commit: r694872 - in /webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2: Constants.java builder/BuilderUtil.java client/ServiceClient.java context/ConfigurationContext.java deployment/POJODeployer.java engine/ListenerManager.java
Date Sat, 13 Sep 2008 03:42:27 GMT
Author: gdaniels
Date: Fri Sep 12 20:42:27 2008
New Revision: 694872

URL: http://svn.apache.org/viewvc?rev=694872&view=rev
Log:
* Code cleanup + reformat, fix IDE warnings, spelling correction, improve JavaDoc, etc.

* Set default configuration context in ServiceClient if not already set.
  TODO : fix ListenerManager.  A static public field, seriously? :(

Modified:
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/Constants.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/builder/BuilderUtil.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/client/ServiceClient.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/ConfigurationContext.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/POJODeployer.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/ListenerManager.java

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/Constants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/Constants.java?rev=694872&r1=694871&r2=694872&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/Constants.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/Constants.java Fri Sep 12 20:42:27 2008
@@ -325,6 +325,9 @@
 
         public static final String CONTENT_TYPE = "ContentType";
 
+        public static final String CONFIG_CONTEXT_TIMEOUT_INTERVAL = "ConfigContextTimeoutInterval";
+
+        /** @deprecated MISSPELLING */
         public static final String CONFIG_CONTEXT_TIMOUT_INTERVAL = "ConfigContextTimeoutInterval";
 
         public static final String TRANSPORT_IN_URL = "TransportInURL";

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/builder/BuilderUtil.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/builder/BuilderUtil.java?rev=694872&r1=694871&r2=694872&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/builder/BuilderUtil.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/builder/BuilderUtil.java Fri Sep 12 20:42:27 2008
@@ -44,13 +44,13 @@
 import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
-import org.apache.axis2.java.security.AccessController;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.deployment.DeploymentConstants;
 import org.apache.axis2.description.AxisMessage;
 import org.apache.axis2.description.AxisOperation;
 import org.apache.axis2.description.Parameter;
 import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.axis2.java.security.AccessController;
 import org.apache.axis2.transport.http.HTTPConstants;
 import org.apache.axis2.util.JavaUtils;
 import org.apache.axis2.util.MultipleEntryHashMap;
@@ -77,11 +77,10 @@
 import java.io.PushbackInputStream;
 import java.io.Reader;
 import java.io.UnsupportedEncodingException;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
 import java.util.Iterator;
 import java.util.Map;
-import java.security.PrivilegedAction;
-import java.security.PrivilegedExceptionAction;
-import java.security.PrivilegedActionException;
 
 public class BuilderUtil {
     private static final Log log = LogFactory.getLog(BuilderUtil.class);
@@ -94,109 +93,113 @@
 
         SOAPEnvelope soapEnvelope = soapFactory.getDefaultEnvelope();
         SOAPBody body = soapEnvelope.getBody();
-        XmlSchemaElement xmlSchemaElement = null;
+        XmlSchemaElement xmlSchemaElement;
         AxisOperation axisOperation = messageContext.getAxisOperation();
         if (axisOperation != null) {
             AxisMessage axisMessage =
                     axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
             xmlSchemaElement = axisMessage.getSchemaElement();
 
-        if (xmlSchemaElement == null) {
-            OMElement bodyFirstChild =
-                            soapFactory.createOMElement(messageContext.getAxisOperation().getName(), body);
-
-            // if there is no schema its piece of cake !! add these to the soap body in any order you like.
-            // Note : if there are parameters in the path of the URL, there is no way this can add them
-            // to the message.
-            createSOAPMessageWithoutSchema(soapFactory, messageContext, bodyFirstChild, requestParameterMap);
-        } else {
-
-            // first get the target namespace from the schema and the wrapping element.
-            // create an OMElement out of those information. We are going to extract parameters from
-            // url, create OMElements and add them as children to this wrapping element.
-            String targetNamespace = xmlSchemaElement.getQName().getNamespaceURI();
-            QName bodyFirstChildQName;
-            if (targetNamespace != null && !"".equals(targetNamespace)) {
-                bodyFirstChildQName = new QName(targetNamespace, xmlSchemaElement.getName());
+            if (xmlSchemaElement == null) {
+                OMElement bodyFirstChild =
+                        soapFactory
+                                .createOMElement(messageContext.getAxisOperation().getName(), body);
+
+                // if there is no schema its piece of cake !! add these to the soap body in any order you like.
+                // Note : if there are parameters in the path of the URL, there is no way this can add them
+                // to the message.
+                createSOAPMessageWithoutSchema(soapFactory, bodyFirstChild, requestParameterMap);
             } else {
-                bodyFirstChildQName = new QName(xmlSchemaElement.getName());
-            }
-            OMElement bodyFirstChild = soapFactory.createOMElement(bodyFirstChildQName, body);
 
-            // Schema should adhere to the IRI style in this. So assume IRI style and dive in to
-            // schema
-            XmlSchemaType schemaType = xmlSchemaElement.getSchemaType();
-            if (schemaType instanceof XmlSchemaComplexType) {
-                XmlSchemaComplexType complexType = ((XmlSchemaComplexType) schemaType);
-                XmlSchemaParticle particle = complexType.getParticle();
-                if (particle instanceof XmlSchemaSequence || particle instanceof XmlSchemaAll) {
-                    XmlSchemaGroupBase xmlSchemaGroupBase = (XmlSchemaGroupBase) particle;
-                    Iterator iterator = xmlSchemaGroupBase.getItems().getIterator();
-
-                    // now we need to know some information from the binding operation.
-
-                    while (iterator.hasNext()) {
-                        XmlSchemaElement innerElement = (XmlSchemaElement) iterator.next();
-                        QName qName = innerElement.getQName();
-                        if (qName ==null && innerElement.getSchemaTypeName().equals(org.apache.ws.commons.schema.constants.Constants.XSD_ANYTYPE)) {
-                            createSOAPMessageWithoutSchema(soapFactory, messageContext, bodyFirstChild, requestParameterMap);
-                            break;
-                        }
-                        long minOccurs = innerElement.getMinOccurs();
-                        boolean nillable = innerElement.isNillable();
-                        String name =
-                                qName != null ? qName.getLocalPart() : innerElement.getName();
+                // first get the target namespace from the schema and the wrapping element.
+                // create an OMElement out of those information. We are going to extract parameters from
+                // url, create OMElements and add them as children to this wrapping element.
+                String targetNamespace = xmlSchemaElement.getQName().getNamespaceURI();
+                QName bodyFirstChildQName;
+                if (targetNamespace != null && !"".equals(targetNamespace)) {
+                    bodyFirstChildQName = new QName(targetNamespace, xmlSchemaElement.getName());
+                } else {
+                    bodyFirstChildQName = new QName(xmlSchemaElement.getName());
+                }
+                OMElement bodyFirstChild = soapFactory.createOMElement(bodyFirstChildQName, body);
+
+                // Schema should adhere to the IRI style in this. So assume IRI style and dive in to
+                // schema
+                XmlSchemaType schemaType = xmlSchemaElement.getSchemaType();
+                if (schemaType instanceof XmlSchemaComplexType) {
+                    XmlSchemaComplexType complexType = ((XmlSchemaComplexType)schemaType);
+                    XmlSchemaParticle particle = complexType.getParticle();
+                    if (particle instanceof XmlSchemaSequence || particle instanceof XmlSchemaAll) {
+                        XmlSchemaGroupBase xmlSchemaGroupBase = (XmlSchemaGroupBase)particle;
+                        Iterator iterator = xmlSchemaGroupBase.getItems().getIterator();
+
+                        // now we need to know some information from the binding operation.
+
+                        while (iterator.hasNext()) {
+                            XmlSchemaElement innerElement = (XmlSchemaElement)iterator.next();
+                            QName qName = innerElement.getQName();
+                            if (qName == null && innerElement.getSchemaTypeName()
+                                    .equals(org.apache.ws.commons.schema.constants.Constants.XSD_ANYTYPE)) {
+                                createSOAPMessageWithoutSchema(soapFactory, bodyFirstChild,
+                                                               requestParameterMap);
+                                break;
+                            }
+                            long minOccurs = innerElement.getMinOccurs();
+                            boolean nillable = innerElement.isNillable();
+                            String name =
+                                    qName != null ? qName.getLocalPart() : innerElement.getName();
                             Object value;
-                        OMNamespace ns = (qName == null ||
-                                qName.getNamespaceURI() == null
-                                || qName.getNamespaceURI().length() == 0) ?
-                                null : soapFactory.createOMNamespace(
-                                qName.getNamespaceURI(), null);
+                            OMNamespace ns = (qName == null ||
+                                              qName.getNamespaceURI() == null
+                                              || qName.getNamespaceURI().length() == 0) ?
+                                    null : soapFactory.createOMNamespace(
+                                    qName.getNamespaceURI(), null);
 
                             // FIXME changed
                             while ((value = requestParameterMap.get(name)) != null) {
                                 addRequestParameter(soapFactory,
-                                        bodyFirstChild, ns, name, value);
-                            minOccurs--;
-                        }
-                        if (minOccurs > 0) {
-                            if (nillable) {
+                                                    bodyFirstChild, ns, name, value);
+                                minOccurs--;
+                            }
+                            if (minOccurs > 0) {
+                                if (nillable) {
 
-                                OMNamespace xsi = soapFactory.createOMNamespace(
-                                        Constants.URI_DEFAULT_SCHEMA_XSI,
-                                        Constants.NS_PREFIX_SCHEMA_XSI);
-                                OMAttribute omAttribute =
-                                        soapFactory.createOMAttribute("nil", xsi, "true");
-                                soapFactory.createOMElement(name, ns,
-                                                            bodyFirstChild)
-                                        .addAttribute(omAttribute);
-
-                            } else {
-                                throw new AxisFault("Required element " + qName +
-                                        " defined in the schema can not be found in the request");
+                                    OMNamespace xsi = soapFactory.createOMNamespace(
+                                            Constants.URI_DEFAULT_SCHEMA_XSI,
+                                            Constants.NS_PREFIX_SCHEMA_XSI);
+                                    OMAttribute omAttribute =
+                                            soapFactory.createOMAttribute("nil", xsi, "true");
+                                    soapFactory.createOMElement(name, ns,
+                                                                bodyFirstChild)
+                                            .addAttribute(omAttribute);
+
+                                } else {
+                                    throw new AxisFault("Required element " + qName +
+                                                        " defined in the schema can not be" +
+                                                        " found in the request");
+                                }
                             }
                         }
                     }
                 }
             }
         }
-    }
         return soapEnvelope;
     }
 
     private static void createSOAPMessageWithoutSchema(SOAPFactory soapFactory,
-                                                       MessageContext messageContext, OMElement bodyFirstChild,
+                                                       OMElement bodyFirstChild,
                                                        MultipleEntryHashMap requestParameterMap) {
 
         // first add the parameters in the URL
         if (requestParameterMap != null) {
             Iterator requestParamMapIter = requestParameterMap.keySet().iterator();
             while (requestParamMapIter.hasNext()) {
-                String key = (String) requestParamMapIter.next();
+                String key = (String)requestParamMapIter.next();
                 Object value = requestParameterMap.get(key);
                 if (value != null) {
                     addRequestParameter(soapFactory, bodyFirstChild, null, key,
-                            value);
+                                        value);
                 }
 
             }
@@ -231,19 +234,21 @@
     }
 
     /**
-     * Use the BOM Mark to identify the encoding to be used. Fall back to
-     * default encoding specified
+     * Use the BOM Mark to identify the encoding to be used. Fall back to default encoding
+     * specified
      *
-     * @param is
-     * @param charSetEncoding
+     * @param is              the InputStream of a message
+     * @param charSetEncoding default character set encoding
+     * @return a Reader with the correct encoding already set
      * @throws java.io.IOException
      */
-    public static Reader getReader(final InputStream is, final String charSetEncoding) throws IOException {
+    public static Reader getReader(final InputStream is, final String charSetEncoding)
+            throws IOException {
         final PushbackInputStream is2 = getPushbackInputStream(is);
         final String encoding = getCharSetEncoding(is2, charSetEncoding);
-        InputStreamReader inputStreamReader = null;
+        InputStreamReader inputStreamReader;
         try {
-            inputStreamReader = (InputStreamReader) AccessController.doPrivileged(
+            inputStreamReader = (InputStreamReader)AccessController.doPrivileged(
                     new PrivilegedExceptionAction() {
                         public Object run() throws UnsupportedEncodingException {
                             return new InputStreamReader(is2, encoding);
@@ -251,62 +256,66 @@
                     }
             );
         } catch (PrivilegedActionException e) {
-            throw (UnsupportedEncodingException) e.getException();
+            throw (UnsupportedEncodingException)e.getException();
         }
         return new BufferedReader(inputStreamReader);
     }
 
     /**
      * Convenience method to get a PushbackInputStream so that we can read the BOM
-     * @param is
-     * @return PushbackInputStream
+     *
+     * @param is a regular InputStream
+     * @return a PushbackInputStream wrapping the passed one
      */
     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
+     * Use the BOM Mark to identify the encoding to be used. Fall back to default encoding
+     * specified
      *
-     * @param is2 PushBackInputStream (it must be a pushback input stream so that we can unread the BOM)
-     * @param defaultEncoding
+     * @param is2             PushBackInputStream (it must be a pushback input stream so that we can
+     *                        unread the BOM)
+     * @param defaultEncoding default encoding style if no BOM
+     * @return the selected character set encoding
      * @throws java.io.IOException
      */
-    public static String getCharSetEncoding(PushbackInputStream is2, String defaultEncoding) throws IOException {
+    public static String getCharSetEncoding(PushbackInputStream is2, String defaultEncoding)
+            throws IOException {
         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)) {
+        if ((bom[0] == (byte)0xEF) && (bom[1] == (byte)0xBB) && (bom[2] == (byte)0xBF)) {
             encoding = "UTF-8";
             if (log.isDebugEnabled()) {
                 log.debug("char set encoding set from BOM =" + encoding);
             }
             unread = n - 3;
-        } else if ((bom[0] == (byte) 0xFE) && (bom[1] == (byte) 0xFF)) {
+        } else if ((bom[0] == (byte)0xFE) && (bom[1] == (byte)0xFF)) {
             encoding = "UTF-16BE";
             if (log.isDebugEnabled()) {
                 log.debug("char set encoding set from BOM =" + encoding);
             }
             unread = n - 2;
-        } else if ((bom[0] == (byte) 0xFF) && (bom[1] == (byte) 0xFE)) {
+        } else if ((bom[0] == (byte)0xFF) && (bom[1] == (byte)0xFE)) {
             encoding = "UTF-16LE";
             if (log.isDebugEnabled()) {
                 log.debug("char set encoding set from BOM =" + encoding);
             }
             unread = n - 2;
-        } else if ((bom[0] == (byte) 0x00) && (bom[1] == (byte) 0x00) && (bom[2] == (byte) 0xFE)
-                && (bom[3] == (byte) 0xFF)) {
+        } else if ((bom[0] == (byte)0x00) && (bom[1] == (byte)0x00) && (bom[2] == (byte)0xFE)
+                   && (bom[3] == (byte)0xFF)) {
             encoding = "UTF-32BE";
             if (log.isDebugEnabled()) {
                 log.debug("char set encoding set from BOM =" + encoding);
             }
             unread = n - 4;
-        } else if ((bom[0] == (byte) 0xFF) && (bom[1] == (byte) 0xFE) && (bom[2] == (byte) 0x00)
-                && (bom[3] == (byte) 0x00)) {
+        } else if ((bom[0] == (byte)0xFF) && (bom[1] == (byte)0xFE) && (bom[2] == (byte)0x00)
+                   && (bom[3] == (byte)0x00)) {
             encoding = "UTF-32LE";
             if (log.isDebugEnabled()) {
                 log.debug("char set encoding set from BOM =" + encoding);
@@ -344,12 +353,12 @@
     }
 
     /**
-     * Extracts and returns the character set encoding from the
-     * Content-type header
-     * Example:
-     * Content-Type: text/xml; charset=utf-8
+     * Extracts and returns the character set encoding from the Content-type header
+     * <p/>
+     * Example: "Content-Type: text/xml; charset=utf-8" would return "utf-8"
      *
-     * @param contentType
+     * @param contentType a content-type (from HTTP or MIME, for instance)
+     * @return the character set encoding if found, or MessageContext.DEFAULT_CHAR_SET_ENCODING
      */
     public static String getCharSetEncoding(String contentType) {
         if (log.isDebugEnabled()) {
@@ -358,7 +367,8 @@
         if (contentType == null) {
             // Using the default UTF-8
             if (log.isDebugEnabled()) {
-                log.debug("CharSetEncoding defaulted (" + MessageContext.DEFAULT_CHAR_SET_ENCODING + ")");
+                log.debug("CharSetEncoding defaulted (" + MessageContext.DEFAULT_CHAR_SET_ENCODING +
+                          ")");
             }
             return MessageContext.DEFAULT_CHAR_SET_ENCODING;
         }
@@ -368,7 +378,8 @@
         if (index == -1) {    // Charset encoding not found in the content-type header
             // Using the default UTF-8
             if (log.isDebugEnabled()) {
-                log.debug("CharSetEncoding defaulted (" + MessageContext.DEFAULT_CHAR_SET_ENCODING + ")");
+                log.debug("CharSetEncoding defaulted (" + MessageContext.DEFAULT_CHAR_SET_ENCODING +
+                          ")");
             }
             return MessageContext.DEFAULT_CHAR_SET_ENCODING;
         }
@@ -408,7 +419,7 @@
         String charSetEncoding = getCharSetEncoding(attachments.getSOAPPartContentType());
 
         if ((charSetEncoding == null)
-                || "null".equalsIgnoreCase(charSetEncoding)) {
+            || "null".equalsIgnoreCase(charSetEncoding)) {
             charSetEncoding = MessageContext.UTF_8;
         }
         msgContext.setProperty(Constants.Configuration.CHARACTER_SET_ENCODING,
@@ -423,7 +434,6 @@
             throw new XMLStreamException(e);
         }
 
-
         //  Put a reference to Attachments Map in to the message context For
         // backword compatibility with Axis2 1.0 
         msgContext.setProperty(MTOMConstants.ATTACHMENTS, attachments);
@@ -453,17 +463,12 @@
         }
         // To handle REST XOP case
         else {
-            if (attachments.getAttachmentSpecType().equals(
-                    MTOMConstants.MTOM_TYPE)) {
-                XOPAwareStAXOMBuilder stAXOMBuilder = new XOPAwareStAXOMBuilder(
-                        streamReader, attachments);
-                builder = stAXOMBuilder;
+            if (attachments.getAttachmentSpecType().equals(MTOMConstants.MTOM_TYPE)) {
+                builder = new XOPAwareStAXOMBuilder(streamReader, attachments);
 
-            } else if (attachments.getAttachmentSpecType().equals(
-                    MTOMConstants.SWA_TYPE)) {
+            } else if (attachments.getAttachmentSpecType().equals(MTOMConstants.SWA_TYPE)) {
                 builder = new StAXOMBuilder(streamReader);
-            } else if (attachments.getAttachmentSpecType().equals(
-                    MTOMConstants.SWA_TYPE_12)) {
+            } else if (attachments.getAttachmentSpecType().equals(MTOMConstants.SWA_TYPE_12)) {
                 builder = new StAXOMBuilder(streamReader);
             }
         }
@@ -484,12 +489,12 @@
                     .getProperty(Constants.Configuration.ATTACHMENT_TEMP_DIR);
 
             if (attachmentRepoDirProperty != null) {
-                attachmentRepoDir = (String) attachmentRepoDirProperty;
+                attachmentRepoDir = (String)attachmentRepoDirProperty;
             } else {
                 Parameter attachmentRepoDirParameter = msgContext
                         .getParameter(Constants.Configuration.ATTACHMENT_TEMP_DIR);
                 attachmentRepoDir =
-                        (attachmentRepoDirParameter != null) ? (String) attachmentRepoDirParameter
+                        (attachmentRepoDirParameter != null) ? (String)attachmentRepoDirParameter
                                 .getValue()
                                 : null;
             }
@@ -497,8 +502,8 @@
             Object attachmentSizeThresholdProperty = msgContext
                     .getProperty(Constants.Configuration.FILE_SIZE_THRESHOLD);
             if (attachmentSizeThresholdProperty != null
-                    && attachmentSizeThresholdProperty instanceof String) {
-                attachmentSizeThreshold = (String) attachmentSizeThresholdProperty;
+                && attachmentSizeThresholdProperty instanceof String) {
+                attachmentSizeThreshold = (String)attachmentSizeThresholdProperty;
             } else {
                 Parameter attachmentSizeThresholdParameter = msgContext
                         .getParameter(Constants.Configuration.FILE_SIZE_THRESHOLD);
@@ -509,15 +514,17 @@
 
         // Get the content-length if it is available
         int contentLength = 0;
-        Map headers = (Map) msgContext.getProperty(MessageContext.TRANSPORT_HEADERS);
+        Map headers = (Map)msgContext.getProperty(MessageContext.TRANSPORT_HEADERS);
         if (headers != null) {
-            String contentLengthValue = (String) headers.get(HTTPConstants.HEADER_CONTENT_LENGTH);
+            String contentLengthValue = (String)headers.get(HTTPConstants.HEADER_CONTENT_LENGTH);
             if (contentLengthValue != null) {
                 try {
-                    contentLength = new Integer(contentLengthValue).intValue();
+                    contentLength = new Integer(contentLengthValue);
                 } catch (NumberFormatException e) {
                     if (log.isDebugEnabled()) {
-                        log.debug("Content-Length is not a valid number.  Will assume it is not set:" + e);
+                        log.debug(
+                                "Content-Length is not a valid number.  Will assume it is not set:" +
+                                e);
                     }
                 }
             }
@@ -530,78 +537,74 @@
             }
         }
         return createAttachments(msgContext,
-                inStream,
-                contentTypeString,
-                fileCacheForAttachments,
-                attachmentRepoDir,
-                attachmentSizeThreshold,
-                contentLength);
+                                 inStream,
+                                 contentTypeString,
+                                 fileCacheForAttachments,
+                                 attachmentRepoDir,
+                                 attachmentSizeThreshold,
+                                 contentLength);
     }
 
     public static boolean isAttachmentsCacheEnabled(MessageContext msgContext) {
         Object cacheAttachmentProperty = msgContext
                 .getProperty(Constants.Configuration.CACHE_ATTACHMENTS);
-        String cacheAttachmentString = null;
+        String cacheAttachmentString;
         boolean fileCacheForAttachments;
 
-        if (cacheAttachmentProperty != null
-                && cacheAttachmentProperty instanceof String) {
-            cacheAttachmentString = (String) cacheAttachmentProperty;
-            fileCacheForAttachments = (Constants.VALUE_TRUE
-                    .equals(cacheAttachmentString));
+        if (cacheAttachmentProperty != null && cacheAttachmentProperty instanceof String) {
+            cacheAttachmentString = (String)cacheAttachmentProperty;
         } else {
-            Parameter parameter_cache_attachment = msgContext
-                    .getParameter(Constants.Configuration.CACHE_ATTACHMENTS);
-            cacheAttachmentString =
-                    (parameter_cache_attachment != null) ? (String) parameter_cache_attachment
-                            .getValue()
-                            : null;
+            Parameter parameter_cache_attachment =
+                    msgContext.getParameter(Constants.Configuration.CACHE_ATTACHMENTS);
+            cacheAttachmentString = (parameter_cache_attachment != null) ?
+                    (String)parameter_cache_attachment.getValue() : null;
         }
-        fileCacheForAttachments = (Constants.VALUE_TRUE
-                .equals(cacheAttachmentString));
+        fileCacheForAttachments = (Constants.VALUE_TRUE.equals(cacheAttachmentString));
         return fileCacheForAttachments;
     }
 
-    public static Attachments createAttachments(MessageContext msgContext, 
-                                                 InputStream inStream,
-                                                 String contentTypeString,
-                                                 boolean fileCacheForAttachments,
-                                                 String attachmentRepoDir,
-                                                 String attachmentSizeThreshold,
-                                                 int contentLength) {
+    public static Attachments createAttachments(MessageContext msgContext,
+                                                InputStream inStream,
+                                                String contentTypeString,
+                                                boolean fileCacheForAttachments,
+                                                String attachmentRepoDir,
+                                                String attachmentSizeThreshold,
+                                                int contentLength) {
         LifecycleManager manager = null;
         try {
             AxisConfiguration configuration = msgContext.getRootContext().getAxisConfiguration();
-            manager = (LifecycleManager) configuration
+            manager = (LifecycleManager)configuration
                     .getParameterValue(DeploymentConstants.ATTACHMENTS_LIFECYCLE_MANAGER);
-            if(manager == null){
+            if (manager == null) {
                 manager = new LifecycleManagerImpl();
-                configuration.addParameter(DeploymentConstants.ATTACHMENTS_LIFECYCLE_MANAGER, manager);
+                configuration.addParameter(DeploymentConstants.ATTACHMENTS_LIFECYCLE_MANAGER,
+                                           manager);
             }
-        } catch (Exception e){
-            if(log.isDebugEnabled()){
+        } catch (Exception e) {
+            if (log.isDebugEnabled()) {
                 log.debug("Exception getting Attachments LifecycleManager", e);
             }
         }
-        return new Attachments(manager, 
-                            inStream,
-                            contentTypeString,
-                            fileCacheForAttachments,
-                            attachmentRepoDir,
-                            attachmentSizeThreshold,
-                            contentLength);
+        return new Attachments(manager,
+                               inStream,
+                               contentTypeString,
+                               fileCacheForAttachments,
+                               attachmentRepoDir,
+                               attachmentSizeThreshold,
+                               contentLength);
     }
 
     /**
-     * @param in
-     * @return
+     * Utility method to get a StAXBuilder
+     *
+     * @param in an InputStream
+     * @return a StAXSOAPModelBuilder for the given InputStream
      * @throws XMLStreamException
      * @deprecated If some one really need this method, please shout.
      */
     public static StAXBuilder getBuilder(Reader in) throws XMLStreamException {
         XMLStreamReader xmlreader = StAXUtils.createXMLStreamReader(in);
-        StAXBuilder builder = new StAXSOAPModelBuilder(xmlreader, null);
-        return builder;
+        return new StAXSOAPModelBuilder(xmlreader, null);
     }
 
     /**
@@ -628,13 +631,14 @@
             throws XMLStreamException {
         XMLStreamReader xmlReader = StAXUtils.createXMLStreamReader(inStream, charSetEnc);
         try {
-            StAXBuilder builder =  new StAXSOAPModelBuilder(xmlReader);
-            return builder;
-        } catch (OMException e){
+            return new StAXSOAPModelBuilder(xmlReader);
+        } catch (OMException e) {
             log.info("OMException in getSOAPBuilder", e);
             try {
-                log.info("Remaining input stream :[" + new String(IOUtils.getStreamAsByteArray(inStream), charSetEnc)+ "]");
+                log.info("Remaining input stream :[" +
+                         new String(IOUtils.getStreamAsByteArray(inStream), charSetEnc) + "]");
             } catch (IOException e1) {
+                // Nothing here?
             }
             throw e;
         }
@@ -650,13 +654,14 @@
     public static StAXBuilder getSOAPBuilder(InputStream inStream) throws XMLStreamException {
         XMLStreamReader xmlReader = StAXUtils.createXMLStreamReader(inStream);
         try {
-            StAXBuilder builder =  new StAXSOAPModelBuilder(xmlReader);
-            return builder;
-        } catch (OMException e){
+            return new StAXSOAPModelBuilder(xmlReader);
+        } catch (OMException e) {
             log.info("OMException in getSOAPBuilder", e);
             try {
-                log.info("Remaining input stream :[" + new String(IOUtils.getStreamAsByteArray(inStream))+ "]");
+                log.info("Remaining input stream :[" +
+                         new String(IOUtils.getStreamAsByteArray(inStream)) + "]");
             } catch (IOException e1) {
+                // Nothing here?
             }
             throw e;
         }
@@ -674,13 +679,14 @@
             throws XMLStreamException {
         XMLStreamReader xmlReader = StAXUtils.createXMLStreamReader(inStream, charSetEnc);
         try {
-            StAXBuilder builder =  new StAXSOAPModelBuilder(xmlReader);
-            return builder;
-        } catch (OMException e){
+            return new StAXSOAPModelBuilder(xmlReader);
+        } catch (OMException e) {
             log.info("OMException in getSOAPBuilder", e);
             try {
-                log.info("Remaining input stream :[" + new String(IOUtils.getStreamAsByteArray(inStream), charSetEnc)+ "]");
+                log.info("Remaining input stream :[" +
+                         new String(IOUtils.getStreamAsByteArray(inStream), charSetEnc) + "]");
             } catch (IOException e1) {
+                // Nothing here?
             }
             throw e;
         }
@@ -695,12 +701,12 @@
     }
 
     /**
-     * Initial work for a builder selector which selects the builder for a given
-     * message format based on the the content type of the recieved message.
-     * content-type to builder mapping can be specified through the Axis2.xml.
+     * Initial work for a builder selector which selects the builder for a given message format
+     * based on the the content type of the recieved message. content-type to builder mapping can be
+     * specified through the Axis2.xml.
      *
-     * @param type
-     * @param msgContext
+     * @param type       content-type
+     * @param msgContext the active MessageContext
      * @return the builder registered against the given content-type
      * @throws AxisFault
      */
@@ -709,8 +715,7 @@
 
         AxisConfiguration configuration =
                 msgContext.getConfigurationContext().getAxisConfiguration();
-        Builder builder = configuration
-                .getMessageBuilder(type);
+        Builder builder = configuration.getMessageBuilder(type);
         if (builder != null) {
             // Check whether the request has a Accept header if so use that as the response
             // message type.
@@ -722,21 +727,23 @@
             Object contentNegotiation = configuration
                     .getParameterValue(Constants.Configuration.ENABLE_HTTP_CONTENT_NEGOTIATION);
             if (JavaUtils.isTrueExplicitly(contentNegotiation)) {
-                Map transportHeaders = (Map) msgContext.getProperty(MessageContext.TRANSPORT_HEADERS);
+                Map transportHeaders =
+                        (Map)msgContext.getProperty(MessageContext.TRANSPORT_HEADERS);
                 if (transportHeaders != null) {
-                    String acceptHeader = (String) transportHeaders.get(HTTPConstants.HEADER_ACCEPT);
+                    String acceptHeader = (String)transportHeaders.get(HTTPConstants.HEADER_ACCEPT);
                     if (acceptHeader != null) {
                         int index = acceptHeader.indexOf(";");
                         if (index > 0) {
                             acceptHeader = acceptHeader.substring(0, index);
                         }
                         String[] strings = acceptHeader.split(",");
-                        for (int i = 0; i < strings.length; i++) {
-                            String accept = strings[i].trim();
+                        for (String string : strings) {
+                            String accept = string.trim();
                             // We dont want dynamic content negotoatin to work on text.xml as its
                             // ambiguos as to whether the user requests SOAP 1.1 or POX response
-                            if (!HTTPConstants.MEDIA_TYPE_TEXT_XML.equals(accept) && configuration.getMessageFormatter(accept) != null) {
-                                type = strings[i];
+                            if (!HTTPConstants.MEDIA_TYPE_TEXT_XML.equals(accept) &&
+                                configuration.getMessageFormatter(accept) != null) {
+                                type = string;
                                 break;
                             }
                         }
@@ -757,8 +764,8 @@
             if (!(soapNamespaceURIFromTransport.equals(namespaceName))) {
                 throw new SOAPProcessingException(
                         "Transport level information does not match with SOAP" +
-                                " Message namespace URI", envelopeNamespace.getPrefix() + ":" +
-                        SOAPConstants.FAULT_CODE_VERSION_MISMATCH);
+                        " Message namespace URI", envelopeNamespace.getPrefix() + ":" +
+                                                  SOAPConstants.FAULT_CODE_VERSION_MISMATCH);
             }
         }
     }
@@ -767,11 +774,10 @@
                                                String charsetEncodingFromXML,
                                                String soapNamespaceURI) throws AxisFault {
         if ((charsetEncodingFromXML != null)
-                && !"".equals(charsetEncodingFromXML)
-                && (charsetEncodingFromTransport != null)
-                && !charsetEncodingFromXML.equalsIgnoreCase(charsetEncodingFromTransport)
-                && !isValidPair(charsetEncodingFromXML, charsetEncodingFromTransport))
-        {
+            && !"".equals(charsetEncodingFromXML)
+            && (charsetEncodingFromTransport != null)
+            && !charsetEncodingFromXML.equalsIgnoreCase(charsetEncodingFromTransport)
+            && !compatibleEncodings(charsetEncodingFromXML, charsetEncodingFromTransport)) {
             String faultCode;
 
             if (SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(soapNamespaceURI)) {
@@ -781,19 +787,22 @@
             }
 
             throw new AxisFault("Character Set Encoding from "
-                    + "transport information [" + charsetEncodingFromTransport + "] does not match with "
-                    + "character set encoding in the received SOAP message [" + charsetEncodingFromXML + "]", faultCode);
+                                + "transport information [" + charsetEncodingFromTransport +
+                                "] does not match with "
+                                + "character set encoding in the received SOAP message [" +
+                                charsetEncodingFromXML + "]", faultCode);
         }
     }
 
     /**
-     * check if the pair is [UTF-16,UTF-16LE] [UTF-32, UTF-32LE],[UTF-16,UTF-16BE] [UTF-32, UTF-32BE] etc.
-     * 
-     * @param enc1
-     * @param enc2
-     * @return
+     * check if the pair is [UTF-16,UTF-16LE] [UTF-32, UTF-32LE],[UTF-16,UTF-16BE] [UTF-32,
+     * UTF-32BE] etc.
+     *
+     * @param enc1 encoding style
+     * @param enc2 encoding style
+     * @return true if the encoding styles are compatible, or false otherwise
      */
-    private static boolean isValidPair(String enc1, String enc2) {
+    private static boolean compatibleEncodings(String enc1, String enc2) {
         enc1 = enc1.toLowerCase();
         enc2 = enc2.toLowerCase();
         if (enc1.endsWith("be") || enc1.endsWith("le")) {

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/client/ServiceClient.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/client/ServiceClient.java?rev=694872&r1=694871&r2=694872&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/client/ServiceClient.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/client/ServiceClient.java Fri Sep 12 20:42:27 2008
@@ -150,6 +150,7 @@
             if (ListenerManager.defaultConfigurationContext == null) {
                 configContext = ConfigurationContextFactory.
                         createConfigurationContextFromFileSystem(null, null);
+                ListenerManager.defaultConfigurationContext = configContext;
                 createConfigCtx = true;
             } else {
                 configContext = ListenerManager.defaultConfigurationContext;

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/ConfigurationContext.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/ConfigurationContext.java?rev=694872&r1=694871&r2=694872&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/ConfigurationContext.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/ConfigurationContext.java Fri Sep 12 20:42:27 2008
@@ -53,27 +53,23 @@
 import java.util.concurrent.ConcurrentHashMap;
 
 /**
- * <p>Axis2 states are held in two information models, called description hierarchy
- * and context hierarchy. Description hierarchy hold deployment configuration
- * and it's values does not change unless deployment configuration change occurs
- * where Context hierarchy hold run time information. Both hierarchies consists
- * four levels, Global, Service Group, Operation and Message. Please look at
- * "Information Model" section  of "Axis2 Architecture Guide" for more information.</p>
+ * <p>Axis2 states are held in two information models, called description hierarchy and context
+ * hierarchy. Description hierarchy hold deployment configuration and it's values does not change
+ * unless deployment configuration change occurs where Context hierarchy hold run time information.
+ * Both hierarchies consists four levels, Global, Service Group, Operation and Message. Please look
+ * at "Information Model" section  of "Axis2 Architecture Guide" for more information.</p>
  * <p/>
- * <p>Configuration Context hold Global level run-time information. This allows
- * same configurations to be used by two Axis2 instances and most Axis2 wide
- * configurations can changed by setting name value pairs of the configurationContext.
- * This hold all OperationContexts, ServiceGroups, Sessions, and ListenerManager.
+ * <p>Configuration Context hold Global level run-time information. This allows same configurations
+ * to be used by two Axis2 instances and most Axis2 wide configurations can changed by setting name
+ * value pairs of the configurationContext. This hold all OperationContexts, ServiceGroups,
+ * Sessions, and ListenerManager.
  */
 public class ConfigurationContext extends AbstractContext {
 
     private static final Log log = LogFactory.getLog(ConfigurationContext.class);
-    /**
-     * Map containing <code>MessageID</code> to
-     * <code>OperationContext</code> mapping.
-     */
+    /** Map containing <code>MessageID</code> to <code>OperationContext</code> mapping. */
     private final ConcurrentHashMap operationContextMap = new ConcurrentHashMap();
-    private Hashtable serviceGroupContextMap = new Hashtable();
+    private final Hashtable serviceGroupContextMap = new Hashtable();
     private Hashtable applicationSessionServiceGroupContexts = new Hashtable();
     private AxisConfiguration axisConfiguration;
     private ThreadFactory threadPool;
@@ -81,7 +77,7 @@
     private ListenerManager listenerManager;
 
     // current time out interval is 30 secs. Need to make this configurable
-    private long serviceGroupContextTimoutInterval = 30 * 1000;
+    private long serviceGroupContextTimeoutInterval = 30 * 1000;
 
     //To specify url mapping for services
     private String contextRoot;
@@ -92,6 +88,7 @@
 
     /**
      * Constructor
+     *
      * @param axisConfiguration - AxisConfiguration for which to create a context
      */
     public ConfigurationContext(AxisConfiguration axisConfiguration) {
@@ -102,11 +99,11 @@
 
     private void initConfigContextTimeout(AxisConfiguration axisConfiguration) {
         Parameter parameter = axisConfiguration
-                .getParameter(Constants.Configuration.CONFIG_CONTEXT_TIMOUT_INTERVAL);
+                .getParameter(Constants.Configuration.CONFIG_CONTEXT_TIMEOUT_INTERVAL);
         if (parameter != null) {
             Object value = parameter.getValue();
             if (value != null && value instanceof String) {
-                serviceGroupContextTimoutInterval = Integer.parseInt((String) value);
+                serviceGroupContextTimeoutInterval = Integer.parseInt((String)value);
             }
         }
     }
@@ -135,10 +132,9 @@
     }
 
     /**
-     *
      * @param clusterManager The ClusterManager implementation
-     * @return true, if the cluster needs to be automatically initialized by the framework;
-     *         false, otherwise
+     * @return true, if the cluster needs to be automatically initialized by the framework; false,
+     *         otherwise
      */
     private static boolean shouldClusterBeInitiated(ClusterManager clusterManager) {
         Parameter param =
@@ -155,8 +151,8 @@
         if (contextListeners == null) {
             return;
         }
-        for (Iterator iter = contextListeners.iterator(); iter.hasNext();) {
-            ContextListener listener = (ContextListener) iter.next();
+        for (Object contextListener : contextListeners) {
+            ContextListener listener = (ContextListener)contextListener;
             listener.contextCreated(context);
         }
     }
@@ -170,8 +166,8 @@
         if (contextListeners == null) {
             return;
         }
-        for (Iterator iter = contextListeners.iterator(); iter.hasNext();) {
-            ContextListener listener = (ContextListener) iter.next();
+        for (Object contextListener : contextListeners) {
+            ContextListener listener = (ContextListener)contextListener;
             listener.contextRemoved(context);
         }
     }
@@ -229,7 +225,7 @@
             if (Constants.SCOPE_APPLICATION.equals(scope)) {
                 String serviceGroupName = axisService.getAxisServiceGroup().getServiceGroupName();
                 serviceGroupContext =
-                        (ServiceGroupContext) applicationSessionServiceGroupContexts.get(
+                        (ServiceGroupContext)applicationSessionServiceGroupContexts.get(
                                 serviceGroupName);
                 if (serviceGroupContext == null) {
                     AxisServiceGroup axisServiceGroup = messageContext.getAxisServiceGroup();
@@ -243,7 +239,8 @@
                             .put(serviceGroupName, serviceGroupContext);
                 }
                 messageContext.setServiceGroupContext(serviceGroupContext);
-                messageContext.setServiceContext(serviceGroupContext.getServiceContext(axisService));
+                messageContext
+                        .setServiceContext(serviceGroupContext.getServiceContext(axisService));
             } else if (Constants.SCOPE_SOAP_SESSION.equals(scope)) {
                 //cleaning the session
                 cleanupServiceGroupContexts();
@@ -275,7 +272,8 @@
                     addServiceGroupContextIntoSoapSessionTable(serviceGroupContext);
                 }
                 messageContext.setServiceGroupContext(serviceGroupContext);
-                messageContext.setServiceContext(serviceGroupContext.getServiceContext(axisService));
+                messageContext
+                        .setServiceContext(serviceGroupContext.getServiceContext(axisService));
             } else if (Constants.SCOPE_REQUEST.equals(scope)) {
                 AxisServiceGroup axisServiceGroup = axisService.getAxisServiceGroup();
                 serviceGroupContext = createServiceGroupContext(axisServiceGroup);
@@ -290,79 +288,77 @@
     }
 
     /**
-     * Registers a OperationContext with a given message ID.
-     * If the given message id already has a registered operation context,
-     * no change is made and the method returns false.
+     * Registers a OperationContext with a given message ID. If the given message id already has a
+     * registered operation context, no change is made and the method returns false.
      *
-     * @param messageID
-     * @param mepContext
+     * @param messageID        the message ID of the request message in the MEP
+     * @param operationContext the OperationContext
+     * @return true if we registered this context, false if there was already one for that ID
      */
-    public boolean registerOperationContext(String messageID,
-                                            OperationContext mepContext) {
-        return registerOperationContext(messageID, mepContext, false);
+    public boolean registerOperationContext(String messageID, OperationContext operationContext) {
+        return registerOperationContext(messageID, operationContext, false);
     }
 
     /**
-     * Registers a OperationContext with a given message ID.
-     * If the given message id already has a registered operation context,
-     * no change is made unless the override flag is set.
+     * Registers a OperationContext with a given message ID. If the given message id already has a
+     * registered operation context, no change is made unless the override flag is set.
      *
-     * @param messageID
-     * @param mepContext
-     * @param override
+     * @param messageID  the message ID of the request message in the MEP
+     * @param mepContext the OperationContext
+     * @param override   true if we should overwrite any existing OperationContext
+     * @return true if we registered the passed OperationContext, false if not
      */
     public boolean registerOperationContext(String messageID,
                                             OperationContext mepContext,
                                             boolean override) {
 
-    	if(messageID == null){
-    		if(log.isDebugEnabled()){
-    			log.debug("messageID is null. Returning false");
-    		}
-    		return false;
-    	}
+        if (messageID == null) {
+            if (log.isDebugEnabled()) {
+                log.debug("messageID is null. Returning false");
+            }
+            return false;
+        }
 
         boolean alreadyInMap = false;
         mepContext.setKey(messageID);
 
-        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());
-        	}
+        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);
     }
+
     /**
      * Unregisters the operation context associated with the given messageID
      *
-     * @param key
+     * @param messageID the messageID to remove
      */
-    public void unregisterOperationContext(String key) {
-    	if(key == null){
-    		if(log.isDebugEnabled()){
-    			log.debug("key is null.");
-    		}
-    	}else{
-    		OperationContext opCtx = (OperationContext) operationContextMap.remove(key);
-    		contextRemoved(opCtx);
-    	}
+    public void unregisterOperationContext(String messageID) {
+        if (messageID == null) {
+            if (log.isDebugEnabled()) {
+                log.debug("messageID is null.");
+            }
+        } else {
+            OperationContext opCtx = (OperationContext)operationContextMap.remove(messageID);
+            contextRemoved(opCtx);
+        }
     }
 
-    public boolean isAnyOperationContextRegistered(){
-    	return !operationContextMap.isEmpty();
+    public boolean isAnyOperationContextRegistered() {
+        return !operationContextMap.isEmpty();
     }
 
     /**
@@ -382,6 +378,7 @@
 
     /**
      * Adds the given ServiceGroupContext into the Application Scope table
+     *
      * @param serviceGroupContext The Service Group Context to add
      */
     public void addServiceGroupContextIntoApplicationScopeTable
@@ -409,6 +406,7 @@
 
     /**
      * Returns the AxisConfiguration
+     *
      * @return Returns AxisConfiguration
      */
     public AxisConfiguration getAxisConfiguration() {
@@ -418,19 +416,18 @@
     /**
      * Gets a OperationContext given a Message ID.
      *
-     * @return Returns OperationContext <code>OperationContext<code>
-     * @param id
+     * @param messageID the message ID of an active OperationContext
+     * @return an active OperationContext, or null
      */
-    public OperationContext getOperationContext(String id) {
-        OperationContext opCtx = (OperationContext) this.operationContextMap.get(id);
-        return opCtx;
+    public OperationContext getOperationContext(String messageID) {
+        return (OperationContext)this.operationContextMap.get(messageID);
     }
 
     /**
      * Finds the OperationContext given the Operation name, Service Name, and ServiceGroupName
      *
-     * @param operationName - OperationName to find
-     * @param serviceName - ServiceName to find
+     * @param operationName    - OperationName to find
+     * @param serviceName      - ServiceName to find
      * @param serviceGroupName - ServiceGroupName to find
      * @return Returns OperationContext <code>OperationContext<code>
      */
@@ -450,33 +447,33 @@
         Iterator it = operationContextMap.values().iterator();
 
         while (it.hasNext()) {
-        	OperationContext value = (OperationContext) it.next();
+            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;
-        				}
-        			}
-        		}
-        	}
+            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
@@ -496,8 +493,8 @@
     }
 
     /**
-     * Create a ServiceGroupContext for the specified service group, and notify any
-     * registered ContextListener.
+     * Create a ServiceGroupContext for the specified service group, and notify any registered
+     * ContextListener.
      *
      * @param serviceGroup an AxisServiceGroup
      * @return a new ServiceGroupContext
@@ -511,8 +508,8 @@
     /**
      * Allows users to resolve the path relative to the root directory.
      *
-     * @param path
-     * @return
+     * @param path a relative path
+     * @return a File for the given path relative to the current repository, or null if no repo
      */
     public File getRealPath(String path) {
         URL repository = axisConfiguration.getRepository();
@@ -527,7 +524,7 @@
      * Retrieve the ServiceGroupContext from the SOAP session table
      *
      * @param serviceGroupContextId Service Group Context ID to search on
-     * @param msgContext Message Context to search on
+     * @param msgContext            Message Context to search on
      * @return Returns a ServiceGroupContext
      * @throws AxisFault if ServiceGroupContext cannot be found
      */
@@ -535,21 +532,21 @@
             String serviceGroupContextId,
             MessageContext msgContext) throws AxisFault {
         ServiceGroupContext serviceGroupContext =
-                (ServiceGroupContext) serviceGroupContextMap.get(serviceGroupContextId);
+                (ServiceGroupContext)serviceGroupContextMap.get(serviceGroupContextId);
 
         if (serviceGroupContext != null) {
             serviceGroupContext.touch();
             return serviceGroupContext;
         } else {
             throw new AxisFault("Unable to find corresponding context" +
-                    " for the serviceGroupId: " + serviceGroupContextId);
+                                " for the serviceGroupId: " + serviceGroupContextId);
         }
     }
 
 
     /**
-     * Returns a ServiceGroupContext object associated
-     * with the specified ID from the internal table.
+     * Returns a ServiceGroupContext object associated with the specified ID from the internal
+     * table.
      *
      * @param serviceGroupCtxId The ID string associated with the ServiceGroupContext object
      * @return The ServiceGroupContext object, or null if not found
@@ -564,12 +561,14 @@
         ServiceGroupContext serviceGroupContext = null;
 
         if (serviceGroupContextMap != null) {
-            serviceGroupContext = (ServiceGroupContext) serviceGroupContextMap.get(serviceGroupCtxId);
+            serviceGroupContext =
+                    (ServiceGroupContext)serviceGroupContextMap.get(serviceGroupCtxId);
             if (serviceGroupContext != null) {
                 serviceGroupContext.touch();
             } else {
                 serviceGroupContext =
-                        (ServiceGroupContext) applicationSessionServiceGroupContexts.get(serviceGroupCtxId);
+                        (ServiceGroupContext)applicationSessionServiceGroupContexts
+                                .get(serviceGroupCtxId);
                 if (serviceGroupContext != null) {
                     serviceGroupContext.touch();
                 }
@@ -589,13 +588,12 @@
         String[] ids = new String[serviceGroupContextMap.size() +
                                   applicationSessionServiceGroupContexts.size()];
         int index = 0;
-        for (Iterator iter = serviceGroupContextMap.keySet().iterator(); iter.hasNext();) {
-            ids[index] = (String) iter.next();
+        for (Object o : serviceGroupContextMap.keySet()) {
+            ids[index] = (String)o;
             index++;
         }
-        for (Iterator iter = applicationSessionServiceGroupContexts.keySet().iterator();
-             iter.hasNext();) {
-            ids[index] = (String) iter.next();
+        for (Object o : applicationSessionServiceGroupContexts.keySet()) {
+            ids[index] = (String)o;
             index++;
         }
         return ids;
@@ -625,7 +623,7 @@
     /**
      * Set the AxisConfiguration to the specified configuration
      *
-     * @param configuration
+     * @param configuration an AxisConfiguration
      */
     public void setAxisConfiguration(AxisConfiguration configuration) {
         axisConfiguration = configuration;
@@ -655,7 +653,7 @@
             return;
         }
         ServiceGroupContext serviceGroupContext =
-                (ServiceGroupContext) serviceGroupContextMap.get(serviceGroupContextId);
+                (ServiceGroupContext)serviceGroupContextMap.get(serviceGroupContextId);
         serviceGroupContextMap.remove(serviceGroupContextId);
         cleanupServiceContexts(serviceGroupContext);
     }
@@ -669,11 +667,11 @@
         synchronized (serviceGroupContextMap) {
             for (Iterator sgCtxtMapKeyIter = serviceGroupContextMap.keySet().iterator();
                  sgCtxtMapKeyIter.hasNext();) {
-                String sgCtxtId = (String) sgCtxtMapKeyIter.next();
+                String sgCtxtId = (String)sgCtxtMapKeyIter.next();
                 ServiceGroupContext serviceGroupContext =
-                        (ServiceGroupContext) serviceGroupContextMap.get(sgCtxtId);
+                        (ServiceGroupContext)serviceGroupContextMap.get(sgCtxtId);
                 if ((currentTime - serviceGroupContext.getLastTouchedTime()) >
-                    getServiceGroupContextTimoutInterval()) {
+                    getServiceGroupContextTimeoutInterval()) {
                     sgCtxtMapKeyIter.remove();
                     cleanupServiceContexts(serviceGroupContext);
                     contextRemoved(serviceGroupContext);
@@ -709,31 +707,26 @@
             return;
         }
         while (serviceContextIter.hasNext()) {
-            ServiceContext serviceContext = (ServiceContext) serviceContextIter.next();
+            ServiceContext serviceContext = (ServiceContext)serviceContextIter.next();
             DependencyManager.destroyServiceObject(serviceContext);
         }
     }
 
-    /**
-     * Called during shutdown to clean up all Contexts
-     */
+    /** Called during shutdown to clean up all Contexts */
     public void cleanupContexts() {
         if ((applicationSessionServiceGroupContexts != null) &&
             (applicationSessionServiceGroupContexts.size() > 0)) {
-            for (Iterator applicationScopeSgs =
-                    applicationSessionServiceGroupContexts.values().iterator();
-                 applicationScopeSgs.hasNext();) {
+            for (Object o : applicationSessionServiceGroupContexts.values()) {
                 ServiceGroupContext serviceGroupContext =
-                        (ServiceGroupContext) applicationScopeSgs.next();
+                        (ServiceGroupContext)o;
                 cleanupServiceContexts(serviceGroupContext);
             }
             applicationSessionServiceGroupContexts.clear();
         }
         if ((serviceGroupContextMap != null) && (serviceGroupContextMap.size() > 0)) {
-            for (Iterator soapSessionSgs = serviceGroupContextMap.values().iterator();
-                 soapSessionSgs.hasNext();) {
+            for (Object o : serviceGroupContextMap.values()) {
                 ServiceGroupContext serviceGroupContext =
-                        (ServiceGroupContext) soapSessionSgs.next();
+                        (ServiceGroupContext)o;
                 cleanupServiceContexts(serviceGroupContext);
             }
             serviceGroupContextMap.clear();
@@ -741,8 +734,7 @@
     }
 
     /**
-     * Invoked during shutdown to stop the ListenerManager and
-     * perform configuration cleanup
+     * Invoked during shutdown to stop the ListenerManager and perform configuration cleanup
      *
      * @throws AxisFault
      */
@@ -755,15 +747,14 @@
     }
 
     /**
-     * This include all the major changes we have done from 1.2
-     * release to 1.3 release. This will include API changes , class
-     * deprecating etc etc.
+     * This include all the major changes we have done from 1.2 release to 1.3 release. This will
+     * include API changes , class deprecating etc etc.
      */
     private void cleanupTemp() {
-        File tempFile = (File) axisConfiguration.getParameterValue(
+        File tempFile = (File)axisConfiguration.getParameterValue(
                 Constants.Configuration.ARTIFACTS_TEMP_DIR);
         if (tempFile == null) {
-            String property = (String) AccessController.doPrivileged(
+            String property = (String)AccessController.doPrivileged(
                     new PrivilegedAction() {
                         public Object run() {
                             return System.getProperty("java.io.tmpdir");
@@ -776,15 +767,15 @@
     }
 
     private void deleteTempFiles(final File dir) {
-        Boolean isDir = (Boolean) AccessController.doPrivileged(
+        Boolean isDir = (Boolean)AccessController.doPrivileged(
                 new PrivilegedAction() {
                     public Object run() {
-                        return new Boolean(dir.isDirectory());
+                        return dir.isDirectory();
                     }
                 }
         );
-        if (isDir.booleanValue()) {
-            String[] children = (String[]) AccessController.doPrivileged(
+        if (isDir) {
+            String[] children = (String[])AccessController.doPrivileged(
                     new PrivilegedAction() {
                         public Object run() {
                             return dir.list();
@@ -835,6 +826,7 @@
 
     /**
      * Retrieves the ServicePath
+     *
      * @return The path to the Service
      */
     public String getServicePath() {
@@ -846,6 +838,7 @@
 
     /**
      * Sets the ServicePath to the given string
+     *
      * @param servicePath The service path for which to set
      */
     public void setServicePath(String servicePath) {
@@ -854,6 +847,7 @@
 
     /**
      * Retrieves the ContextRoot
+     *
      * @return The ContextRoot
      */
     public String getContextRoot() {
@@ -862,6 +856,7 @@
 
     /**
      * Sets the context root to the given string
+     *
      * @param contextRoot The context root for which to set
      */
     public void setContextRoot(String contextRoot) {
@@ -872,45 +867,56 @@
     }
 
     /**
+     * @deprecated MISSPELLING - Please use getServiceGroupContextTimeoutInterval()
+     * @return the service group context timeout interval
+     */
+    public long getServiceGroupContextTimoutInterval() {
+        return getServiceGroupContextTimeoutInterval();
+    }
+
+    /**
      * This will be used to fetch the serviceGroupContextTimoutInterval from any place available.
      *
-     * @return long
+     * @return the service group context timeout interval (in milliseconds)
      */
-    public long getServiceGroupContextTimoutInterval() {
+    public long getServiceGroupContextTimeoutInterval() {
         Integer serviceGroupContextTimoutIntervalParam =
-                (Integer) getProperty(Constants.Configuration.CONFIG_CONTEXT_TIMOUT_INTERVAL);
+                (Integer)getProperty(Constants.Configuration.CONFIG_CONTEXT_TIMEOUT_INTERVAL);
         if (serviceGroupContextTimoutIntervalParam != null) {
-            serviceGroupContextTimoutInterval = serviceGroupContextTimoutIntervalParam.intValue();
+            // TODO: This seems wrong - setting a field inside a getter??
+            serviceGroupContextTimeoutInterval = serviceGroupContextTimoutIntervalParam;
         }
-        return serviceGroupContextTimoutInterval;
+        return serviceGroupContextTimeoutInterval;
     }
 
     /**
      * Removes the given ServiceGroup from the ServiceGroup context
-     * @param serviceGroup
+     *
+     * @param serviceGroup the AxisServiceGroup to remove
      */
     public void removeServiceGroupContext(AxisServiceGroup serviceGroup) {
-        if (serviceGroup != null) {
-            Object obj = applicationSessionServiceGroupContexts.get(
-                    serviceGroup.getServiceGroupName());
-            if (obj == null) {
-                ArrayList toBeRemovedList = new ArrayList();
-                Iterator serviceGroupContexts = serviceGroupContextMap.values().iterator();
-                while (serviceGroupContexts.hasNext()) {
-                    ServiceGroupContext serviceGroupContext =
-                            (ServiceGroupContext) serviceGroupContexts.next();
-                    if (serviceGroupContext.getDescription().equals(serviceGroup)) {
-                        toBeRemovedList.add(serviceGroupContext.getId());
-                    }
-                }
-                for (int i = 0; i < toBeRemovedList.size(); i++) {
-                    String s = (String) toBeRemovedList.get(i);
-                    serviceGroupContextMap.remove(s);
-                }
-            }  else {
-                 applicationSessionServiceGroupContexts.remove(serviceGroup.getServiceGroupName());
+        if (serviceGroup == null) return;
+
+        String groupName = serviceGroup.getServiceGroupName();
+        Object obj = applicationSessionServiceGroupContexts.get(groupName);
+        if (obj != null) {
+            applicationSessionServiceGroupContexts.remove(serviceGroup.getServiceGroupName());
+            return;
+        }
+
+        ArrayList toBeRemovedList = new ArrayList();
+        Iterator serviceGroupContexts = serviceGroupContextMap.values().iterator();
+        while (serviceGroupContexts.hasNext()) {
+            ServiceGroupContext serviceGroupContext =
+                    (ServiceGroupContext)serviceGroupContexts.next();
+            if (serviceGroupContext.getDescription().equals(serviceGroup)) {
+                toBeRemovedList.add(serviceGroupContext.getId());
             }
         }
+        for (Object aToBeRemovedList : toBeRemovedList) {
+            String s = (String)aToBeRemovedList;
+            serviceGroupContextMap.remove(s);
+        }
     }
 
     /* (non-Javadoc)

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/POJODeployer.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/POJODeployer.java?rev=694872&r1=694871&r2=694872&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/POJODeployer.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/POJODeployer.java Fri Sep 12 20:42:27 2008
@@ -31,7 +31,6 @@
 import org.apache.axis2.engine.MessageReceiver;
 import org.apache.axis2.i18n.Messages;
 import org.apache.axis2.util.Loader;
-import org.apache.axis2.wsdl.WSDLConstants;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -134,8 +133,8 @@
                     }
                 }
                 ArrayList axisServiceList = new ArrayList();
-                for (int i = 0; i < classList.size(); i++) {
-                    String className = (String) classList.get(i);
+                for (Object aClassList : classList) {
+                    String className = (String)aClassList;
                     ArrayList urls = new ArrayList();
                     urls.add(deploymentFileData.getFile().toURL());
                     urls.add(configCtx.getAxisConfiguration().getRepository());
@@ -147,7 +146,7 @@
                             urls,
                             configCtx.getAxisConfiguration().getSystemClassLoader(),
                             true,
-                            (File) configCtx.getAxisConfiguration().
+                            (File)configCtx.getAxisConfiguration().
                                     getParameterValue(Constants.Configuration.ARTIFACTS_TEMP_DIR));
                     Thread.currentThread().setContextClassLoader(classLoader);
                     className = className.replaceAll(".class", "");
@@ -162,13 +161,13 @@
                      * nothing will happen) 2. In the next stage for all the methods
                      * messages and port types will be creteated
                      */
-                    WebService annotation = (WebService) clazz.getAnnotation(WebService.class);
+                    WebService annotation = (WebService)clazz.getAnnotation(WebService.class);
                     if (annotation != null) {
                         AxisService axisService;
                         axisService =
                                 createAxisService(classLoader,
-                                        className,
-                                        deploymentFileData.getFile().toURL());
+                                                  className,
+                                                  deploymentFileData.getFile().toURL());
                         axisServiceList.add(axisService);
                     }
                 }
@@ -176,8 +175,8 @@
                 if (axisServiceList.size() > 0) {
                     AxisServiceGroup serviceGroup = new AxisServiceGroup();
                     serviceGroup.setServiceGroupName(deploymentFileData.getName());
-                    for (int i = 0; i < axisServiceList.size(); i++) {
-                        AxisService axisService = (AxisService) axisServiceList.get(i);
+                    for (Object anAxisServiceList : axisServiceList) {
+                        AxisService axisService = (AxisService)anAxisServiceList;
                         serviceGroup.addService(axisService);
                     }
                     configCtx.getAxisConfiguration().addServiceGroup(serviceGroup);
@@ -222,12 +221,9 @@
         try {
             Class claxx = Class.forName(
                     "org.apache.axis2.jaxws.description.DescriptionFactory");
-            Method mthod = claxx.getMethod(
-                    "createAxisService",
-                    new Class[]{Class.class});
+            Method mthod = claxx.getMethod("createAxisService", Class.class);
             Class pojoClass = Loader.loadClass(classLoader, className);
-            axisService =
-                    (AxisService) mthod.invoke(claxx, new Object[]{pojoClass});
+            axisService = (AxisService) mthod.invoke(claxx, pojoClass);
             if (axisService != null) {
                 Iterator operations = axisService.getOperations();
                 while (operations.hasNext()) {
@@ -303,9 +299,7 @@
             String MEP = operation.getMessageExchangePattern();
             if (MEP != null) {
                 try {
-                    if (WSDLConstants.WSDL20_2006Constants.MEP_URI_IN_ONLY.equals(MEP)
-                            || WSDLConstants.WSDL20_2004_Constants.MEP_URI_IN_ONLY.equals(MEP)
-                            || WSDL2Constants.MEP_URI_IN_ONLY.equals(MEP)) {
+                    if (WSDL2Constants.MEP_URI_IN_ONLY.equals(MEP)) {
                         Class inOnlyMessageReceiver = Loader.loadClass(
                                 "org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver");
                         MessageReceiver messageReceiver =

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/ListenerManager.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/ListenerManager.java?rev=694872&r1=694871&r2=694872&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/ListenerManager.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/ListenerManager.java Fri Sep 12 20:42:27 2008
@@ -42,6 +42,7 @@
     private static final Log log = LogFactory.getLog(ListenerManager.class);
 
     public static ConfigurationContext defaultConfigurationContext;
+
     public static ListenerManager getDefaultListenerManager() {
         if (defaultConfigurationContext == null) return null;
         return defaultConfigurationContext.getListenerManager();
@@ -49,7 +50,7 @@
 
     private ConfigurationContext configctx;
     private HashMap startedTransports = new HashMap();
-    private boolean stopped ;
+    private boolean stopped;
 
     public void init(ConfigurationContext configCtx) {
         configCtx.setTransportManager(this);
@@ -63,8 +64,9 @@
     /**
      * To get an EPR for a given service
      *
-     * @param serviceName   : Name of the service
-     * @param transportName : name of the trasport can be null , if it is null then
+     * @param serviceName   the name of the service
+     * @param opName        the operation name
+     * @param transportName the name of the transport, or null.
      * @return String
      */
     public synchronized EndpointReference getEPRforService(String serviceName, String opName,
@@ -72,13 +74,12 @@
         if (transportName == null || "".equals(transportName)) {
             AxisService service = configctx.getAxisConfiguration().getService(serviceName);
             if (service == null) {
-                throw new AxisFault(Messages.getMessage(
-                        "servicenotfoundinthesystem", serviceName));
+                throw new AxisFault(Messages.getMessage("servicenotfoundinthesystem", serviceName));
             }
             if (service.isEnableAllTransports()) {
                 Iterator itr_st = startedTransports.values().iterator();
                 while (itr_st.hasNext()) {
-                    TransportListener transportListener = (TransportListener) itr_st.next();
+                    TransportListener transportListener = (TransportListener)itr_st.next();
                     EndpointReference[] epRsForService =
                             transportListener.getEPRsForService(serviceName, null);
                     if (epRsForService != null) {
@@ -109,24 +110,16 @@
         }
     }
 
-    /**
-     * To start all the transports
-     */
+    /** To start all the transports */
     public synchronized void start() {
-
-        for (Iterator transportNames =
-                configctx.getAxisConfiguration().getTransportsIn().values().iterator();
-             transportNames.hasNext();) {
+        for (Object o : configctx.getAxisConfiguration().getTransportsIn().values()) {
             try {
-                TransportInDescription transportIn = (TransportInDescription) transportNames.next();
+                TransportInDescription transportIn = (TransportInDescription)o;
                 TransportListener listener = transportIn.getReceiver();
-                if (listener != null &&
-                    startedTransports.get(transportIn.getName()) == null) {
+                if (listener != null && startedTransports.get(transportIn.getName()) == null) {
                     listener.init(configctx, transportIn);
                     listener.start();
-                    if (startedTransports.get(transportIn.getName()) == null) {
-                        startedTransports.put(transportIn.getName(), listener);
-                    }
+                    startedTransports.put(transportIn.getName(), listener);
                 }
             } catch (Exception e) {
                 log.info(e.getMessage(), e);
@@ -140,38 +133,36 @@
         start();
     }
 
-    /**
-     * Stop all the transports and notify modules of shutdown.
-     */
+    /** Stop all the transports and notify modules of shutdown. */
     public synchronized void stop() throws AxisFault {
         if (stopped) {
             return;
         }
 
-        for (Iterator iter = startedTransports.values().iterator();
-             iter.hasNext();) {
-            TransportListener transportListener = (TransportListener) iter.next();
+        for (Object o : startedTransports.values()) {
+            TransportListener transportListener = (TransportListener)o;
             transportListener.stop();
         }
 
-        /*Stop the transport senders*/
-        HashMap transportOut = configctx.getAxisConfiguration().getTransportsOut();
-        if (transportOut.size() > 0) {
-            Iterator trsItr = transportOut.values().iterator();
+        // Stop the transport senders
+        HashMap outTransports = configctx.getAxisConfiguration().getTransportsOut();
+        if (outTransports.size() > 0) {
+            Iterator trsItr = outTransports.values().iterator();
             while (trsItr.hasNext()) {
-                TransportOutDescription outDescription = (TransportOutDescription) trsItr.next();
-                TransportSender trsSededer = outDescription.getSender();
-                if (trsSededer != null) {
-                    trsSededer.stop();
+                TransportOutDescription outDescription = (TransportOutDescription)trsItr.next();
+                TransportSender sender = outDescription.getSender();
+                if (sender != null) {
+                    sender.stop();
                 }
             }
         }
-        /*Shut down the modules*/
+
+        // Shut down the modules
         HashMap modules = configctx.getAxisConfiguration().getModules();
         if (modules != null) {
             Iterator moduleitr = modules.values().iterator();
             while (moduleitr.hasNext()) {
-                AxisModule axisModule = (AxisModule) moduleitr.next();
+                AxisModule axisModule = (AxisModule)moduleitr.next();
                 Module module = axisModule.getModule();
                 if (module != null) {
                     module.shutdown(configctx);
@@ -179,10 +170,10 @@
             }
         }
         configctx.cleanupContexts();
-        /*Shut down the services*/
-        for (Iterator services = configctx.getAxisConfiguration().getServices().values().iterator();
-             services.hasNext();) {
-            AxisService axisService = (AxisService) services.next();
+
+        // Shut down the services
+        for (Object o : configctx.getAxisConfiguration().getServices().values()) {
+            AxisService axisService = (AxisService)o;
             ServiceLifeCycle serviceLifeCycle = axisService.getServiceLifeCycle();
             if (serviceLifeCycle != null) {
                 serviceLifeCycle.shutDown(configctx, axisService);
@@ -220,9 +211,8 @@
     public void destroy() throws AxisFault {
         stop();
         this.configctx.setTransportManager(null);
-        for (Iterator iter = startedTransports.values().iterator();
-             iter.hasNext();) {
-            TransportListener transportListener = (TransportListener) iter.next();
+        for (Object o : startedTransports.values()) {
+            TransportListener transportListener = (TransportListener)o;
             transportListener.destroy();
         }
         this.startedTransports.clear();



Mime
View raw message