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 de...@apache.org on 2006/10/20 11:11:30 UTC
svn commit: r466040 - in /webservices/axis2/branches/java/1_1/modules:
adb/src/org/apache/axis2/databinding/utils/
adb/src/org/apache/axis2/rpc/client/ adb/src/org/apache/axis2/rpc/receivers/
integration/test/org/apache/axis2/rpc/ kernel/src/org/apache...
Author: deepal
Date: Fri Oct 20 02:11:26 2006
New Revision: 466040
URL: http://svn.apache.org/viewvc?view=rev&rev=466040
Log:
fixing AXIS2-1346
Added:
webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/engine/DefaultObjectSuppler.java
webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/engine/ObjectSuppler.java
Modified:
webservices/axis2/branches/java/1_1/modules/adb/src/org/apache/axis2/databinding/utils/BeanUtil.java
webservices/axis2/branches/java/1_1/modules/adb/src/org/apache/axis2/databinding/utils/MultirefHelper.java
webservices/axis2/branches/java/1_1/modules/adb/src/org/apache/axis2/rpc/client/RPCServiceClient.java
webservices/axis2/branches/java/1_1/modules/adb/src/org/apache/axis2/rpc/receivers/RPCInOnlyMessageReceiver.java
webservices/axis2/branches/java/1_1/modules/adb/src/org/apache/axis2/rpc/receivers/RPCInOutAsyncMessageReceiver.java
webservices/axis2/branches/java/1_1/modules/adb/src/org/apache/axis2/rpc/receivers/RPCMessageReceiver.java
webservices/axis2/branches/java/1_1/modules/adb/src/org/apache/axis2/rpc/receivers/RPCUtil.java
webservices/axis2/branches/java/1_1/modules/integration/test/org/apache/axis2/rpc/MultirefTest.java
webservices/axis2/branches/java/1_1/modules/integration/test/org/apache/axis2/rpc/RPCCallTest.java
webservices/axis2/branches/java/1_1/modules/integration/test/org/apache/axis2/rpc/RPCServiceClass.java
webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/deployment/DeploymentConstants.java
webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java
webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/deployment/ServiceBuilder.java
webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java
webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/description/AxisService.java
Modified: webservices/axis2/branches/java/1_1/modules/adb/src/org/apache/axis2/databinding/utils/BeanUtil.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/adb/src/org/apache/axis2/databinding/utils/BeanUtil.java?view=diff&rev=466040&r1=466039&r2=466040
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/adb/src/org/apache/axis2/databinding/utils/BeanUtil.java (original)
+++ webservices/axis2/branches/java/1_1/modules/adb/src/org/apache/axis2/databinding/utils/BeanUtil.java Fri Oct 20 02:11:26 2006
@@ -27,8 +27,8 @@
import org.apache.axis2.AxisFault;
import org.apache.axis2.databinding.typemapping.SimpleTypeMapper;
import org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl;
+import org.apache.axis2.engine.ObjectSuppler;
import org.apache.axis2.util.StreamWrapper;
-import org.apache.axis2.util.JavaUtils;
import org.codehaus.jam.*;
import javax.xml.namespace.QName;
@@ -37,8 +37,8 @@
import java.beans.IntrospectionException;
import java.beans.Introspector;
import java.beans.PropertyDescriptor;
-import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Array;
+import java.lang.reflect.InvocationTargetException;
import java.util.*;
@@ -96,7 +96,8 @@
if (SimpleTypeMapper.isSimpleType(ptype)) {
Object value = propDesc.getReadMethod().invoke(beanObject,
null);
- object.add(new QName(beanName.getNamespaceURI(), propDesc.getName(), beanName.getPrefix()));
+ object.add(new QName(beanName.getNamespaceURI(),
+ propDesc.getName(), beanName.getPrefix()));
object.add(value == null ? null : SimpleTypeMapper.getStringValue(value));
} else if (ptype.isArray()) {
Object value [] = (Object[]) propDesc.getReadMethod().invoke(beanObject,
@@ -104,13 +105,15 @@
if (SimpleTypeMapper.isSimpleType(ptype.getComponentType())) {
for (int j = 0; j < value.length; j++) {
Object o = value[j];
- object.add(new QName(beanName.getNamespaceURI(), propDesc.getName(), beanName.getPrefix()));
+ object.add(new QName(beanName.getNamespaceURI(),
+ propDesc.getName(), beanName.getPrefix()));
object.add(o == null ? null : SimpleTypeMapper.getStringValue(o));
}
} else {
for (int j = 0; j < value.length; j++) {
Object o = value[j];
- object.add(new QName(beanName.getNamespaceURI(), propDesc.getName(), beanName.getPrefix()));
+ object.add(new QName(beanName.getNamespaceURI(),
+ propDesc.getName(), beanName.getPrefix()));
object.add(o);
}
}
@@ -126,10 +129,12 @@
for (int j = 0; j < objList.size(); j++) {
Object o = objList.get(j);
if (SimpleTypeMapper.isSimpleType(o)) {
- object.add(new QName(beanName.getNamespaceURI(), propDesc.getName(), beanName.getPrefix()));
+ object.add(new QName(beanName.getNamespaceURI(),
+ propDesc.getName(), beanName.getPrefix()));
object.add(o);
} else {
- object.add(new QName(beanName.getNamespaceURI(), propDesc.getName(), beanName.getPrefix()));
+ object.add(new QName(beanName.getNamespaceURI(),
+ propDesc.getName(), beanName.getPrefix()));
object.add(o);
}
}
@@ -162,12 +167,16 @@
public static XMLStreamReader getPullParser(Object beanObject) {
String className = beanObject.getClass().getName();
if (className.indexOf(".") > 0) {
- className = className.substring(className.lastIndexOf('.') + 1, className.length());
+ className = className.substring(className.lastIndexOf('.') + 1,
+ className.length());
}
return getPullParser(beanObject, new QName(className));
}
- public static Object deserialize(Class beanClass, OMElement beanElement) throws AxisFault {
+ public static Object deserialize(Class beanClass,
+ OMElement beanElement,
+ ObjectSuppler objectSuppler)
+ throws AxisFault {
Object beanObj;
try {
if (beanClass.isArray()) {
@@ -179,7 +188,9 @@
Object objValue = parts.next();
if (objValue instanceof OMElement) {
omElement = (OMElement) objValue;
- Object obj = deserialize(arrayClassType, omElement);
+ Object obj = deserialize(arrayClassType,
+ omElement,
+ objectSuppler);
if (obj != null) {
valueList.add(obj);
}
@@ -199,7 +210,7 @@
properties.put(proprty.getName(), proprty);
}
- beanObj = beanClass.newInstance();
+ beanObj = objectSuppler.getObject(beanClass);
boolean tuched = false;
Iterator elements = beanElement.getChildren();
while (elements.hasNext()) {
@@ -223,11 +234,12 @@
if (SimpleTypeMapper.isSimpleType(parameters)) {
partObj = SimpleTypeMapper.getSimpleTypeObject(parameters, parts);
} else if (SimpleTypeMapper.isArrayList(parameters)) {
- partObj = SimpleTypeMapper.getArrayList((OMElement) parts.getParent(), prty.getName());
+ partObj = SimpleTypeMapper.getArrayList((OMElement)
+ parts.getParent(), prty.getName());
} else if (parameters.isArray()) {
- partObj = deserialize(parameters, (OMElement) parts.getParent());
+ partObj = deserialize(parameters, (OMElement) parts.getParent(), objectSuppler);
} else {
- partObj = deserialize(parameters, parts);
+ partObj = deserialize(parameters, parts, objectSuppler);
}
Object [] parms = new Object[]{partObj};
prty.getWriteMethod().invoke(beanObj, parms);
@@ -240,8 +252,6 @@
return null;
}
}
- } catch (InstantiationException e) {
- throw new AxisFault("InstantiationException : " + e);
} catch (IllegalAccessException e) {
throw new AxisFault("IllegalAccessException : " + e);
} catch (InvocationTargetException e) {
@@ -255,7 +265,8 @@
public static Object deserialize(Class beanClass,
OMElement beanElement,
- MultirefHelper helper) throws AxisFault {
+ MultirefHelper helper,
+ ObjectSuppler objectSuppler) throws AxisFault {
Object beanObj;
try {
HashMap properties = new HashMap();
@@ -266,7 +277,7 @@
properties.put(proprty.getName(), proprty);
}
- beanObj = beanClass.newInstance();
+ beanObj = objectSuppler.getObject(beanClass);
Iterator elements = beanElement.getChildren();
while (elements.hasNext()) {
Object child = elements.next();
@@ -277,7 +288,8 @@
continue;
}
String partsLocalName = parts.getLocalName();
- PropertyDescriptor prty = (PropertyDescriptor) properties.get(partsLocalName.toLowerCase());
+ PropertyDescriptor prty = (PropertyDescriptor) properties.get(
+ partsLocalName.toLowerCase());
if (prty != null) {
Class parameters = prty.getPropertyType();
if (prty.equals("class"))
@@ -288,20 +300,18 @@
String refId = MultirefHelper.getAttvalue(attr);
partObj = helper.getObject(refId);
if (partObj == null) {
- partObj = helper.processRef(parameters, refId);
+ partObj = helper.processRef(parameters, refId , objectSuppler);
}
} else {
partObj = SimpleTypeMapper.getSimpleTypeObject(parameters, parts);
if (partObj == null) {
- partObj = deserialize(parameters, parts);
+ partObj = deserialize(parameters, parts, objectSuppler);
}
}
Object [] parms = new Object[]{partObj};
prty.getWriteMethod().invoke(beanObj, parms);
}
}
- } catch (InstantiationException e) {
- throw new AxisFault("InstantiationException : " + e);
} catch (IllegalAccessException e) {
throw new AxisFault("IllegalAccessException : " + e);
} catch (InvocationTargetException e) {
@@ -324,7 +334,9 @@
* @return Array of objects
* @throws AxisFault
*/
- public static Object [] deserialize(OMElement response, Object [] javaTypes) throws AxisFault {
+ public static Object [] deserialize(OMElement response,
+ Object [] javaTypes,
+ ObjectSuppler objectSuppler) throws AxisFault {
/*
* Take the number of parameters in the method and , only take that much of child elements
* from the OMElement , other are ignore , as an example
@@ -374,10 +386,12 @@
}
currentLocalName = omElement.getLocalName();
classType = (Class) javaTypes[count];
- omElement = ProcessElement(classType, omElement, helper, parts, currentLocalName, retObjs, count);
+ omElement = ProcessElement(classType, omElement, helper, parts,
+ currentLocalName, retObjs, count, objectSuppler);
while (omElement != null) {
count ++;
- omElement = ProcessElement((Class) javaTypes[count], omElement, helper, parts, omElement.getLocalName(), retObjs, count);
+ omElement = ProcessElement((Class) javaTypes[count], omElement,
+ helper, parts, omElement.getLocalName(), retObjs, count, objectSuppler);
}
count ++;
}
@@ -397,17 +411,19 @@
private static OMElement ProcessElement(Class classType, OMElement omElement,
MultirefHelper helper, Iterator parts,
String currentLocalName,
- Object[] retObjs, int count) throws AxisFault {
+ Object[] retObjs,
+ int count,
+ ObjectSuppler objectSuppler) throws AxisFault {
Object objValue;
if (classType.isArray()) {
boolean done = true;
ArrayList valueList = new ArrayList();
Class arrayClassType = classType.getComponentType();
if ("byte".equals(arrayClassType.getName())) {
- retObjs[count] = processObject(omElement, arrayClassType, helper, true);
+ retObjs[count] = processObject(omElement, arrayClassType, helper, true, objectSuppler);
return null;
} else {
- valueList.add(processObject(omElement, arrayClassType, helper, true));
+ valueList.add(processObject(omElement, arrayClassType, helper, true, objectSuppler));
}
while (parts.hasNext()) {
objValue = parts.next();
@@ -421,7 +437,7 @@
break;
}
Object o = processObject(omElement, arrayClassType,
- helper, true);
+ helper, true, objectSuppler);
valueList.add(o);
}
retObjs[count] = ConverterUtil.convertToArray(arrayClassType,
@@ -431,14 +447,16 @@
}
} else {
//handling refs
- retObjs[count] = processObject(omElement, classType, helper, false);
+ retObjs[count] = processObject(omElement, classType, helper, false, objectSuppler);
}
return null;
}
public static Object processObject(OMElement omElement,
Class classType,
- MultirefHelper helper, boolean isArrayType) throws AxisFault {
+ MultirefHelper helper,
+ boolean isArrayType,
+ ObjectSuppler objectSuppler) throws AxisFault {
boolean hasRef = false;
OMAttribute omatribute = MultirefHelper.processRefAtt(omElement);
String ref = null;
@@ -461,7 +479,7 @@
if (helper.getObject(ref) != null) {
return helper.getObject(ref);
} else {
- return helper.processRef(classType, ref);
+ return helper.processRef(classType, ref , objectSuppler);
}
} else {
OMAttribute attribute = omElement.getAttribute(
@@ -479,7 +497,7 @@
} else if (SimpleTypeMapper.isArrayList(classType)) {
return SimpleTypeMapper.getArrayList(omElement);
} else {
- return BeanUtil.deserialize(classType, omElement);
+ return BeanUtil.deserialize(classType, omElement, objectSuppler);
}
}
}
Modified: webservices/axis2/branches/java/1_1/modules/adb/src/org/apache/axis2/databinding/utils/MultirefHelper.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/adb/src/org/apache/axis2/databinding/utils/MultirefHelper.java?view=diff&rev=466040&r1=466039&r2=466040
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/adb/src/org/apache/axis2/databinding/utils/MultirefHelper.java (original)
+++ webservices/axis2/branches/java/1_1/modules/adb/src/org/apache/axis2/databinding/utils/MultirefHelper.java Fri Oct 20 02:11:26 2006
@@ -22,6 +22,7 @@
import org.apache.axiom.om.OMNode;
import org.apache.axiom.om.impl.builder.StAXOMBuilder;
import org.apache.axis2.AxisFault;
+import org.apache.axis2.engine.ObjectSuppler;
import org.apache.axis2.databinding.typemapping.SimpleTypeMapper;
import javax.xml.namespace.QName;
@@ -96,7 +97,7 @@
return new StAXOMBuilder(ele.getXMLStreamReader()).getDocumentElement();
}
- public Object processRef(Class javatype, String id) throws AxisFault {
+ public Object processRef(Class javatype, String id , ObjectSuppler objectSuppler) throws AxisFault {
if (!filledTable) {
readallChildElements();
}
@@ -122,7 +123,7 @@
objectmap.put(id, valobj);
return valobj;
} else {
- Object obj = BeanUtil.deserialize(javatype, val, this);
+ Object obj = BeanUtil.deserialize(javatype, val, this , objectSuppler);
objectmap.put(id, obj);
return obj;
}
Modified: webservices/axis2/branches/java/1_1/modules/adb/src/org/apache/axis2/rpc/client/RPCServiceClient.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/adb/src/org/apache/axis2/rpc/client/RPCServiceClient.java?view=diff&rev=466040&r1=466039&r2=466040
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/adb/src/org/apache/axis2/rpc/client/RPCServiceClient.java (original)
+++ webservices/axis2/branches/java/1_1/modules/adb/src/org/apache/axis2/rpc/client/RPCServiceClient.java Fri Oct 20 02:11:26 2006
@@ -7,6 +7,7 @@
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.databinding.utils.BeanUtil;
import org.apache.axis2.description.AxisService;
+import org.apache.axis2.engine.DefaultObjectSuppler;
import javax.xml.namespace.QName;
import java.net.URL;
@@ -93,7 +94,8 @@
} else {
response = super.sendReceive(omElement);
}
- return BeanUtil.deserialize(response, returnTypes);
+ return BeanUtil.deserialize(response, returnTypes,
+ new DefaultObjectSuppler());
}
/**
Modified: webservices/axis2/branches/java/1_1/modules/adb/src/org/apache/axis2/rpc/receivers/RPCInOnlyMessageReceiver.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/adb/src/org/apache/axis2/rpc/receivers/RPCInOnlyMessageReceiver.java?view=diff&rev=466040&r1=466039&r2=466040
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/adb/src/org/apache/axis2/rpc/receivers/RPCInOnlyMessageReceiver.java (original)
+++ webservices/axis2/branches/java/1_1/modules/adb/src/org/apache/axis2/rpc/receivers/RPCInOnlyMessageReceiver.java Fri Oct 20 02:11:26 2006
@@ -43,7 +43,7 @@
Class ImplClass = obj.getClass();
DependencyManager.configureBusinessLogicProvider(obj,
- inMessage.getOperationContext());
+ inMessage.getOperationContext());
AxisOperation op = inMessage.getOperationContext().getAxisOperation();
@@ -71,18 +71,19 @@
OMNamespace namespace = methodElement.getNamespace();
if (messageNameSpace != null) {
if (namespace == null ||
- !messageNameSpace.equals(namespace.getNamespaceURI())){
+ !messageNameSpace.equals(namespace.getNamespaceURI())) {
throw new AxisFault("namespace mismatch require " +
- messageNameSpace +
- " found " +
- methodElement.getNamespace().getNamespaceURI());
+ messageNameSpace +
+ " found " +
+ methodElement.getNamespace().getNamespaceURI());
}
} else if (namespace != null) {
throw new AxisFault("namespace mismatch. Axis Oepration expects non-namespace " +
- "qualified element. But received a namespace qualified element");
+ "qualified element. But received a namespace qualified element");
}
- Object[] objectArray = RPCUtil.processRequest(methodElement, method);
+ Object[] objectArray = RPCUtil.processRequest(methodElement, method,
+ inMessage.getAxisService().getObjectSuppler());
method.invoke(obj, objectArray);
}
@@ -94,13 +95,13 @@
}
if (msg == null) {
msg = "Exception occurred while trying to invoke service method " +
- method.getName();
+ method.getName();
}
log.error(msg, e);
throw new AxisFault(msg);
} catch (Exception e) {
String msg = "Exception occurred while trying to invoke service method " +
- method.getName();
+ method.getName();
log.error(msg, e);
throw new AxisFault(msg, e);
}
Modified: webservices/axis2/branches/java/1_1/modules/adb/src/org/apache/axis2/rpc/receivers/RPCInOutAsyncMessageReceiver.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/adb/src/org/apache/axis2/rpc/receivers/RPCInOutAsyncMessageReceiver.java?view=diff&rev=466040&r1=466039&r2=466040
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/adb/src/org/apache/axis2/rpc/receivers/RPCInOutAsyncMessageReceiver.java (original)
+++ webservices/axis2/branches/java/1_1/modules/adb/src/org/apache/axis2/rpc/receivers/RPCInOutAsyncMessageReceiver.java Fri Oct 20 02:11:26 2006
@@ -108,7 +108,8 @@
"qualified element. But received a namespace qualified element");
}
- Object[] objectArray = RPCUtil.processRequest(methodElement, method);
+ Object[] objectArray = RPCUtil.processRequest(methodElement,
+ method ,inMessage.getAxisService().getObjectSuppler());
resObject = method.invoke(obj, objectArray);
}
Modified: webservices/axis2/branches/java/1_1/modules/adb/src/org/apache/axis2/rpc/receivers/RPCMessageReceiver.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/adb/src/org/apache/axis2/rpc/receivers/RPCMessageReceiver.java?view=diff&rev=466040&r1=466039&r2=466040
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/adb/src/org/apache/axis2/rpc/receivers/RPCMessageReceiver.java (original)
+++ webservices/axis2/branches/java/1_1/modules/adb/src/org/apache/axis2/rpc/receivers/RPCMessageReceiver.java Fri Oct 20 02:11:26 2006
@@ -118,7 +118,8 @@
"qualified element. But received a namespace qualified element");
}
- Object[] objectArray = RPCUtil.processRequest(methodElement, method);
+ Object[] objectArray = RPCUtil.processRequest(methodElement, method ,
+ inMessage.getAxisService().getObjectSuppler());
resObject = method.invoke(obj, objectArray);
}
Modified: webservices/axis2/branches/java/1_1/modules/adb/src/org/apache/axis2/rpc/receivers/RPCUtil.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/adb/src/org/apache/axis2/rpc/receivers/RPCUtil.java?view=diff&rev=466040&r1=466039&r2=466040
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/adb/src/org/apache/axis2/rpc/receivers/RPCUtil.java (original)
+++ webservices/axis2/branches/java/1_1/modules/adb/src/org/apache/axis2/rpc/receivers/RPCUtil.java Fri Oct 20 02:11:26 2006
@@ -8,6 +8,7 @@
import org.apache.axiom.soap.SOAPEnvelope;
import org.apache.axiom.soap.SOAPFactory;
import org.apache.axis2.AxisFault;
+import org.apache.axis2.engine.ObjectSuppler;
import org.apache.axis2.databinding.typemapping.SimpleTypeMapper;
import org.apache.axis2.databinding.utils.BeanUtil;
import org.apache.axis2.util.StreamWrapper;
@@ -94,9 +95,10 @@
}
}
- public static Object[] processRequest(OMElement methodElement, Method method) throws AxisFault {
+ public static Object[] processRequest(OMElement methodElement,
+ Method method , ObjectSuppler objectSuppler) throws AxisFault {
Class[] parameters = method.getParameterTypes();
- return BeanUtil.deserialize(methodElement, parameters);
+ return BeanUtil.deserialize(methodElement, parameters , objectSuppler);
}
public static OMElement getResponseElement(QName resname, Object [] objs, boolean qualified) {
Modified: webservices/axis2/branches/java/1_1/modules/integration/test/org/apache/axis2/rpc/MultirefTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/integration/test/org/apache/axis2/rpc/MultirefTest.java?view=diff&rev=466040&r1=466039&r2=466040
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/integration/test/org/apache/axis2/rpc/MultirefTest.java (original)
+++ webservices/axis2/branches/java/1_1/modules/integration/test/org/apache/axis2/rpc/MultirefTest.java Fri Oct 20 02:11:26 2006
@@ -44,6 +44,7 @@
import org.apache.axis2.description.InOutAxisOperation;
import org.apache.axis2.description.Parameter;
import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.axis2.engine.DefaultObjectSuppler;
import org.apache.axis2.integration.UtilServer;
import org.apache.axis2.integration.UtilServerBasedTestCase;
import org.apache.axis2.receivers.AbstractMessageReceiver;
@@ -359,7 +360,7 @@
SOAPEnvelope env = responseMessageContx.getEnvelope();
OMElement response = env.getBody().getFirstElement();
- MyBean resBean = (MyBean) BeanUtil.deserialize(MyBean.class, response.getFirstElement());
+ MyBean resBean = (MyBean) BeanUtil.deserialize(MyBean.class, response.getFirstElement() , new DefaultObjectSuppler());
assertNotNull(resBean);
assertEquals(resBean.getAge(), 159);
}
@@ -419,7 +420,7 @@
SOAPEnvelope env = responseMessageContx.getEnvelope();
OMElement response = env.getBody().getFirstElement();
- MyBean resBean = (MyBean) BeanUtil.deserialize(MyBean.class, response.getFirstElement());
+ MyBean resBean = (MyBean) BeanUtil.deserialize(MyBean.class, response.getFirstElement() , new DefaultObjectSuppler());
assertNotNull(resBean);
assertEquals(resBean.getAge(), 159);
}
@@ -484,7 +485,7 @@
ArrayList args = new ArrayList();
args.add(boolean.class);
- Object [] resBean = BeanUtil.deserialize(response, args.toArray());
+ Object [] resBean = BeanUtil.deserialize(response, args.toArray() , new DefaultObjectSuppler());
assertNotNull(resBean);
assertEquals(((Boolean) resBean[0]).booleanValue(), true);
}
@@ -554,7 +555,7 @@
SOAPEnvelope env = responseMessageContx.getEnvelope();
- Employee emp = (Employee) BeanUtil.deserialize(Employee.class, env.getBody().getFirstElement().getFirstElement());
+ Employee emp = (Employee) BeanUtil.deserialize(Employee.class, env.getBody().getFirstElement().getFirstElement() , new DefaultObjectSuppler());
assertNotNull(emp);
}
Modified: webservices/axis2/branches/java/1_1/modules/integration/test/org/apache/axis2/rpc/RPCCallTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/integration/test/org/apache/axis2/rpc/RPCCallTest.java?view=diff&rev=466040&r1=466039&r2=466040
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/integration/test/org/apache/axis2/rpc/RPCCallTest.java (original)
+++ webservices/axis2/branches/java/1_1/modules/integration/test/org/apache/axis2/rpc/RPCCallTest.java Fri Oct 20 02:11:26 2006
@@ -36,6 +36,7 @@
import org.apache.axis2.description.AxisService;
import org.apache.axis2.description.InOutAxisOperation;
import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.axis2.engine.DefaultObjectSuppler;
import org.apache.axis2.integration.UtilServer;
import org.apache.axis2.integration.UtilServerBasedTestCase;
import org.apache.axis2.rpc.client.RPCServiceClient;
@@ -128,7 +129,7 @@
args.add("159");
OMElement response = sender.invokeBlocking(operationName, args.toArray());
- MyBean resBean = (MyBean) BeanUtil.deserialize(MyBean.class, response.getFirstElement());
+ MyBean resBean = (MyBean) BeanUtil.deserialize(MyBean.class, response.getFirstElement(), new DefaultObjectSuppler());
assertNotNull(resBean);
assertEquals(resBean.getAge(), 159);
}
@@ -171,7 +172,8 @@
OMElement response = sender.invokeBlocking(operationName, args.toArray());
- MyBean resBean = (MyBean) BeanUtil.deserialize(MyBean.class, response.getFirstElement());
+ MyBean resBean = (MyBean) BeanUtil.deserialize(MyBean.class,
+ response.getFirstElement(), new DefaultObjectSuppler());
// MyBean resBean =(MyBean) new BeanSerializer(MyBean.class,response).deserilze();
assertNotNull(resBean);
assertEquals(resBean.getAge(), 100);
@@ -202,7 +204,8 @@
OMElement response = sender.invokeBlocking(operationName, args.toArray());
- Mail resBean = (Mail) BeanUtil.deserialize(Mail.class, response.getFirstElement());
+ Mail resBean = (Mail) BeanUtil.deserialize(Mail.class, response.getFirstElement(),
+ new DefaultObjectSuppler());
// MyBean resBean =(MyBean) new BeanSerializer(MyBean.class,response).deserilze();
assertNotNull(resBean);
assertEquals(resBean.getBody(), "My Body");
Modified: webservices/axis2/branches/java/1_1/modules/integration/test/org/apache/axis2/rpc/RPCServiceClass.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/integration/test/org/apache/axis2/rpc/RPCServiceClass.java?view=diff&rev=466040&r1=466039&r2=466040
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/integration/test/org/apache/axis2/rpc/RPCServiceClass.java (original)
+++ webservices/axis2/branches/java/1_1/modules/integration/test/org/apache/axis2/rpc/RPCServiceClass.java Fri Oct 20 02:11:26 2006
@@ -22,6 +22,7 @@
import org.apache.axiom.om.OMNamespace;
import org.apache.axiom.soap.SOAPFactory;
import org.apache.axis2.AxisFault;
+import org.apache.axis2.engine.DefaultObjectSuppler;
import org.apache.axis2.databinding.utils.BeanUtil;
import javax.xml.stream.XMLStreamException;
@@ -122,14 +123,14 @@
}
public MyBean beanOM(OMElement element, int val) throws AxisFault {
- MyBean bean = (MyBean) BeanUtil.deserialize(MyBean.class, element);
+ MyBean bean = (MyBean) BeanUtil.deserialize(MyBean.class, element , new DefaultObjectSuppler());
bean.setAge(val);
return bean;
}
public boolean omrefs(OMElement element, OMElement element2) throws AxisFault {
- MyBean bean = (MyBean) BeanUtil.deserialize(MyBean.class, element);
- MyBean bean2 = (MyBean) BeanUtil.deserialize(MyBean.class, element2);
+ MyBean bean = (MyBean) BeanUtil.deserialize(MyBean.class, element , new DefaultObjectSuppler());
+ MyBean bean2 = (MyBean) BeanUtil.deserialize(MyBean.class, element2 , new DefaultObjectSuppler());
return bean2 != null && bean != null;
}
@@ -168,7 +169,7 @@
ArrayList tems = new ArrayList();
for (int i = 0; i < pss.size(); i++) {
OMElement omElement = (OMElement) pss.get(i);
- Person p = (Person) BeanUtil.deserialize(Person.class, omElement);
+ Person p = (Person) BeanUtil.deserialize(Person.class, omElement , new DefaultObjectSuppler());
tems.add(p);
}
com.setPersons(tems);
Modified: webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/deployment/DeploymentConstants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/deployment/DeploymentConstants.java?view=diff&rev=466040&r1=466039&r2=466040
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/deployment/DeploymentConstants.java (original)
+++ webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/deployment/DeploymentConstants.java Fri Oct 20 02:11:26 2006
@@ -55,6 +55,7 @@
String TAG_PHASE_FIRST = "phaseFirst";
String TAG_ORDER = "order"; // to resolve the order tag
String TAG_OPERATION = "operation"; // operation start tag
+ String TAG_OBJECT_SUPPLER = "objectSuppler"; // operation start tag
String TAG_EXCLUDE_OPERATIONS="excludeOperations";
String TAG_MESSAGE_RECEIVER = "messageReceiver";
String TAG_MESSAGE_RECEIVERS = "messageReceivers";
Modified: webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java?view=diff&rev=466040&r1=466039&r2=466040
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java (original)
+++ webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java Fri Oct 20 02:11:26 2006
@@ -517,6 +517,7 @@
log.info(Messages.getMessage(DeploymentErrorMsgs.DEPLOYING_WS,
currentArchiveFile.getName()));
} catch (DeploymentException de) {
+ de.printStackTrace();
log.error(Messages.getMessage(DeploymentErrorMsgs.INVALID_SERVICE,
currentArchiveFile.getName(),
de.getMessage()),
Modified: webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/deployment/ServiceBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/deployment/ServiceBuilder.java?view=diff&rev=466040&r1=466039&r2=466040
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/deployment/ServiceBuilder.java (original)
+++ webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/deployment/ServiceBuilder.java Fri Oct 20 02:11:26 2006
@@ -25,6 +25,7 @@
import org.apache.axis2.deployment.util.Utils;
import org.apache.axis2.description.*;
import org.apache.axis2.engine.MessageReceiver;
+import org.apache.axis2.engine.ObjectSuppler;
import org.apache.axis2.engine.ServiceLifeCycle;
import org.apache.axis2.i18n.Messages;
import org.apache.axis2.util.Loader;
@@ -123,18 +124,7 @@
getAttribute(new QName(TAG_CLASS_NAME));
if (serviceLifeCycleClass != null) {
String className = serviceLifeCycleClass.getAttributeValue();
- if (className != null) {
- try {
- ClassLoader loader = service.getClassLoader();
- Class serviceLifeCycleClassImpl = Loader.loadClass(loader, className);
- ServiceLifeCycle serviceLifeCycle = (ServiceLifeCycle) serviceLifeCycleClassImpl.newInstance();
- serviceLifeCycle.startUp(configCtx, service);
- service.setServiceLifeCycle(
- serviceLifeCycle);
- } catch (Exception e) {
- throw new DeploymentException(e.getMessage(), e);
- }
- }
+ loadServiceLifeCycleClass(className);
}
//Setting schema namespece if any
OMElement schemaElement = service_element.getFirstChildWithName(new QName(SCHEMA));
@@ -282,6 +272,10 @@
}
}
}
+ String objectSupplerValue = (String) service.getParameterValue(TAG_OBJECT_SUPPLER);
+ if (objectSupplerValue != null) {
+ loadObjectSupllerClass(objectSupplerValue);
+ }
if (!service.isUseUserWSDL()) {
// Generating schema for the service if the impl class is Java
if (!service.isWsdlFound()) {
@@ -328,6 +322,33 @@
DeploymentErrorMsgs.OPERATION_PROCESS_ERROR, axisFault.getMessage()), axisFault);
}
return service;
+ }
+
+ private void loadObjectSupllerClass(String objectSupplerValue) throws AxisFault {
+ try {
+ ClassLoader loader = service.getClassLoader();
+ Class objectSupplerImpl = Loader.loadClass(loader, objectSupplerValue.trim());
+ ObjectSuppler objectSuppler = (ObjectSuppler) objectSupplerImpl.newInstance();
+ service.setObjectSuppler(
+ objectSuppler);
+ } catch (Exception e) {
+ throw new AxisFault(e);
+ }
+ }
+
+ private void loadServiceLifeCycleClass(String className) throws DeploymentException {
+ if (className != null) {
+ try {
+ ClassLoader loader = service.getClassLoader();
+ Class serviceLifeCycleClassImpl = Loader.loadClass(loader, className);
+ ServiceLifeCycle serviceLifeCycle = (ServiceLifeCycle) serviceLifeCycleClassImpl.newInstance();
+ serviceLifeCycle.startUp(configCtx, service);
+ service.setServiceLifeCycle(
+ serviceLifeCycle);
+ } catch (Exception e) {
+ throw new DeploymentException(e.getMessage(), e);
+ }
+ }
}
Modified: webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java?view=diff&rev=466040&r1=466039&r2=466040
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java (original)
+++ webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java Fri Oct 20 02:11:26 2006
@@ -250,7 +250,8 @@
}
if (obj == null) {
log.warn("ServiceObjectSupplier implmentation Object could not be found");
- return;
+ throw new DeploymentException(
+ "ServiceClass or ServiceObjectSupplier implmentation Object could not be found");
}
serviceClass = obj.getClass().getName();
} else {
Modified: webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/description/AxisService.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/description/AxisService.java?view=diff&rev=466040&r1=466039&r2=466040
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/description/AxisService.java (original)
+++ webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/description/AxisService.java Fri Oct 20 02:11:26 2006
@@ -25,9 +25,7 @@
import org.apache.axis2.client.Options;
import org.apache.axis2.deployment.util.PhasesInfo;
import org.apache.axis2.deployment.util.Utils;
-import org.apache.axis2.engine.AxisConfiguration;
-import org.apache.axis2.engine.MessageReceiver;
-import org.apache.axis2.engine.ServiceLifeCycle;
+import org.apache.axis2.engine.*;
import org.apache.axis2.i18n.Messages;
import org.apache.axis2.modules.Module;
import org.apache.axis2.phaseresolver.PhaseResolver;
@@ -173,6 +171,9 @@
private String wsaddressingFlag = AddressingConstants.ADDRESSING_UNSPECIFIED;
private boolean clientSide = false;
+ //To keep a ref to ObjectSuppler instance
+ private ObjectSuppler objectSuppler;
+
// package to namespace mapping
private Map p2nMap;
@@ -233,6 +234,7 @@
engagedModules = new ArrayList();
schemaList = new ArrayList();
serviceClassLoader = Thread.currentThread().getContextClassLoader();
+ objectSuppler = new DefaultObjectSuppler();
}
/**
@@ -1502,7 +1504,7 @@
Set keys = nameSpacesMap.keySet();
while (itr.hasNext()) {
String value = (String) itr.next();
- if (value.equals(targetNameSpace)&&keys.contains(prefix)) {
+ if (value.equals(targetNameSpace) && keys.contains(prefix)) {
found = true;
}
}
@@ -1713,5 +1715,13 @@
public void setP2nMap(Map p2nMap) {
this.p2nMap = p2nMap;
+ }
+
+ public ObjectSuppler getObjectSuppler() {
+ return objectSuppler;
+ }
+
+ public void setObjectSuppler(ObjectSuppler objectSuppler) {
+ this.objectSuppler = objectSuppler;
}
}
Added: webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/engine/DefaultObjectSuppler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/engine/DefaultObjectSuppler.java?view=auto&rev=466040
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/engine/DefaultObjectSuppler.java (added)
+++ webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/engine/DefaultObjectSuppler.java Fri Oct 20 02:11:26 2006
@@ -0,0 +1,31 @@
+package org.apache.axis2.engine;
+
+import org.apache.axis2.AxisFault;
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+*
+*/
+
+public class DefaultObjectSuppler implements ObjectSuppler {
+
+ public Object getObject(Class clazz) throws AxisFault {
+ try {
+ return clazz.newInstance();
+ } catch (Exception e) {
+ throw new AxisFault(e);
+ }
+ }
+}
Added: webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/engine/ObjectSuppler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/engine/ObjectSuppler.java?view=auto&rev=466040
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/engine/ObjectSuppler.java (added)
+++ webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/engine/ObjectSuppler.java Fri Oct 20 02:11:26 2006
@@ -0,0 +1,33 @@
+package org.apache.axis2.engine;
+
+import org.apache.axis2.AxisFault;
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+*
+*/
+
+public interface ObjectSuppler {
+ /**
+ * If someone want to write service impl class with interface
+ * being there method parameter , then at the time of deserilization
+ * this method will provide the impl class for that interface.
+ *
+ * @param clazz Type
+ * @return
+ * @throws AxisFault : will throw an exception when something goes wrong
+ */
+ Object getObject(Class clazz) throws AxisFault;
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org
Re: svn commit: r466040 - in
/webservices/axis2/branches/java/1_1/modules:
adb/src/org/apache/axis2/databinding/utils/
adb/src/org/apache/axis2/rpc/client/
adb/src/org/apache/axis2/rpc/receivers/
integration/test/org/apache/axis2/rpc/ kernel/src/org/apache...
Posted by Sanjiva Weerawarana <sa...@opensource.lk>.
On Fri, 2006-10-20 at 09:11 +0000, deepal@apache.org wrote:
> Author: deepal
> Date: Fri Oct 20 02:11:26 2006
> New Revision: 466040
>
> URL: http://svn.apache.org/viewvc?view=rev&rev=466040
> Log:
> fixing AXIS2-1346
>
> Added:
> webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/engine/DefaultObjectSuppler.java
> webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/engine/ObjectSuppler.java
Please correct the spelling:
s/ObjectSuppler/ObjectSupplier/
s/DefaultObjectSuppler/DefaultObjectSupplier/
Sanjiva.
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org
Re: svn commit: r466040 - in
/webservices/axis2/branches/java/1_1/modules:
adb/src/org/apache/axis2/databinding/utils/
adb/src/org/apache/axis2/rpc/client/
adb/src/org/apache/axis2/rpc/receivers/
integration/test/org/apache/axis2/rpc/ kernel/src/org/apache...
Posted by Sanjiva Weerawarana <sa...@opensource.lk>.
On Fri, 2006-10-20 at 09:11 +0000, deepal@apache.org wrote:
> Author: deepal
> Date: Fri Oct 20 02:11:26 2006
> New Revision: 466040
>
> URL: http://svn.apache.org/viewvc?view=rev&rev=466040
> Log:
> fixing AXIS2-1346
>
> Added:
> webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/engine/DefaultObjectSuppler.java
> webservices/axis2/branches/java/1_1/modules/kernel/src/org/apache/axis2/engine/ObjectSuppler.java
Please correct the spelling:
s/ObjectSuppler/ObjectSupplier/
s/DefaultObjectSuppler/DefaultObjectSupplier/
Sanjiva.
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org