Author: dolander
Date: Wed Mar 16 10:09:24 2005
New Revision: 157781

URL: http://svn.apache.org/viewcvs?view=rev&rev=157781
Log:
Additional cleanup and documenetation of the AxisHook.
I added some JavaDoc and description within the code.
I cleaned up a bit of code that was duplicated.
Added the Apache header to BeehiveWsSOAPBindingInfo


Modified:
    
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/AxisHook.java
    
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/handlers/AnnotatedWebServiceDeploymentHandler.java
    
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/BeehiveWsSOAPBindingInfo.java

Modified: 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/AxisHook.java
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/AxisHook.java?view=diff&r1=157780&r2=157781
==============================================================================
--- 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/AxisHook.java
 (original)
+++ 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/AxisHook.java
 Wed Mar 16 10:09:24 2005
@@ -73,22 +73,19 @@
             cl = AxisHook.class.getClassLoader();
         }
         final Class serviceClass = cl.loadClass(wsm.getClassName());
-        sd.setName(wsm.getWsName());
-        sd.setImplClass(serviceClass);
-        String targetNamespace = wsm.getWsTargetNamespace();
-        sd.setDefaultNamespace(targetNamespace);
-        configureSoapBinding(sd, wsm.getSoapBinding());
-               
+
+        // Create a list of the allowed methods
         List<String> allowedMethods = new ArrayList<String>();
-        
         for (BeehiveWsMethodMetadata meth : wsm.getMethods())
         {            
             String method = meth.getJavaMethodName();
             allowedMethods.add(method);
         }
-               
-        
-        sd.setName(wsm.getWsName());           
+
+        // set the ServiceDesc base information
+        sd.setName(wsm.getWsName());
+        sd.setImplClass(serviceClass);
+        String targetNamespace = wsm.getWsTargetNamespace();
         sd.setDefaultNamespace(targetNamespace);
         sd.setAllowedMethods(allowedMethods);
         configureSoapBinding(sd, wsm.getSoapBinding());        
@@ -105,13 +102,15 @@
          * which is required for Axis to work in wrapped/lit mode.
          */
         sd.getOperations();
-        
+
+        // Walk the methods
         for (BeehiveWsMethodMetadata meth : wsm.getMethods())
         {
             String operationName = meth.getWmOperationName();
             if (null != operationName && 0 < operationName.length())
             {
-                OperationDesc od = 
sd.getOperationByName(meth.getJavaMethodName());        
+                // set the Operations properties
+                OperationDesc od = 
sd.getOperationByName(meth.getJavaMethodName());
                 od.setElementQName(new QName(targetNamespace, operationName));
                 od.setName(operationName);
                 od.setSoapAction(meth.getWmAction());
@@ -121,14 +120,14 @@
                 }
                 else
                 {
-                    od.setReturnQName(
-                        new QName(meth.getWrTargetNamespace(), 
meth.getWrName())
-                    );
+                    od.setReturnQName(new QName(meth.getWrTargetNamespace(), 
meth.getWrName()));
                     final Class returnType = meth.getJavaReturnType();
                     QName qn = configureTypeMapping(sd, returnType, 
meth.getWrTargetNamespace());
                     od.setReturnType(qn);
                     od.setReturnClass(returnType);
                 }
+
+                // process the parameters
                 int pcnt = 0;
                 for (BeehiveWsParameterMetadata param : meth.getParams())
                 {
@@ -144,15 +143,14 @@
                         pd.setTypeQName(typeQName);
                     }
 
-                    QName paramQName = new QName(param.getWpTargetNamespace(), 
param.getWpName());
                     // set QName
+                    QName paramQName = new QName(param.getWpTargetNamespace(), 
param.getWpName());
                     pd.setQName(paramQName);
-                    
-                    
+
                     // set Mode
                     final boolean header = param.isWpHeader();
-                    final WebParam.Mode mo = param.getWpMode();
-                    switch (mo) {
+                    final WebParam.Mode mode = param.getWpMode();
+                    switch (mode) {
                         case IN:
                             pd.setMode(ParameterDesc.IN);
                             pd.setInHeader(header);
@@ -169,16 +167,16 @@
                             pd.setOutHeader(header);
                             break;
                         default:
-                            throw new IllegalArgumentException("Illegal value 
for WebParam.Mode: " + mo);
+                            throw new IllegalArgumentException("Illegal value 
for WebParam.Mode: " + mode);
                     }
 
                     // set JavaType
                     pd.setJavaType(paramType);                                 
        
                 }
                 
-                Method javaMethod = od.getMethod();
-                
+
                 // set Exceptions
+                Method javaMethod = od.getMethod();
                 for (Class thrown : javaMethod.getExceptionTypes())
                 {
                     FaultDesc fd = od.getFaultByClass(thrown);
@@ -187,39 +185,53 @@
                     fd.setQName(qname);
                     fd.setComplex(true);                    
                 }
-                
             }
         }
-
-        sd.setAllowedMethods(allowedMethods);
         return sd;
     }
 
+    /**
+     * This method will return a boolean value indicating that Activation is 
enabled.
+     * Activation requires the DataHandler and the Multipart Classes to both 
be found.
+     * @return boolean indicating that Activation is enabled.
+     */
     private static boolean isActivationEnabled()
     {
         return null != getDataHandlerClass() && null != getMultipartClass();
     }
 
+    /**
+     * This will return the Class for the DataHandler.  This will return null
+     * if the DataHandler is not available.
+     * @return The DataHandler Class or null if the DataHandler is not found
+     */
     private static Class getDataHandlerClass()
     {
         try
         {
             return 
AxisHook.class.getClassLoader().loadClass("javax.activation.DataHandler");
         }
-        catch (Exception e)
+        catch (ClassNotFoundException e)
         {
+            // ignore the class was not found
         }
         return null;
     }
 
+    /**
+     * This will return the Class for the MimeMultipart handler.  It will
+     * return null if the MimMultipart class is not available.
+     * @return  The MimeMultipart Class or null if the DataHandler is not 
found.
+     */
     private static Class getMultipartClass()
     {
         try
         {
             return 
AxisHook.class.getClassLoader().loadClass("javax.mail.internet.MimeMultipart");
         }
-        catch (Exception e)
+        catch (ClassNotFoundException e)
         {
+            // ignore the class was not found
         }
         return null;
     }

Modified: 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/handlers/AnnotatedWebServiceDeploymentHandler.java
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/handlers/AnnotatedWebServiceDeploymentHandler.java?view=diff&r1=157780&r2=157781
==============================================================================
--- 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/handlers/AnnotatedWebServiceDeploymentHandler.java
 (original)
+++ 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/handlers/AnnotatedWebServiceDeploymentHandler.java
 Wed Mar 16 10:09:24 2005
@@ -161,8 +161,7 @@
                 scope = "Request";
             }
             ss.setOption(RPCProvider.OPTION_SCOPE, scope);
-            ServiceDesc sd = AxisHook.createServiceDesc(wsm, cls
-                    .getClassLoader());
+            ServiceDesc sd = AxisHook.createServiceDesc(wsm, 
cls.getClassLoader());
             ss.setServiceDescription(sd);
             List allowedMethodNames = sd.getAllowedMethods();
             Iterator allowIt = allowedMethodNames.iterator();

Modified: 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/BeehiveWsSOAPBindingInfo.java
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/BeehiveWsSOAPBindingInfo.java?view=diff&r1=157780&r2=157781
==============================================================================
--- 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/BeehiveWsSOAPBindingInfo.java
 (original)
+++ 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/BeehiveWsSOAPBindingInfo.java
 Wed Mar 16 10:09:24 2005
@@ -1,16 +1,24 @@
 /*
- * Created on Feb 11, 2005
+ * Copyright 2005 The Apache Software Foundation
  *
- * TODO To change the template for this generated file go to
- * Window - Preferences - Java - Code Style - Code Templates
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
  */
 package org.apache.beehive.wsm.jsr181.model;
 import javax.jws.soap.SOAPBinding;
 /**
  * @author dmehrtash
- *
- * TODO To change the template for this generated type comment go to
- * Window - Preferences - Java - Code Style - Code Templates
  */
 public interface BeehiveWsSOAPBindingInfo {
   /**


Reply via email to