You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by di...@apache.org on 2005/09/15 21:07:03 UTC
svn commit: r289289 [8/134] - in /webservices/axis2/trunk/java: ./ etc/
modules/addressing/ modules/addressing/src/META-INF/
modules/addressing/src/org/apache/axis2/handlers/addressing/
modules/addressing/test-resources/ modules/addressing/test/org/apa...
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/Call.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/Call.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/Call.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/Call.java Thu Sep 15 11:52:11 2005
@@ -1,256 +1,256 @@
-/*
-* 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.
-*
-* Runtime state of the engine
-*/
-package org.apache.axis2.clientapi;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.ConfigurationContextFactory;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.context.ServiceContext;
-import org.apache.axis2.deployment.util.PhasesInfo;
-import org.apache.axis2.description.OperationDescription;
-import org.apache.axis2.description.ServiceDescription;
-import org.apache.axis2.description.ServiceGroupDescription;
-import org.apache.axis2.engine.AxisConfigurationImpl;
-import org.apache.axis2.om.OMElement;
-import org.apache.axis2.soap.SOAPEnvelope;
-
-import javax.xml.namespace.QName;
-
-/**
- * This class should be used only to invoke INOUT web services and will serve as a more convenient
- * class to work with INOUT MEP.
- */
-public class Call extends InOutMEPClient {
-
-// Unused? --GD
-// private HashMap properties;
- protected static OperationDescription operationTemplate;
- private MessageContext lastResponseMessage;
-
- /**
- * @throws AxisFault
- */
-
- public Call() throws AxisFault {
- super(assumeServiceContext(null));
- }
-
- /**
- * This is used to create call object with client home , using only this constructor it can
- * able to engage modules , addning client side parameters
- *
- * @param clientHome
- * @throws AxisFault
- */
- public Call(String clientHome) throws AxisFault {
- super(assumeServiceContext(clientHome));
- }
-
- /**
- * @param service
- * @see InOutMEPClient constructer
- */
- public Call(ServiceContext service) {
- super(service);
- }
-
- /**
- * Invoke the blocking/Synchronous call
- *
- * @param axisop - this will be used to identify the operation in the client side, without dispatching
- * @param toSend - This should be OM Element (payload)
- * @return
- * @throws AxisFault
- */
-
- public OMElement invokeBlocking(String axisop, OMElement toSend)
- throws AxisFault {
-
- OperationDescription opDesc =
- serviceContext.getServiceConfig().getOperation(new QName(axisop));
- opDesc = createOpDescAndFillInFlowInformation(opDesc,axisop);
- opDesc.setParent(serviceContext.getServiceConfig());
- MessageContext msgctx = prepareTheSOAPEnvelope(toSend);
-
- this.lastResponseMessage = super.invokeBlocking(opDesc, msgctx);
- SOAPEnvelope resEnvelope = lastResponseMessage.getEnvelope();
- return resEnvelope.getBody().getFirstElement();
- }
-
- /**
- * Invoke the blocking/Synchronous call
- *
- * @param axisop - this will be used to identify the operation in the client side, without dispatching
- * @param envelope - This should be SOAPEnvelope
- * @return
- * @throws AxisFault
- */
- public SOAPEnvelope invokeBlocking(String axisop, SOAPEnvelope envelope)
- throws AxisFault {
-
- OperationDescription opDesc =
- serviceContext.getServiceConfig().getOperation(new QName(axisop));
- opDesc = createOpDescAndFillInFlowInformation(opDesc,axisop);
-
- MessageContext msgctx = new MessageContext(serviceContext.getEngineContext());
- msgctx.setEnvelope(envelope);
-
- this.lastResponseMessage = super.invokeBlocking(opDesc, msgctx);
- return lastResponseMessage.getEnvelope();
- }
-
- /**
- * Invoke the nonblocking/Asynchronous call
- *
- * @param axisop
- * @param toSend - This should be OM Element (payload)
- * invocation behaves accordingly
- * @param callback
- * @throws org.apache.axis2.AxisFault
- */
-
- public void invokeNonBlocking(
- String axisop,
- OMElement toSend,
- Callback callback)
- throws AxisFault {
- OperationDescription opDesc =
- serviceContext.getServiceConfig().getOperation(new QName(axisop));
- opDesc = createOpDescAndFillInFlowInformation(opDesc,axisop);
- MessageContext msgctx = prepareTheSOAPEnvelope(toSend);
- //call the underline implementation
- super.invokeNonBlocking(opDesc, msgctx, callback);
- }
-/**
- * Invoke the nonblocking/Asynchronous call
- *
- * @param axisop
- * @param envelope - This should be a SOAP Envelope
- * invocation behaves accordingly
- * @param callback
- * @throws org.apache.axis2.AxisFault
- */
-
- public void invokeNonBlocking(
- String axisop,
- SOAPEnvelope envelope,
- Callback callback)
- throws AxisFault {
- OperationDescription opDesc =
- serviceContext.getServiceConfig().getOperation(new QName(axisop));
- opDesc = createOpDescAndFillInFlowInformation(opDesc,axisop);
-
- MessageContext msgctx = new MessageContext(serviceContext.getEngineContext());
- msgctx.setEnvelope(envelope);
- //call the underline implementation
- super.invokeNonBlocking(opDesc, msgctx, callback);
- }
-
- /**
- * This method create a operation desc if it null and copy the flows from the template operation
- * @param opDesc
- * @param axisOp
- * @return
- */
- private OperationDescription createOpDescAndFillInFlowInformation(
- OperationDescription opDesc,
- String axisOp) {
- if (opDesc == null) {
- //if the operation is not alrady define we will copy the
- //crated Phases from the templete operation to the this Operation
- opDesc = new OperationDescription(new QName(axisOp));
- opDesc.setRemainingPhasesInFlow(
- operationTemplate.getRemainingPhasesInFlow());
- opDesc.setPhasesOutFlow(operationTemplate.getPhasesOutFlow());
- opDesc.setPhasesInFaultFlow(
- operationTemplate.getPhasesInFaultFlow());
- opDesc.setPhasesOutFaultFlow(
- operationTemplate.getPhasesOutFaultFlow());
- serviceContext.getServiceConfig().addOperation(opDesc);
- }
- return opDesc;
- }
-
- /**
- * Assume the values for the ConfigurationContext and ServiceContext to make the NON WSDL cases simple.
- *
- * @return ServiceContext that has a ConfigurationContext set in and has assumed values.
- * @throws org.apache.axis2.AxisFault
- */
- protected static ServiceContext assumeServiceContext(String clientHome)
- throws AxisFault {
- ConfigurationContext sysContext = null;
- //we are trying to keep one configuration Context at the Client side. That make it easier to
- //manage the TransportListeners. But using the static referance is bit crude!.
- if (ListenerManager.configurationContext == null) {
- ConfigurationContextFactory efac =
- new ConfigurationContextFactory();
- sysContext = efac.buildClientConfigurationContext(clientHome);
- ListenerManager.configurationContext = sysContext;
- } else {
- sysContext = ListenerManager.configurationContext;
- }
-
- //we will assume a Service and operations
- QName assumedServiceName = new QName("AnonymousService");
- ServiceDescription axisService = new ServiceDescription(assumedServiceName);
- operationTemplate = new OperationDescription(new QName("TemplateOperation"));
- ServiceGroupDescription serviceGroupDescription =
- new ServiceGroupDescription(sysContext.getAxisConfiguration());
-
- PhasesInfo info =((AxisConfigurationImpl)sysContext.getAxisConfiguration()).getPhasesinfo();
- //to set the operation flows
- if(info != null){
- info.setOperationPhases(operationTemplate);
- }
- axisService.addOperation(operationTemplate);
- serviceGroupDescription.addService(axisService);
- serviceGroupDescription.getServiceGroupContext(sysContext);
- serviceGroupDescription.setServiceGroupName(assumedServiceName.getLocalPart());
- sysContext.getAxisConfiguration().addServiceGroup(serviceGroupDescription);
-
-// return sysContext.createServiceContext(assumedServiceName);
- return serviceGroupDescription.getServiceGroupContext(sysContext).getServiceContext(
- assumedServiceName.getLocalPart());
- }
-
- /**
- * @param key
- * @return
- */
- public Object get(String key) {
- return serviceContext.getProperty(key);
- }
-
- /**
- * @param key
- * @param value
- */
- public void set(String key, Object value) {
- serviceContext.getEngineContext().setProperty(key, value);
- }
-
- /**
- * @return
- */
- public MessageContext getLastResponseMessage() {
- return lastResponseMessage;
- }
-
-}
+/*
+* 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.
+*
+* Runtime state of the engine
+*/
+package org.apache.axis2.clientapi;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.context.ServiceContext;
+import org.apache.axis2.deployment.util.PhasesInfo;
+import org.apache.axis2.description.OperationDescription;
+import org.apache.axis2.description.ServiceDescription;
+import org.apache.axis2.description.ServiceGroupDescription;
+import org.apache.axis2.engine.AxisConfigurationImpl;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.soap.SOAPEnvelope;
+
+import javax.xml.namespace.QName;
+
+/**
+ * This class should be used only to invoke INOUT web services and will serve as a more convenient
+ * class to work with INOUT MEP.
+ */
+public class Call extends InOutMEPClient {
+
+// Unused? --GD
+// private HashMap properties;
+ protected static OperationDescription operationTemplate;
+ private MessageContext lastResponseMessage;
+
+ /**
+ * @throws AxisFault
+ */
+
+ public Call() throws AxisFault {
+ super(assumeServiceContext(null));
+ }
+
+ /**
+ * This is used to create call object with client home , using only this constructor it can
+ * able to engage modules , addning client side parameters
+ *
+ * @param clientHome
+ * @throws AxisFault
+ */
+ public Call(String clientHome) throws AxisFault {
+ super(assumeServiceContext(clientHome));
+ }
+
+ /**
+ * @param service
+ * @see InOutMEPClient constructer
+ */
+ public Call(ServiceContext service) {
+ super(service);
+ }
+
+ /**
+ * Invoke the blocking/Synchronous call
+ *
+ * @param axisop - this will be used to identify the operation in the client side, without dispatching
+ * @param toSend - This should be OM Element (payload)
+ * @return
+ * @throws AxisFault
+ */
+
+ public OMElement invokeBlocking(String axisop, OMElement toSend)
+ throws AxisFault {
+
+ OperationDescription opDesc =
+ serviceContext.getServiceConfig().getOperation(new QName(axisop));
+ opDesc = createOpDescAndFillInFlowInformation(opDesc,axisop);
+ opDesc.setParent(serviceContext.getServiceConfig());
+ MessageContext msgctx = prepareTheSOAPEnvelope(toSend);
+
+ this.lastResponseMessage = super.invokeBlocking(opDesc, msgctx);
+ SOAPEnvelope resEnvelope = lastResponseMessage.getEnvelope();
+ return resEnvelope.getBody().getFirstElement();
+ }
+
+ /**
+ * Invoke the blocking/Synchronous call
+ *
+ * @param axisop - this will be used to identify the operation in the client side, without dispatching
+ * @param envelope - This should be SOAPEnvelope
+ * @return
+ * @throws AxisFault
+ */
+ public SOAPEnvelope invokeBlocking(String axisop, SOAPEnvelope envelope)
+ throws AxisFault {
+
+ OperationDescription opDesc =
+ serviceContext.getServiceConfig().getOperation(new QName(axisop));
+ opDesc = createOpDescAndFillInFlowInformation(opDesc,axisop);
+
+ MessageContext msgctx = new MessageContext(serviceContext.getEngineContext());
+ msgctx.setEnvelope(envelope);
+
+ this.lastResponseMessage = super.invokeBlocking(opDesc, msgctx);
+ return lastResponseMessage.getEnvelope();
+ }
+
+ /**
+ * Invoke the nonblocking/Asynchronous call
+ *
+ * @param axisop
+ * @param toSend - This should be OM Element (payload)
+ * invocation behaves accordingly
+ * @param callback
+ * @throws org.apache.axis2.AxisFault
+ */
+
+ public void invokeNonBlocking(
+ String axisop,
+ OMElement toSend,
+ Callback callback)
+ throws AxisFault {
+ OperationDescription opDesc =
+ serviceContext.getServiceConfig().getOperation(new QName(axisop));
+ opDesc = createOpDescAndFillInFlowInformation(opDesc,axisop);
+ MessageContext msgctx = prepareTheSOAPEnvelope(toSend);
+ //call the underline implementation
+ super.invokeNonBlocking(opDesc, msgctx, callback);
+ }
+/**
+ * Invoke the nonblocking/Asynchronous call
+ *
+ * @param axisop
+ * @param envelope - This should be a SOAP Envelope
+ * invocation behaves accordingly
+ * @param callback
+ * @throws org.apache.axis2.AxisFault
+ */
+
+ public void invokeNonBlocking(
+ String axisop,
+ SOAPEnvelope envelope,
+ Callback callback)
+ throws AxisFault {
+ OperationDescription opDesc =
+ serviceContext.getServiceConfig().getOperation(new QName(axisop));
+ opDesc = createOpDescAndFillInFlowInformation(opDesc,axisop);
+
+ MessageContext msgctx = new MessageContext(serviceContext.getEngineContext());
+ msgctx.setEnvelope(envelope);
+ //call the underline implementation
+ super.invokeNonBlocking(opDesc, msgctx, callback);
+ }
+
+ /**
+ * This method create a operation desc if it null and copy the flows from the template operation
+ * @param opDesc
+ * @param axisOp
+ * @return
+ */
+ private OperationDescription createOpDescAndFillInFlowInformation(
+ OperationDescription opDesc,
+ String axisOp) {
+ if (opDesc == null) {
+ //if the operation is not alrady define we will copy the
+ //crated Phases from the templete operation to the this Operation
+ opDesc = new OperationDescription(new QName(axisOp));
+ opDesc.setRemainingPhasesInFlow(
+ operationTemplate.getRemainingPhasesInFlow());
+ opDesc.setPhasesOutFlow(operationTemplate.getPhasesOutFlow());
+ opDesc.setPhasesInFaultFlow(
+ operationTemplate.getPhasesInFaultFlow());
+ opDesc.setPhasesOutFaultFlow(
+ operationTemplate.getPhasesOutFaultFlow());
+ serviceContext.getServiceConfig().addOperation(opDesc);
+ }
+ return opDesc;
+ }
+
+ /**
+ * Assume the values for the ConfigurationContext and ServiceContext to make the NON WSDL cases simple.
+ *
+ * @return ServiceContext that has a ConfigurationContext set in and has assumed values.
+ * @throws org.apache.axis2.AxisFault
+ */
+ protected static ServiceContext assumeServiceContext(String clientHome)
+ throws AxisFault {
+ ConfigurationContext sysContext = null;
+ //we are trying to keep one configuration Context at the Client side. That make it easier to
+ //manage the TransportListeners. But using the static referance is bit crude!.
+ if (ListenerManager.configurationContext == null) {
+ ConfigurationContextFactory efac =
+ new ConfigurationContextFactory();
+ sysContext = efac.buildClientConfigurationContext(clientHome);
+ ListenerManager.configurationContext = sysContext;
+ } else {
+ sysContext = ListenerManager.configurationContext;
+ }
+
+ //we will assume a Service and operations
+ QName assumedServiceName = new QName("AnonymousService");
+ ServiceDescription axisService = new ServiceDescription(assumedServiceName);
+ operationTemplate = new OperationDescription(new QName("TemplateOperation"));
+ ServiceGroupDescription serviceGroupDescription =
+ new ServiceGroupDescription(sysContext.getAxisConfiguration());
+
+ PhasesInfo info =((AxisConfigurationImpl)sysContext.getAxisConfiguration()).getPhasesinfo();
+ //to set the operation flows
+ if(info != null){
+ info.setOperationPhases(operationTemplate);
+ }
+ axisService.addOperation(operationTemplate);
+ serviceGroupDescription.addService(axisService);
+ serviceGroupDescription.getServiceGroupContext(sysContext);
+ serviceGroupDescription.setServiceGroupName(assumedServiceName.getLocalPart());
+ sysContext.getAxisConfiguration().addServiceGroup(serviceGroupDescription);
+
+// return sysContext.createServiceContext(assumedServiceName);
+ return serviceGroupDescription.getServiceGroupContext(sysContext).getServiceContext(
+ assumedServiceName.getLocalPart());
+ }
+
+ /**
+ * @param key
+ * @return
+ */
+ public Object get(String key) {
+ return serviceContext.getProperty(key);
+ }
+
+ /**
+ * @param key
+ * @param value
+ */
+ public void set(String key, Object value) {
+ serviceContext.getEngineContext().setProperty(key, value);
+ }
+
+ /**
+ * @return
+ */
+ public MessageContext getLastResponseMessage() {
+ return lastResponseMessage;
+ }
+
+}
Propchange: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/Call.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/Callback.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/Callback.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/Callback.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/Callback.java Thu Sep 15 11:52:11 2005
@@ -1,59 +1,59 @@
-package org.apache.axis2.clientapi;
-
-
-/**
- * This Class is the abstract representation of the Callback that would be called in the completion of a
- * Async invocation
- * Author : Deepal Jayasinghe
- * Date: Apr 9, 2005
- * Time: 8:03:41 PM
- */
-public abstract class Callback {
- /**
- * Field complete
- */
- private boolean complete = false;
-
-
- /**
- * This Method is called by Axis2 once the Async Operation is sucessfully completed and the result returns
- *
- * @param result
- */
- public abstract void onComplete(AsyncResult result);
-
- /**
- * This Method is called by Axis2 once the Async Operation fails and the result returns
- *
- * @param e
- */
- public abstract void reportError(Exception e);
-
- /**
- * This says has the Async Operation is completed or not. this could be useful for poleing
- * with a special callback written for poleing (checking repeatedly time to time).
- * e.g.
- * <code>
- * <pre>
- * while(!callback.isComplete()){
- * Thread.sleep(1000);
- * }
- * do whatever u need to do
- * </pre>
- * </code>
- *
- * @return
- */
- public boolean isComplete() {
- return complete;
- }
-
- /**
- * Method setComplete
- *
- * @param complete
- */
- public void setComplete(boolean complete) {
- this.complete = complete;
- }
-}
+package org.apache.axis2.clientapi;
+
+
+/**
+ * This Class is the abstract representation of the Callback that would be called in the completion of a
+ * Async invocation
+ * Author : Deepal Jayasinghe
+ * Date: Apr 9, 2005
+ * Time: 8:03:41 PM
+ */
+public abstract class Callback {
+ /**
+ * Field complete
+ */
+ private boolean complete = false;
+
+
+ /**
+ * This Method is called by Axis2 once the Async Operation is sucessfully completed and the result returns
+ *
+ * @param result
+ */
+ public abstract void onComplete(AsyncResult result);
+
+ /**
+ * This Method is called by Axis2 once the Async Operation fails and the result returns
+ *
+ * @param e
+ */
+ public abstract void reportError(Exception e);
+
+ /**
+ * This says has the Async Operation is completed or not. this could be useful for poleing
+ * with a special callback written for poleing (checking repeatedly time to time).
+ * e.g.
+ * <code>
+ * <pre>
+ * while(!callback.isComplete()){
+ * Thread.sleep(1000);
+ * }
+ * do whatever u need to do
+ * </pre>
+ * </code>
+ *
+ * @return
+ */
+ public boolean isComplete() {
+ return complete;
+ }
+
+ /**
+ * Method setComplete
+ *
+ * @param complete
+ */
+ public void setComplete(boolean complete) {
+ this.complete = complete;
+ }
+}
Propchange: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/Callback.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/CallbackReceiver.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/CallbackReceiver.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/CallbackReceiver.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/CallbackReceiver.java Thu Sep 15 11:52:11 2005
@@ -1,47 +1,47 @@
-package org.apache.axis2.clientapi;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.addressing.miheaders.RelatesTo;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.engine.MessageReceiver;
-
-import java.util.HashMap;
-
-/**
- * This is a MessageReceiver that is used at the client side to accept the
- * Messages (response) that comes in the Client. This one correlated the incomming Message to
- * the related Messages and Call the correct callback.
- */
-
-public class CallbackReceiver implements MessageReceiver {
-
- public static String SERVIC_NAME = "ClientService";
-
- private HashMap callbackstore;
-
- public CallbackReceiver() {
- callbackstore = new HashMap();
- }
-
- public void addCallback(String MsgID, Callback callback) {
- callbackstore.put(MsgID, callback);
- }
-
- public void receive(MessageContext messgeCtx) throws AxisFault {
- RelatesTo relatesTO = messgeCtx.getMessageInformationHeaders()
- .getRelatesTo();
-
- String messageID = relatesTO.getValue();
- Callback callback = (Callback) callbackstore.get(messageID);
- AsyncResult result = new AsyncResult(messgeCtx);
- if (callback != null) {
- callback.onComplete(result);
- callback.setComplete(true);
- } else {
- throw new AxisFault(
- "The Callback realtes to MessageID " + messageID +
- " is not found");
- }
- }
-
-}
+package org.apache.axis2.clientapi;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.miheaders.RelatesTo;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.engine.MessageReceiver;
+
+import java.util.HashMap;
+
+/**
+ * This is a MessageReceiver that is used at the client side to accept the
+ * Messages (response) that comes in the Client. This one correlated the incomming Message to
+ * the related Messages and Call the correct callback.
+ */
+
+public class CallbackReceiver implements MessageReceiver {
+
+ public static String SERVIC_NAME = "ClientService";
+
+ private HashMap callbackstore;
+
+ public CallbackReceiver() {
+ callbackstore = new HashMap();
+ }
+
+ public void addCallback(String MsgID, Callback callback) {
+ callbackstore.put(MsgID, callback);
+ }
+
+ public void receive(MessageContext messgeCtx) throws AxisFault {
+ RelatesTo relatesTO = messgeCtx.getMessageInformationHeaders()
+ .getRelatesTo();
+
+ String messageID = relatesTO.getValue();
+ Callback callback = (Callback) callbackstore.get(messageID);
+ AsyncResult result = new AsyncResult(messgeCtx);
+ if (callback != null) {
+ callback.onComplete(result);
+ callback.setComplete(true);
+ } else {
+ throw new AxisFault(
+ "The Callback realtes to MessageID " + messageID +
+ " is not found");
+ }
+ }
+
+}
Propchange: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/CallbackReceiver.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/InOnlyMEPClient.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/InOutMEPClient.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/ListenerManager.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/MEPClient.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/MessageSender.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/RESTCall.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/RESTCall.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/RESTCall.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/RESTCall.java Thu Sep 15 11:52:11 2005
@@ -1,52 +1,52 @@
-/*
- * 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.
- */
-
-package org.apache.axis2.clientapi;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.context.ServiceContext;
-import org.apache.axis2.om.OMAbstractFactory;
-import org.apache.axis2.om.OMElement;
-
-
-public class RESTCall extends Call {
-
- public RESTCall() throws AxisFault {
- super();
- }
-
- public RESTCall(ServiceContext service) throws AxisFault {
- super(service);
- }
-
- public OMElement invokeBlocking()
- throws AxisFault {
- return super.invokeBlocking(
- "nothing",
- OMAbstractFactory.getOMFactory().createOMElement(
- "nothing", "nothing", "nothing"));
-
- }
-
- public void invokeNonBlocking(Callback callback)
- throws AxisFault {
- super.invokeNonBlocking(
- "nothing",
- OMAbstractFactory.getOMFactory().createOMElement(
- "nothing", "nothing", "nothing"), callback);
-
- }
-}
+/*
+ * 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.
+ */
+
+package org.apache.axis2.clientapi;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.ServiceContext;
+import org.apache.axis2.om.OMAbstractFactory;
+import org.apache.axis2.om.OMElement;
+
+
+public class RESTCall extends Call {
+
+ public RESTCall() throws AxisFault {
+ super();
+ }
+
+ public RESTCall(ServiceContext service) throws AxisFault {
+ super(service);
+ }
+
+ public OMElement invokeBlocking()
+ throws AxisFault {
+ return super.invokeBlocking(
+ "nothing",
+ OMAbstractFactory.getOMFactory().createOMElement(
+ "nothing", "nothing", "nothing"));
+
+ }
+
+ public void invokeNonBlocking(Callback callback)
+ throws AxisFault {
+ super.invokeNonBlocking(
+ "nothing",
+ OMAbstractFactory.getOMFactory().createOMElement(
+ "nothing", "nothing", "nothing"), callback);
+
+ }
+}
Propchange: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/RESTCall.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/StreamWrapper.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/StreamWrapper.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/StreamWrapper.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/StreamWrapper.java Thu Sep 15 11:52:11 2005
@@ -1,416 +1,416 @@
-package org.apache.axis2.clientapi;
-
-import javax.xml.namespace.NamespaceContext;
-import javax.xml.namespace.QName;
-import javax.xml.stream.Location;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-
-/*
-* 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 StreamWrapper implements XMLStreamReader {
-
- private XMLStreamReader realReader = null;
- private static final int STATE_SWITCHED = 0;
- private static final int STATE_INIT = 1;
- private static final int STATE_SWITHC_AT_NEXT = 2;
-
- private int state = STATE_INIT;
- private int prevState = state;
-
- public StreamWrapper(XMLStreamReader realReader) {
- if (realReader == null) {
- throw new UnsupportedOperationException("Reader cannot be null");
- }
- this.realReader = realReader;
- }
-
- public Object getProperty(String s) throws IllegalArgumentException {
- if (prevState != STATE_INIT) {
- return realReader.getProperty(s);
- } else {
- throw new IllegalArgumentException();
- }
- }
-
- public int next() throws XMLStreamException {
-
- prevState = state;
-
- if (state == STATE_SWITCHED) {
- return realReader.next();
- } else if (state == STATE_INIT) {
- if (realReader.getEventType() == START_DOCUMENT) {
- state = STATE_SWITCHED;
- return realReader.getEventType();
- } else {
- state = STATE_SWITHC_AT_NEXT;
- return START_DOCUMENT;
- }
- } else if (state == STATE_SWITHC_AT_NEXT) {
- state = STATE_SWITCHED;
- return realReader.getEventType();
- } else {
- throw new UnsupportedOperationException();
- }
-
- }
-
- public void require(int i, String s, String s1) throws XMLStreamException {
- if (prevState != STATE_INIT) {
- realReader.require(i, s, s1);
- }
- }
-
- public String getElementText() throws XMLStreamException {
- if (prevState != STATE_INIT) {
- return realReader.getElementText();
- } else {
- throw new XMLStreamException();
- }
- }
-
- public int nextTag() throws XMLStreamException {
- if (prevState != STATE_INIT) {
- return realReader.nextTag();
- } else {
- throw new XMLStreamException();
- }
- }
-
- public boolean hasNext() throws XMLStreamException {
- if (prevState != STATE_INIT) {
- return realReader.hasNext();
- } else {
- return true;
- }
- }
-
- public void close() throws XMLStreamException {
- if (prevState != STATE_INIT) {
- realReader.close();
- } else {
- throw new XMLStreamException();
- }
- }
-
- public String getNamespaceURI(String s) {
- if (prevState != STATE_INIT) {
- return realReader.getNamespaceURI(s);
- } else {
- return null;
- }
- }
-
- public boolean isStartElement() {
- if (prevState != STATE_INIT) {
- return realReader.isStartElement();
- } else {
- return false;
- }
- }
-
- public boolean isEndElement() {
- if (prevState != STATE_INIT) {
- return realReader.isEndElement();
- } else {
- return false;
- }
- }
-
- public boolean isCharacters() {
- if (prevState != STATE_INIT) {
- return realReader.isCharacters();
- } else {
- return false;
- }
- }
-
- public boolean isWhiteSpace() {
- if (prevState != STATE_INIT) {
- return realReader.isWhiteSpace();
- } else {
- return false;
- }
- }
-
- public String getAttributeValue(String s, String s1) {
- if (prevState != STATE_INIT) {
- return realReader.getAttributeValue(s, s1);
- } else {
- return null;
- }
- }
-
- public int getAttributeCount() {
- if (prevState != STATE_INIT) {
- return realReader.getAttributeCount();
- } else {
- return 0;
- }
- }
-
- public QName getAttributeName(int i) {
- if (prevState != STATE_INIT) {
- return realReader.getAttributeName(i);
- } else {
- return null;
- }
- }
-
- public String getAttributeNamespace(int i) {
- if (prevState != STATE_INIT) {
- return realReader.getAttributeNamespace(i);
- } else {
- return null;
- }
- }
-
- public String getAttributeLocalName(int i) {
- if (prevState != STATE_INIT) {
- return realReader.getAttributeLocalName(i);
- } else {
- return null;
- }
- }
-
- public String getAttributePrefix(int i) {
- if (prevState != STATE_INIT) {
- return realReader.getAttributePrefix(i);
- } else {
- return null;
- }
- }
-
- public String getAttributeType(int i) {
- if (prevState != STATE_INIT) {
- return realReader.getAttributeType(i);
- } else {
- return null;
- }
- }
-
- public String getAttributeValue(int i) {
- if (prevState != STATE_INIT) {
- return realReader.getAttributeValue(i);
- } else {
- return null;
- }
- }
-
- public boolean isAttributeSpecified(int i) {
- if (prevState != STATE_INIT) {
- return realReader.isAttributeSpecified(i);
- } else {
- return false;
- }
- }
-
- public int getNamespaceCount() {
- if (prevState != STATE_INIT) {
- return realReader.getNamespaceCount();
- } else {
- return 0;
- }
- }
-
- public String getNamespacePrefix(int i) {
- if (prevState != STATE_INIT) {
- return realReader.getNamespacePrefix(i);
- } else {
- return null;
- }
- }
-
- public String getNamespaceURI(int i) {
- if (prevState != STATE_INIT) {
- return realReader.getNamespaceURI(i);
- } else {
- return null;
- }
- }
-
- public NamespaceContext getNamespaceContext() {
- if (prevState != STATE_INIT) {
- return realReader.getNamespaceContext();
- } else {
- return null;
- }
- }
-
- public int getEventType() {
- if (prevState == STATE_INIT) {
- return START_DOCUMENT;
- } else {
- return realReader.getEventType();
- }
- }
-
- public String getText() {
- if (prevState != STATE_INIT) {
- return realReader.getText();
- } else {
- return null;
- }
- }
-
- public char[] getTextCharacters() {
- if (prevState != STATE_INIT) {
- return realReader.getTextCharacters();
- } else {
- return new char[0];
- }
- }
-
- public int getTextCharacters(int i, char[] chars, int i1, int i2) throws XMLStreamException {
- if (prevState != STATE_INIT) {
- return realReader.getTextCharacters(i, chars, i1, i2);
- } else {
- return 0;
- }
- }
-
- public int getTextStart() {
- if (prevState != STATE_INIT) {
- return realReader.getTextStart();
- } else {
- return 0;
- }
- }
-
- public int getTextLength() {
- if (prevState != STATE_INIT) {
- return realReader.getTextStart();
- } else {
- return 0;
- }
- }
-
- public String getEncoding() {
- if (prevState != STATE_INIT) {
- return realReader.getEncoding();
- } else {
- return null;
- }
- }
-
- public boolean hasText() {
- if (prevState != STATE_INIT) {
- return realReader.hasText();
- } else {
- return false;
- }
- }
-
- public Location getLocation() {
- if (prevState != STATE_INIT) {
- return realReader.getLocation();
- } else {
- return null;
- }
- }
-
- public QName getName() {
- if (prevState != STATE_INIT) {
- return realReader.getName();
- } else {
- return null;
- }
- }
-
- public String getLocalName() {
- if (prevState != STATE_INIT) {
- return realReader.getLocalName();
- } else {
- return null;
- }
- }
-
- public boolean hasName() {
- if (prevState != STATE_INIT) {
- return realReader.hasName();
- } else {
- return false;
- }
- }
-
- public String getNamespaceURI() {
- if (prevState != STATE_INIT) {
- return realReader.getNamespaceURI();
- } else {
- return null;
- }
- }
-
- public String getPrefix() {
- if (prevState != STATE_INIT) {
- return realReader.getPrefix();
- } else {
- return null;
- }
- }
-
- public String getVersion() {
- if (prevState != STATE_INIT) {
- return realReader.getVersion();
- } else {
- return null;
- }
- }
-
- public boolean isStandalone() {
- if (prevState != STATE_INIT) {
- return realReader.isStandalone();
- } else {
- return false;
- }
- }
-
- public boolean standaloneSet() {
- if (prevState != STATE_INIT) {
- return realReader.standaloneSet();
- } else {
- return false;
- }
- }
-
- public String getCharacterEncodingScheme() {
- if (prevState != STATE_INIT) {
- return realReader.getCharacterEncodingScheme();
- } else {
- return null;
- }
- }
-
- public String getPITarget() {
- if (prevState != STATE_INIT) {
- return realReader.getPITarget();
- } else {
- return null;
- }
- }
-
- public String getPIData() {
- if (prevState != STATE_INIT) {
- return realReader.getPIData();
- } else {
- return null;
- }
- }
-}
+package org.apache.axis2.clientapi;
+
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.namespace.QName;
+import javax.xml.stream.Location;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+/*
+* 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 StreamWrapper implements XMLStreamReader {
+
+ private XMLStreamReader realReader = null;
+ private static final int STATE_SWITCHED = 0;
+ private static final int STATE_INIT = 1;
+ private static final int STATE_SWITHC_AT_NEXT = 2;
+
+ private int state = STATE_INIT;
+ private int prevState = state;
+
+ public StreamWrapper(XMLStreamReader realReader) {
+ if (realReader == null) {
+ throw new UnsupportedOperationException("Reader cannot be null");
+ }
+ this.realReader = realReader;
+ }
+
+ public Object getProperty(String s) throws IllegalArgumentException {
+ if (prevState != STATE_INIT) {
+ return realReader.getProperty(s);
+ } else {
+ throw new IllegalArgumentException();
+ }
+ }
+
+ public int next() throws XMLStreamException {
+
+ prevState = state;
+
+ if (state == STATE_SWITCHED) {
+ return realReader.next();
+ } else if (state == STATE_INIT) {
+ if (realReader.getEventType() == START_DOCUMENT) {
+ state = STATE_SWITCHED;
+ return realReader.getEventType();
+ } else {
+ state = STATE_SWITHC_AT_NEXT;
+ return START_DOCUMENT;
+ }
+ } else if (state == STATE_SWITHC_AT_NEXT) {
+ state = STATE_SWITCHED;
+ return realReader.getEventType();
+ } else {
+ throw new UnsupportedOperationException();
+ }
+
+ }
+
+ public void require(int i, String s, String s1) throws XMLStreamException {
+ if (prevState != STATE_INIT) {
+ realReader.require(i, s, s1);
+ }
+ }
+
+ public String getElementText() throws XMLStreamException {
+ if (prevState != STATE_INIT) {
+ return realReader.getElementText();
+ } else {
+ throw new XMLStreamException();
+ }
+ }
+
+ public int nextTag() throws XMLStreamException {
+ if (prevState != STATE_INIT) {
+ return realReader.nextTag();
+ } else {
+ throw new XMLStreamException();
+ }
+ }
+
+ public boolean hasNext() throws XMLStreamException {
+ if (prevState != STATE_INIT) {
+ return realReader.hasNext();
+ } else {
+ return true;
+ }
+ }
+
+ public void close() throws XMLStreamException {
+ if (prevState != STATE_INIT) {
+ realReader.close();
+ } else {
+ throw new XMLStreamException();
+ }
+ }
+
+ public String getNamespaceURI(String s) {
+ if (prevState != STATE_INIT) {
+ return realReader.getNamespaceURI(s);
+ } else {
+ return null;
+ }
+ }
+
+ public boolean isStartElement() {
+ if (prevState != STATE_INIT) {
+ return realReader.isStartElement();
+ } else {
+ return false;
+ }
+ }
+
+ public boolean isEndElement() {
+ if (prevState != STATE_INIT) {
+ return realReader.isEndElement();
+ } else {
+ return false;
+ }
+ }
+
+ public boolean isCharacters() {
+ if (prevState != STATE_INIT) {
+ return realReader.isCharacters();
+ } else {
+ return false;
+ }
+ }
+
+ public boolean isWhiteSpace() {
+ if (prevState != STATE_INIT) {
+ return realReader.isWhiteSpace();
+ } else {
+ return false;
+ }
+ }
+
+ public String getAttributeValue(String s, String s1) {
+ if (prevState != STATE_INIT) {
+ return realReader.getAttributeValue(s, s1);
+ } else {
+ return null;
+ }
+ }
+
+ public int getAttributeCount() {
+ if (prevState != STATE_INIT) {
+ return realReader.getAttributeCount();
+ } else {
+ return 0;
+ }
+ }
+
+ public QName getAttributeName(int i) {
+ if (prevState != STATE_INIT) {
+ return realReader.getAttributeName(i);
+ } else {
+ return null;
+ }
+ }
+
+ public String getAttributeNamespace(int i) {
+ if (prevState != STATE_INIT) {
+ return realReader.getAttributeNamespace(i);
+ } else {
+ return null;
+ }
+ }
+
+ public String getAttributeLocalName(int i) {
+ if (prevState != STATE_INIT) {
+ return realReader.getAttributeLocalName(i);
+ } else {
+ return null;
+ }
+ }
+
+ public String getAttributePrefix(int i) {
+ if (prevState != STATE_INIT) {
+ return realReader.getAttributePrefix(i);
+ } else {
+ return null;
+ }
+ }
+
+ public String getAttributeType(int i) {
+ if (prevState != STATE_INIT) {
+ return realReader.getAttributeType(i);
+ } else {
+ return null;
+ }
+ }
+
+ public String getAttributeValue(int i) {
+ if (prevState != STATE_INIT) {
+ return realReader.getAttributeValue(i);
+ } else {
+ return null;
+ }
+ }
+
+ public boolean isAttributeSpecified(int i) {
+ if (prevState != STATE_INIT) {
+ return realReader.isAttributeSpecified(i);
+ } else {
+ return false;
+ }
+ }
+
+ public int getNamespaceCount() {
+ if (prevState != STATE_INIT) {
+ return realReader.getNamespaceCount();
+ } else {
+ return 0;
+ }
+ }
+
+ public String getNamespacePrefix(int i) {
+ if (prevState != STATE_INIT) {
+ return realReader.getNamespacePrefix(i);
+ } else {
+ return null;
+ }
+ }
+
+ public String getNamespaceURI(int i) {
+ if (prevState != STATE_INIT) {
+ return realReader.getNamespaceURI(i);
+ } else {
+ return null;
+ }
+ }
+
+ public NamespaceContext getNamespaceContext() {
+ if (prevState != STATE_INIT) {
+ return realReader.getNamespaceContext();
+ } else {
+ return null;
+ }
+ }
+
+ public int getEventType() {
+ if (prevState == STATE_INIT) {
+ return START_DOCUMENT;
+ } else {
+ return realReader.getEventType();
+ }
+ }
+
+ public String getText() {
+ if (prevState != STATE_INIT) {
+ return realReader.getText();
+ } else {
+ return null;
+ }
+ }
+
+ public char[] getTextCharacters() {
+ if (prevState != STATE_INIT) {
+ return realReader.getTextCharacters();
+ } else {
+ return new char[0];
+ }
+ }
+
+ public int getTextCharacters(int i, char[] chars, int i1, int i2) throws XMLStreamException {
+ if (prevState != STATE_INIT) {
+ return realReader.getTextCharacters(i, chars, i1, i2);
+ } else {
+ return 0;
+ }
+ }
+
+ public int getTextStart() {
+ if (prevState != STATE_INIT) {
+ return realReader.getTextStart();
+ } else {
+ return 0;
+ }
+ }
+
+ public int getTextLength() {
+ if (prevState != STATE_INIT) {
+ return realReader.getTextStart();
+ } else {
+ return 0;
+ }
+ }
+
+ public String getEncoding() {
+ if (prevState != STATE_INIT) {
+ return realReader.getEncoding();
+ } else {
+ return null;
+ }
+ }
+
+ public boolean hasText() {
+ if (prevState != STATE_INIT) {
+ return realReader.hasText();
+ } else {
+ return false;
+ }
+ }
+
+ public Location getLocation() {
+ if (prevState != STATE_INIT) {
+ return realReader.getLocation();
+ } else {
+ return null;
+ }
+ }
+
+ public QName getName() {
+ if (prevState != STATE_INIT) {
+ return realReader.getName();
+ } else {
+ return null;
+ }
+ }
+
+ public String getLocalName() {
+ if (prevState != STATE_INIT) {
+ return realReader.getLocalName();
+ } else {
+ return null;
+ }
+ }
+
+ public boolean hasName() {
+ if (prevState != STATE_INIT) {
+ return realReader.hasName();
+ } else {
+ return false;
+ }
+ }
+
+ public String getNamespaceURI() {
+ if (prevState != STATE_INIT) {
+ return realReader.getNamespaceURI();
+ } else {
+ return null;
+ }
+ }
+
+ public String getPrefix() {
+ if (prevState != STATE_INIT) {
+ return realReader.getPrefix();
+ } else {
+ return null;
+ }
+ }
+
+ public String getVersion() {
+ if (prevState != STATE_INIT) {
+ return realReader.getVersion();
+ } else {
+ return null;
+ }
+ }
+
+ public boolean isStandalone() {
+ if (prevState != STATE_INIT) {
+ return realReader.isStandalone();
+ } else {
+ return false;
+ }
+ }
+
+ public boolean standaloneSet() {
+ if (prevState != STATE_INIT) {
+ return realReader.standaloneSet();
+ } else {
+ return false;
+ }
+ }
+
+ public String getCharacterEncodingScheme() {
+ if (prevState != STATE_INIT) {
+ return realReader.getCharacterEncodingScheme();
+ } else {
+ return null;
+ }
+ }
+
+ public String getPITarget() {
+ if (prevState != STATE_INIT) {
+ return realReader.getPITarget();
+ } else {
+ return null;
+ }
+ }
+
+ public String getPIData() {
+ if (prevState != STATE_INIT) {
+ return realReader.getPIData();
+ } else {
+ return null;
+ }
+ }
+}
Propchange: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/StreamWrapper.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/Stub.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/Stub.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/Stub.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/Stub.java Thu Sep 15 11:52:11 2005
@@ -1,311 +1,311 @@
-/*
-* Copyright 2001-2004 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.
-*/
-
-package org.apache.axis2.clientapi;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.Constants;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.context.ServiceContext;
-import org.apache.axis2.deployment.DeploymentException;
-import org.apache.axis2.description.ServiceDescription;
-import org.apache.axis2.om.OMAbstractFactory;
-import org.apache.axis2.om.OMElement;
-import org.apache.axis2.om.OMFactory;
-import org.apache.axis2.om.OMNamespace;
-import org.apache.axis2.om.impl.llom.builder.StAXOMBuilder;
-import org.apache.axis2.om.impl.llom.factory.OMXMLBuilderFactory;
-import org.apache.axis2.soap.*;
-import org.apache.axis2.soap.impl.llom.SOAPProcessingException;
-import org.apache.wsdl.WSDLService;
-
-import javax.xml.stream.XMLStreamReader;
-import java.util.HashMap;
-import java.util.Set;
-import java.util.Iterator;
-
-
-/**
- * @author chathura@opensource.lk
- */
-public abstract class Stub{
-
- public static final int SOAP_11 =0;
- public static final int SOAP_12 =1;
-
-
- protected ConfigurationContext _configurationContext;
- protected static ServiceDescription _service;
- protected ServiceContext _serviceContext;
- protected EndpointReference toEPR;
-
- protected boolean doRest=false;
-
- protected String senderTransport = Constants.TRANSPORT_HTTP;
- protected String listenerTransport =Constants.TRANSPORT_HTTP ;
- protected boolean useSeparateListener;
-
- //Default SOAP version is 11
- protected int soapVesrion = SOAP_11;
- protected HashMap propertyMap = new HashMap();
-
- /**
- *
- * @param senderTransport
- * @param listenerTransport
- * @param useSeparateListener
- * @throws AxisFault
- */
- public void setTransportInfo(String senderTransport,String listenerTransport,boolean useSeparateListener)throws AxisFault{
- this.senderTransport = senderTransport;
- this.listenerTransport=listenerTransport;
- this.useSeparateListener=useSeparateListener;
- }
-
- /**
- *
- * @param key
- * @param value
- */
- public void _put(String key,Object value){
- this.propertyMap.put(key,value);
- }
-
-
- /**
- *
- * @param key
- * @return the object
- */
- public Object _get(String key){
- return this.propertyMap.get(key);
- }
- /**
- *
- * @param doRest
- */
- public void setDoREST(boolean doRest) {
- this.doRest = doRest;
- }
-
-
- /**
- * If _maintainSession is set to True all the calls will use the same
- * ServiceContext and the user can Share information through that
- * ServiceContext across operations.
- */
- protected boolean _maintainSession = false;
- protected String _currentSessionId = null;
-
-
- protected Stub() throws DeploymentException, AxisFault {
-
- }
-
- /**
- * Set the soap version
- * @param soapVersion
- */
- public void setSOAPVersion(int soapVersion){
- this.soapVesrion = soapVersion;
- }
-
-// public abstract void _setSessionInfo(Object key, Object value) throws Exception;
-//
-// public abstract Object _getSessionInfo(Object key) throws Exception ;
-
- public void _setSessionInfo(String key, Object value) throws java.lang.Exception {
- if (!_maintainSession) {
- //TODO Comeup with a Exception
- throw new java.lang.Exception(
- "Client is running the session OFF mode: Start session before saving to a session ");
- }
- _configurationContext.getServiceContext(_currentSessionId).setProperty(
- key, value);
- }
-
-
- public Object _getSessionInfo(String key) throws java.lang.Exception {
- if (!_maintainSession) {
- //TODO Comeup with a Exception
- throw new java.lang.Exception(
- "Client is running the session OFF mode: Start session before saving to a session ");
- }
- return _configurationContext.getServiceContext(_currentSessionId)
- .getProperty(key);
- }
-
- public void _startSession() {
- _maintainSession = true;
- _currentSessionId = getID();
- }
-
- public void _endSession() {
- _maintainSession = false;
- }
-
- protected String _getServiceContextID() {
- if (_maintainSession)
- return _currentSessionId;
- else
- return getID();
- }
-
- private String getID() {
- //TODO Get the UUID generator to generate values
- return Long.toString(System.currentTimeMillis());
- }
-
-
- protected SOAPEnvelope createEnvelope() throws SOAPProcessingException {
- return getFactory(this.soapVesrion).getDefaultEnvelope();
- }
-
- protected void setValueRPC(SOAPEnvelope env,
- String methodNamespaceURI,
- String methodName,
- String[] paramNames,
- Object[] values) {
- SOAPBody body = env.getBody();
- OMFactory fac = this.getFactory(this.soapVesrion);
-
- OMNamespace methodNamespace = fac.createOMNamespace(methodNamespaceURI,
- "ns1");
- OMElement elt = fac.createOMElement(methodName, methodNamespace);
- if (paramNames != null) {
- //find the relevant object here, convert it and add it to the elt
- for (int i = 0; i < paramNames.length; i++) {
- String paramName = paramNames[i];
- Object value = values[i];
- elt.addChild(StubSupporter.createRPCMappedElement(paramName,
- fac.createOMNamespace("", null), //empty namespace
- value,
- fac));
- }
- }
- body.addChild(elt);
- }
-
-
- protected OMElement getElementFromReader(XMLStreamReader reader) {
- StAXOMBuilder builder = OMXMLBuilderFactory.createStAXOMBuilder(
- OMAbstractFactory.getOMFactory(), reader);
- return builder.getDocumentElement();
- }
-
- protected void setValueDoc(SOAPEnvelope env, OMElement value) {
- setValueDoc(env,value,false);
- }
-
- protected void setValueDoc(SOAPEnvelope env, OMElement value,boolean isHeader) {
-
- if (value != null) {
- if (isHeader){
- SOAPHeader header = env.getHeader();
- header.addChild(value);
- }else{
- SOAPBody body = env.getBody();
- body.addChild(value);
- }
-
- }
- }
-
-// /**
-// * use this method to handle the faults
-// * @param env
-// */
-// protected void checkFault(SOAPEnvelope env) throws AxisFault{
-// SOAPBody body = env.getBody();
-// if (body.hasFault()){
-// SOAPFault fault = body.getFault();
-// if (null!=fault.getException()){
-// throw new AxisFault(fault.getException());
-// }else{
-// String message = "";
-// message = message + "Code =" + fault.getCode()==null?"":
-// fault.getCode().getValue()==null?"":fault.getCode().getValue().getText();
-// message = message + "Actor = "+fault.getRole()==null?"":
-// fault.getRole().getRoleValue();
-// //add the details here
-// throw new AxisFault(message);
-// }
-// }
-// }
-
- /**
- * Extract the correct element - A util method
- * @param env
- * @param type
- * @return the relevant element to be databound
- */
- protected OMElement getElement(SOAPEnvelope env, String type) {
- SOAPBody body = env.getBody();
- OMElement element = body.getFirstElement();
-
- if (WSDLService.STYLE_RPC.equals(type)) {
- return element.getFirstElement(); //todo this needs to be fixed
- } else if (WSDLService.STYLE_DOC.equals(type)) {
- return element;
- } else {
- throw new UnsupportedOperationException("Unsupported type");
- }
-
- }
-
-// protected Object getValue(SOAPEnvelope env,String type,Class outputType){
-// SOAPBody body = env.getBody();
-// OMElement element = body.getFirstElement();
-//
-// if (WSDLService.STYLE_RPC.equals(type)){
-// return StubSupporter.getRPCMappedElementValue(element.getFirstElement(),outputType);
-// }else if (WSDLService.STYLE_DOC.equals(type)){
-// return element;
-// }else {
-// throw new UnsupportedOperationException("Unsupported type");
-// }
-//
-// }
- /**
- * get the message context
- */
- protected MessageContext getMessageContext() throws AxisFault {
- return new MessageContext(_configurationContext);
- }
-
-
- private SOAPFactory getFactory(int soapVersion) {
- if (soapVersion==SOAP_11){
- return OMAbstractFactory.getSOAP11Factory();
- }else if (soapVersion==SOAP_12){
- return OMAbstractFactory.getSOAP12Factory();
- }else{
- throw new RuntimeException("Unknown SOAP version");
- }
- }
-
- protected void populateProperties(Call call){
- Iterator keys = this.propertyMap.keySet().iterator();
- String key;
- while (keys.hasNext()) {
- key = keys.next().toString();
- call.set(key,propertyMap.get(key));
- }
- }
-}
-
+/*
+* Copyright 2001-2004 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.
+*/
+
+package org.apache.axis2.clientapi;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.context.ServiceContext;
+import org.apache.axis2.deployment.DeploymentException;
+import org.apache.axis2.description.ServiceDescription;
+import org.apache.axis2.om.OMAbstractFactory;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMFactory;
+import org.apache.axis2.om.OMNamespace;
+import org.apache.axis2.om.impl.llom.builder.StAXOMBuilder;
+import org.apache.axis2.om.impl.llom.factory.OMXMLBuilderFactory;
+import org.apache.axis2.soap.*;
+import org.apache.axis2.soap.impl.llom.SOAPProcessingException;
+import org.apache.wsdl.WSDLService;
+
+import javax.xml.stream.XMLStreamReader;
+import java.util.HashMap;
+import java.util.Set;
+import java.util.Iterator;
+
+
+/**
+ * @author chathura@opensource.lk
+ */
+public abstract class Stub{
+
+ public static final int SOAP_11 =0;
+ public static final int SOAP_12 =1;
+
+
+ protected ConfigurationContext _configurationContext;
+ protected static ServiceDescription _service;
+ protected ServiceContext _serviceContext;
+ protected EndpointReference toEPR;
+
+ protected boolean doRest=false;
+
+ protected String senderTransport = Constants.TRANSPORT_HTTP;
+ protected String listenerTransport =Constants.TRANSPORT_HTTP ;
+ protected boolean useSeparateListener;
+
+ //Default SOAP version is 11
+ protected int soapVesrion = SOAP_11;
+ protected HashMap propertyMap = new HashMap();
+
+ /**
+ *
+ * @param senderTransport
+ * @param listenerTransport
+ * @param useSeparateListener
+ * @throws AxisFault
+ */
+ public void setTransportInfo(String senderTransport,String listenerTransport,boolean useSeparateListener)throws AxisFault{
+ this.senderTransport = senderTransport;
+ this.listenerTransport=listenerTransport;
+ this.useSeparateListener=useSeparateListener;
+ }
+
+ /**
+ *
+ * @param key
+ * @param value
+ */
+ public void _put(String key,Object value){
+ this.propertyMap.put(key,value);
+ }
+
+
+ /**
+ *
+ * @param key
+ * @return the object
+ */
+ public Object _get(String key){
+ return this.propertyMap.get(key);
+ }
+ /**
+ *
+ * @param doRest
+ */
+ public void setDoREST(boolean doRest) {
+ this.doRest = doRest;
+ }
+
+
+ /**
+ * If _maintainSession is set to True all the calls will use the same
+ * ServiceContext and the user can Share information through that
+ * ServiceContext across operations.
+ */
+ protected boolean _maintainSession = false;
+ protected String _currentSessionId = null;
+
+
+ protected Stub() throws DeploymentException, AxisFault {
+
+ }
+
+ /**
+ * Set the soap version
+ * @param soapVersion
+ */
+ public void setSOAPVersion(int soapVersion){
+ this.soapVesrion = soapVersion;
+ }
+
+// public abstract void _setSessionInfo(Object key, Object value) throws Exception;
+//
+// public abstract Object _getSessionInfo(Object key) throws Exception ;
+
+ public void _setSessionInfo(String key, Object value) throws java.lang.Exception {
+ if (!_maintainSession) {
+ //TODO Comeup with a Exception
+ throw new java.lang.Exception(
+ "Client is running the session OFF mode: Start session before saving to a session ");
+ }
+ _configurationContext.getServiceContext(_currentSessionId).setProperty(
+ key, value);
+ }
+
+
+ public Object _getSessionInfo(String key) throws java.lang.Exception {
+ if (!_maintainSession) {
+ //TODO Comeup with a Exception
+ throw new java.lang.Exception(
+ "Client is running the session OFF mode: Start session before saving to a session ");
+ }
+ return _configurationContext.getServiceContext(_currentSessionId)
+ .getProperty(key);
+ }
+
+ public void _startSession() {
+ _maintainSession = true;
+ _currentSessionId = getID();
+ }
+
+ public void _endSession() {
+ _maintainSession = false;
+ }
+
+ protected String _getServiceContextID() {
+ if (_maintainSession)
+ return _currentSessionId;
+ else
+ return getID();
+ }
+
+ private String getID() {
+ //TODO Get the UUID generator to generate values
+ return Long.toString(System.currentTimeMillis());
+ }
+
+
+ protected SOAPEnvelope createEnvelope() throws SOAPProcessingException {
+ return getFactory(this.soapVesrion).getDefaultEnvelope();
+ }
+
+ protected void setValueRPC(SOAPEnvelope env,
+ String methodNamespaceURI,
+ String methodName,
+ String[] paramNames,
+ Object[] values) {
+ SOAPBody body = env.getBody();
+ OMFactory fac = this.getFactory(this.soapVesrion);
+
+ OMNamespace methodNamespace = fac.createOMNamespace(methodNamespaceURI,
+ "ns1");
+ OMElement elt = fac.createOMElement(methodName, methodNamespace);
+ if (paramNames != null) {
+ //find the relevant object here, convert it and add it to the elt
+ for (int i = 0; i < paramNames.length; i++) {
+ String paramName = paramNames[i];
+ Object value = values[i];
+ elt.addChild(StubSupporter.createRPCMappedElement(paramName,
+ fac.createOMNamespace("", null), //empty namespace
+ value,
+ fac));
+ }
+ }
+ body.addChild(elt);
+ }
+
+
+ protected OMElement getElementFromReader(XMLStreamReader reader) {
+ StAXOMBuilder builder = OMXMLBuilderFactory.createStAXOMBuilder(
+ OMAbstractFactory.getOMFactory(), reader);
+ return builder.getDocumentElement();
+ }
+
+ protected void setValueDoc(SOAPEnvelope env, OMElement value) {
+ setValueDoc(env,value,false);
+ }
+
+ protected void setValueDoc(SOAPEnvelope env, OMElement value,boolean isHeader) {
+
+ if (value != null) {
+ if (isHeader){
+ SOAPHeader header = env.getHeader();
+ header.addChild(value);
+ }else{
+ SOAPBody body = env.getBody();
+ body.addChild(value);
+ }
+
+ }
+ }
+
+// /**
+// * use this method to handle the faults
+// * @param env
+// */
+// protected void checkFault(SOAPEnvelope env) throws AxisFault{
+// SOAPBody body = env.getBody();
+// if (body.hasFault()){
+// SOAPFault fault = body.getFault();
+// if (null!=fault.getException()){
+// throw new AxisFault(fault.getException());
+// }else{
+// String message = "";
+// message = message + "Code =" + fault.getCode()==null?"":
+// fault.getCode().getValue()==null?"":fault.getCode().getValue().getText();
+// message = message + "Actor = "+fault.getRole()==null?"":
+// fault.getRole().getRoleValue();
+// //add the details here
+// throw new AxisFault(message);
+// }
+// }
+// }
+
+ /**
+ * Extract the correct element - A util method
+ * @param env
+ * @param type
+ * @return the relevant element to be databound
+ */
+ protected OMElement getElement(SOAPEnvelope env, String type) {
+ SOAPBody body = env.getBody();
+ OMElement element = body.getFirstElement();
+
+ if (WSDLService.STYLE_RPC.equals(type)) {
+ return element.getFirstElement(); //todo this needs to be fixed
+ } else if (WSDLService.STYLE_DOC.equals(type)) {
+ return element;
+ } else {
+ throw new UnsupportedOperationException("Unsupported type");
+ }
+
+ }
+
+// protected Object getValue(SOAPEnvelope env,String type,Class outputType){
+// SOAPBody body = env.getBody();
+// OMElement element = body.getFirstElement();
+//
+// if (WSDLService.STYLE_RPC.equals(type)){
+// return StubSupporter.getRPCMappedElementValue(element.getFirstElement(),outputType);
+// }else if (WSDLService.STYLE_DOC.equals(type)){
+// return element;
+// }else {
+// throw new UnsupportedOperationException("Unsupported type");
+// }
+//
+// }
+ /**
+ * get the message context
+ */
+ protected MessageContext getMessageContext() throws AxisFault {
+ return new MessageContext(_configurationContext);
+ }
+
+
+ private SOAPFactory getFactory(int soapVersion) {
+ if (soapVersion==SOAP_11){
+ return OMAbstractFactory.getSOAP11Factory();
+ }else if (soapVersion==SOAP_12){
+ return OMAbstractFactory.getSOAP12Factory();
+ }else{
+ throw new RuntimeException("Unknown SOAP version");
+ }
+ }
+
+ protected void populateProperties(Call call){
+ Iterator keys = this.propertyMap.keySet().iterator();
+ String key;
+ while (keys.hasNext()) {
+ key = keys.next().toString();
+ call.set(key,propertyMap.get(key));
+ }
+ }
+}
+
Propchange: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/Stub.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/StubSupporter.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/StubSupporter.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/StubSupporter.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/StubSupporter.java Thu Sep 15 11:52:11 2005
@@ -1,88 +1,88 @@
-package org.apache.axis2.clientapi;
-
-import org.apache.axis2.om.OMElement;
-import org.apache.axis2.om.OMFactory;
-import org.apache.axis2.om.OMNamespace;
-
-/*
- * 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.
- *
- * A utility class for the use of the stub
- * Not visible outside
- */
-
-public class StubSupporter {
-
- public static OMElement createRPCMappedElement(
- String elementName,
- OMNamespace ns,
- Object value,
- OMFactory fac) {
- OMElement returnElement = fac.createOMElement(elementName, ns);
- Class inputParamClass = value.getClass();
-
- if (inputParamClass.equals(String.class)) {
- returnElement.addChild(
- fac.createText(returnElement, value.toString()));
- } else if (inputParamClass.equals(Integer.class)) {
- returnElement.addChild(
- fac.createText(
- returnElement,
- String.valueOf(((Integer) value).intValue())));
- } else if (inputParamClass.equals(Float.class)) {
- returnElement.addChild(
- fac.createText(
- returnElement,
- String.valueOf(((Float) value).floatValue())));
- } else if (inputParamClass.equals(Double.class)) {
- returnElement.addChild(
- fac.createText(
- returnElement,
- String.valueOf(((Double) value).doubleValue())));
- //todo this seems to be a long list... need to complete this
- } else if (inputParamClass.equals(OMElement.class)) {
- returnElement.addChild((OMElement) value);
- } else {
- returnElement.addChild(
- fac.createText(returnElement, value.toString()));
- }
- return returnElement;
- }
-
- public static Object getRPCMappedElementValue(
- OMElement elt,
- Class outputTypeClass) {
- Object outputObj = null;
- if (outputTypeClass.equals(String.class)) {
- outputObj = elt.getText();
- } else if (outputTypeClass.equals(Integer.class)) {
- outputObj = new Integer(elt.getText());
- } else if (outputTypeClass.equals(Float.class)) {
- outputObj = new Float(elt.getText());
- } else if (outputTypeClass.equals(Double.class)) {
- outputObj = new Double(elt.getText());
-
- //todo this seems to be a long list... need to complete this
-
- } else if (outputTypeClass.equals(OMElement.class)) {
- outputObj = elt;
- } else {
- outputObj = elt.toString();
- }
-
- return outputObj;
- }
-
-}
+package org.apache.axis2.clientapi;
+
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMFactory;
+import org.apache.axis2.om.OMNamespace;
+
+/*
+ * 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.
+ *
+ * A utility class for the use of the stub
+ * Not visible outside
+ */
+
+public class StubSupporter {
+
+ public static OMElement createRPCMappedElement(
+ String elementName,
+ OMNamespace ns,
+ Object value,
+ OMFactory fac) {
+ OMElement returnElement = fac.createOMElement(elementName, ns);
+ Class inputParamClass = value.getClass();
+
+ if (inputParamClass.equals(String.class)) {
+ returnElement.addChild(
+ fac.createText(returnElement, value.toString()));
+ } else if (inputParamClass.equals(Integer.class)) {
+ returnElement.addChild(
+ fac.createText(
+ returnElement,
+ String.valueOf(((Integer) value).intValue())));
+ } else if (inputParamClass.equals(Float.class)) {
+ returnElement.addChild(
+ fac.createText(
+ returnElement,
+ String.valueOf(((Float) value).floatValue())));
+ } else if (inputParamClass.equals(Double.class)) {
+ returnElement.addChild(
+ fac.createText(
+ returnElement,
+ String.valueOf(((Double) value).doubleValue())));
+ //todo this seems to be a long list... need to complete this
+ } else if (inputParamClass.equals(OMElement.class)) {
+ returnElement.addChild((OMElement) value);
+ } else {
+ returnElement.addChild(
+ fac.createText(returnElement, value.toString()));
+ }
+ return returnElement;
+ }
+
+ public static Object getRPCMappedElementValue(
+ OMElement elt,
+ Class outputTypeClass) {
+ Object outputObj = null;
+ if (outputTypeClass.equals(String.class)) {
+ outputObj = elt.getText();
+ } else if (outputTypeClass.equals(Integer.class)) {
+ outputObj = new Integer(elt.getText());
+ } else if (outputTypeClass.equals(Float.class)) {
+ outputObj = new Float(elt.getText());
+ } else if (outputTypeClass.equals(Double.class)) {
+ outputObj = new Double(elt.getText());
+
+ //todo this seems to be a long list... need to complete this
+
+ } else if (outputTypeClass.equals(OMElement.class)) {
+ outputObj = elt;
+ } else {
+ outputObj = elt.toString();
+ }
+
+ return outputObj;
+ }
+
+}
Propchange: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/StubSupporter.java
------------------------------------------------------------------------------
svn:eol-style = native