[prev in list] [next in list] [prev in thread] [next in thread]
List: axis-cvs
Subject: svn commit: r542524 - in /webservices/axis2/trunk/java/modules:
From: dims () apache ! org
Date: 2007-05-29 14:05:04
Message-ID: 20070529140504.86CE91A981A () eris ! apache ! org
[Download RAW message or body]
Author: dims
Date: Tue May 29 07:05:03 2007
New Revision: 542524
URL: http://svn.apache.org/viewvc?view=rev&rev=542524
Log:
Fix for AXIS2-2055 - POJO service's return object loses data from parent class. \
(Ported by hand the changes from Sathija)
Modified:
webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/BeanUtil.java
webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/SchemaGenerator.java
Modified: webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/BeanUtil.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb/src/org/apa \
che/axis2/databinding/utils/BeanUtil.java?view=diff&rev=542524&r1=542523&r2=542524 \
==============================================================================
--- webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/BeanUtil.java \
(original)
+++ webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/BeanUtil.java \
Tue May 29 07:05:03 2007 @@ -29,6 +29,7 @@
import org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl;
import org.apache.axis2.engine.ObjectSupplier;
import org.apache.axis2.util.StreamWrapper;
+import org.apache.axis2.util.Loader;
import org.apache.ws.java2wsdl.utils.TypeTable;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -79,7 +80,6 @@
if (cl == null)
cl = ClassLoader.getSystemClassLoader();
jam_service_parms.addClassLoader(cl);
-// beanObject.getClass().isArray()
jam_service_parms.includeClass(beanObject.getClass().getName());
JamService service = factory.createService(jam_service_parms);
@@ -278,9 +278,9 @@
// support polymorphism in POJO approach.
// For some reason, using QName(Constants.XSI_NAMESPACE, "type", "xsi") \
does not generate
// an xsi:type attribtue properly for inner objects. So just using a \
simple QName("type").
-// ArrayList objectAttributes = new ArrayList();
-// objectAttributes.add(new QName(Constants.XSI_NAMESPACE, "type", \
"xsi"));
-// objectAttributes.add(beanObject.getClass().getName());
+ ArrayList objectAttributes = new ArrayList();
+ objectAttributes.add(new QName("type"));
+ objectAttributes.add(beanObject.getClass().getName());
return new ADBXMLStreamReaderImpl(beanName, object.toArray(), null,
typeTable, qualified);
@@ -317,22 +317,18 @@
throws AxisFault {
Object beanObj =null;
try {
- // Added this block as a fix for issues AXIS2-2055 and AXIS2-1899
+ // Added this block as a fix for issues AXIS2-2055 and AXIS2-1899
// to support polymorphism in POJO approach.
// Retrieve the type name of the instance from the 'type' attribute
// and retrieve the class.
-// String instanceTypeName = beanElement.getAttributeValue(
-// new QName(Constants.XSI_NAMESPACE,"type","xsi"));
-// if ((instanceTypeName != null) && (! beanClass.isArray())) {
-// try {
-// beanClass = Class.forName(instanceTypeName);
-// } catch (ClassNotFoundException ce) {
-// log.warn(ce);
- // This breaks samples , and Need to improve a bit to fully
- // support this so , Exception just ignore here, we can fix
- // that later
-// }
-// }
+ String instanceTypeName = beanElement.getAttributeValue(new \
QName("type")); + if ((instanceTypeName != null) && (! \
beanClass.isArray())) { + try {
+ beanClass = Loader.loadClass(beanClass.getClassLoader(), \
instanceTypeName); + } catch (ClassNotFoundException ce) {
+ throw AxisFault.makeFault(ce);
+ }
+ }
if (beanClass.isArray()) {
ArrayList valueList = new ArrayList();
@@ -374,9 +370,9 @@
// the beanClass could be an abstract one.
// so create an instance only if there are elements, in
// which case a concrete subclass is available to instantiate.
-// if (beanObj == null) {
-// beanObj = objectSupplier.getObject(beanClass);
-// }
+ if (beanObj == null) {
+ beanObj = objectSupplier.getObject(beanClass);
+ }
OMElement parts;
Object objValue = elements.next();
if (objValue instanceof OMElement) {
Modified: webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/SchemaGenerator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/java2wsdl/src/o \
rg/apache/ws/java2wsdl/SchemaGenerator.java?view=diff&rev=542524&r1=542523&r2=542524 \
==============================================================================
--- webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/SchemaGenerator.java \
(original)
+++ webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/SchemaGenerator.java \
Tue May 29 07:05:03 2007 @@ -158,7 +158,6 @@
JamServiceFactory factory = JamServiceFactory.getInstance();
JamServiceParams jam_service_parms = factory.createServiceParams();
//setting the classLoder
-// jam_service_parms.setParentClassLoader(factory.createJamClassLoader(classLoader));
//it can posible to add the classLoader as well
jam_service_parms.addClassLoader(classLoader);
jam_service_parms.includeClass(className);
@@ -223,28 +222,14 @@
continue;
}
if (jMethod.getExceptionTypes().length > 0) {
- /*
- methodSchemaType = \
createSchemaTypeForMethodPart(getSimpleName(jMethod) + "Fault");
- sequence = new XmlSchemaSequence();
- XmlSchemaElement elt1 = new XmlSchemaElement();
- elt1.setName(getSimpleName(jMethod) + "Fault");
- \
elt1.setSchemaTypeName(typeTable.getQNamefortheType(Object.class.getName()));
- sequence.getItems().add(elt1);
- methodSchemaType.setParticle(sequence);
- */
-// begin mj
JClass[] extypes = jMethod.getExceptionTypes() ;
for (int j= 0 ; j < extypes.length ; j++) {
JClass extype = extypes[j] ;
methodSchemaType = \
createSchemaTypeForMethodPart(extype.getSimpleName()+ "Fault"); sequence = new \
XmlSchemaSequence();
- // methodSchemaType = \
createSchemaTypeForMethodPart(extype.getSimpleName());
- // methodSchemaType.setParticle(sequence);
generateSchemaForType(sequence, extype, \
extype.getSimpleName()); methodSchemaType.setParticle(sequence);
}
- // end mj
-
}
uniqueMethods.put(getSimpleName(jMethod), jMethod);
//create the schema type for the method wrapper
@@ -363,7 +348,6 @@
JClass sup = javaType.getSuperclass();
-// AXIS2-1749 inheritance
if ((sup != null) && !( \
"java.lang.Object".compareTo(sup.getQualifiedName()) == 0) &&
!("org.apache.axis2".compareTo(sup.getContainingPackage().getQualifiedName()) \
== 0)) { String superClassName = sup.getQualifiedName();
@@ -413,23 +397,18 @@
// adding this type to the table
typeTable.addComplexSchema(name, eltOuter.getQName());
// adding this type's package to the table, to support inheritance.
-// typeTable.addComplexSchema(javaType.getContainingPackage().getQualifiedName(),
-// eltOuter.getQName());
-
+ typeTable.addComplexSchema(javaType.getContainingPackage().getQualifiedName(),
+ eltOuter.getQName());
JClass tempClass = javaType;
Set propertiesSet = new HashSet();
Set propertiesNames = new HashSet();
- // while (tempClass != null && \
!"java.lang.Object".equals(getQualifiedName(tempClass))) {
-// With 1749 we don'nt need properties of superclasses
JProperty[] tempProperties = tempClass.getDeclaredProperties();
for (int i = 0; i < tempProperties.length; i++) {
propertiesSet.add(tempProperties[i]);
}
- // tempClass = tempClass.getSuperclass();
- // }
JProperty[] properties = (JProperty[])propertiesSet.toArray(new \
JProperty[0]); Arrays.sort(properties);
@@ -447,8 +426,6 @@
}
- // AXIS2-2116 support for fields
-
JField[] tempFields = javaType.getDeclaredFields();
HashMap FieldMap = new HashMap();
@@ -471,24 +448,15 @@
// remove fields from super classes patch for defect Annogen-21
// getDeclaredFields is incorrectly returning fields of super classes as \
well // getDeclaredProperties used earlier works correctly
-
JClass supr = javaType.getSuperclass();
while (supr != null && \
supr.getQualifiedName().compareTo("java.lang.Object") != 0) {
-
JField[] suprFields = supr.getFields();
-
for (int i = 0; i < suprFields.length; i++) {
-
FieldMap.remove(suprFields[i].getSimpleName());
-
}
-
supr = supr.getSuperclass();
-
-
}
-
- // end patch for Annogen -21
+ // end patch for Annogen -21
JField[] froperties = (JField[])FieldMap.values().toArray(new \
JField[0]); Arrays.sort(froperties);
@@ -599,7 +567,6 @@
schemaTypeName,
partName,
isArrayType);
- //addImport((XmlSchema)schemaMap.get(schemaTargetNameSpace), \
schemaTypeName); String schemaNamespace;
schemaNamespace = \
resolveSchemaNamespace(getQualifiedName(type.getContainingPackage())); \
addImport(getXmlSchema(schemaNamespace), schemaTypeName); @@ -639,7 +606,6 @@
XmlSchemaElement globalElement = new XmlSchemaElement();
globalElement.setSchemaType(complexType);
-// globalElement.setName(formGlobalElementName(localPartName));
globalElement.setName(localPartName);
globalElement.setQName(elementName);
xmlSchema.getItems().add(globalElement);
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic