You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ba...@apache.org on 2008/01/18 17:30:07 UTC

svn commit: r613197 - in /webservices/axis2/trunk/java/modules/metadata: src/org/apache/axis2/jaxws/description/builder/ src/org/apache/axis2/jaxws/description/impl/ src/org/apache/axis2/jaxws/i18n/ test/org/apache/axis2/jaxws/description/impl/

Author: barrettj
Date: Fri Jan 18 08:30:05 2008
New Revision: 613197

URL: http://svn.apache.org/viewvc?rev=613197&view=rev
Log:
NLS-ify strings in exceptions related to client-side sparse composite support.

Modified:
    webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/DescriptionBuilderComposite.java
    webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/WebServiceClientAnnot.java
    webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java
    webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointInterfaceDescriptionImpl.java
    webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/ServiceDescriptionImpl.java
    webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/i18n/resource.properties
    webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/impl/ClientDBCSupportEndpointTests.java

Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/DescriptionBuilderComposite.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/DescriptionBuilderComposite.java?rev=613197&r1=613196&r2=613197&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/DescriptionBuilderComposite.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/DescriptionBuilderComposite.java Fri Jan 18 08:30:05 2008
@@ -29,18 +29,11 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-
-import javax.jws.HandlerChain;
 import javax.wsdl.Definition;
 import javax.xml.namespace.QName;
-import javax.xml.ws.BindingType;
-import javax.xml.ws.ServiceMode;
-import javax.xml.ws.WebServiceException;
-import javax.xml.ws.WebServiceProvider;
 
 import java.io.InputStream;
 import java.lang.annotation.Annotation;
-import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.net.URL;
 import java.security.PrivilegedAction;
@@ -50,6 +43,7 @@
 import java.util.List;
 import java.util.Map;
 import java.util.WeakHashMap;
+import org.apache.axis2.jaxws.i18n.Messages;
 
 public class DescriptionBuilderComposite implements TMAnnotationComposite, TMFAnnotationComposite {
 
@@ -126,7 +120,6 @@
     // For a service requester, this will be the client-side class associated with this composite; 
     // It could be the Service class or the SEI class.  On the service provider this will be null
     // unless the deprecated service construction logic in DescriptionFactory was used.
-    // TODO: (JLB) Remove the comment about the deprecated service construction logi
     private Class theCorrespondingClass;
     
     // Service-requesters (aka clients) can specify a sprase composite that may contain annotation
@@ -327,8 +320,10 @@
                                   + "; Composite Annot class: " + compositeAnnotClass 
                                   + "; Java Annot class: " + javaAnnotationClass, e);
                     }
-                    // TODO: (JLB) NLS
-                    throw ExceptionFactory.makeWebServiceException("Unable to create composite annotation", e);
+                    String msg = Messages.getMessage("DescriptionBuilderErr1", 
+                                                     compositeAnnotClass.toString(),
+                                                     e.toString());
+                    throw ExceptionFactory.makeWebServiceException(msg, e);
                 }
             }
         }

Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/WebServiceClientAnnot.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/WebServiceClientAnnot.java?rev=613197&r1=613196&r2=613197&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/WebServiceClientAnnot.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/WebServiceClientAnnot.java Fri Jan 18 08:30:05 2008
@@ -20,9 +20,11 @@
 package org.apache.axis2.jaxws.description.builder;
 
 import org.apache.axis2.jaxws.ExceptionFactory;
+import org.apache.axis2.jaxws.i18n.Messages;
 
 import java.lang.annotation.Annotation;
 
+
 public class WebServiceClientAnnot implements javax.xml.ws.WebServiceClient {
 
     private String name;
@@ -125,10 +127,11 @@
             // No anntotation specifed, so just return null which was initialized above
         } else {
             // This should never happen; all the cases are covered above
-            // TODO: (JLB) RAS/NLS
-            throw ExceptionFactory.makeWebServiceException("Programming error! annot = " + baseAnnotation + "; sparseAnnot = " + sparseAnnotation);
+            String msg = Messages.getMessage("DescriptionBuilderErr2",
+                                             (sparseAnnotation == null) ? null : sparseAnnotation.toString(),
+                                             (baseAnnotation == null) ? null : baseAnnotation.toString());
+            throw ExceptionFactory.makeWebServiceException(msg);
         }
-
         return returnAnnot;
     }
 

Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java?rev=613197&r1=613196&r2=613197&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java Fri Jan 18 08:30:05 2008
@@ -206,15 +206,7 @@
         composite.setCorrespondingClass(theClass);
         composite.setClassLoader(this.getClass().getClassLoader());
         composite.setIsServiceProvider(false);
-        // REVIEW: setting these should probably be done in the getters!  It needs to be done before we try to select a 
-        //         port to use if one wasn't specified because we'll try to get to the annotations to get the PortType
-        // TODO: (JLB) REmove commented out code
-//        if (this.implOrSEIClass != null) {
-//            webServiceAnnotation = (WebService)getAnnotation(implOrSEIClass,WebService.class);
-//            // TODO: (JLB) Seems like the provider annotation is only for the deprecated service construction and can be removed
-//            webServiceProviderAnnotation =
-//                    (WebServiceProvider)getAnnotation(implOrSEIClass,WebServiceProvider.class);
-//        }
+
         webServiceAnnotation = composite.getWebServiceAnnot();
         
         this.isDynamicPort = dynamicPort;
@@ -548,7 +540,6 @@
         // TODO: Add tests to verify this error checking
 
         if (composite.isDeprecatedServiceProviderConstruction()) {
-//        if (!getServiceDescriptionImpl().isDBCMap()) {
 
             webServiceAnnotation = composite.getWebServiceAnnot();
             webServiceProviderAnnotation = composite.getWebServiceProviderAnnot();
@@ -576,18 +567,14 @@
 
             if (composite.isDeprecatedServiceProviderConstruction()
                     || !composite.isServiceProvider()) {
-//            if (!getServiceDescriptionImpl().isDBCMap()) {
                 Class seiClass = null;
                 if (DescriptionUtils.isEmpty(seiClassName)) {
-                    // TODO: (JLB) This is the client code path; the @WebServce will not have an endpointInterface member
-                    // For now, just build the EndpointInterfaceDesc based on the class itself.
-                    // TODO: The EID ctor doesn't correctly handle anything but an SEI at this
-                    //       point; e.g. it doesn't publish the correct methods of just an impl.
+                    // This is the client code path; the @WebServce will not have an endpointInterface member
+                    // so just build the EndpointInterfaceDesc based on the class itself.
                     seiClass = composite.getCorrespondingClass();
                 } else {
-                    // TODO: (JLB) This is the deprecated server-side introspection code for an impl that references an SEI
+                    // This is the deprecated server-side introspection code for an impl that references an SEI
                     try {
-                        // TODO: Using Class forName() is probably not the best long-term way to get the SEI class from the annotation
                         seiClass = ClassLoaderUtils.forName(seiClassName, false,
                                                             ClassLoaderUtils.getContextClassLoader(this.axisService != null ? this.axisService.getClassLoader() : null));
                         // Catch Throwable as ClassLoader can throw an NoClassDefFoundError that
@@ -600,17 +587,14 @@
                 }
                 endpointInterfaceDescription = new EndpointInterfaceDescriptionImpl(seiClass, this);
             } else {
-                //TODO: Determine if we need logic here to determine implied SEI or not. This logic
-                //		may be handled by EndpointInterfaceDescription
-
                 if (DescriptionUtils.isEmpty(getAnnoWebServiceEndpointInterface())) {
 
-                    //TODO: Build the EndpointInterfaceDesc based on the class itself
+                    // Build the EndpointInterfaceDesc based on the class itself
                     endpointInterfaceDescription =
                             new EndpointInterfaceDescriptionImpl(composite, true, this);
 
                 } else {
-                    //Otherwise, build the EID based on the SEI composite
+                    // Otherwise, build the EID based on the SEI composite
                     endpointInterfaceDescription = new EndpointInterfaceDescriptionImpl(
                             getServiceDescriptionImpl().getDBCMap().get(seiClassName),
                             false,
@@ -908,10 +892,6 @@
         // WSDL to build up the hierachy since the port added to the Service by the client is not
         // one that will be present in the WSDL.
 
-        //First, check to see if we can build this with the DBC List
-        //TODO: When MDQ input is the only possible input, then we can remove the check for
-        //      the DBC list, until that time the code in here may appear somewhat redundant
-        // TODO: (JLB) Can this logic be combined?
         if (composite.isServiceProvider()) {
             if (!isDynamicPort && isWSDLFullySpecified())
                 buildEndpointDescriptionFromWSDL();
@@ -1297,7 +1277,7 @@
 
                 String className = composite.getClassName();
 
-                // TODO: (JLB) This is using the classloader for EndpointDescriptionImpl; is that OK?
+                // REVIEW: This is using the classloader for EndpointDescriptionImpl; is that OK?
                 ClassLoader classLoader = (composite.isServiceProvider() && !composite.isDeprecatedServiceProviderConstruction()) ?
                         composite.getClassLoader() : this.getClass().getClassLoader();
 

Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointInterfaceDescriptionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointInterfaceDescriptionImpl.java?rev=613197&r1=613196&r2=613197&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointInterfaceDescriptionImpl.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointInterfaceDescriptionImpl.java Fri Jan 18 08:30:05 2008
@@ -66,10 +66,6 @@
     private ArrayList<OperationDescription> operationDescriptions =
             new ArrayList<OperationDescription>();
     private Map<QName, List<OperationDescription>> dispatchableOperations = new HashMap<QName, List<OperationDescription>>();
-    // This may be an actual Service Endpoint Interface -OR- it may be a service implementation class that did not 
-    // specify an @WebService.endpointInterface.
-    // TODO: (JLB) Remove commented out code
-//    private Class seiClass;
     private DescriptionBuilderComposite dbc;
 
     //Logging setup

Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/ServiceDescriptionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/ServiceDescriptionImpl.java?rev=613197&r1=613196&r2=613197&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/ServiceDescriptionImpl.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/ServiceDescriptionImpl.java Fri Jan 18 08:30:05 2008
@@ -201,9 +201,7 @@
                 URL wsdlUrl = getWSDLURL(wsdlLocation);
                 
                 if (wsdlUrl == null) {
-                    // TODO: (JLB) NLS
-                    throw ExceptionFactory.makeWebServiceException("Unable to access wsdlLocation: "
-                                                                   + wsdlLocation);
+                    throw ExceptionFactory.makeWebServiceException(Messages.getMessage("serviceDescErr4", wsdlLocation));
                 } else {
                     url = wsdlUrl;
                 }
@@ -365,8 +363,7 @@
 
             case ADD_PORT:
                 if (composite != null) {
-                    // TODO: (JLB) NLS
-                    throw ExceptionFactory.makeWebServiceException("AddPort can not have a composite");
+                    throw ExceptionFactory.makeWebServiceException(Messages.getMessage("serviceDescErr5", portQName.toString()));
                 }
                 // Port must NOT be declared (e.g. can not already exist in WSDL)
                 // If an EndpointDesc doesn't exist; create it as long as it doesn't exist in the WSDL
@@ -457,8 +454,7 @@
 
             case CREATE_DISPATCH:
                 if (composite != null) {
-                    // TODO: (JLB) NLS
-                    throw ExceptionFactory.makeWebServiceException("CreateDispatch can not have a composite");
+                    throw ExceptionFactory.makeWebServiceException(Messages.getMessage("serviceDescErr6"));
                 }
                 
                 // Port may or may not exist in WSDL.

Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/i18n/resource.properties
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/i18n/resource.properties?rev=613197&r1=613196&r2=613197&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/i18n/resource.properties (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/i18n/resource.properties Fri Jan 18 08:30:05 2008
@@ -281,4 +281,9 @@
 pDescrErr=Null Descriptor. PropertyDescriptor not found.
 pDescrErr2=No read Method found to read property Value from jaxbObject: {0} 
 restWithSOAPErr=Expected an XML over HTTP message, but the message appears to be a SOAP message.  The namespace is {0}
-noDataHandler=A data handler was not found for content id {0}
\ No newline at end of file
+noDataHandler=A data handler was not found for content id {0}
+DescriptionBuilderErr1=Unable to create composite annotation {0} due to exception {1}
+DescriptionBuilderErr2=Unable to create sparse annotation {0} from base annotation {1}
+serviceDescErr4=Unable to access wsdlLocation {0}
+serviceDescErr5=The dynamic port {0} can not specify a sparse composite.
+serviceDescErr6=Can not specify a sparse composite when calling Service.createDispatch.
\ No newline at end of file

Modified: webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/impl/ClientDBCSupportEndpointTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/impl/ClientDBCSupportEndpointTests.java?rev=613197&r1=613196&r2=613197&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/impl/ClientDBCSupportEndpointTests.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/impl/ClientDBCSupportEndpointTests.java Fri Jan 18 08:30:05 2008
@@ -22,6 +22,7 @@
 import org.apache.axis2.jaxws.description.EndpointDescription;
 import org.apache.axis2.jaxws.description.ServiceDescription;
 import org.apache.axis2.jaxws.description.builder.DescriptionBuilderComposite;
+import org.apache.axis2.jaxws.i18n.Messages;
 
 import javax.jws.WebService;
 import javax.xml.namespace.QName;
@@ -178,7 +179,8 @@
         }
         catch (WebServiceException e) {
             // Expected path
-            assertTrue(e.toString().contains("CreateDispatch can not have a composite"));
+            String msg = Messages.getMessage("serviceDescErr6");
+            assertTrue(e.toString().contains(msg));
         }
     }
     



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