axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gdani...@apache.org
Subject svn commit: r776172 - in /webservices/axis2/trunk/java/modules: jaxws/src/org/apache/axis2/jaxws/handler/SOAPHeadersAdapter.java kernel/src/org/apache/axis2/deployment/DeploymentEngine.java kernel/src/org/apache/axis2/engine/AxisConfiguration.java
Date Tue, 19 May 2009 04:03:27 GMT
Author: gdaniels
Date: Tue May 19 04:03:26 2009
New Revision: 776172

URL: http://svn.apache.org/viewvc?rev=776172&view=rev
Log:
Patch up some JavaDocs and JDK 1.5 paradigms in order to get green lights on a couple of files.  Also remove @Override annotations in SOAPHeadersAdapter b/c JDK 1.5 can't compile them and AFAIK we haven't yet decided to drop JDK 1.5.

Modified:
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/SOAPHeadersAdapter.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/SOAPHeadersAdapter.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/SOAPHeadersAdapter.java?rev=776172&r1=776171&r2=776172&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/SOAPHeadersAdapter.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/handler/SOAPHeadersAdapter.java Tue May 19 04:03:26 2009
@@ -126,8 +126,11 @@
             log.debug("Init SOAPHeadersAdapter for " + property);
         }
     }
-    
-    @Override
+
+    // These @Override annotations break JDK 1.5 compilation... AFAIK we have not discussed
+    // forcing Axis2 devs to JDK 1.6, so commenting them out for now... --gdaniels
+
+    // @Override
     public void clear() {
         // Throw unsupported operation exception per Map javadoc
         // for any method that is not supported.
@@ -138,13 +141,13 @@
         throw new UnsupportedOperationException();
     }
     
-    @Override
+    // @Override
     public boolean containsKey(Object key) {
         Set<QName> keys = this.keySet();
         return keys.contains(key);
     }
     
-    @Override
+    // @Override
     public boolean containsValue(Object value) {
         Set<QName> keys = this.keySet();
         for(QName key: keys) {
@@ -159,7 +162,7 @@
     }
     
 
-    @Override
+    // @Override
     public Set<Entry<QName, List<String>>> entrySet() {
         // Previous implementation of this method called tempMap.putAll(this), which resulted
         // in an infinite loop due to Map calling back into this entrySet() method.  So, don't do that!
@@ -180,7 +183,7 @@
      * headers on the message.
      * @param _key Object -- QName key of header XML strings you intend to retrieve
      */
-    @Override
+    // @Override
     public List<String> get(Object _key) {
         // notify the HandlerChainProcessor that a transformation has occurred possibly due to a handler method call into here
         HandlerChainProcessor.trackInternalCall(mc, HandlerChainProcessor.TRACKER.SOAP_HEADERS_ADAPTER_CALLED);
@@ -213,12 +216,12 @@
         }
     }
     
-    @Override
+    // @Override
     public boolean isEmpty() {
         return this.keySet().isEmpty();
     }
     
-    @Override
+    // @Override
     public Set<QName> keySet() {
         // notify the HandlerChainProcessor that a transformation has occurred possibly due to a handler method call into here
         HandlerChainProcessor.trackInternalCall(mc, HandlerChainProcessor.TRACKER.SOAP_HEADERS_ADAPTER_CALLED);
@@ -231,7 +234,7 @@
      * @param key Object -- QName key of header XML strings you wish to be put on the SOAP header
      * @param values List<String> -- list of XML strings that have the same namespace as the QName key
      */
-    @Override
+    // @Override
     public List<String> put(QName key, List<String> values) {
         // notify the HandlerChainProcessor that a transformation has occurred possibly due to a handler method call into here
         HandlerChainProcessor.trackInternalCall(mc, HandlerChainProcessor.TRACKER.SOAP_HEADERS_ADAPTER_CALLED);
@@ -262,7 +265,7 @@
     /**
      * putAll will inject the headers into the SOAP message immediately
      */
-    @Override
+    // @Override
     public void putAll(Map<? extends QName, ? extends List<String>> t) {
         for(Entry<? extends QName, ? extends List<String>> entry: t.entrySet()) {
             QName key = entry.getKey();
@@ -274,9 +277,9 @@
     
     /**
      * remove will immediately remove the headers from the SOAP message that match the QName key
-     * @param key Object -- QName key of header XML strings you wish to remove from the SOAP header
+     * @param _key Object -- QName key of header XML strings you wish to remove from the SOAP header
      */
-    @Override
+    // @Override
     public List<String> remove(Object _key) {
         // notify the HandlerChainProcessor that a transformation has occurred possibly due to a handler method call into here
         HandlerChainProcessor.trackInternalCall(mc, HandlerChainProcessor.TRACKER.SOAP_HEADERS_ADAPTER_CALLED);
@@ -308,9 +311,8 @@
             
             // Get the strings from the blocks
             ArrayList<String> xmlStrings = new ArrayList<String>();
-            for (int i=0; i<blocks.size(); i++) {
-                Block block = blocks.get(i);
-                String value = (block == null) ? null : (String) block.getBusinessObject(false);
+            for (Block block : blocks) {
+                String value = (block == null) ? null : (String)block.getBusinessObject(false);
                 xmlStrings.add(value);
                 m.removeHeaderBlock(key.getNamespaceURI(), key.getLocalPart());
             }
@@ -324,12 +326,12 @@
     	
     }
     
-    @Override
+    // @Override
     public int size() {
         return this.keySet().size();
     }
     
-    @Override
+    // @Override
     public Collection<List<String>> values() {
     	/*
     	 * Previous implementation of this method called tempMap.putAll(this), which resulted
@@ -338,9 +340,9 @@
         Map<QName, List<String>> tempMap = new HashMap<QName, List<String>>();
         Set<QName> keys = this.keySet();
         QName key;
-        for (Iterator<QName> it = keys.iterator();it.hasNext();) {
-        	key = (QName)it.next();
-        	tempMap.put(key, this.get(key));
+        for (QName key1 : keys) {
+            key = key1;
+            tempMap.put(key, this.get(key));
         }
         return tempMap.values();
     }

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java?rev=776172&r1=776171&r2=776172&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java Tue May 19 04:03:26 2009
@@ -22,10 +22,9 @@
 
 import org.apache.axiom.om.OMElement;
 import org.apache.axis2.AxisFault;
-import org.apache.axis2.classloader.JarFileClassLoader;
 import org.apache.axis2.Constants;
+import org.apache.axis2.classloader.JarFileClassLoader;
 import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.ServiceContext;
 import org.apache.axis2.deployment.repository.util.ArchiveReader;
 import org.apache.axis2.deployment.repository.util.DeploymentFileData;
 import org.apache.axis2.deployment.repository.util.WSInfo;
@@ -46,8 +45,8 @@
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.engine.MessageReceiver;
 import org.apache.axis2.i18n.Messages;
-import org.apache.axis2.util.JavaUtils;
 import org.apache.axis2.util.FaultyServiceData;
+import org.apache.axis2.util.JavaUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -60,15 +59,18 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
+import java.lang.reflect.Method;
 import java.net.MalformedURLException;
 import java.net.URL;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReentrantLock;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipInputStream;
-import java.lang.reflect.Method;
-import java.lang.reflect.InvocationTargetException;
 
 public abstract class DeploymentEngine implements DeploymentConstants {
     private static final Log log = LogFactory.getLog(DeploymentEngine.class);
@@ -200,8 +202,8 @@
                 URL servicesDir = new URL(repoURL, directory);
                 URL filelisturl = new URL(servicesDir, listName);
                 ArrayList files = getFileList(filelisturl);
-                for (int i = 0; i < files.size(); i++) {
-                    String fileName = (String) files.get(i);
+                for (Object file : files) {
+                    String fileName = (String)file;
                     String extension = getExtension(fileName);
                     Deployer deployer = extensionMap.get(extension);
                     if (deployer == null) {
@@ -216,7 +218,7 @@
                     // just for init and other reflection methods
                     Method method = null;
                     try {
-                        method = classToLoad.getMethod("deployFromURL", new Class[]{URL.class});
+                        method = classToLoad.getMethod("deployFromURL", URL.class);
                     } catch (Exception e) {
                         //We do not need to inform this to user , since this something
                         // Axis2 is checking to support Session. So if the method is
@@ -224,9 +226,11 @@
                     }
                     if (method != null) {
                         try {
-                            method.invoke(deployer, new Object[]{servicesURL});
+                            method.invoke(deployer, servicesURL);
                         } catch (Exception e) {
-                            log.info("Exception trying to call " + "deployFromURL for the deployer" + deployer.getClass() , e);
+                            log.info(
+                                    "Exception trying to call " + "deployFromURL for the deployer" +
+                                    deployer.getClass(), e);
                         }
                     }
                 }
@@ -258,9 +262,8 @@
             URL filelisturl = new URL(servicesDir, "services.list");
             ArrayList files = getFileList(filelisturl);
 
-            for (Iterator fileIterator = files.iterator();
-                 fileIterator.hasNext();) {
-                String fileUrl = (String) fileIterator.next();
+            for (Object file : files) {
+                String fileUrl = (String)file;
                 if (fileUrl.endsWith(".aar")) {
                     AxisServiceGroup serviceGroup = new AxisServiceGroup();
                     URL servicesURL = new URL(servicesDir, fileUrl);
@@ -270,7 +273,8 @@
                                             fileUrl.substring(0, fileUrl.indexOf(".aar")));
                     addServiceGroup(serviceGroup, servicelist, servicesURL, null, axisConfig);
                     log.info(Messages.getMessage(DeploymentErrorMsgs.DEPLOYING_WS,
-                                                 org.apache.axis2.util.Utils.getModuleName(serviceGroup.getServiceGroupName()),
+                                                 org.apache.axis2.util.Utils.getModuleName(
+                                                         serviceGroup.getServiceGroupName()),
                                                  servicesURL.toString()));
                 }
             }
@@ -389,8 +393,8 @@
                                     serviceClassLoader.getResourceAsStream(line),
                                     serviceClassLoader, line);
                             if (services != null) {
-                                for (int i = 0; i < services.size(); i++) {
-                                    AxisService axisService = (AxisService) services.get(i);
+                                for (Object service : services) {
+                                    AxisService axisService = (AxisService)service;
                                     servicesMap.put(axisService.getName(), axisService);
                                 }
                             }
@@ -434,7 +438,7 @@
                             new WSDL11ToAxisServiceBuilder(wsdlStream, null, null);
                     File file = Utils.toFile(servicesURL);
                     if(file != null && file.exists()){
-                        wsdl2AxisServiceBuilder.setCustomWSLD4JResolver(
+                        wsdl2AxisServiceBuilder.setCustomWSDLResolver(
                                     new AARBasedWSDLLocator(wsdlLocation, file, wsdlStream));
                         wsdl2AxisServiceBuilder.setCustomResolver(
                                 new AARFileBasedURIResolver(file));
@@ -483,7 +487,7 @@
                                 new WSDL11ToAxisServiceBuilder(wsdlStream, axisService);
                         File file = Utils.toFile(servicesURL);
                         if(file != null && file.exists()){
-                            wsdl2AxisServiceBuilder.setCustomWSLD4JResolver(
+                            wsdl2AxisServiceBuilder.setCustomWSDLResolver(
                                         new AARBasedWSDLLocator(wsdlLocation, file, wsdlStream));
                             wsdl2AxisServiceBuilder.setCustomResolver(
                                     new AARFileBasedURIResolver(file));
@@ -571,18 +575,18 @@
 
             // Here iterating a cloned hashmap and modifying the original hashmap.
             // To avoid the ConcurrentModificationException.
-            for (Iterator<FaultyServiceData> itr = faultyServices.values().iterator(); itr.hasNext();) {
+            for (FaultyServiceData faultyServiceData : faultyServices.values()) {
 
-                FaultyServiceData faultyServiceData = itr.next();
                 axisConfiguration.removeFaultyServiceDuetoModule(modulemetadata.getName(),
-                        faultyServiceData.getServiceGroup().getServiceGroupName());
+                                                                 faultyServiceData
+                                                                         .getServiceGroup().getServiceGroupName());
 
                 //Recover the faulty serviceGroup.
                 addServiceGroup(faultyServiceData.getServiceGroup(),
-                        faultyServiceData.getServiceList(),
-                        faultyServiceData.getServiceLocation(),
-                        faultyServiceData.getCurrentDeploymentFile(),
-                        axisConfiguration);
+                                faultyServiceData.getServiceList(),
+                                faultyServiceData.getServiceLocation(),
+                                faultyServiceData.getCurrentDeploymentFile(),
+                                axisConfiguration);
             }
         }
     }
@@ -614,13 +618,15 @@
     }
 
     /**
-     * Performs a check routine, in order to identify whether all the serviceGroup, service and operation level
-     * modules are available. If a referenced module is not deployed yet, the serviceGroup is added as a faulty service.
-     * @param serviceGroup
-     * @param serviceList
-     * @param serviceLocation
-     * @param currentDeploymentFile
-     * @param axisConfig
+     * Performs a check routine, in order to identify whether all the serviceGroup, service and
+     * operation level modules are available. If a referenced module is not deployed yet, the
+     * serviceGroup is added as a faulty service.
+     * @param serviceGroup the AxisServiceGroup we're checking
+     * @param serviceList a List of AxisServices to check
+     * @param serviceLocation the URL of the service (only used if there's a problem)
+     * @param currentDeploymentFile the current DeploymentFileData object (only used if there's a
+     *                              problem)
+     * @param axisConfig the active AxisConfiguration
      * @return boolean
      * @throws AxisFault
      */
@@ -628,21 +634,25 @@
                                                          ArrayList serviceList,
                                                          URL serviceLocation,
                                                          DeploymentFileData currentDeploymentFile,
-                                                         AxisConfiguration axisConfig) throws AxisFault {
+                                                         AxisConfiguration axisConfig)
+            throws AxisFault {
         synchronized (axisConfig.getFaultyServicesDuetoModules()) {
             String moduleName;
             ArrayList groupModules = serviceGroup.getModuleRefs();
-            for (int i = 0; i < groupModules.size(); i++) {
-                moduleName = (String) groupModules.get(i);
+            for (Object groupModule : groupModules) {
+                moduleName = (String)groupModule;
                 AxisModule module = axisConfig.getModule(moduleName);
 
                 if (module == null) {
-                    axisConfig.addFaultyServiceDuetoModule(moduleName, new FaultyServiceData(serviceGroup, serviceList,
-                            serviceLocation, currentDeploymentFile));
+                    axisConfig.addFaultyServiceDuetoModule(moduleName,
+                                   new FaultyServiceData(serviceGroup,
+                                                         serviceList,
+                                                         serviceLocation,
+                                                         currentDeploymentFile));
                     if (log.isDebugEnabled()) {
-                                log.debug("Service: " + serviceGroup.getServiceGroupName() +
-                                        " becomes faulty due to Module: " + moduleName);
-                            }
+                        log.debug("Service: " + serviceGroup.getServiceGroupName() +
+                                  " becomes faulty due to Module: " + moduleName);
+                    }
                     return false;
                 }
             }
@@ -653,17 +663,20 @@
                 // modules from <service>
                 ArrayList list = axisService.getModules();
 
-                for (int i = 0; i < list.size(); i++) {
-                    moduleName = (String) list.get(i);
+                for (Object aList : list) {
+                    moduleName = (String)aList;
                     AxisModule module = axisConfig.getModule(moduleName);
 
                     if (module == null) {
-                        axisConfig.addFaultyServiceDuetoModule(moduleName, new FaultyServiceData(serviceGroup, serviceList,
-                                serviceLocation, currentDeploymentFile));
+                        axisConfig.addFaultyServiceDuetoModule(moduleName,
+                                                               new FaultyServiceData(serviceGroup,
+                                                                                     serviceList,
+                                                                                     serviceLocation,
+                                                                                     currentDeploymentFile));
                         if (log.isDebugEnabled()) {
-                                log.debug("Service: " + serviceGroup.getServiceGroupName() +
-                                        " becomes faulty due to Module: " + moduleName);
-                            }
+                            log.debug("Service: " + serviceGroup.getServiceGroupName() +
+                                      " becomes faulty due to Module: " + moduleName);
+                        }
                         return false;
                     }
                 }
@@ -672,16 +685,20 @@
                     AxisOperation opDesc = (AxisOperation) iterator.next();
                     ArrayList modules = opDesc.getModuleRefs();
 
-                    for (int i = 0; i < modules.size(); i++) {
-                        moduleName = (String) modules.get(i);
+                    for (Object module1 : modules) {
+                        moduleName = (String)module1;
                         AxisModule module = axisConfig.getModule(moduleName);
 
                         if (module == null) {
-                            axisConfig.addFaultyServiceDuetoModule(moduleName, new FaultyServiceData(serviceGroup,
-                                    serviceList, serviceLocation, currentDeploymentFile));
+                            axisConfig.addFaultyServiceDuetoModule(moduleName,
+                                                                   new FaultyServiceData(
+                                                                           serviceGroup,
+                                                                           serviceList,
+                                                                           serviceLocation,
+                                                                           currentDeploymentFile));
                             if (log.isDebugEnabled()) {
                                 log.debug("Service: " + serviceGroup.getServiceGroupName() +
-                                        " becomes faulty due to Module: " + moduleName);
+                                          " becomes faulty due to Module: " + moduleName);
                             }
                             return false;
                         }
@@ -700,8 +717,8 @@
         // module from services.xml at serviceGroup level
         ArrayList groupModules = serviceGroup.getModuleRefs();
         serviceGroup.setParent(axisConfig);
-        for (int i = 0; i < groupModules.size(); i++) {
-            String moduleName = (String) groupModules.get(i);
+        for (Object groupModule : groupModules) {
+            String moduleName = (String)groupModule;
             AxisModule module = axisConfig.getModule(moduleName);
 
             if (module != null) {
@@ -726,15 +743,15 @@
             // modules from <service>
             ArrayList list = axisService.getModules();
 
-            for (int i = 0; i < list.size(); i++) {
-                AxisModule module = axisConfig.getModule((String) list.get(i));
+            for (Object aList : list) {
+                AxisModule module = axisConfig.getModule((String)aList);
 
                 if (module == null) {
                     throw new DeploymentException(
                             Messages.getMessage(
                                     DeploymentErrorMsgs.BAD_MODULE_FROM_SERVICE,
                                     axisService.getName(),
-                                    ((QName) list.get(i)).getLocalPart()));
+                                    ((QName)aList).getLocalPart()));
                 }
 
                 axisService.engageModule(module);
@@ -744,8 +761,8 @@
                 AxisOperation opDesc = (AxisOperation) iterator.next();
                 ArrayList modules = opDesc.getModuleRefs();
 
-                for (int i = 0; i < modules.size(); i++) {
-                    String moduleName = (String) modules.get(i);
+                for (Object module1 : modules) {
+                    String moduleName = (String)module1;
                     AxisModule module = axisConfig.getModule(moduleName);
 
                     if (module != null) {
@@ -779,8 +796,8 @@
     public void doDeploy() {
         try {
             if (wsToDeploy.size() > 0) {
-                for (int i = 0; i < wsToDeploy.size(); i++) {
-                    DeploymentFileData fileToDeploy = (DeploymentFileData) wsToDeploy.get(i);
+                for (Object aWsToDeploy : wsToDeploy) {
+                    DeploymentFileData fileToDeploy = (DeploymentFileData)aWsToDeploy;
                     try {
                         fileToDeploy.deploy();
                     } catch (DeploymentException e) {
@@ -852,8 +869,8 @@
     public void unDeploy() {
         try {
             if (wsToUnDeploy.size() > 0) {
-                for (int i = 0; i < wsToUnDeploy.size(); i++) {
-                    WSInfo wsInfo = (WSInfo) wsToUnDeploy.get(i);
+                for (Object aWsToUnDeploy : wsToUnDeploy) {
+                    WSInfo wsInfo = (WSInfo)aWsToUnDeploy;
                     if (wsInfo.getType() == WSInfo.TYPE_SERVICE) {
                         //No matter what we need to undeploy the service
                         // if user has deleted the file from the repository
@@ -1340,11 +1357,11 @@
     }
 
     /**
-     * Adds and initializes the deploer.
+     * Add and initialize a new Deployer.
      *
-     * @param deployer  Deployer object to be added
-     * @param directory
-     * @param extension
+     * @param deployer Deployer object to be registered
+     * @param directory the directory which will be scanned for deployable artifacts
+     * @param extension the extension of the deployable artifacts for this Deployer
      */
     public void addDeployer(Deployer deployer, String directory, String extension){
 
@@ -1393,9 +1410,10 @@
     }
 
     /**
-     * Remove the Deployer mapped for the diven directory and the extension
-     * @param directory
-     * @param extension
+     * Remove any Deployer mapped for the given directory and extension
+     *
+     * @param directory the directory of deployables
+     * @param extension the extension of deployables
      */
     public void removeDeployer(String directory, String extension) {
         if (directory == null) {

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java?rev=776172&r1=776171&r2=776172&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java Tue May 19 04:03:26 2009
@@ -118,11 +118,12 @@
     private Hashtable<String, String> faultyServices;
 
     /**
-     * To store services which have become faulty due to modules. Here key is the module name and the corresponding
-     * value is an another map which holds the list faulty services due a single module.
+     * To store services which have become faulty due to modules. Here key is the module name and
+     * the corresponding value is an another map which holds the a Map of faulty services due a
+     * single module (keyed by service name).
      */
-    private final Map<String, Map<String, FaultyServiceData>> faultyServicesDueToModules = new HashMap<String,
-            Map<String, FaultyServiceData>>();
+    private final Map<String, Map<String, FaultyServiceData>> faultyServicesDueToModules =
+            new HashMap<String, Map<String, FaultyServiceData>>();
 
 
     private List<Phase> inFaultPhases;
@@ -176,7 +177,7 @@
         faultyModules = new Hashtable<String, String>();
         observersList = new ArrayList<AxisObserver>();
         inPhasesUptoAndIncludingPostDispatch = new ArrayList<Phase>();
-        systemClassLoader = (ClassLoader) org.apache.axis2.java.security.AccessController
+        systemClassLoader = org.apache.axis2.java.security.AccessController
                 .doPrivileged(new PrivilegedAction<ClassLoader>() {
                     public ClassLoader run() {
                         return Thread.currentThread().getContextClassLoader();
@@ -282,8 +283,8 @@
     /**
      * Remove a module with moduleName & moduleVersion
      *
-     * @param moduleName
-     * @param moduleVersion
+     * @param moduleName the name of the module to remove
+     * @param moduleVersion the version of the module to remove
      */
     public void removeModule(String moduleName, String moduleVersion) {
         allModules.remove(Utils.getModuleName(moduleName, moduleVersion));
@@ -305,10 +306,13 @@
     }
 
     /**
-     * Method addService.
-     *
-     * @param service
-     * @throws AxisFault
+     * Add an AxisService to our global configuration.  Since services must
+     * be in ServiceGroups, we construct an anonymous AxisServiceGroup around
+     * the passed AxisService and then call addServiceGroup().
+     *
+     * @param service an AxisService to deploy.
+     * @throws AxisFault if something goes wrong (invalid service, service is
+     *                   already deployed, etc...)
      */
     public synchronized void addService(AxisService service) throws AxisFault {
         AxisServiceGroup axisServiceGroup = new AxisServiceGroup();
@@ -327,30 +331,30 @@
 
         Iterator<AxisService> services = axisServiceGroup.getServices();
         while (services.hasNext()) {
-            axisService = (AxisService) services.next();
+            axisService = services.next();
             if (axisService.getSchemaTargetNamespace() == null) {
                 axisService.setSchemaTargetNamespace(Java2WSDLConstants.AXIS2_XSD);
             }
         }
         services = axisServiceGroup.getServices();
         while (services.hasNext()) {
-            axisService = (AxisService) services.next();
+            axisService = services.next();
             if (axisService.isUseDefaultChains()) {
                 Iterator<AxisOperation> operations = axisService.getOperations();
                 while (operations.hasNext()) {
-                    AxisOperation operation = (AxisOperation) operations.next();
+                    AxisOperation operation = operations.next();
                     phasesinfo.setOperationPhases(operation);
                 }
             }
         }
         Iterator<AxisModule> enModule = getEngagedModules().iterator();
         while (enModule.hasNext()) {
-            axisServiceGroup.engageModule((AxisModule) enModule.next());
+            axisServiceGroup.engageModule(enModule.next());
         }
         services = axisServiceGroup.getServices();
         ArrayList<AxisService> servicesIAdded = new ArrayList<AxisService>();
         while (services.hasNext()) {
-            axisService = (AxisService) services.next();
+            axisService = services.next();
             processEndpoints(axisService, axisService.getAxisConfiguration());
 
             Map<String, AxisEndpoint> endpoints = axisService.getEndpoints();
@@ -360,8 +364,7 @@
             } catch (AxisFault axisFault) {
                 // Whoops, must have been a duplicate!  If we had a problem here, we have to
                 // remove all the ones we added...
-                for (Iterator<AxisService> i = servicesIAdded.iterator(); i.hasNext();) {
-                    AxisService service = (AxisService) i.next();
+                for (AxisService service : servicesIAdded) {
                     allServices.remove(service.getName());
                 }
                 // And toss this in case anyone wants it?
@@ -371,7 +374,7 @@
             if (endpoints != null) {
                 Iterator<String> endpointNameIter = endpoints.keySet().iterator();
                 while (endpointNameIter.hasNext()) {
-                    String endpointName = (String) endpointNameIter.next();
+                    String endpointName = endpointNameIter.next();
                     if (log.isDebugEnabled()) {
                         log.debug("Adding service to allEndpoints map: ("
                                   + serviceName + "," + endpointName + ") ");
@@ -396,13 +399,14 @@
 
     public void addToAllServicesMap(AxisService axisService) throws AxisFault {
         String serviceName = axisService.getName();
-        AxisService oldService = (AxisService) allServices.get(serviceName);
+        AxisService oldService = allServices.get(serviceName);
         if (oldService == null) {
             if (log.isDebugEnabled()) {
                 log.debug("Adding service to allServices map: [" + serviceName + "] ");
             }
             allServices.put(serviceName, axisService);
             if (log.isTraceEnabled()) {
+                //noinspection ThrowableInstanceNeverThrown
                 log.trace("After adding to allServices map, size is "
                           + allServices.size(), 
                           new Exception("AxisConfiguration.addToAllServicesMap called from"));
@@ -427,7 +431,7 @@
         Iterator<AxisService> services = axisServiceGroup.getServices();
         boolean isClientSide = false;
         while (services.hasNext()) {
-            AxisService axisService = (AxisService) services.next();
+            AxisService axisService = services.next();
             allServices.remove(axisService.getName());
             if (!axisService.isClientSide()) {
                 notifyObservers(AxisEvent.SERVICE_REMOVE, axisService);
@@ -437,10 +441,10 @@
 
             //removes the endpoints to this service
             String serviceName = axisService.getName();
-            String key = null;
+            String key;
 
-            for (Iterator<String> iter = axisService.getEndpoints().keySet().iterator(); iter.hasNext();){
-                key = serviceName + "." + (String)iter.next();
+            for (String s : axisService.getEndpoints().keySet()) {
+                key = serviceName + "." + s;
                 this.allEndpoints.remove(key);
             }
 
@@ -454,9 +458,9 @@
     }
 
     /**
-     * Method addTransportIn.
+     * Add an incoming transport description (i.e. receiver) to our configuration.
      *
-     * @param transport
+     * @param transport TransportInDescription to add.
      * @throws AxisFault
      */
     public void addTransportIn(TransportInDescription transport) throws AxisFault {
@@ -469,9 +473,9 @@
     }
 
     /**
-     * Method addTransportOut.
+     * Add an outgoing transport description (i.e. sender) to our configuration.
      *
-     * @param transport
+     * @param transport TransportOutDescription to add.
      * @throws AxisFault
      */
     public void addTransportOut(TransportOutDescription transport)
@@ -519,8 +523,8 @@
     /**
      * Engages a module using given name and its version ID.
      *
-     * @param moduleName
-     * @param versionID
+     * @param moduleName name of module to engage
+     * @param versionID version of module to engage
      * @throws AxisFault
      */
     public void engageModule(String moduleName, String versionID)
@@ -530,6 +534,7 @@
         if (module != null) {
             engageModule(module);
         } else {
+            // TODO : Should this be an NPE or InvalidArgumentException?
             throw new AxisFault(Messages.getMessage("refertoinvalidmodule"));
         }
     }
@@ -537,7 +542,7 @@
     public void onEngage(AxisModule module, AxisDescription engager) throws AxisFault {
         Iterator<AxisServiceGroup> servicegroups = getServiceGroups();
         while (servicegroups.hasNext()) {
-            AxisServiceGroup serviceGroup = (AxisServiceGroup) servicegroups.next();
+            AxisServiceGroup serviceGroup = servicegroups.next();
             serviceGroup.engageModule(module, engager);
         }
     }
@@ -554,21 +559,20 @@
 
         Iterator<AxisServiceGroup> serviceGroups = getServiceGroups();
         while (serviceGroups.hasNext()) {
-            AxisServiceGroup axisServiceGroup = (AxisServiceGroup) serviceGroups.next();
+            AxisServiceGroup axisServiceGroup = serviceGroups.next();
             axisServiceGroup.disengageModule(module);
         }
     }
 
     public void notifyObservers(int event_type, AxisService service) {
-        AxisEvent event = new AxisEvent(event_type);
+        if (service.isClientSide())
+            return;
 
-        for (int i = 0; i < observersList.size(); i++) {
-            AxisObserver axisObserver = (AxisObserver) observersList.get(i);
+        AxisEvent event = new AxisEvent(event_type);
 
+        for (AxisObserver observer : observersList) {
             try {
-                if (!service.isClientSide()) {
-                    axisObserver.serviceUpdate(event, service);
-                }
+                observer.serviceUpdate(event, service);
             } catch (Throwable e) {
                 // No need to stop the system due to this, so log and ignore
                 log.debug(e);
@@ -579,11 +583,10 @@
     public void notifyObservers(int event_type, AxisModule moule) {
         AxisEvent event = new AxisEvent(event_type);
 
-        for (int i = 0; i < observersList.size(); i++) {
-            AxisObserver axisObserver = (AxisObserver) observersList.get(i);
+        for (AxisObserver anObserversList : observersList) {
 
             try {
-                axisObserver.moduleUpdate(event, moule);
+                anObserversList.moduleUpdate(event, moule);
             } catch (Throwable e) {
                 // No need to stop the system due to this, so log and ignore
                 log.debug(e);
@@ -594,11 +597,10 @@
     public void notifyObservers(int event_type, AxisServiceGroup serviceGroup) {
         AxisEvent event = new AxisEvent(event_type);
 
-        for (int i = 0; i < observersList.size(); i++) {
-            AxisObserver axisObserver = (AxisObserver) observersList.get(i);
+        for (AxisObserver anObserversList : observersList) {
 
             try {
-                axisObserver.serviceGroupUpdate(event, serviceGroup);
+                anObserversList.serviceGroupUpdate(event, serviceGroup);
             } catch (Throwable e) {
                 // No need to stop the system due to this, so log and ignore
                 log.debug(e);
@@ -607,13 +609,13 @@
     }
 
     /**
-     * Method removeService.
+     * Remove a service.
      *
-     * @param name
+     * @param name name of service to remove
      * @throws AxisFault
      */
     public synchronized void removeService(String name) throws AxisFault {
-        AxisService service = (AxisService) allServices.remove(name);
+        AxisService service = allServices.remove(name);
         if (service != null) {
             AxisServiceGroup serviceGroup = service.getAxisServiceGroup();
             serviceGroup.removeService(name);
@@ -638,8 +640,8 @@
      * @throws AxisFault if an individual engageModule() fails
      */
     public void engageGlobalModules() throws AxisFault {
-        for (Iterator<String> i = globalModuleList.iterator(); i.hasNext();) {
-            engageModule((String) i.next());
+        for (String aGlobalModuleList : globalModuleList) {
+            engageModule(aGlobalModuleList);
         }
     }
 
@@ -674,9 +676,10 @@
     }
 
     /**
-     * Returns a map which contains the faulty services due a module.
-     * @param moduleName
-     * @return
+     * Returns a map which contains the faulty services due a particular module.
+     *
+     * @param moduleName name of the module about which to inquire
+     * @return a Map&lt;String, FaultyServiceData&gt; mapping service name to data
      */
     public Map<String, FaultyServiceData> getFaultyServicesDuetoModule(String moduleName) {
         if (faultyServicesDueToModules.containsKey(moduleName)) {
@@ -688,22 +691,27 @@
 
     /**
      * Returns the map which keeps track of faulty services due to modules.
-     * @return
+     * @return a Map keyed by module name, containing Maps keyed by service name containing
+     *         FaultyServiceData for each faulty service.
      */
     public Map<String, Map<String, FaultyServiceData>> getFaultyServicesDuetoModules(){
         return faultyServicesDueToModules;
     }
 
     /**
-     * Removes a faulty service from the map faultyServicesDueToModules.
-     * @param moduleName
-     * @param serviceGroupName
+     * Removes a faulty service for a given module from the internal map.
+     *
+     * TODO: Doesn't this actually remove a faulty service *group*? And should this even be public?
+     * 
+     * @param moduleName name of the module to look up
+     * @param serviceGroupName name of the service group to remove
      */
     public void removeFaultyServiceDuetoModule(String moduleName, String serviceGroupName) {
         synchronized (faultyServicesDueToModules) {
-            Map<String, FaultyServiceData> faultyServices = faultyServicesDueToModules.get(moduleName);
+            Map<String, FaultyServiceData> faultyServices =
+                    faultyServicesDueToModules.get(moduleName);
 
-            if(faultyServices != null){
+            if (faultyServices != null) {
                 faultyServices.remove(serviceGroupName);
 
                 if(faultyServices.isEmpty()){
@@ -716,7 +724,7 @@
     public void removeFaultyService(String key) {
         Iterator<String> itr = faultyServices.keySet().iterator();
         while (itr.hasNext()) {
-            String fullFileName = (String) itr.next();
+            String fullFileName = itr.next();
             if (fullFileName.indexOf(key) > 0) {
                 faultyServices.remove(fullFileName);
                 return;
@@ -741,11 +749,13 @@
     }
 
     public MessageReceiver getMessageReceiver(String mepURL) {
-        return (MessageReceiver) messageReceivers.get(mepURL);
+        return messageReceivers.get(mepURL);
     }
 
     /**
-     * @param contentType
+     * Get a Builder for a particular content type.
+     *
+     * @param contentType the desired content type
      * @return the configured message builder implementation class name against
      *         the given content type.
      */
@@ -755,9 +765,9 @@
             return null;
         }
         if (contentType != null) {
-            builder = (Builder) messageBuilders.get(contentType);
+            builder = messageBuilders.get(contentType);
             if (builder == null) {
-                builder = (Builder) messageBuilders.get(contentType.toLowerCase());
+                builder = messageBuilders.get(contentType.toLowerCase());
             }
             if (builder == null) {
                 Iterator<Entry<String, Builder>> iterator = messageBuilders.entrySet().iterator();
@@ -782,12 +792,13 @@
     }
 
     /**
-     * @param contentType
-     * @return the configured message formatter implementation class name
-     *         against the given content type.
+     * Get a MessageFormatter for the specified content type.
+     *
+     * @param contentType content type to look up
+     * @return a MessageFormatter corresponding to the given content type, or null.
      */
     public MessageFormatter getMessageFormatter(String contentType) {
-        return (MessageFormatter) messageFormatters.get(contentType);
+        return messageFormatters.get(contentType);
     }
 
 //    /**
@@ -801,29 +812,25 @@
 //    }
 
     /**
-     * Method getModule. First it will check whether the given module is there
-     * in the hashMap, if so returns that and the name, which can be either with
-     * version string or without version string. <p/> If its not found and the
-     * name does not contain the version string in it then checks whether the default
-     * version of the module is available in the sytem for the given name, then returns
-     * that.
+     * Get an AxisModule by name.
+     *
+     * If the exact name passed (which might contain a version) is present, we'll return that,
+     * otherwise we'll look for the default version *if* there is no version in the passed
+     * name.
      *
-     * @param name
-     * @return Returns ModuleDescription.
+     * @param name module name to look up
+     * @return an AxisModule if found, or null
      */
     public AxisModule getModule(String name) {
-        AxisModule module = (AxisModule) allModules.get(name);
+        AxisModule module = allModules.get(name);
         if (module != null) {
             return module;
         }
         // checks whether the version string seperator is not there in the
         // module name
-        String moduleName = name;
-        String defaultModuleVersion = getDefaultModuleVersion(moduleName);
+        String defaultModuleVersion = getDefaultModuleVersion(name);
         if (defaultModuleVersion != null) {
-            module =
-                    (AxisModule) allModules.get(Utils.getModuleName(moduleName,
-                                                                    defaultModuleVersion));
+            module = allModules.get(Utils.getModuleName(name, defaultModuleVersion));
             if (module != null) {
                 return module;
             }
@@ -842,20 +849,20 @@
         if (moduleVersion == null || moduleVersion.trim().length() == 0) {
             moduleVersion = getDefaultModuleVersion(moduleName);
         }
-        return (AxisModule) allModules.get(Utils.getModuleName(moduleName, moduleVersion));
+        return allModules.get(Utils.getModuleName(moduleName, moduleVersion));
     }
 
     /**
-     * The class loader that becomes the parent of all the modules
+     * Get the class loader that becomes the parent of all the modules
      *
-     * @return
+     * @return a ClassLoader
      */
     public ClassLoader getModuleClassLoader() {
         return this.moduleClassLoader;
     }
 
     public ModuleConfiguration getModuleConfig(String moduleName) {
-        return (ModuleConfiguration) moduleConfigmap.get(moduleName);
+        return moduleConfigmap.get(moduleName);
     }
 
     /**
@@ -893,11 +900,11 @@
     /**
      * Method getService.
      *
-     * @param name
-     * @return Returns AxisService.
+     * @param name the name of the service to look up
+     * @return an AxisService if found, or null
      */
     public AxisService getService(String name) throws AxisFault {
-        AxisService axisService = (AxisService) allServices.get(name);
+        AxisService axisService = allServices.get(name);
         if (axisService != null) {
             if (axisService.isActive()) {
                 return axisService;
@@ -906,7 +913,7 @@
                         .getMessage("serviceinactive", name));
             }
         } else {
-            axisService = (AxisService) allEndpoints.get(name);
+            axisService = allEndpoints.get(name);
             if (axisService != null) {
                 if (axisService.isActive()) {
                     return axisService;
@@ -923,15 +930,16 @@
      * Service can start and stop, once stopped it cannot be accessed, so we
      * need a way to get the service even if service is not active.
      *
+     * @param serviceName name to look up
      * @return AxisService
      */
     public AxisService getServiceForActivation(String serviceName) {
-        AxisService axisService = null;
-        axisService = (AxisService) allServices.get(serviceName);
+        AxisService axisService;
+        axisService = allServices.get(serviceName);
         if (axisService != null) {
             return axisService;
         } else {
-            axisService = (AxisService) allEndpoints.get(serviceName);
+            axisService = allEndpoints.get(serviceName);
             return axisService;
         }
     }
@@ -956,8 +964,8 @@
     public HashMap<String, AxisService> getServices() {
         HashMap<String, AxisService> hashMap = new HashMap<String, AxisService>(this.allServices.size());
         String key;
-        for (Iterator<String> iter = this.allServices.keySet().iterator(); iter.hasNext();){
-            key = iter.next();
+        for (String s : this.allServices.keySet()) {
+            key = s;
             hashMap.put(key, this.allServices.get(key));
         }
         return hashMap;
@@ -970,11 +978,11 @@
     }
 
     public TransportInDescription getTransportIn(String name) {
-        return (TransportInDescription) transportsIn.get(name);
+        return transportsIn.get(name);
     }
 
     public TransportOutDescription getTransportOut(String name) {
-        return (TransportOutDescription) transportsOut.get(name);
+        return transportsOut.get(name);
     }
 
     public HashMap<String, TransportInDescription> getTransportsIn() {
@@ -986,11 +994,14 @@
     }
 
     /**
+     * Find out whether a given module is engaged.
+     *
      * This method needs to remain for a few Axis2 releases to support
-     * legacy apps still using it.
+     * legacy apps still using it.  It will be disappearing in 1.6.
      *
-     * @param qname
+     * @param qname QName of the module
      * @deprecated Use {@link #isEngaged(String)}
+     * @return true if a module matching the passed QName is engaged globally
      */
     public boolean isEngaged(QName qname) {
         return isEngaged(qname.getLocalPart());
@@ -1023,7 +1034,11 @@
     }
 
     /**
-     * @param list
+     * Set the inbound fault phases
+     *
+     * TODO: Passing mutable lists like this and using them directly is bad practice.
+     *
+     * @param list a List of Phases which will become our inbound fault flow
      */
     public void setInFaultPhases(List<Phase> list) {
         inFaultPhases = list;
@@ -1039,7 +1054,11 @@
     }
 
     /**
-     * @param list
+     * Set the outbound fault phases
+     *
+     * TODO: Passing mutable lists like this and using them directly is bad practice.
+     *
+     * @param list a List of Phases which will become our outbound fault flow
      */
     public void setOutFaultPhases(List<Phase> list) {
         outFaultPhases = list;
@@ -1067,8 +1086,10 @@
      * asks to engage a module without given version ID, in which case,
      * the default version is engaged.
      *
-     * @param moduleName
-     * @param moduleVersion
+     * TODO: This currently does NOTHING if a default has already been set. Should either overwrite or throw.
+     *
+     * @param moduleName the name of the module for which we're setting the default version
+     * @param moduleVersion the default version
      */
     public void addDefaultModuleVersion(String moduleName, String moduleVersion) {
         if (nameToversionMap.get(moduleName) == null) {
@@ -1077,15 +1098,15 @@
     }
 
     public String getDefaultModuleVersion(String moduleName) {
-        return (String) nameToversionMap.get(moduleName);
+        return nameToversionMap.get(moduleName);
     }
 
     public AxisModule getDefaultModule(String moduleName) {
         String defaultModuleVersion = getDefaultModuleVersion(moduleName);
         if (defaultModuleVersion == null) {
-            return (AxisModule) allModules.get(moduleName);
+            return allModules.get(moduleName);
         } else {
-            return (AxisModule) allModules.get(moduleName + "-" + defaultModuleVersion);
+            return allModules.get(moduleName + "-" + defaultModuleVersion);
         }
     }
 
@@ -1110,7 +1131,7 @@
     }
 
     public void stopService(String serviceName) throws AxisFault {
-        AxisService service = (AxisService) allServices.get(serviceName);
+        AxisService service = allServices.get(serviceName);
         if (service == null) {
             throw new AxisFault(Messages.getMessage("servicenamenotvalid",
                                                     serviceName));
@@ -1120,7 +1141,7 @@
     }
 
     public void startService(String serviceName) throws AxisFault {
-        AxisService service = (AxisService) allServices.get(serviceName);
+        AxisService service = allServices.get(serviceName);
         if (service == null) {
             throw new AxisFault(Messages.getMessage("servicenamenotvalid",
                                                     serviceName));
@@ -1142,15 +1163,15 @@
 
         List<AxisModule> modulesList;
 
-        for (int i = 0; i < namespaces.length; i++) {
-            modulesList = policySupportedModules.get(namespaces[i]);
+        for (String namespace : namespaces) {
+            modulesList = policySupportedModules.get(namespace);
 
             if (modulesList != null) {
                 modulesList.add(axisModule);
             } else {
                 modulesList = new ArrayList<AxisModule>();
                 modulesList.add(axisModule);
-                policySupportedModules.put(namespaces[i], modulesList);
+                policySupportedModules.put(namespace, modulesList);
             }
         }
     }
@@ -1162,8 +1183,8 @@
             return;
         }
 
-        for (int i = 0; i < localPolicyAssertions.length; i++) {
-            addLocalPolicyAssertion(localPolicyAssertions[i]);
+        for (QName localPolicyAssertion : localPolicyAssertions) {
+            addLocalPolicyAssertion(localPolicyAssertion);
         }
     }
 
@@ -1184,6 +1205,8 @@
      * TargetResolver which iterates over the registered
      * TargetResolvers, calling each one in turn when
      * resolveTarget is called.
+     *
+     * @return a TargetResolver which iterates over all registered TargetResolvers.
      */
     public TargetResolver getTargetResolverChain() {
         if (targetResolvers.isEmpty()) {
@@ -1193,7 +1216,7 @@
             public void resolveTarget(MessageContext messageContext) {
                 Iterator<TargetResolver> iter = targetResolvers.iterator();
                 while (iter.hasNext()) {
-                    TargetResolver tr = (TargetResolver) iter.next();
+                    TargetResolver tr = iter.next();
                     tr.resolveTarget(messageContext);
                 }
             }
@@ -1245,17 +1268,21 @@
 
     /**
      * Return DataLocator instance for specified dialect.
+     * @param dialect the dialect to look up
+     * @return an AxisDataLocator, or null
      */
     public AxisDataLocator getDataLocator(String dialect) {
-        return (AxisDataLocator) dataLocators.get(dialect);
+        return dataLocators.get(dialect);
     }
 
 
     /**
      * Return classname of DataLocator configured for specified dialect.
+     * @param dialect the dialect to look up
+     * @return a String containing a class name, or null
      */
     public String getDataLocatorClassName(String dialect) {
-        return (String) dataLocatorClassNames.get(dialect);
+        return dataLocatorClassNames.get(dialect);
     }
 
 
@@ -1345,17 +1372,17 @@
     }
 
     /**
-     * Insert a Phase
-     * @param d
-     * @param phaseList
-     * @return
+     * Insert a Phase into a list of Phases
+     *
+     * @param d a Deployable containing the Phase to insert
+     * @param phaseList a list of Phases
+     * @return a new List of Phases with the new one correctly deployed.
      * @throws AxisFault
      */
     private List<Phase> findAndInsertPhase(Deployable d, List<Phase> phaseList) throws AxisFault {
         DeployableChain<Phase> ec = new DeployableChain<Phase>();
         String last = null;
-        for (Iterator<Phase> i = phaseList.iterator(); i.hasNext();) {
-            Phase phase = (Phase)i.next();
+        for (Phase phase : phaseList) {
             String name = phase.getName();
             Deployable existing = new Deployable(name);
             existing.setTarget(phase);



Mime
View raw message