Author: dasarath
Date: Wed Nov 2 20:40:28 2005
New Revision: 330443
URL: http://svn.apache.org/viewcvs?rev=330443&view=rev
Log: (empty)
Added:
webservices/kandula/branches/Kandula_1/src/java/org/apache/ws/transaction/wscoor/_CoordinationContext.java
Removed:
webservices/kandula/branches/Kandula_1/src/java/org/apache/ws/transaction/wscoor/CoordinationContext.java
Modified:
webservices/kandula/branches/Kandula_1/src/java/org/apache/ws/transaction/wscoor/ActivationRPCEndpoint.java
webservices/kandula/branches/Kandula_1/src/java/org/apache/ws/transaction/wscoor/ActivationRPCPort.java
Modified:
webservices/kandula/branches/Kandula_1/src/java/org/apache/ws/transaction/wscoor/ActivationRPCEndpoint.java
URL:
http://svn.apache.org/viewcvs/webservices/kandula/branches/Kandula_1/src/java/org/apache/ws/transaction/wscoor/ActivationRPCEndpoint.java?rev=330443&r1=330442&r2=330443&view=diff
==============================================================================
---
webservices/kandula/branches/Kandula_1/src/java/org/apache/ws/transaction/wscoor/ActivationRPCEndpoint.java
(original)
+++
webservices/kandula/branches/Kandula_1/src/java/org/apache/ws/transaction/wscoor/ActivationRPCEndpoint.java
Wed Nov 2 20:40:28 2005
@@ -33,7 +33,7 @@
Coordinator coordinator=
CoordinationService.getInstance().coordinate(coordinationType);
CreateCoordinationContextResponseType response= new
CreateCoordinationContextResponseType();
response.setCoordinationContext(
-
coordinator.getCoordinationContext().toCoordinationContextType());
+
coordinator.getCoordinationContext().toCoordinationContext());
return response;
}
catch (Exception e) {
Modified:
webservices/kandula/branches/Kandula_1/src/java/org/apache/ws/transaction/wscoor/ActivationRPCPort.java
URL:
http://svn.apache.org/viewcvs/webservices/kandula/branches/Kandula_1/src/java/org/apache/ws/transaction/wscoor/ActivationRPCPort.java?rev=330443&r1=330442&r2=330443&view=diff
==============================================================================
---
webservices/kandula/branches/Kandula_1/src/java/org/apache/ws/transaction/wscoor/ActivationRPCPort.java
(original)
+++
webservices/kandula/branches/Kandula_1/src/java/org/apache/ws/transaction/wscoor/ActivationRPCPort.java
Wed Nov 2 20:40:28 2005
@@ -39,12 +39,12 @@
}
}
- public CoordinationContext createCoordinationContext(String
coordinationType) throws RemoteException {
+ public _CoordinationContext createCoordinationContext(String
coordinationType) throws RemoteException {
try {
CreateCoordinationContextType parameters= new
CreateCoordinationContextType();
parameters.setCoordinationType(new
URI(coordinationType));
CreateCoordinationContextResponseType response=
stub.createCoordinationContextOperation(parameters);
- return new
CoordinationContext(response.getCoordinationContext());
+ return new
_CoordinationContext(response.getCoordinationContext());
}
catch (URI.MalformedURIException e) {
throw new IllegalArgumentException(e + "???" +
coordinationType);
Added:
webservices/kandula/branches/Kandula_1/src/java/org/apache/ws/transaction/wscoor/_CoordinationContext.java
URL:
http://svn.apache.org/viewcvs/webservices/kandula/branches/Kandula_1/src/java/org/apache/ws/transaction/wscoor/_CoordinationContext.java?rev=330443&view=auto
==============================================================================
---
webservices/kandula/branches/Kandula_1/src/java/org/apache/ws/transaction/wscoor/_CoordinationContext.java
(added)
+++
webservices/kandula/branches/Kandula_1/src/java/org/apache/ws/transaction/wscoor/_CoordinationContext.java
Wed Nov 2 20:40:28 2005
@@ -0,0 +1,141 @@
+/*
+ * Copyright 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.ws.transaction.wscoor;
+
+import java.rmi.RemoteException;
+
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPHeader;
+import javax.xml.soap.SOAPHeaderElement;
+
+import org.apache.axis.message.MessageElement;
+import org.apache.axis.message.PrefixedQName;
+import org.apache.axis.message.addressing.EndpointReference;
+import org.apache.axis.message.addressing.util.TextExtractor;
+import org.apache.axis.types.URI;
+import org.apache.ws.transaction.coordinator.Identifier;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+
+public class _CoordinationContext {
+ static final Name NAME_COORDINATION_CONTEXT=
+ new
PrefixedQName("http://schemas.xmlsoap.org/ws/2003/09/wscoor",
"CoordinationContext", "wscoor");
+ static final Name NAME_IDENTIFIER=
+ new
PrefixedQName("http://schemas.xmlsoap.org/ws/2002/07/utility", "Identifier",
"wsu");
+ static final Name NAME_COORDINATION_TYPE=
+ new
PrefixedQName("http://schemas.xmlsoap.org/ws/2003/09/wscoor",
"CoordinationType", "wscoor");
+ static final Name NAME_REGISTRATION_SERVICE=
+ new
PrefixedQName("http://schemas.xmlsoap.org/ws/2003/09/wscoor",
"RegistrationService", "wscoor");
+ static final Name NAME_ADDRESS=
+ new
PrefixedQName("http://schemas.xmlsoap.org/ws/2004/03/addressing", "Address",
"wsa");
+ static final Name NAME_REFERENCE_PROPERTIES=
+ new
PrefixedQName("http://schemas.xmlsoap.org/ws/2004/03/addressing",
"ReferenceProperties", "wsa");
+
+ CoordinationContext ctx;
+
+ public _CoordinationContext(CoordinationContext ctx) {
+ this.ctx= ctx;
+ }
+
+ public _CoordinationContext(
+ Identifier identifier,
+ String coordinationType,
+ EndpointReference registrationServiceEndpoint) {
+ ctx= new CoordinationContext();
+ ctx.setIdentifier(new
CoordinationContextTypeIdentifier(identifier.toString()));
+ ctx.setRegistrationService(registrationServiceEndpoint);
+ try {
+ ctx.setCoordinationType(new URI(coordinationType));
+ }
+ catch (URI.MalformedURIException e) {
+ throw new IllegalArgumentException(e.toString() + "???"
+ coordinationType);
+ }
+ }
+
+ public _CoordinationContext(SOAPElement el) {
+ if (!is(el))
+ throw new IllegalArgumentException();
+ ctx= new CoordinationContext();
+ try {
+ NodeList list=
+
el.getElementsByTagNameNS(NAME_IDENTIFIER.getURI(),
NAME_IDENTIFIER.getLocalName());
+ Element node= (Element)list.item(0);
+ ctx.setIdentifier(new
CoordinationContextTypeIdentifier(TextExtractor.getText(node)));
+
+ list=
+ el.getElementsByTagNameNS(
+ NAME_COORDINATION_TYPE.getURI(),
+ NAME_COORDINATION_TYPE.getLocalName());
+ node= (Element)list.item(0);
+ ctx.setCoordinationType(new
URI(TextExtractor.getText(node)));
+
+ list=
+ el.getElementsByTagNameNS(
+ NAME_REGISTRATION_SERVICE.getURI(),
+
NAME_REGISTRATION_SERVICE.getLocalName());
+ node= (Element)list.item(0);
+
+ EndpointReference epr= new EndpointReference(node);
+ ctx.setRegistrationService(epr);
+ }
+ catch (Exception e) {
+ throw new IllegalArgumentException(e.toString());
+ }
+ }
+
+ public static boolean is(SOAPElement e) {
+ return e.getElementName().equals(NAME_COORDINATION_CONTEXT);
+ }
+
+ public CoordinationContext toCoordinationContext() {
+ return ctx;
+ }
+
+ public void toSOAPHeaderElement(SOAPHeader header) {
+ try {
+ SOAPHeaderElement e=
header.addHeaderElement(NAME_COORDINATION_CONTEXT);
+
e.addChildElement(NAME_IDENTIFIER).addTextNode(ctx.getIdentifier().toString());
+
e.addChildElement(NAME_COORDINATION_TYPE).addTextNode(ctx.getCoordinationType().toString());
+ SOAPElement e1=
e.addChildElement(NAME_REGISTRATION_SERVICE);
+
org.apache.axis.message.addressing.EndpointReferenceType registrationEndpoint=
+ ctx.getRegistrationService();
+
e1.addChildElement(NAME_ADDRESS).addTextNode(registrationEndpoint.getAddress().toString());
+ SOAPElement e3=
e1.addChildElement(NAME_REFERENCE_PROPERTIES);
+ MessageElement[] _referenceProperties=
registrationEndpoint.getProperties().get_any();
+ for (int ii= 0; ii < _referenceProperties.length; ii++)
+
e3.addChildElement(_referenceProperties[ii].getElementName()).addTextNode(
+ _referenceProperties[ii].getValue());
+ }
+ catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public EndpointReference register(
+ String protocol,
+ EndpointReference participantEndpoint)
+ throws RemoteException {
+ RegistrationRPCPort port= new RegistrationRPCPort(new
EndpointReference(ctx.getRegistrationService()));
+ return port.register(protocol, participantEndpoint);
+ }
+
+ public Identifier getActivityId() {
+ return new Identifier(ctx.getIdentifier().toString());
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]