You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@axis.apache.org by sc...@apache.org on 2010/06/29 23:10:28 UTC
svn commit: r959103 - in /axis/axis2/java/core/trunk/modules:
jaxws-integration/test/org/apache/axis2/jaxws/sample/addressbook/data/
jaxws/src/org/apache/axis2/datasource/jaxb/
jaxws/src/org/apache/axis2/jaxws/marshaller/factory/
jaxws/src/org/apache/a...
Author: scheu
Date: Tue Jun 29 21:10:27 2010
New Revision: 959103
URL: http://svn.apache.org/viewvc?rev=959103&view=rev
Log:
AXIS2-4757
Contributor:Rich Scheuerle
Support JAX-WS WebMethods that have @RequestWrapper or @ResponseWrapper annotations that use classes that don't
have @XmlRootElement.
A validation test is also contributed.
Modified:
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addressbook/data/FindEntryByName.java
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addressbook/data/FindEntryByNameResponse.java
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/datasource/jaxb/JAXBDSContext.java
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/factory/MethodMarshallerFactory.java
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedMethodMarshaller.java
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedPlusMethodMarshaller.java
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/MarshalServiceRuntimeDescription.java
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/MarshalServiceRuntimeDescriptionImpl.java
Modified: axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addressbook/data/FindEntryByName.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addressbook/data/FindEntryByName.java?rev=959103&r1=959102&r2=959103&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addressbook/data/FindEntryByName.java (original)
+++ axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addressbook/data/FindEntryByName.java Tue Jun 29 21:10:27 2010
@@ -53,7 +53,8 @@ import javax.xml.bind.annotation.XmlType
"firstname",
"lastname"
})
-@XmlRootElement(name = "findEntryByName")
+// Intentional comment to test support of wrapper classes that are not root elements
+//@XmlRootElement(name = "findEntryByName")
public class FindEntryByName {
@XmlElement(namespace = "http://org/apache/axis2/jaxws/sample/addressbook", required = true, nillable = true)
Modified: axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addressbook/data/FindEntryByNameResponse.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addressbook/data/FindEntryByNameResponse.java?rev=959103&r1=959102&r2=959103&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addressbook/data/FindEntryByNameResponse.java (original)
+++ axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addressbook/data/FindEntryByNameResponse.java Tue Jun 29 21:10:27 2010
@@ -51,7 +51,8 @@ import javax.xml.bind.annotation.XmlType
@XmlType(name = "", propOrder = {
"entry"
})
-@XmlRootElement(name = "findEntryByNameResponse")
+// Intentional comment to test support of wrapper classes that are not root elements
+// @XmlRootElement(name = "findEntryByNameResponse")
public class FindEntryByNameResponse {
@XmlElement(namespace = "http://org/apache/axis2/jaxws/sample/addressbook", required = true)
Modified: axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/datasource/jaxb/JAXBDSContext.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/datasource/jaxb/JAXBDSContext.java?rev=959103&r1=959102&r2=959103&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/datasource/jaxb/JAXBDSContext.java (original)
+++ axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/datasource/jaxb/JAXBDSContext.java Tue Jun 29 21:10:27 2010
@@ -236,12 +236,17 @@ public class JAXBDSContext {
}
/**
- * Set RPC Declared Type. The use of use this property if the message is style=document is
- * discouraged.
+ * The procesess type to indicate the class of the target of the unmarshaling.
+ * This method should only be used in the cases where the element being unmarshaled
+ * is not known to the JAXBContext (examples include RPC/Literal processing
+ * and Doc/Literal Wrapped processing with a non-element wrapper class)
*
* @param type
*/
public void setProcessType(Class type) {
+ if (log.isDebugEnabled()) {
+ log.debug("Process Type set to: " + type);
+ }
processType = type;
}
@@ -254,6 +259,9 @@ public class JAXBDSContext {
}
public void setIsxmlList(boolean isxmlList) {
+ if (log.isDebugEnabled()) {
+ log.debug("isxmlListSet to " + isxmlList);
+ }
this.isxmlList = isxmlList;
}
Modified: axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/factory/MethodMarshallerFactory.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/factory/MethodMarshallerFactory.java?rev=959103&r1=959102&r2=959103&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/factory/MethodMarshallerFactory.java (original)
+++ axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/factory/MethodMarshallerFactory.java Tue Jun 29 21:10:27 2010
@@ -102,6 +102,15 @@ public class MethodMarshallerFactory {
public static MethodMarshaller getMarshaller(OperationDescription op, boolean isClient,
ClassLoader cl) {
+ // Always make sure the MarshalServiceRuntimeDescription is built before getting the MethodMarshaller.
+ // Getting the MarshalServiceRuntimeDescription will ensure that it is built.
+ ServiceDescription serviceDesc =
+ op.getEndpointInterfaceDescription()
+ .getEndpointDescription()
+ .getServiceDescription();
+ MarshalServiceRuntimeDescription marshalDesc =
+ MarshalServiceRuntimeDescriptionFactory.get(serviceDesc);
+
MethodMarshaller marshaller = null;
if (op.getSoapBindingStyle() == SOAPBinding.Style.DOCUMENT) {
marshaller = createDocLitMethodMarshaller(op, isClient, cl);
Modified: axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedMethodMarshaller.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedMethodMarshaller.java?rev=959103&r1=959102&r2=959103&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedMethodMarshaller.java (original)
+++ axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedMethodMarshaller.java Tue Jun 29 21:10:27 2010
@@ -33,6 +33,7 @@ import org.apache.axis2.jaxws.message.da
import org.apache.axis2.jaxws.message.factory.JAXBBlockFactory;
import org.apache.axis2.jaxws.message.factory.MessageFactory;
import org.apache.axis2.jaxws.registry.FactoryRegistry;
+import org.apache.axis2.jaxws.runtime.description.marshal.AnnotationDesc;
import org.apache.axis2.jaxws.runtime.description.marshal.MarshalServiceRuntimeDescription;
import org.apache.axis2.jaxws.utility.ConvertUtils;
import org.apache.axis2.jaxws.wrapper.JAXBWrapperTool;
@@ -91,9 +92,11 @@ public class DocLitWrappedMethodMarshall
// Remember this unmarshal information so that we can speed up processing
// the next time.
- MethodMarshallerUtils.registerUnmarshalInfo(message.getMessageContext(),
+ if (shouldRegiserUnmarshalInfo(operationDesc, marshalDesc, endpointDesc)) {
+ MethodMarshallerUtils.registerUnmarshalInfo(message.getMessageContext(),
packages,
packagesKey);
+ }
// Determine if a returnValue is expected.
// The return value may be an child element
@@ -109,6 +112,15 @@ public class DocLitWrappedMethodMarshall
// Get this block
JAXBBlockContext blockContext = new JAXBBlockContext(packages, packagesKey);
blockContext.setWebServiceNamespace(ed.getTargetNamespace());
+
+ // If the wrapper is not a root element, then the process type
+ // must be set on the context so that "by type" unmarshal is performed.
+ if (!isResponseWrapperAnXmlRootElement(operationDesc, marshalDesc, endpointDesc)) {
+ String clsName = marshalDesc.getResponseWrapperClassName(operationDesc);
+ Class cls = loadClass(clsName,endpointDesc);
+ blockContext.setProcessType(cls);
+ }
+
JAXBBlockFactory factory =
(JAXBBlockFactory)FactoryRegistry.getFactory(JAXBBlockFactory.class);
Block block = message.getBodyBlock(blockContext, factory);
@@ -220,14 +232,24 @@ public class DocLitWrappedMethodMarshall
TreeSet<String> packages = marshalDesc.getPackages();
String packagesKey = marshalDesc.getPackagesKey();
- MethodMarshallerUtils.registerUnmarshalInfo(message.getMessageContext(),
+ if (shouldRegiserUnmarshalInfo(operationDesc, marshalDesc, endpointDesc)) {
+ MethodMarshallerUtils.registerUnmarshalInfo(message.getMessageContext(),
packages,
packagesKey);
+ }
// In usage=WRAPPED, there will be a single JAXB block inside the body.
// Get this block
JAXBBlockContext blockContext = new JAXBBlockContext(packages, packagesKey);
blockContext.setWebServiceNamespace(ed.getTargetNamespace());
+ // If the wrapper is not a root element, then the process type
+ // must be set on the context so that "by type" unmarshal is performed.
+ if (!isRequestWrapperAnXmlRootElement(operationDesc, marshalDesc, endpointDesc)) {
+ String clsName = marshalDesc.getRequestWrapperClassName(operationDesc);
+ Class cls = loadClass(clsName,endpointDesc);
+ blockContext.setProcessType(cls);
+ }
+
JAXBBlockFactory factory =
(JAXBBlockFactory)FactoryRegistry.getFactory(JAXBBlockFactory.class);
Block block = message.getBodyBlock(blockContext, factory);
@@ -370,12 +392,7 @@ public class DocLitWrappedMethodMarshall
// Now create the single JAXB element
String wrapperName = marshalDesc.getResponseWrapperClassName(operationDesc);
- Class cls;
- try {
- cls = MethodMarshallerUtils.loadClass(wrapperName);
- } catch (ClassNotFoundException e){
- cls = MethodMarshallerUtils.loadClass(wrapperName, endpointDesc.getAxisService().getClassLoader());
- }
+ Class cls = loadClass(wrapperName, endpointDesc);
JAXBWrapperTool wrapperTool = new JAXBWrapperToolImpl();
Object object = wrapperTool.wrap(cls, nameList, objectList, declaredClassMap,
marshalDesc.getPropertyDescriptorMap(cls));
@@ -476,12 +493,8 @@ public class DocLitWrappedMethodMarshall
// Now create the single JAXB element
String wrapperName = marshalDesc.getRequestWrapperClassName(operationDesc);
- Class cls;
- try {
- cls = MethodMarshallerUtils.loadClass(wrapperName);
- } catch (ClassNotFoundException e){
- cls = MethodMarshallerUtils.loadClass(wrapperName, endpointDesc.getAxisService().getClassLoader());
- }
+ Class cls = loadClass(wrapperName, endpointDesc);
+
JAXBWrapperTool wrapperTool = new JAXBWrapperToolImpl();
Object object = wrapperTool.wrap(cls, nameList, objectList, declaredClassMap,
marshalDesc.getPropertyDescriptorMap(cls));
@@ -566,4 +579,96 @@ public class DocLitWrappedMethodMarshall
}
}
+ /**
+ * @param opDesc
+ * @param msrd
+ * @param endpointDesc
+ * @return true if should register UnmarshalInfo for faster processing
+ */
+ boolean shouldRegiserUnmarshalInfo(OperationDescription opDesc,
+ MarshalServiceRuntimeDescription msrd,
+ EndpointDescription endpointDesc) {
+ // If either the request wrapper or the response wrapper is
+ // not a rendered as a root element, then "by type" unmarshaling
+ // is needed. In such cases faster unmarshaling should be disabled.
+ return isRequestWrapperAnXmlRootElement(opDesc, msrd, endpointDesc) &&
+ isResponseWrapperAnXmlRootElement(opDesc, msrd, endpointDesc);
+ }
+ /**
+ * @param opDesc
+ * @param msrd
+ * @param endpointDesc
+ * @return true if request wrapper is a root element
+ */
+ boolean isRequestWrapperAnXmlRootElement(OperationDescription opDesc,
+ MarshalServiceRuntimeDescription msrd,
+ EndpointDescription endpointDesc) {
+ boolean isRootElement = false;
+ String wrapperClassName = msrd.getRequestWrapperClassName(opDesc);
+ try {
+
+ if (wrapperClassName != null) {
+ AnnotationDesc aDesc = msrd.getAnnotationDesc(wrapperClassName);
+ if (aDesc == null) {
+ Class cls = loadClass(wrapperClassName, endpointDesc);
+ aDesc = msrd.getAnnotationDesc(cls);
+ }
+ isRootElement = aDesc.hasXmlRootElement();
+ }
+
+ } catch (Throwable t) {
+ if (log.isDebugEnabled()) {
+ log.debug("An error occurred while processing class " + wrapperClassName + " exception is " + t);
+ log.debug("The error is ignored and processing continues.");
+ }
+ }
+ return isRootElement;
+ }
+
+ /**
+ * @param opDesc
+ * @param msrd
+ * @param endpointDesc
+ * @return true if response wrapper is a root element
+ */
+ boolean isResponseWrapperAnXmlRootElement(OperationDescription opDesc,
+ MarshalServiceRuntimeDescription msrd,
+ EndpointDescription endpointDesc) {
+ boolean isRootElement = false;
+ String wrapperClassName = msrd.getResponseWrapperClassName(opDesc);
+ try {
+
+ if (wrapperClassName != null) {
+ AnnotationDesc aDesc = msrd.getAnnotationDesc(wrapperClassName);
+ if (aDesc == null) {
+ Class cls = loadClass(wrapperClassName, endpointDesc);
+ aDesc = msrd.getAnnotationDesc(cls);
+ }
+ isRootElement = aDesc.hasXmlRootElement();
+ }
+
+ } catch (Throwable t) {
+ if (log.isDebugEnabled()) {
+ log.debug("An error occurred while processing class " + wrapperClassName + " exception is " + t);
+ log.debug("The error is ignored and processing continues.");
+ }
+ }
+ return isRootElement;
+ }
+
+ /**
+ * @param clsName
+ * @param endpontDesc
+ * @return
+ * @throws ClassNotFoundException
+ */
+ Class loadClass(String clsName, EndpointDescription endpointDesc) throws ClassNotFoundException {
+ Class cls = null;
+ try {
+ cls = MethodMarshallerUtils.loadClass(clsName);
+ } catch (ClassNotFoundException e){
+ cls = MethodMarshallerUtils.loadClass(clsName, endpointDesc.getAxisService().getClassLoader());
+ }
+ return cls;
+ }
}
Modified: axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedPlusMethodMarshaller.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedPlusMethodMarshaller.java?rev=959103&r1=959102&r2=959103&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedPlusMethodMarshaller.java (original)
+++ axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedPlusMethodMarshaller.java Tue Jun 29 21:10:27 2010
@@ -34,6 +34,7 @@ import org.apache.axis2.jaxws.message.da
import org.apache.axis2.jaxws.message.factory.JAXBBlockFactory;
import org.apache.axis2.jaxws.message.factory.MessageFactory;
import org.apache.axis2.jaxws.registry.FactoryRegistry;
+import org.apache.axis2.jaxws.runtime.description.marshal.AnnotationDesc;
import org.apache.axis2.jaxws.runtime.description.marshal.MarshalServiceRuntimeDescription;
import org.apache.axis2.jaxws.utility.ConvertUtils;
import org.apache.axis2.jaxws.wrapper.JAXBWrapperTool;
@@ -149,7 +150,15 @@ public class DocLitWrappedPlusMethodMars
// In usage=WRAPPED, there will be a single JAXB block inside the body.
// Get this block
JAXBBlockContext blockContext = new JAXBBlockContext(packages, packagesKey);
+
blockContext.setWebServiceNamespace(ed.getTargetNamespace());
+ // If the wrapper is not a root element, then the process type
+ // must be set on the context so that "by type" unmarshal is performed.
+ if (!isResponseWrapperAnXmlRootElement(operationDesc, marshalDesc, endpointDesc)) {
+ String clsName = marshalDesc.getResponseWrapperClassName(operationDesc);
+ Class cls = loadClass(clsName,endpointDesc);
+ blockContext.setProcessType(cls);
+ }
JAXBBlockFactory factory =
(JAXBBlockFactory)FactoryRegistry.getFactory(JAXBBlockFactory.class);
Block block = message.getBodyBlock(blockContext, factory);
@@ -313,6 +322,14 @@ public class DocLitWrappedPlusMethodMars
// Get this block
JAXBBlockContext blockContext = new JAXBBlockContext(packages, packagesKey);
blockContext.setWebServiceNamespace(ed.getTargetNamespace());
+
+ // If the wrapper is not a root element, then the process type
+ // must be set on the context so that "by type" unmarshal is performed.
+ if (!isRequestWrapperAnXmlRootElement(operationDesc, marshalDesc, endpointDesc)) {
+ String clsName = marshalDesc.getRequestWrapperClassName(operationDesc);
+ Class cls = loadClass(clsName,endpointDesc);
+ blockContext.setProcessType(cls);
+ }
JAXBBlockFactory factory =
(JAXBBlockFactory)FactoryRegistry.getFactory(JAXBBlockFactory.class);
Block block = message.getBodyBlock(blockContext, factory);
@@ -531,12 +548,8 @@ public class DocLitWrappedPlusMethodMars
// Now create the single JAXB element
String wrapperName = marshalDesc.getResponseWrapperClassName(operationDesc);
- Class cls;
- try {
- cls = MethodMarshallerUtils.loadClass(wrapperName);
- } catch (ClassNotFoundException e){
- cls = MethodMarshallerUtils.loadClass(wrapperName, endpointDesc.getAxisService().getClassLoader());
- }
+ Class cls = loadClass(wrapperName, endpointDesc);
+
JAXBWrapperTool wrapperTool = new JAXBWrapperToolImpl();
Object object = wrapperTool.wrap(cls, nameList, objectList, declaredClassMap,
marshalDesc.getPropertyDescriptorMap(cls));
@@ -665,12 +678,8 @@ public class DocLitWrappedPlusMethodMars
// Now create the single JAXB element
String wrapperName = marshalDesc.getRequestWrapperClassName(operationDesc);
- Class cls;
- try {
- cls = MethodMarshallerUtils.loadClass(wrapperName);
- } catch (ClassNotFoundException e){
- cls = MethodMarshallerUtils.loadClass(wrapperName, endpointDesc.getAxisService().getClassLoader());
- }
+ Class cls = loadClass(wrapperName, endpointDesc);
+
JAXBWrapperTool wrapperTool = new JAXBWrapperToolImpl();
Object object = wrapperTool.wrap(cls, nameList, objectList, declardClassMap,
marshalDesc.getPropertyDescriptorMap(cls));
@@ -777,4 +786,81 @@ public class DocLitWrappedPlusMethodMars
}
}
+ /**
+ * @param opDesc
+ * @param msrd
+ * @param endpointDesc
+ * @return true if request wrapper is a root element
+ */
+ boolean isRequestWrapperAnXmlRootElement(OperationDescription opDesc,
+ MarshalServiceRuntimeDescription msrd,
+ EndpointDescription endpointDesc) {
+ boolean isRootElement = false;
+ String wrapperClassName = msrd.getRequestWrapperClassName(opDesc);
+ try {
+
+ if (wrapperClassName != null) {
+ AnnotationDesc aDesc = msrd.getAnnotationDesc(wrapperClassName);
+ if (aDesc == null) {
+ Class cls = loadClass(wrapperClassName, endpointDesc);
+ aDesc = msrd.getAnnotationDesc(cls);
+ }
+ isRootElement = aDesc.hasXmlRootElement();
+ }
+
+ } catch (Throwable t) {
+ if (log.isDebugEnabled()) {
+ log.debug("An error occurred while processing class " + wrapperClassName + " exception is " + t);
+ log.debug("The error is ignored and processing continues.");
+ }
+ }
+ return isRootElement;
+ }
+
+ /**
+ * @param opDesc
+ * @param msrd
+ * @param endpointDesc
+ * @return true if response wrapper is a root element
+ */
+ boolean isResponseWrapperAnXmlRootElement(OperationDescription opDesc,
+ MarshalServiceRuntimeDescription msrd,
+ EndpointDescription endpointDesc) {
+ boolean isRootElement = false;
+ String wrapperClassName = msrd.getResponseWrapperClassName(opDesc);
+ try {
+
+ if (wrapperClassName != null) {
+ AnnotationDesc aDesc = msrd.getAnnotationDesc(wrapperClassName);
+ if (aDesc == null) {
+ Class cls = loadClass(wrapperClassName, endpointDesc);
+ aDesc = msrd.getAnnotationDesc(cls);
+ }
+ isRootElement = aDesc.hasXmlRootElement();
+ }
+
+ } catch (Throwable t) {
+ if (log.isDebugEnabled()) {
+ log.debug("An error occurred while processing class " + wrapperClassName + " exception is " + t);
+ log.debug("The error is ignored and processing continues.");
+ }
+ }
+ return isRootElement;
+ }
+
+ /**
+ * @param clsName
+ * @param endpontDesc
+ * @return
+ * @throws ClassNotFoundException
+ */
+ Class loadClass(String clsName, EndpointDescription endpointDesc) throws ClassNotFoundException {
+ Class cls = null;
+ try {
+ cls = MethodMarshallerUtils.loadClass(clsName);
+ } catch (ClassNotFoundException e){
+ cls = MethodMarshallerUtils.loadClass(clsName, endpointDesc.getAxisService().getClassLoader());
+ }
+ return cls;
+ }
}
Modified: axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/MarshalServiceRuntimeDescription.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/MarshalServiceRuntimeDescription.java?rev=959103&r1=959102&r2=959103&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/MarshalServiceRuntimeDescription.java (original)
+++ axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/MarshalServiceRuntimeDescription.java Tue Jun 29 21:10:27 2010
@@ -40,13 +40,19 @@ public interface MarshalServiceRuntimeDe
public String getPackagesKey();
/**
- * Get the AnnotationDesc for this class. If one is not cached, a new one is creatd
+ * Gets/Creates the AnnotationDesc for this class.
*
* @param cls
* @return AnnotationDesc
*/
public AnnotationDesc getAnnotationDesc(Class cls);
+ /**
+ * Gets the AnnotationDesc for this class if already determined
+ * @param clsName
+ * @return AnnotationDesc or null
+ */
+ public AnnotationDesc getAnnotationDesc(String clsName);
/**
* Get the PropertyDescriptor map for the class. The key of the map is a child xml local name.
Modified: axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/MarshalServiceRuntimeDescriptionImpl.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/MarshalServiceRuntimeDescriptionImpl.java?rev=959103&r1=959102&r2=959103&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/MarshalServiceRuntimeDescriptionImpl.java (original)
+++ axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/MarshalServiceRuntimeDescriptionImpl.java Tue Jun 29 21:10:27 2010
@@ -28,25 +28,24 @@ import org.apache.axis2.jaxws.registry.F
import org.apache.axis2.jaxws.runtime.description.marshal.AnnotationDesc;
import org.apache.axis2.jaxws.runtime.description.marshal.FaultBeanDesc;
import org.apache.axis2.jaxws.runtime.description.marshal.MarshalServiceRuntimeDescription;
+import org.apache.axis2.jaxws.runtime.description.marshal.impl.AnnotationDescImpl;
+import org.apache.axis2.jaxws.runtime.description.marshal.impl.MarshalServiceRuntimeDescriptionImpl;
import org.apache.axis2.jaxws.utility.PropertyDescriptorPlus;
import org.apache.axis2.jaxws.utility.XMLRootElementUtil;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import java.lang.reflect.Method;
import java.util.Map;
import java.util.Map.Entry;
import java.util.TreeSet;
+import javax.xml.namespace.QName;
+
-/**
- * @author scheu
- *
- */
-/**
- * @author scheu
- *
- */
public class MarshalServiceRuntimeDescriptionImpl implements
MarshalServiceRuntimeDescription {
+ private static final Log log = LogFactory.getLog(MarshalServiceRuntimeDescriptionImpl.class);
private ServiceDescription serviceDesc;
private String key;
@@ -64,6 +63,10 @@ public class MarshalServiceRuntimeDescri
protected MarshalServiceRuntimeDescriptionImpl(String key,
ServiceDescription serviceDesc) {
+ if (log.isDebugEnabled()) {
+ QName qName = (serviceDesc == null) ? null : serviceDesc.getServiceQName();
+ log.debug("Create MarshalServiceRuntimeDescriptionImpl for " + serviceDesc);
+ }
this.serviceDesc = serviceDesc;
this.key = key;
}
@@ -91,15 +94,33 @@ public class MarshalServiceRuntimeDescri
}
public AnnotationDesc getAnnotationDesc(Class cls) {
- String className = cls.getCanonicalName();
+ if (log.isDebugEnabled()) {
+ log.debug("getAnnotationDesc for class " + cls);
+ }
+ String className = cls.getCanonicalName();
AnnotationDesc aDesc = annotationMap.get(className);
- if (aDesc != null) {
- // Cache hit
- return aDesc;
+ if (aDesc == null) {
+ // Cache miss
+ if (log.isDebugEnabled()) {
+ log.debug("creating AnnotationDesc");
+ }
+ aDesc = AnnotationDescImpl.create(cls);
}
- // Cache miss...we cannot update the map because we don't want to introduce a sync call.
- aDesc = AnnotationDescImpl.create(cls);
-
+
+ if (log.isDebugEnabled()) {
+ log.debug("getAnnotationDesc is " + aDesc);
+ }
+ return aDesc;
+ }
+
+ public AnnotationDesc getAnnotationDesc(String clsName) {
+ if (log.isDebugEnabled()) {
+ log.debug("getAnnotationDesc for " + clsName);
+ }
+ AnnotationDesc aDesc = annotationMap.get(clsName);
+ if (log.isDebugEnabled()) {
+ log.debug("getAnnotationDesc is " + aDesc);
+ }
return aDesc;
}