You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by pr...@apache.org on 2008/01/15 17:22:27 UTC
svn commit: r612147 [14/17] - in /webservices/axis2/branches/java/jaxws21:
./ modules/adb-codegen/ modules/adb-codegen/src/org/apache/axis2/schema/
modules/adb-codegen/src/org/apache/axis2/schema/template/
modules/adb-codegen/src/org/apache/axis2/schem...
Modified: webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/builder/DescriptionBuilderComposite.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/builder/DescriptionBuilderComposite.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/builder/DescriptionBuilderComposite.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/builder/DescriptionBuilderComposite.java Tue Jan 15 08:21:22 2008
@@ -22,21 +22,34 @@
*/
package org.apache.axis2.jaxws.description.builder;
+import org.apache.axis2.java.security.AccessController;
+import org.apache.axis2.jaxws.ExceptionFactory;
import org.apache.axis2.jaxws.description.xml.handler.HandlerChainsType;
import org.apache.axis2.jaxws.util.WSDL4JWrapper;
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;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.WeakHashMap;
public class DescriptionBuilderComposite implements TMAnnotationComposite, TMFAnnotationComposite {
@@ -59,12 +72,6 @@
genericAnnotationProcessors = new HashMap<String, CustomAnnotationProcessor>();
}
- //Class type within the module
- public static enum ModuleClassType {
- SERVICEIMPL, SEI, SERVICE, SUPER, PROVIDER, FAULT}
-
- private ModuleClassType moduleClassType = null;
-
//Note: a WSDL is not necessary
private Definition wsdlDefinition = null;
private URL wsdlURL = null;
@@ -88,6 +95,8 @@
private String extendsClass; //Set to the name of the super class
private List<String> interfacesList; //Set this for all implemented interfaces
private boolean isInterface = false;
+ private QName preferredPort; // Port to use if no port QName given. May be null
+ private boolean isMTOMEnabled = false;
private List<MethodDescriptionComposite> methodDescriptions;
private List<FieldDescriptionComposite> fieldDescriptions;
@@ -109,12 +118,104 @@
// JAXB object used to represent handler chain configuration info
private HandlerChainsType handlerChainsType = null;
+
+ // Does this composite represent a service requester or service provider.
+ // We default to service provider since composites were orginally not used by requesters.
+ private boolean isServiceProvider = true;
+
+ // 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
+ // information corresponding to information in a deployment descriptor or an injected
+ // resource.
+ private WeakHashMap<Object, DescriptionBuilderComposite> sparseCompositeMap = new WeakHashMap<Object, DescriptionBuilderComposite>();
+
+ public void setSparseComposite(Object key, DescriptionBuilderComposite sparseComposite) {
+ if (key != null && sparseComposite != null) {
+ this.sparseCompositeMap.put(key, sparseComposite);
+ }
+ }
+ public DescriptionBuilderComposite getSparseComposite(Object key) {
+ return sparseCompositeMap.get(key);
+ }
+ /**
+ * For a service requester, set the QName of the preferred port for this service. This
+ * indicates which port (i.e. which EndpointDescription) should be returned if a port QName
+ * isn't specified. This may be null, indicating the first valid port in the WSDL should be
+ * returned.
+ *
+ * @param preferredPort
+ */
+ public void setPreferredPort(QName preferredPort) {
+ this.preferredPort = preferredPort;
+ }
+
+ /**
+ * For a service requester, the QName of the prefered port for this service. This indicates
+ * which port should be returned if a port QName wasn't specified. This may be null,
+ * indicating the first valid port in the WSDL should be returned.
+ * @return
+ */
+ public QName getPreferredPort() {
+ return preferredPort;
+ }
+ public QName getPreferredPort(Object key) {
+ QName returnPreferredPort = null;
+ // See if there's a sparse composite override for this composite
+ if (key != null) {
+ DescriptionBuilderComposite sparse = getSparseComposite(key);
+ if (sparse != null
+ && !DescriptionBuilderUtils.isEmpty(sparse.getPreferredPort())) {
+ returnPreferredPort = sparse.getPreferredPort();
+ } else {
+ returnPreferredPort = getPreferredPort();
+ }
+ } else {
+ returnPreferredPort = getPreferredPort();
+ }
+
+ return returnPreferredPort;
+
+ }
+
+ public void setIsMTOMEnabled(boolean isMTOMEnabled) {
+ this.isMTOMEnabled = isMTOMEnabled;
+ }
+
+ public boolean isMTOMEnabled() {
+ return isMTOMEnabled;
+ }
+
+ public boolean isMTOMEnabled(Object key) {
+ boolean returnIsMTOMEnabled = false;
+ if (key != null) {
+ DescriptionBuilderComposite sparseDBC = getSparseComposite(key);
+ if (sparseDBC != null && sparseDBC.isMTOMEnabled()) {
+ returnIsMTOMEnabled = sparseDBC.isMTOMEnabled();
+ } else {
+ returnIsMTOMEnabled = isMTOMEnabled();
+ }
+
+ } else {
+ returnIsMTOMEnabled = isMTOMEnabled();
+ }
+
+ return returnIsMTOMEnabled;
+ }
+
// Methods
public WebServiceAnnot getWebServiceAnnot() {
- return this.webServiceAnnot;
+ return webServiceAnnot =
+ (WebServiceAnnot) getCompositeAnnotation(webServiceAnnot,
+ WebServiceAnnot.class,
+ javax.jws.WebService.class);
}
-
+
/** @return Returns the classModifiers. */
public String[] getClassModifiers() {
return classModifiers;
@@ -122,8 +223,17 @@
/** @return Returns the className. */
public String getClassName() {
- return className;
+ if (className != null) {
+ return className;
+ }
+ else if (theCorrespondingClass != null) {
+ return theCorrespondingClass.getName();
+ }
+ else {
+ return null;
+ }
}
+
/** @return Returns the super class name. */
public String getSuperClassName() {
@@ -137,32 +247,100 @@
/** @return Returns the handlerChainAnnotImpl. */
public HandlerChainAnnot getHandlerChainAnnot() {
- return handlerChainAnnot;
+ return handlerChainAnnot =
+ (HandlerChainAnnot) getCompositeAnnotation(handlerChainAnnot,
+ HandlerChainAnnot.class,
+ javax.jws.HandlerChain.class);
}
/** @return Returns the serviceModeAnnot. */
public ServiceModeAnnot getServiceModeAnnot() {
- return serviceModeAnnot;
+ return serviceModeAnnot =
+ (ServiceModeAnnot) getCompositeAnnotation(serviceModeAnnot,
+ ServiceModeAnnot.class,
+ javax.xml.ws.ServiceMode.class);
}
/** @return Returns the soapBindingAnnot. */
public SoapBindingAnnot getSoapBindingAnnot() {
- return soapBindingAnnot;
+ return soapBindingAnnot =
+ (SoapBindingAnnot) getCompositeAnnotation(soapBindingAnnot,
+ SoapBindingAnnot.class,
+ javax.jws.soap.SOAPBinding.class);
}
/** @return Returns the webFaultAnnot. */
public WebFaultAnnot getWebFaultAnnot() {
- return webFaultAnnot;
+ return webFaultAnnot =
+ (WebFaultAnnot) getCompositeAnnotation(webFaultAnnot,
+ WebFaultAnnot.class,
+ javax.xml.ws.WebFault.class);
}
/** @return Returns the webServiceClientAnnot. */
public WebServiceClientAnnot getWebServiceClientAnnot() {
- return webServiceClientAnnot;
+ return webServiceClientAnnot =
+ (WebServiceClientAnnot) getCompositeAnnotation(webServiceClientAnnot,
+ WebServiceClientAnnot.class,
+ javax.xml.ws.WebServiceClient.class);
+ }
+
+ public WebServiceClientAnnot getWebServiceClientAnnot(Object key) {
+ WebServiceClientAnnot annot = getWebServiceClientAnnot();
+ DescriptionBuilderComposite sparseComposite = getSparseComposite(key);
+ WebServiceClientAnnot sparseAnnot = null;
+ if (sparseComposite != null) {
+ sparseAnnot = sparseComposite.getWebServiceClientAnnot();
+ }
+ return WebServiceClientAnnot.createFromAnnotation(annot, sparseAnnot);
+ }
+
+ /**
+ * Return a composite annotation of the specified type. If the composite annotation is
+ * null, then the associated class (if not null) will be examined for the appropriate java
+ * annotation. If one is found, it will be used to create a new composite annotation.
+ *
+ * @param compositeAnnotation May be null. The current composite annotation. If this is
+ * non-null, it will simply be returned.
+ * @param compositeAnnotClass The class of the composite annotation. This is a subclass of
+ * the java annotation class.
+ * @param javaAnnotationClass The java annotation class. The associated class will be
+ * reflected on to see if this annotation exists. If so, it is used to create an instance of
+ * the composite annotation class.
+ * @return
+ */
+ private Annotation getCompositeAnnotation(Annotation compositeAnnotation,
+ Class compositeAnnotClass,
+ Class javaAnnotationClass) {
+ Annotation returnAnnotation = compositeAnnotation;
+ if (returnAnnotation == null && theCorrespondingClass != null) {
+ // Get the annotation from the class and if one exists, construct a composite annot for it
+ Annotation annotationFromClass = getAnnotationFromClass(theCorrespondingClass, javaAnnotationClass);
+ if (annotationFromClass != null) {
+ try {
+ Method createAnnot = compositeAnnotClass.getMethod("createFromAnnotation", Annotation.class);
+ returnAnnotation = (Annotation) createAnnot.invoke(null, annotationFromClass);
+ } catch (Exception e) {
+ if (log.isDebugEnabled()) {
+ log.debug("Unable to create composite annotation due to exception."
+ + " Composite Annotation: " + compositeAnnotation
+ + "; Composite Annot class: " + compositeAnnotClass
+ + "; Java Annot class: " + javaAnnotationClass, e);
+ }
+ // TODO: (JLB) NLS
+ throw ExceptionFactory.makeWebServiceException("Unable to create composite annotation", e);
+ }
+ }
+ }
+ return returnAnnotation;
}
/** @return Returns the webServiceProviderAnnot. */
public WebServiceProviderAnnot getWebServiceProviderAnnot() {
- return webServiceProviderAnnot;
+ return webServiceProviderAnnot =
+ (WebServiceProviderAnnot) getCompositeAnnotation(webServiceProviderAnnot,
+ WebServiceProviderAnnot.class,
+ javax.xml.ws.WebServiceProvider.class);
}
/** @return Returns the webServiceRefAnnot list. */
@@ -187,12 +365,14 @@
/** @return Returns the webServiceRefAnnot. */
public BindingTypeAnnot getBindingTypeAnnot() {
- return bindingTypeAnnot;
+ return (BindingTypeAnnot) getCompositeAnnotation(bindingTypeAnnot,
+ BindingTypeAnnot.class,
+ javax.xml.ws.BindingType.class);
}
/** @return Returns the webServiceContextAnnot. */
public WebServiceContextAnnot getWebServiceContextAnnot() {
- return webServiceContextAnnot;
+ return (WebServiceContextAnnot) webServiceContextAnnot;
}
/** @return Returns the wsdlDefinition */
@@ -446,22 +626,11 @@
fieldDescriptions.add(fieldDescription);
}
- /** @return Returns the ModuleClassType. */
- public ModuleClassType getClassType() {
-
- if (moduleClassType == null) {
- //TODO: Determine the class type
- }
- return moduleClassType;
- }
-
- /** @return Returns the ModuleClassType. */
public void setCustomWsdlGenerator(WsdlGenerator wsdlGenerator) {
this.wsdlGenerator = wsdlGenerator;
}
- /** @return Returns the ModuleClassType. */
public void setClassLoader(ClassLoader classLoader) {
this.classLoader = classLoader;
@@ -482,6 +651,70 @@
public void setHandlerChainsType(HandlerChainsType handlerChainsType) {
this.handlerChainsType = handlerChainsType;
}
+
+ /**
+ * Answer does this composite represent a service requester (aka client) or a service
+ * provider (aka server).
+ *
+ * @return true if this is a service provider (aka an endpoint or a service implementation
+ * or a server)
+ *
+ */
+ public boolean isServiceProvider() {
+ return isServiceProvider;
+ }
+
+ /**
+ * Set the indication of whether this composite represents a service requester (aka client) or
+ * a service provider (aka server).
+ */
+ public void setIsServiceProvider(boolean value) {
+ isServiceProvider = value;
+ }
+
+ /**
+ * Set the class associated with this composite. For a service requester, this could be the
+ * Service class or the SEI class. For a service provider this will be null (unless the
+ * deprecated service construction logic in DescriptionFactory is used)
+ * @param theClass
+ */
+ public void setCorrespondingClass(Class theClass) {
+ this.theCorrespondingClass = theClass;
+ }
+
+ /**
+ * Returns the corresponding class associated with this composite, if any.
+ * @return
+ */
+ public Class getCorrespondingClass() {
+ return theCorrespondingClass;
+ }
+
+ /**
+ * @deprecated
+ */
+ private boolean isDeprecatedServiceProviderConstruction = false;
+ /**
+ * Answer if this composite represents a service provider that was constructed using the
+ * deprecated path (used for testing only and being removed). Once that deprecated path
+ * is removed, this method and all code blocks referencing it can be removed.
+ *
+ * @see org.apache.axis2.jaxws.description.DescriptionFactory.createServiceDescriptionFromServiceImpl
+ *
+ * @deprecated
+ * @return true if the this was constructed with the deprecated logic
+ */
+ public boolean isDeprecatedServiceProviderConstruction() {
+ return isDeprecatedServiceProviderConstruction;
+ }
+ /**
+ * @deprecated
+ * @param value
+ */
+ public void setIsDeprecatedServiceProviderConstruction(boolean value) {
+ isDeprecatedServiceProviderConstruction = value;
+ }
+
/**
* Convenience method for unit testing. We will print all of the
@@ -624,5 +857,21 @@
}
return wsdlDef;
+ }
+
+ /**
+ * Get an annotation by introspecting on a class. This is wrappered to avoid a Java2Security violation.
+ * @param cls Class that contains annotation
+ * @param annotation Class of requrested Annotation
+ * @return annotation or null
+ */
+ private static Annotation getAnnotationFromClass(final Class cls, final Class annotation) {
+ return (Annotation) AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+
+ Annotation a = cls.getAnnotation(annotation);
+ return a;
+ }
+ });
}
}
Modified: webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/builder/DescriptionBuilderUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/builder/DescriptionBuilderUtils.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/builder/DescriptionBuilderUtils.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/builder/DescriptionBuilderUtils.java Tue Jan 15 08:21:22 2008
@@ -23,6 +23,8 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import javax.xml.namespace.QName;
+
/**
*
*/
@@ -330,7 +332,7 @@
//Use the thread context class loader to load the class.
try {
returnClass = ClassLoaderUtils.forName(classToLoad, false,
- ClassLoaderUtils.getContextClassLoader());
+ ClassLoaderUtils.getContextClassLoader(null));
}
catch (Throwable ex) {
//Use the default classloader to load the class.
@@ -347,6 +349,14 @@
}
}
return returnClass;
+ }
+
+ static boolean isEmpty(String string) {
+ return (string == null || "".equals(string));
+ }
+
+ static boolean isEmpty(QName qname) {
+ return qname == null || isEmpty(qname.getLocalPart());
}
}
Modified: webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/builder/HandlerChainAnnot.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/builder/HandlerChainAnnot.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/builder/HandlerChainAnnot.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/builder/HandlerChainAnnot.java Tue Jan 15 08:21:22 2008
@@ -30,9 +30,23 @@
private HandlerChainAnnot() {
}
+
+ private HandlerChainAnnot(String file, String name) {
+ this.file = file;
+ this.name = name;
+ }
public static HandlerChainAnnot createHandlerChainAnnotImpl() {
return new HandlerChainAnnot();
+ }
+
+ public static HandlerChainAnnot createFromAnnotation(Annotation annotation) {
+ HandlerChainAnnot returnAnnot = null;
+ if (annotation != null && annotation instanceof javax.jws.HandlerChain) {
+ javax.jws.HandlerChain hc = (javax.jws.HandlerChain) annotation;
+ returnAnnot = new HandlerChainAnnot(hc.file(), hc.name());
+ }
+ return returnAnnot;
}
public String file() {
Modified: webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/builder/MDQConstants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/builder/MDQConstants.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/builder/MDQConstants.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/builder/MDQConstants.java Tue Jan 15 08:21:22 2008
@@ -48,4 +48,16 @@
public static final String RETURN_TYPE_FUTURE = "java.util.concurrent.Future";
public static final String RETURN_TYPE_RESPONSE = "javax.xml.ws.Response";
+
+ public static final String CLIENT_SERVICE_CLASS = "CLIENT_SERVICE_CLASS";
+ public static final String CLIENT_SEI_CLASS = "CLIENT_SEI_CLASS";
+
+ //Represent SOAP/JMS Bindings
+ //REVIEW: SOAP-JMS may be using the same NS for SOAP11 and SOAP12,
+ // if so we could remove some duplicate values below
+ public static final String SOAP11JMS_BINDING = "http://www.example.org/2006/06/soap/bindings/JMS/";
+ public static final String SOAP12JMS_BINDING = "http://www.example.org/2006/06/soap/bindings/JMS/";
+ public static final String SOAP11JMS_MTOM_BINDING = "http://http://www.example.org/2006/06/soap/bindings/JMS/?mtom=true";
+ public static final String SOAP12JMS_MTOM_BINDING = "http://http://www.example.org/2006/06/soap/bindings/JMS/?mtom=true";
+
}
Modified: webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/builder/ServiceModeAnnot.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/builder/ServiceModeAnnot.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/builder/ServiceModeAnnot.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/builder/ServiceModeAnnot.java Tue Jan 15 08:21:22 2008
@@ -42,6 +42,15 @@
public static ServiceModeAnnot createWebServiceAnnotImpl(Service.Mode value) {
return new ServiceModeAnnot(value);
}
+
+ public static ServiceModeAnnot createFromAnnotation(Annotation annotation) {
+ ServiceModeAnnot returnAnnot = null;
+ if (annotation != null && annotation instanceof javax.xml.ws.ServiceMode) {
+ javax.xml.ws.ServiceMode sm = (javax.xml.ws.ServiceMode) annotation;
+ returnAnnot = new ServiceModeAnnot(sm.value());
+ }
+ return returnAnnot;
+ }
public Service.Mode value() {
return this.value;
Modified: webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/builder/SoapBindingAnnot.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/builder/SoapBindingAnnot.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/builder/SoapBindingAnnot.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/builder/SoapBindingAnnot.java Tue Jan 15 08:21:22 2008
@@ -31,9 +31,26 @@
private SoapBindingAnnot() {
}
+
+ private SoapBindingAnnot(Style style, Use use, ParameterStyle paramStyle) {
+ this.style = style;
+ this.use = use;
+ this.parameterStyle = paramStyle;
+ }
public static SoapBindingAnnot createSoapBindingAnnotImpl() {
return new SoapBindingAnnot();
+ }
+ public static SoapBindingAnnot createFromAnnotation(Annotation annotation) {
+ SoapBindingAnnot returnAnnot = null;
+ if (annotation != null && annotation instanceof javax.jws.soap.SOAPBinding) {
+ javax.jws.soap.SOAPBinding sb = (javax.jws.soap.SOAPBinding) annotation;
+ returnAnnot = new SoapBindingAnnot(sb.style(),
+ sb.use(),
+ sb.parameterStyle());
+ }
+
+ return returnAnnot;
}
public Style style() {
Modified: webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/builder/WebServiceAnnot.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/builder/WebServiceAnnot.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/builder/WebServiceAnnot.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/builder/WebServiceAnnot.java Tue Jan 15 08:21:22 2008
@@ -69,6 +69,21 @@
endpointInterface,
portName);
}
+
+ public static WebServiceAnnot createFromAnnotation(Annotation annotation) {
+ WebServiceAnnot returnAnnot = null;
+ if (annotation != null && annotation instanceof javax.jws.WebService) {
+ javax.jws.WebService ws = (javax.jws.WebService) annotation;
+ return new WebServiceAnnot(ws.name(),
+ ws.targetNamespace(),
+ ws.serviceName(),
+ ws.wsdlLocation(),
+ ws.endpointInterface(),
+ ws.portName());
+
+ }
+ return returnAnnot;
+ }
public String name() {
return this.name;
Modified: webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/builder/WebServiceClientAnnot.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/builder/WebServiceClientAnnot.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/builder/WebServiceClientAnnot.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/builder/WebServiceClientAnnot.java Tue Jan 15 08:21:22 2008
@@ -19,6 +19,8 @@
package org.apache.axis2.jaxws.description.builder;
+import org.apache.axis2.jaxws.ExceptionFactory;
+
import java.lang.annotation.Annotation;
public class WebServiceClientAnnot implements javax.xml.ws.WebServiceClient {
@@ -27,7 +29,6 @@
private String targetNamespace;
private String wsdlLocation;
-
/** A WebServiceClientAnnot cannot be instantiated. */
private WebServiceClientAnnot() {
@@ -56,6 +57,80 @@
wsdlLocation);
}
+ /**
+ * Create an instance of this annotation using the values from the annotation instance
+ * passed in.
+ *
+ * @param annotation Use the values to create a new instance of annotation. Note this could
+ * be an instance of the java annotation superclass as well.
+ * @return a new instance of this annotation or null if one could not be created with the
+ * annotation passed in.
+ */
+ public static WebServiceClientAnnot createFromAnnotation(Annotation annotation) {
+ WebServiceClientAnnot returnAnnot = null;
+ if (annotation != null && annotation instanceof javax.xml.ws.WebServiceClient) {
+ javax.xml.ws.WebServiceClient wsc = (javax.xml.ws.WebServiceClient) annotation;
+ returnAnnot = new WebServiceClientAnnot(wsc.name(),
+ wsc.targetNamespace(),
+ wsc.wsdlLocation());
+ }
+ return returnAnnot;
+ }
+
+ /**
+ * Create a new instance of this annotation using the values from the two annotations passed
+ * in as arguments. If either is null, the new annotation is created with the non-null
+ * annotation's values. If both are null, then no annotation is created. Non-empty values in
+ * the sparse annotation (if any) will override the values in the base annotation.
+ *
+ * @param baseAnnotation Initial values to be used in creating the annotation. May be null.
+ * @param sparseAnnotation Non-empty values (not null and not "") will override values in
+ * the base annotation.
+ * @return A new annotation created from the arguments, or null if one could not be created.
+ */
+ public static WebServiceClientAnnot createFromAnnotation(Annotation baseAnnotation,
+ Annotation sparseAnnotation) {
+ WebServiceClientAnnot returnAnnot = null;
+ javax.xml.ws.WebServiceClient baseWSCAnnotation = null;
+ javax.xml.ws.WebServiceClient sparseWSCAnnotation = null;
+
+ if (baseAnnotation != null && baseAnnotation instanceof javax.xml.ws.WebServiceClient) {
+ baseWSCAnnotation = (javax.xml.ws.WebServiceClient) baseAnnotation;
+ }
+
+ if (sparseAnnotation != null && sparseAnnotation instanceof javax.xml.ws.WebServiceClient) {
+ sparseWSCAnnotation = (javax.xml.ws.WebServiceClient) sparseAnnotation;
+ }
+
+ if (baseWSCAnnotation != null && sparseWSCAnnotation != null) {
+ // Both specified, create based on the base annotation merged with the sparse
+ // annotation
+ returnAnnot = WebServiceClientAnnot.createFromAnnotation(baseWSCAnnotation);
+ if (!DescriptionBuilderUtils.isEmpty(sparseWSCAnnotation.name())) {
+ returnAnnot.setName(sparseWSCAnnotation.name());
+ }
+ if (!DescriptionBuilderUtils.isEmpty(sparseWSCAnnotation.targetNamespace())) {
+ returnAnnot.setTargetNamespace(sparseWSCAnnotation.targetNamespace());
+ }
+ if (!DescriptionBuilderUtils.isEmpty(sparseWSCAnnotation.wsdlLocation())) {
+ returnAnnot.setWsdlLocation(sparseWSCAnnotation.wsdlLocation());
+ }
+ } else if (baseWSCAnnotation != null && sparseWSCAnnotation == null) {
+ // There's no sparse information, so just create from the base annotation
+ returnAnnot = WebServiceClientAnnot.createFromAnnotation(baseWSCAnnotation);
+ } else if (baseWSCAnnotation == null && sparseWSCAnnotation != null) {
+ // There's only sparse information, so create a new annotation based on that
+ returnAnnot = WebServiceClientAnnot.createFromAnnotation(sparseWSCAnnotation);
+ } else if (baseWSCAnnotation == null && sparseWSCAnnotation == null) {
+ // 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);
+ }
+
+ return returnAnnot;
+ }
/** @return Returns the name. */
public String name() {
@@ -108,5 +183,4 @@
sb.append(newLine);
return sb.toString();
}
-
}
Modified: webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/builder/WebServiceProviderAnnot.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/builder/WebServiceProviderAnnot.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/builder/WebServiceProviderAnnot.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/builder/WebServiceProviderAnnot.java Tue Jan 15 08:21:22 2008
@@ -61,6 +61,20 @@
portName,
targetNamespace);
}
+
+ public static WebServiceProviderAnnot createFromAnnotation(Annotation annotation) {
+ WebServiceProviderAnnot returnAnnot = null;
+ if (annotation != null && annotation instanceof javax.xml.ws.WebServiceProvider) {
+ javax.xml.ws.WebServiceProvider wsp = (javax.xml.ws.WebServiceProvider) annotation;
+ returnAnnot = new WebServiceProviderAnnot(wsp.wsdlLocation(),
+ wsp.serviceName(),
+ wsp.portName(),
+ wsp.targetNamespace());
+
+ }
+
+ return returnAnnot;
+ }
/** @return Returns the portName. */
public String portName() {
Modified: webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/builder/WebServiceRefAnnot.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/builder/WebServiceRefAnnot.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/builder/WebServiceRefAnnot.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/builder/WebServiceRefAnnot.java Tue Jan 15 08:21:22 2008
@@ -28,7 +28,8 @@
private Class type;
private Class value;
private String mappedName = "";
-
+
+ // TODO: (JLB) Remove the String versions of the Class attributes?
private String typeString = "";
private String valueString = "";
@@ -42,6 +43,20 @@
String wsdlLocation,
Class type,
Class value,
+ String mappedName) {
+ this.name = name;
+ this.wsdlLocation = wsdlLocation;
+ this.type = type;
+ this.value = value;
+ this.mappedName = mappedName;
+ }
+
+ // TODO: (JLB) Deprecate or remove this; has both Class and String for value and type
+ private WebServiceRefAnnot(
+ String name,
+ String wsdlLocation,
+ Class type,
+ Class value,
String mappedName,
String typeString,
String valueString) {
@@ -63,6 +78,25 @@
String wsdlLocation,
Class type,
Class value,
+ String mappedName) {
+ return new WebServiceRefAnnot(name,
+ wsdlLocation,
+ type,
+ value,
+ mappedName);
+ }
+
+ // TODO: (JLB) Why is there both a class and String for type and value?
+ // There isn't on the actual annotation, only the class is there
+ // Looks like SERV1/ws/code/websvcs/src/com/ibm/ws/websvcs/annotations/adapters/WebServiceRefAdapter.java
+ // only reference in WAS to the string "createWebServiceRefAnnotImpl", and it sets the String values, not the classes
+ // Check with Dustin, can they give us the class (instead of string) since we may not have the right classloader
+ // to create the class when the getter is called.
+ public static WebServiceRefAnnot createWebServiceRefAnnotImpl(
+ String name,
+ String wsdlLocation,
+ Class type,
+ Class value,
String mappedName,
String typeString,
String valueString
@@ -102,11 +136,13 @@
return wsdlLocation;
}
+ // TODO: (JLB) Remove this?
/** @return Returns the typeString. */
public String getTypeString() {
return typeString;
}
+ // TODO: (JLB) Remove this?
/** @return Returns the valueString. */
public String getValueString() {
return valueString;
@@ -142,11 +178,13 @@
return wsdlLocation;
}
+ // TODO: (JLB) Remove this?
/** @param typeString The typeString to set. */
public void setTypeString(String typeString) {
this.typeString = typeString;
}
+ // TODO: (JLB) Remove this?
/** @param valueString The valueString to set. */
public void setValueString(String valueString) {
this.valueString = valueString;
Modified: webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/impl/DescriptionFactoryImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/impl/DescriptionFactoryImpl.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/impl/DescriptionFactoryImpl.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/impl/DescriptionFactoryImpl.java Tue Jan 15 08:21:22 2008
@@ -69,12 +69,24 @@
}
/**
+ * @see org.apache.axis2.jaxws.description.DescriptionFactory#createServiceDescription(URL, QName, Class, DescriptionBuilderComposite)
+ */
+ public static ServiceDescription createServiceDescription(URL wsdlURL,
+ QName serviceQName,
+ Class serviceClass) {
+ return createServiceDescription(wsdlURL, serviceQName, serviceClass, null, null);
+
+ }
+
+ /**
* @see org.apache.axis2.jaxws.description.DescriptionFactory#createServiceDescription(URL,
* QName, Class)
*/
public static ServiceDescription createServiceDescription(URL wsdlURL,
QName serviceQName,
- Class serviceClass) {
+ Class serviceClass,
+ DescriptionBuilderComposite sparseComposite,
+ Object sparseCompositeKey) {
ConfigurationContext configContext = DescriptionFactory.createClientConfigurationFactory()
.getClientConfigurationContext();
DescriptionKey key = new DescriptionKey(serviceQName, wsdlURL, serviceClass, configContext);
@@ -102,7 +114,21 @@
log.debug(" creating new ServiceDescriptionImpl");
}
- ServiceDescriptionImpl serviceDescImpl = new ServiceDescriptionImpl(wsdlURL, serviceQName, serviceClass);
+ ServiceDescriptionImpl serviceDescImpl = null;
+ if (sparseComposite != null) {
+ serviceDescImpl = new ServiceDescriptionImpl(wsdlURL, serviceQName,
+ serviceClass, sparseComposite,
+ sparseCompositeKey);
+ if (log.isDebugEnabled()) {
+ log.debug("Client-side service description created with service class: " + serviceClass
+ + ", Service QN: " + serviceQName
+ + ", and DBC: " + sparseComposite);
+ log.debug(serviceDescImpl.toString());
+ }
+
+ } else {
+ serviceDescImpl = new ServiceDescriptionImpl(wsdlURL, serviceQName, serviceClass);
+ }
serviceDescImpl.setAxisConfigContext(configContext);
serviceDesc = serviceDescImpl;
@@ -115,6 +141,11 @@
log.debug("Caching new ServiceDescription in the cache");
}
cache.put(key, serviceDesc);
+ } else {
+ // A service description was found in the cache. If a sparse composite was
+ // specified, then set it on the found service desc
+ ((ServiceDescriptionImpl) serviceDesc).getDescriptionBuilderComposite().
+ setSparseComposite(sparseCompositeKey, sparseComposite);
}
}
return serviceDesc;
@@ -257,11 +288,22 @@
public static EndpointDescription updateEndpoint(
ServiceDescription serviceDescription, Class sei, QName portQName,
DescriptionFactory.UpdateType updateType) {
+ return updateEndpoint(serviceDescription, sei, portQName, updateType, null, null);
+ }
+
+ /**
+ * @see org.apache.axis2.jaxws.description.DescriptionFactory#updateEndpoint(ServiceDescription, Class, QName, org.apache.axis2.jaxws.description.DescriptionFactory.UpdateType, DescriptionBuilderComposite)
+ */
+ public static EndpointDescription updateEndpoint(
+ ServiceDescription serviceDescription, Class sei, QName portQName,
+ DescriptionFactory.UpdateType updateType,
+ DescriptionBuilderComposite composite,
+ Object compositeKey) {
EndpointDescription endpointDesc = null;
synchronized(serviceDescription) {
endpointDesc =
((ServiceDescriptionImpl)serviceDescription)
- .updateEndpointDescription(sei, portQName, updateType);
+ .updateEndpointDescription(sei, portQName, updateType, composite, compositeKey);
}
EndpointDescriptionValidator endpointValidator = new EndpointDescriptionValidator(endpointDesc);
Modified: webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/impl/DescriptionUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/impl/DescriptionUtils.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/impl/DescriptionUtils.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/impl/DescriptionUtils.java Tue Jan 15 08:21:22 2008
@@ -145,25 +145,6 @@
}
/**
- * Return the name of the class without any package qualifier. This method should be DEPRECATED
- * when DBC support is complete
- *
- * @param theClass
- * @return the name of the class sans package qualification.
- */
- static String getSimpleJavaClassName(Class theClass) {
- String returnName = null;
- if (theClass != null) {
- String fqName = theClass.getName();
- // We need the "simple name", so strip off any package information from the name
- int endOfPackageIndex = fqName.lastIndexOf('.');
- int startOfClassIndex = endOfPackageIndex + 1;
- returnName = fqName.substring(startOfClassIndex);
- }
- return returnName;
- }
-
- /**
* Return the name of the class without any package qualifier.
*
* @param theClass
@@ -184,26 +165,6 @@
}
/**
- * Returns the package name from the class. If no package, then returns null This method should
- * be DEPRECATED when DBC support is complete
- *
- * @param theClass
- * @return
- */
- static String getJavaPackageName(Class theClass) {
- String returnPackage = null;
- if (theClass != null) {
- String fqName = theClass.getName();
- // Get the package name, if there is one
- int endOfPackageIndex = fqName.lastIndexOf('.');
- if (endOfPackageIndex >= 0) {
- returnPackage = fqName.substring(0, endOfPackageIndex);
- }
- }
- return returnPackage;
- }
-
- /**
* Returns the package name from the class. If no package, then returns null
*
* @param theClassName
@@ -417,6 +378,22 @@
}
return ((SOAP12Header) extObj).getNamespaceURI();
}
+ else if (extObj instanceof MIMEMultipartRelated) {
+ if (log.isDebugEnabled()) {
+ log.debug("Found a MIMEMultipartRelated element. Unwrapping to get SOAP binding.");
+ }
+ MIMEMultipartRelated mime = (MIMEMultipartRelated) extObj;
+ List mimeParts = mime.getMIMEParts();
+
+ Iterator itr = mimeParts.iterator();
+ while (itr.hasNext()) {
+ MIMEPart mimePart = (MIMEPart) itr.next();
+ List elements = mimePart.getExtensibilityElements();
+
+ String ns = getNamespaceFromSOAPElement(elements);
+ return ns;
+ }
+ }
}
return null;
}
@@ -433,21 +410,17 @@
if (bindingOp.getName().equals(opDesc.getName().getLocalPart())) {
if (bindingOp.getBindingInput() != null) {
if (log.isDebugEnabled()) {
- log.debug("Processing binding input");
+ log.debug("Processing binding opertion input");
}
- processBindingForMIME(bindingOp.getBindingInput()
- .getExtensibilityElements(),
- opDesc,
- bindingOp.getOperation());
+ processBindingForMIME(bindingOp.getBindingInput().getExtensibilityElements(),
+ opDesc, bindingOp.getOperation(), true);
}
if (bindingOp.getBindingOutput() != null) {
if (log.isDebugEnabled()) {
log.debug("Processing binding output");
}
- processBindingForMIME(bindingOp.getBindingOutput()
- .getExtensibilityElements(),
- opDesc,
- bindingOp.getOperation());
+ processBindingForMIME(bindingOp.getBindingOutput().getExtensibilityElements(),
+ opDesc, bindingOp.getOperation(), false);
}
}
}
@@ -460,16 +433,24 @@
* does it will build up the appropriate AttachmentDescription objects.
*/
private static void processBindingForMIME(List extensibilityElements,
- OperationDescriptionImpl opDesc, Operation operation) {
+ OperationDescriptionImpl opDesc,
+ Operation operation,
+ boolean isRequest) {
Iterator extensibilityIter = extensibilityElements.iterator();
while (extensibilityIter.hasNext()) {
Object obj = extensibilityIter.next();
if (obj instanceof MIMEMultipartRelated) {
+ if (log.isDebugEnabled()) {
+ log.debug("Found a mime:multipartRelated extensiblity element.");
+ }
// Found mime information now process it and determine if we need to
// create an AttachmentDescription
MIMEMultipartRelated mime = (MIMEMultipartRelated) obj;
Iterator partIter = mime.getMIMEParts().iterator();
while (partIter.hasNext()) {
+ if (log.isDebugEnabled()) {
+ log.debug("Found a mime:part child element.");
+ }
MIMEPart mimePart = (MIMEPart) partIter.next();
Iterator mExtIter = mimePart.getExtensibilityElements().iterator();
// Process each mime part to determine if there is mime content
@@ -495,6 +476,19 @@
log.debug("Already created AttachmentDescription for part: "
+ part + " of type: " + type);
}
+ }
+ }
+ else if (obj2 instanceof SOAPBody || obj2 instanceof SOAP12Body) {
+ if (log.isDebugEnabled()) {
+ log.debug("Found a body element with potential nested mime content");
+ }
+
+ // Flag whether there's a potential nested attachment.
+ if (isRequest) {
+ opDesc.setHasRequestSwaRefAttachments(true);
+ }
+ else {
+ opDesc.setHasResponseSwaRefAttachments(true);
}
}
}
Modified: webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java Tue Jan 15 08:21:22 2008
@@ -54,7 +54,6 @@
import org.apache.axis2.AxisFault;
import org.apache.axis2.client.ServiceClient;
import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.deployment.DeploymentException;
import org.apache.axis2.description.AxisService;
import org.apache.axis2.description.OutInAxisOperation;
import org.apache.axis2.description.OutOnlyAxisOperation;
@@ -123,12 +122,6 @@
// it will NOT be set for a Provider-based implementation
private EndpointInterfaceDescription endpointInterfaceDescription;
- // This can be an SEI (on the client or server) or a Service implentation (server only)
- // Note that for clients that are Dispatch, this will be null. Also note that a client that was initially
- // dispatch (sei = null) could later do a getPort(sei), at which time the original EndpointDescription will be
- // updated with the SEI information.
- private Class implOrSEIClass;
-
//On Client side, there should be One ServiceClient instance per AxisSerivce
private ServiceClient serviceClient = null;
@@ -199,7 +192,8 @@
/**
- * Create an EndpointDescription based on the WSDL port. Note that per the JAX-WS Spec (Final
+ * Create a service-requester side EndpointDescription based on the WSDL port.
+ * Note that per the JAX-WS Spec (Final
* Release, 4/19/2006 Section 4.2.3 Proxies, page 55)the "namespace component of the port is the
* target namespace of the WSDL definition document". Note this is currently only used on the
* client-side (this may change).
@@ -208,23 +202,41 @@
* don't use an SEI
*/
EndpointDescriptionImpl(Class theClass, QName portName, ServiceDescriptionImpl parent) {
- this(theClass, portName, false, parent);
+ this(theClass, portName, parent, null, null);
+ }
+ EndpointDescriptionImpl(Class theClass, QName portName, ServiceDescriptionImpl parent,
+ DescriptionBuilderComposite dbc, Object compositeKey ) {
+ this(theClass, portName, false, parent, dbc, compositeKey);
}
-
EndpointDescriptionImpl(Class theClass, QName portName, boolean dynamicPort,
ServiceDescriptionImpl parent) {
-
+ this(theClass, portName, dynamicPort, parent, null, null);
+ }
+
+ EndpointDescriptionImpl(Class theClass, QName portName, boolean dynamicPort,
+ ServiceDescriptionImpl parent,
+ DescriptionBuilderComposite sparseComposite,
+ Object sparseCompositeKey) {
+
// TODO: This and the other constructor will (eventually) take the same args, so the logic needs to be combined
// TODO: If there is WSDL, could compare the namespace of the defn against the portQName.namespace
this.parentServiceDescription = parent;
- this.implOrSEIClass = theClass;
+ composite = new DescriptionBuilderComposite();
+ composite.setSparseComposite(sparseCompositeKey, sparseComposite);
+ 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
- if (this.implOrSEIClass != null) {
- webServiceAnnotation = (WebService)getAnnotation(implOrSEIClass,WebService.class);
- webServiceProviderAnnotation =
- (WebServiceProvider)getAnnotation(implOrSEIClass,WebServiceProvider.class);
- }
+ // 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;
if (DescriptionUtils.isEmpty(portName)) {
// If the port name is null, then per JAX-WS 2.0 spec p. 55, the runtime is responsible for selecting the port.
@@ -259,7 +271,8 @@
}
/**
- * Create an EndpointDescription based on the DescriptionBuilderComposite. Note that per the
+ * Create a service-provider side EndpointDescription based on the DescriptionBuilderComposite.
+ * Note that per the
* JAX-WS Spec (Final Release, 4/19/2006 Section 4.2.3 Proxies, page 55)the "namespace component
* of the port is the target namespace of the WSDL definition document".
*
@@ -277,8 +290,6 @@
// TODO: If there is WSDL, could compare the namespace of the defn against the portQName.namespace
this.parentServiceDescription = parent;
this.serviceImplName = serviceImplName;
- this.implOrSEIClass = null;
-
composite = getServiceDescriptionImpl().getDescriptionBuilderComposite();
if (composite == null) {
@@ -491,18 +502,24 @@
}
/**
- * Create from an annotated implementation or SEI class. Note this is
+ * Create a service-provider side EndpointDescription from an annotated implementation class. Note this is
* currently used only on the server-side (this probably won't change).
*
* @param theClass An implemntation or SEI class
* @param portName May be null; if so the annotation is used
* @param parent
+ *
+ * @deprecated
*/
EndpointDescriptionImpl(Class theClass, QName portName, AxisService axisService,
ServiceDescriptionImpl parent) {
this.parentServiceDescription = parent;
+ composite = new DescriptionBuilderComposite();
+ composite.setIsDeprecatedServiceProviderConstruction(true);
+ composite.setIsServiceProvider(true);
this.portQName = portName;
- this.implOrSEIClass = theClass;
+ composite.setCorrespondingClass(theClass);
+ composite.setClassLoader(this.getClass().getClassLoader());
this.axisService = axisService;
addToAxisService();
@@ -552,17 +569,16 @@
// Verify that one (and only one) of the required annotations is present.
// TODO: Add tests to verify this error checking
+ if (composite.isDeprecatedServiceProviderConstruction()) {
+// if (!getServiceDescriptionImpl().isDBCMap()) {
- if (!getServiceDescriptionImpl().isDBCMap()) {
-
- webServiceAnnotation = (WebService)getAnnotation(implOrSEIClass,WebService.class);
- webServiceProviderAnnotation =
- (WebServiceProvider)getAnnotation(implOrSEIClass,WebServiceProvider.class);
+ webServiceAnnotation = composite.getWebServiceAnnot();
+ webServiceProviderAnnotation = composite.getWebServiceProviderAnnot();
if (webServiceAnnotation == null && webServiceProviderAnnotation == null)
- throw ExceptionFactory.makeWebServiceException(Messages.getMessage("endpointDescriptionErr6",implOrSEIClass.getName()));
+ throw ExceptionFactory.makeWebServiceException(Messages.getMessage("endpointDescriptionErr6",composite.getClassName()));
else if (webServiceAnnotation != null && webServiceProviderAnnotation != null)
- throw ExceptionFactory.makeWebServiceException(Messages.getMessage("endpointDescriptionErr7",implOrSEIClass.getName()));
+ throw ExceptionFactory.makeWebServiceException(Messages.getMessage("endpointDescriptionErr7",composite.getClassName()));
}
// If portName was specified, set it. Otherwise, we will get it from the appropriate
// annotation when the getter is called.
@@ -580,18 +596,22 @@
// that this is also called with just an SEI interface from svcDesc.updateWithSEI()
String seiClassName = getAnnoWebServiceEndpointInterface();
- if (!getServiceDescriptionImpl().isDBCMap()) {
+ 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.
- seiClass = implOrSEIClass;
+ seiClass = composite.getCorrespondingClass();
} else {
+ // TODO: (JLB) 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());
+ ClassLoaderUtils.getContextClassLoader(this.axisService != null ? this.axisService.getClassLoader() : null));
// Catch Throwable as ClassLoader can throw an NoClassDefFoundError that
// does not extend Exception, so lets catch everything that extends Throwable
// rather than just Exception.
@@ -683,7 +703,7 @@
return isDynamicPort;
}
- void updateWithSEI(Class sei) {
+ void updateWithSEI(Class sei, DescriptionBuilderComposite sparseComposite, Object sparseCompositeKey) {
// Updating with an SEI is only valid for declared ports; it is not valid for dynamic ports.
if (isDynamicPort()) {
throw ExceptionFactory.makeWebServiceException(Messages.getMessage("updateWithSEIErr1",portQName.toString()));
@@ -691,6 +711,8 @@
if (sei == null) {
throw ExceptionFactory.makeWebServiceException(Messages.getMessage("updateWithSEIErr2",portQName.toString()));
}
+
+ composite.setSparseComposite(sparseCompositeKey, sparseComposite);
if (endpointInterfaceDescription != null) {
// The EndpointInterfaceDescription was created previously based on the port declaration (i.e. WSDL)
@@ -731,10 +753,32 @@
Parameter portParameter = new Parameter();
portParameter.setName(WSDL11ToAllAxisServicesBuilder.WSDL_PORT);
portParameter.setValue(portQName.getLocalPart());
+
+ // Store the service class fully qualified name
+ Parameter serviceClassNameParam = new Parameter();
+ serviceClassNameParam.setName(MDQConstants.CLIENT_SERVICE_CLASS);
+ String serviceClassName = this.getServiceDescriptionImpl().getServiceClassName();
+ if(log.isDebugEnabled()) {
+ log.debug("Setting service class name parameter to: " + serviceClassName +
+ " on AxisService: " + axisService + "@" + axisService.hashCode());
+ }
+ serviceClassNameParam.setValue(serviceClassName);
+
+ // Store the sei class fully qualified name, if it is available
+ Parameter seiClassNameParam = new Parameter();
+ seiClassNameParam.setName(MDQConstants.CLIENT_SEI_CLASS);
+ String seiClassName = composite.getClassName();
+ if(log.isDebugEnabled()) {
+ log.debug("Setting sei class name parameter to: " + seiClassName +
+ " on AxisService: " + axisService + "@" + axisService.hashCode());
+ }
+ seiClassNameParam.setValue(seiClassName);
try {
axisService.addParameter(serviceNameParameter);
axisService.addParameter(portParameter);
+ axisService.addParameter(serviceClassNameParam);
+ axisService.addParameter(seiClassNameParam);
}
catch (AxisFault e) {
throw ExceptionFactory.makeWebServiceException(Messages.getMessage("setupAxisServiceErr2"),e);
@@ -822,7 +866,8 @@
log.debug("Building AxisService from wsdl: " + getServiceDescriptionImpl().getWSDLWrapper().getWSDLLocation());
}
- if (getServiceDescriptionImpl().isDBCMap()) {
+ if (composite.isServiceProvider()) {
+// if (getServiceDescriptionImpl().isDBCMap()) {
//this.class.getClass().getClassLoader();
URIResolverImpl uriResolver =
new URIResolverImpl(composite.getClassLoader());
@@ -855,12 +900,7 @@
// Note that if we choose to fail, we need to distinguish the partial WSDL case (which can not fail)
String wsdlLocation = (getServiceDescriptionImpl().getWSDLLocation() != null) ?
getServiceDescriptionImpl().getWSDLLocation().toString() : null;
- String implClassName = null;
- if (getServiceDescriptionImpl().isDBCMap()) {
- implClassName = composite.getClassName();
- } else {
- implClassName = (implOrSEIClass != null) ? implOrSEIClass.getName() : null;
- }
+ String implClassName = composite.getClassName();
log.warn(Messages.getMessage("bldAxisSrvcFromWSDLErr",implClassName,wsdlLocation),e);
isBuiltFromWSDL = false;
@@ -893,7 +933,8 @@
//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
- if (getServiceDescriptionImpl().isDBCMap()) {
+ // TODO: (JLB) Can this logic be combined?
+ if (composite.isServiceProvider()) {
if (!isDynamicPort && isWSDLFullySpecified())
buildEndpointDescriptionFromWSDL();
else
@@ -903,7 +944,7 @@
// This path was not updated
if (!isDynamicPort && isWSDLFullySpecified()) {
buildEndpointDescriptionFromWSDL();
- } else if (implOrSEIClass != null) {
+ } else if (composite.getCorrespondingClass() != null) {
// Create the rest of the description hierachy from annotations on the class.
// If there is no SEI class, then this is a Distpach case, and we currently
// don't create the rest of the description hierachy (since it is not an SEI and thus
@@ -934,7 +975,7 @@
// Build the EndpointInterface based on the specified SEI if there is one
// or on the service impl class (i.e. an implicit SEI).
- if (getServiceDescriptionImpl().isDBCMap()) {
+ if (composite.isServiceProvider()) {
String seiClassName = getAnnoWebServiceEndpointInterface();
if (DescriptionUtils.isEmpty(seiClassName)) {
// No SEI specified, so use the service impl as an implicit SEI
@@ -955,7 +996,7 @@
// Update the EndpointInterfaceDescription created with WSDL with information from the
// annotations in the SEI
((EndpointInterfaceDescriptionImpl)endpointInterfaceDescription)
- .updateWithSEI(implOrSEIClass);
+ .updateWithSEI(composite.getCorrespondingClass());
}
wsdlPortFound = true;
}
@@ -1041,7 +1082,7 @@
annotation_WsdlLocation = getAnnoWebService().wsdlLocation();
//If this is not an implicit SEI, then make sure that its not on the SEI
- if (getServiceDescriptionImpl().isDBCMap()) {
+ if (composite.isServiceProvider() && !composite.isDeprecatedServiceProviderConstruction()) {
if (!DescriptionUtils.isEmpty(getAnnoWebServiceEndpointInterface())) {
DescriptionBuilderComposite seic =
@@ -1074,13 +1115,7 @@
} else {
// Default value is the "simple name" of the class or interface + "Service"
// Per JSR-181 MR Sec 4.1, pg 15
- if (getServiceDescriptionImpl().isDBCMap()) {
- annotation_ServiceName = DescriptionUtils
- .getSimpleJavaClassName(composite.getClassName()) + "Service";
- } else {
- annotation_ServiceName =
- DescriptionUtils.getSimpleJavaClassName(implOrSEIClass) + "Service";
- }
+ annotation_ServiceName = DescriptionUtils.getSimpleJavaClassName(composite.getClassName()) + "Service";
}
}
return annotation_ServiceName;
@@ -1105,11 +1140,8 @@
// Note that this is really the same thing as the call to getWebServiceName()
// in the WebService case; it is done sepertely just to be clear there is no
// name element on the WebServiceProvider annotation
-
- annotation_PortName = (getServiceDescriptionImpl().isDBCMap()) ?
- DescriptionUtils.getSimpleJavaClassName(composite.getClassName()) +
- "Port"
- : DescriptionUtils.getSimpleJavaClassName(implOrSEIClass) + "Port";
+ annotation_PortName = DescriptionUtils.getSimpleJavaClassName(composite.getClassName())
+ + "Port";
} else {
// This is the @WebService annotation path
// Default value is the @WebService.name of the class or interface + "Port"
@@ -1133,16 +1165,10 @@
// Default value per JSR-181 MR Sec 4.1 pg 15 defers to "Implementation defined,
// as described in JAX-WS 2.0, section 3.2" which is JAX-WS 2.0 Sec 3.2, pg 29.
// FIXME: Hardcoded protocol for namespace
- if (getServiceDescriptionImpl().isDBCMap())
- annotation_TargetNamespace =
- DescriptionUtils.makeNamespaceFromPackageName(
- DescriptionUtils.getJavaPackageName(composite.getClassName()),
- "http");
- else
- annotation_TargetNamespace =
- DescriptionUtils.makeNamespaceFromPackageName(
- DescriptionUtils.getJavaPackageName(implOrSEIClass), "http");
-
+ annotation_TargetNamespace =
+ DescriptionUtils.makeNamespaceFromPackageName(
+ DescriptionUtils.getJavaPackageName(composite.getClassName()),
+ "http");
}
}
return annotation_TargetNamespace;
@@ -1197,14 +1223,8 @@
&& !DescriptionUtils.isEmpty(getAnnoWebService().name())) {
webService_Name = getAnnoWebService().name();
} else {
- if (getServiceDescriptionImpl().isDBCMap()) {
- //The name is the simple name of the class or interface
- webService_Name =
- DescriptionUtils.getSimpleJavaClassName(composite.getClassName());
- } else {
- // Default per JSR-181 Sec 4.1, pg 15
- webService_Name = DescriptionUtils.getSimpleJavaClassName(implOrSEIClass);
- }
+ webService_Name =
+ DescriptionUtils.getSimpleJavaClassName(composite.getClassName());
}
} else {
// This element is not valid on a WebServiceProvider annotation
@@ -1222,14 +1242,7 @@
public ServiceMode getAnnoServiceMode() {
if (serviceModeAnnotation == null) {
- if (getServiceDescriptionImpl().isDBCMap()) {
- serviceModeAnnotation = composite.getServiceModeAnnot();
- } else {
- if (implOrSEIClass != null) {
- serviceModeAnnotation =
- (ServiceMode)getAnnotation(implOrSEIClass,ServiceMode.class);
- }
- }
+ serviceModeAnnotation = composite.getServiceModeAnnot();
}
return serviceModeAnnotation;
}
@@ -1257,14 +1270,7 @@
public BindingType getAnnoBindingType() {
if (bindingTypeAnnotation == null) {
- if (getServiceDescriptionImpl().isDBCMap()) {
- bindingTypeAnnotation = composite.getBindingTypeAnnot();
- } else {
- if (implOrSEIClass != null) {
- bindingTypeAnnotation =
- (BindingType)getAnnotation(implOrSEIClass,BindingType.class);
- }
- }
+ bindingTypeAnnotation = composite.getBindingTypeAnnot();
}
return bindingTypeAnnotation;
}
@@ -1311,10 +1317,10 @@
log.debug(Messages.getMessage("handlerChainsTypeErr",handlerFileName,composite.getClassName()));
}
- String className = getServiceDescriptionImpl().isDBCMap() ?
- composite.getClassName() : implOrSEIClass.getName();
+ String className = composite.getClassName();
- ClassLoader classLoader = getServiceDescriptionImpl().isDBCMap() ?
+ // TODO: (JLB) This is using the classloader for EndpointDescriptionImpl; is that OK?
+ ClassLoader classLoader = (composite.isServiceProvider() && !composite.isDeprecatedServiceProviderConstruction()) ?
composite.getClassLoader() : this.getClass().getClassLoader();
InputStream is = DescriptionUtils.openHandlerConfigStream(
@@ -1343,7 +1349,8 @@
public HandlerChain getAnnoHandlerChainAnnotation() {
if (this.handlerChainAnnotation == null) {
- if (getServiceDescriptionImpl().isDBCMap()) {
+ if (composite.isServiceProvider() && !composite.isDeprecatedServiceProviderConstruction()) {
+// if (getServiceDescriptionImpl().isDBCMap()) {
/*
* Per JSR-181 The @HandlerChain annotation MAY be present on
* the endpoint interface and service implementation bean. The
@@ -1370,10 +1377,7 @@
}
}
} else {
- if (implOrSEIClass != null) {
- handlerChainAnnotation =
- (HandlerChain)getAnnotation(implOrSEIClass,HandlerChain.class);
- }
+ handlerChainAnnotation = composite.getHandlerChainAnnot();
}
}
@@ -1400,7 +1404,7 @@
}
//TODO: Need to add support for the DescriptionBuilderComposite?
- Annotation[] annotations = implOrSEIClass.getAnnotations();
+ Annotation[] annotations = composite.getCorrespondingClass().getAnnotations();
if (annotations != null) {
for (Annotation annotation : annotations) {
@@ -1446,11 +1450,14 @@
public String getWSDLBindingType() {
String wsdlBindingType = null;
+ String soapTransport = null;
Binding wsdlBinding = getWSDLBinding();
if (wsdlBinding != null) {
+
// If a WSDL binding was found, we need to find the proper extensibility
- // element and return the namespace. The namespace will be different
- // for SOAP 1.1 vs. SOAP 1.2 bindings and HTTP.
+ // element and return the namespace. The namespace for the binding element will
+ // determine whether it is SOAP 1.1 vs. SOAP 1.2 vs. HTTP (or other). If the namespace
+ // indicates SOAP we then need to determine what the transport is (HTTP vs. JMS)
// TODO: What do we do if no extensibility element exists?
List<ExtensibilityElement> elements = wsdlBinding.getExtensibilityElements();
Iterator<ExtensibilityElement> itr = elements.iterator();
@@ -1459,24 +1466,46 @@
if (javax.wsdl.extensions.soap.SOAPBinding.class.isAssignableFrom(e.getClass())) {
javax.wsdl.extensions.soap.SOAPBinding soapBnd =
(javax.wsdl.extensions.soap.SOAPBinding)e;
+
+ //representation: this is soap:binding = elementType where NamespaceURI is "soap"
+ // The transport is represented by the 'transport' attribute within this binding element
wsdlBindingType = soapBnd.getElementType().getNamespaceURI();
+
+ soapTransport = soapBnd.getTransportURI();
+
+
break;
+
} else if (SOAP12Binding.class.isAssignableFrom(e.getClass())) {
SOAP12Binding soapBnd = (SOAP12Binding)e;
wsdlBindingType = soapBnd.getElementType().getNamespaceURI();
+ soapTransport = soapBnd.getTransportURI();
break;
+
} else if (HTTPBinding.class.isAssignableFrom(e.getClass())) {
HTTPBinding httpBnd = (HTTPBinding)e;
wsdlBindingType = httpBnd.getElementType().getNamespaceURI();
break;
}
}
- // We need to convert the wsdl-based SOAP and HTTP namespace into the expected namespace for
- //SOAPBindings or HTTPBindings
+
+ // We need to convert the wsdl-based SOAP and HTTP namespace into the expected Binding Type for
+ //HTTP or SOAPBindings with the appropriate transport (HTTP, JMS, etc.)
+
if (SOAP11_WSDL_BINDING.equals(wsdlBindingType)) {
- wsdlBindingType = SOAPBinding.SOAP11HTTP_BINDING;
+ if (MDQConstants.SOAP11JMS_BINDING.equals(soapTransport)) {
+ wsdlBindingType = MDQConstants.SOAP11JMS_BINDING;
+ } else {
+ //REVIEW: We are making the assumption that if not JMS, then HTTP
+ wsdlBindingType = SOAPBinding.SOAP11HTTP_BINDING;
+ }
} else if (SOAP12_WSDL_BINDING.equals(wsdlBindingType)) {
- wsdlBindingType = SOAPBinding.SOAP12HTTP_BINDING;
+ if (MDQConstants.SOAP12JMS_BINDING.equals(soapTransport)) {
+ wsdlBindingType = MDQConstants.SOAP12JMS_BINDING;
+ } else {
+ //REVIEW: We are making the assumption that if not JMS, then HTTP
+ wsdlBindingType = SOAPBinding.SOAP12HTTP_BINDING;
+ }
} else if (HTTP_WSDL_BINDING.equals(wsdlBindingType)) {
wsdlBindingType = javax.xml.ws.http.HTTPBinding.HTTP_BINDING;
}
@@ -1527,7 +1556,11 @@
bindingId.equals(javax.xml.ws.http.HTTPBinding.HTTP_BINDING) ||
bindingId.equals(SOAPBinding.SOAP12HTTP_BINDING) ||
bindingId.equals(SOAPBinding.SOAP11HTTP_MTOM_BINDING) ||
- bindingId.equals(SOAPBinding.SOAP12HTTP_MTOM_BINDING))) {
+ bindingId.equals(SOAPBinding.SOAP12HTTP_MTOM_BINDING) ||
+ bindingId.equals(MDQConstants.SOAP11JMS_BINDING) ||
+ bindingId.equals(MDQConstants.SOAP12JMS_BINDING) ||
+ bindingId.equals(MDQConstants.SOAP11JMS_MTOM_BINDING) ||
+ bindingId.equals(MDQConstants.SOAP12JMS_MTOM_BINDING))) {
throw ExceptionFactory.makeWebServiceException(
Messages.getMessage("addPortErr0", getPortQName().toString()));
}
@@ -1751,6 +1784,10 @@
return customAnnotationProcessors != null ?
customAnnotationProcessors.get(annotationInstanceClassName) : null;
}
+
+ public DescriptionBuilderComposite getDescriptionBuilderComposite() {
+ return composite;
+ }
public String toString() {
final String newline = "\n";
@@ -1802,20 +1839,6 @@
return string.toString();
}
return string.toString();
- }
-
- /**
- * Get an annotation. This is wrappered to avoid a Java2Security violation.
- * @param cls Class that contains annotation
- * @param annotation Class of requrested Annotation
- * @return annotation or null
- */
- private static Annotation getAnnotation(final Class cls, final Class annotation) {
- return (Annotation) AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- return cls.getAnnotation(annotation);
- }
- });
}
}
Modified: webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointInterfaceDescriptionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointInterfaceDescriptionImpl.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointInterfaceDescriptionImpl.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointInterfaceDescriptionImpl.java Tue Jan 15 08:21:22 2008
@@ -68,7 +68,8 @@
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.
- private Class seiClass;
+ // TODO: (JLB) Remove commented out code
+// private Class seiClass;
private DescriptionBuilderComposite dbc;
//Logging setup
@@ -114,27 +115,38 @@
}
}
+ /**
+ * Construct a service requester (aka client-side) EndpointInterfaceDescription for the
+ * given SEI class. This constructor is used if hierachy is being built fully from annotations
+ * and not WSDL.
+ * @param sei
+ * @param parent
+ */
EndpointInterfaceDescriptionImpl(Class sei, EndpointDescriptionImpl parent) {
- seiClass = sei;
parentEndpointDescription = parent;
+ dbc = new DescriptionBuilderComposite();
+ dbc.setCorrespondingClass(sei);
// Per JSR-181 all methods on the SEI are mapped to operations regardless
// of whether they include an @WebMethod annotation. That annotation may
// be present to customize the mapping, but is not required (p14)
- // TODO: Testcases that do and do not include @WebMethod anno
- for (Method method : getSEIMethods(seiClass)) {
+ for (Method method : getSEIMethods(dbc.getCorrespondingClass())) {
OperationDescription operation = new OperationDescriptionImpl(method, this);
addOperation(operation);
}
}
/**
- * Build from AxisService
+ * Construct a service requester (aka client-side) EndpointInterfaceDescrption for
+ * an SEI represented by an AxisService. This constructor is used if the hierachy is
+ * being built fully from WSDL. The AxisService and underlying AxisOperations were built
+ * based on the WSDL, so we will use them to create the necessary objects.
*
* @param parent
*/
EndpointInterfaceDescriptionImpl(EndpointDescriptionImpl parent) {
parentEndpointDescription = parent;
+ dbc = new DescriptionBuilderComposite();
AxisService axisService = parentEndpointDescription.getAxisService();
if (axisService != null) {
ArrayList publishedOperations = axisService.getPublishedOperations();
@@ -207,8 +219,6 @@
// of whether they include an @WebMethod annotation. That annotation may
// be present to customize the mapping, but is not required (p14)
- // TODO: Testcases that do and do not include @WebMethod anno
-
//We are processing the SEI composite
//For every MethodDescriptionComposite in this list, call OperationDescription
//constructor for it, then add this operation
@@ -300,13 +310,17 @@
* @param sei
*/
void updateWithSEI(Class sei) {
- if (seiClass != null && seiClass != sei)
- throw ExceptionFactory.makeWebServiceException(new UnsupportedOperationException(Messages.getMessage("seiProcessingErr")));
- else if (seiClass != null && seiClass == sei)
+ Class seiClass = dbc.getCorrespondingClass();
+ if (seiClass != null && seiClass != sei) {
+ throw ExceptionFactory.makeWebServiceException(new UnsupportedOperationException(Messages.getMessage("seiProcessingErr")));
+ }
+ else if (seiClass != null && seiClass == sei) {
// We've already done the necessary updates for this SEI
return;
+ }
else if (sei != null) {
seiClass = sei;
+ dbc.setCorrespondingClass(sei);
// Update (or possibly add) the OperationDescription for each of the methods on the SEI.
for (Method seiMethod : getSEIMethods(seiClass)) {
@@ -537,7 +551,7 @@
}
public Class getSEIClass() {
- return seiClass;
+ return dbc.getCorrespondingClass();
}
// Annotation-realted getters
@@ -548,20 +562,12 @@
// TODO: Test with sei Null, not null, SOAP Binding annotated, not annotated
if (soapBindingAnnotation == null) {
- if (dbc != null) {
- soapBindingAnnotation = dbc.getSoapBindingAnnot();
- } else {
- if (seiClass != null) {
- soapBindingAnnotation =
- (SOAPBinding)getAnnotation(seiClass,SOAPBinding.class);
- }
- }
+ soapBindingAnnotation = dbc.getSoapBindingAnnot();
}
return soapBindingAnnotation;
}
public javax.jws.soap.SOAPBinding.Style getSoapBindingStyle() {
- // REVIEW: Implement WSDL/Anno merge
return getAnnoSoapBindingStyle();
}
@@ -577,7 +583,6 @@
}
public javax.jws.soap.SOAPBinding.Use getSoapBindingUse() {
- // REVIEW: Implement WSDL/Anno merge
return getAnnoSoapBindingUse();
}
@@ -593,7 +598,6 @@
}
public javax.jws.soap.SOAPBinding.ParameterStyle getSoapBindingParameterStyle() {
- // REVIEW: Implement WSDL/Anno merge
return getAnnoSoapBindingParameterStyle();
}
@@ -913,20 +917,12 @@
public String getTargetNamespace() {
- // REVIEW: WSDL/Anno mertge
return getAnnoWebServiceTargetNamespace();
}
public WebService getAnnoWebService() {
- // TODO Auto-generated method stub
if (webServiceAnnotation == null) {
- if (dbc != null) {
- webServiceAnnotation = dbc.getWebServiceAnnot();
- } else {
- if (seiClass != null) {
- webServiceAnnotation = (WebService)getAnnotation(seiClass,WebService.class);
- }
- }
+ webServiceAnnotation = dbc.getWebServiceAnnot();
}
return webServiceAnnotation;
}
@@ -940,16 +936,10 @@
// Default value per JSR-181 MR Sec 4.1 pg 15 defers to "Implementation defined,
// as described in JAX-WS 2.0, section 3.2" which is JAX-WS 2.0 Sec 3.2, pg 29.
// FIXME: Hardcoded protocol for namespace
- if (dbc != null)
- webServiceTargetNamespace =
- DescriptionUtils.makeNamespaceFromPackageName(
- DescriptionUtils.getJavaPackageName(dbc.getClassName()),
- "http");
- else
- webServiceTargetNamespace =
- DescriptionUtils.makeNamespaceFromPackageName(
- DescriptionUtils.getJavaPackageName(seiClass), "http");
-
+ webServiceTargetNamespace =
+ DescriptionUtils.makeNamespaceFromPackageName(
+ DescriptionUtils.getJavaPackageName(dbc.getClassName()),
+ "http");
}
}
return webServiceTargetNamespace;
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org