You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fx-dev@ws.apache.org by th...@apache.org on 2005/08/20 05:01:40 UTC
svn commit: r233989 [2/3] - in /webservices/kandula/trunk/java: ./ schema/
src/ src/org/ src/org/apache/ src/org/apache/kandula/
src/org/apache/kandula/coordinator/ src/org/apache/kandula/coordinator/at/
src/org/apache/kandula/coordinator/ba/ src/org/a...
Added: webservices/kandula/trunk/java/schema/wscoor.wsdl
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/schema/wscoor.wsdl?rev=233989&view=auto
==============================================================================
--- webservices/kandula/trunk/java/schema/wscoor.wsdl (added)
+++ webservices/kandula/trunk/java/schema/wscoor.wsdl Fri Aug 19 19:59:21 2005
@@ -0,0 +1,175 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+Legal Disclaimer
+
+The presentation, distribution or other dissemination of the information
+contained in this specification is not a license, either expressly or impliedly,
+to any intellectual property owned or controlled by BEA or IBM or Microsoft and\or any other
+third party. BEA and IBM and Microsoft and\or any other third party may have patents, patent
+applications, trademarks, copyrights, or other intellectual property rights
+covering subject matter in this document. The furnishing of this document
+does not give you any license to BEA's and IBM's and Microsoft's or any other third party's patents, trademarks, copyrights, or other intellectual property.
+
+This specification and the information contained herein is provided on an "AS IS"
+ basis and to the maximum extent permitted by applicable law, BEA and IBM and Microsoft provides
+the document AS IS AND WITH ALL FAULTS, and hereby disclaims all other warranties
+and conditions, either express, implied or statutory, including, but not limited
+to, any (if any) implied warranties, duties or conditions of merchantability, of
+fitness for a particular purpose, of accuracy or completeness of responses, of
+results, of workmanlike effort, of lack of viruses, and of lack of negligence,
+all with regard to the document. ALSO, THERE IS NO WARRANTY OR CONDITION OF
+TITLE, QUIET ENJOYMENT, QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR
+NON-INFRINGEMENT OF ANY INTELLECTUAL PROPERTY RIGHTS WITH REGARD TO THE DOCUMENT.
+
+IN NO EVENT WILL BEA or IBM or MICROSOFT BE LIABLE TO ANY OTHER PARTY FOR THE COST OF PROCURING
+SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS OF USE, LOSS OF DATA, OR ANY
+INCIDENTAL, CONSEQUENTIAL, DIRECT, INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER
+CONTRACT, TORT, WARRANTY, OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY
+OTHER AGREEMENT RELATING TO THIS DOCUMENT, WHETHER OR NOT SUCH PARTY HAD ADVANCE
+NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
+
+Copyright Notice
+
+Copyright 2001, 2002 BEA Systems and IBM Corporation and Microsoft Corporation. All rights reserved.
+-->
+<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/07/utility" xmlns:wscoor="http://schemas.xmlsoap.org/ws/2003/09/wscoor" targetNamespace="http://schemas.xmlsoap.org/ws/2003/09/wscoor">
+ <wsdl:import namespace="http://schemas.xmlsoap.org/ws/2003/09/wscoor" location="wscoor.xsd"/>
+ <!-- location="http://schemas.xmlsoap.org/ws/2003/09/wscoor" -->
+ <!-- Messages -->
+ <wsdl:message name="CreateCoordinationContext">
+ <wsdl:part name="parameters" element="wscoor:CreateCoordinationContext"/>
+ </wsdl:message>
+ <wsdl:message name="CreateCoordinationContextResponse">
+ <wsdl:part name="parameters" element="wscoor:CreateCoordinationContextResponse"/>
+ </wsdl:message>
+ <wsdl:message name="Register">
+ <wsdl:part name="parameters" element="wscoor:Register"/>
+ </wsdl:message>
+ <wsdl:message name="RegisterResponse">
+ <wsdl:part name="parameters" element="wscoor:RegisterResponse"/>
+ </wsdl:message>
+ <!-- Manditory Asyncronous PortTypes -->
+ <wsdl:portType name="ActivationCoordinatorPortType">
+ <wsdl:operation name="CreateCoordinationContextOperation">
+ <wsdl:input message="wscoor:CreateCoordinationContext"/>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:portType name="ActivationRequesterPortType">
+ <wsdl:operation name="CreateCoordinationContextResponseOperation">
+ <wsdl:input message="wscoor:CreateCoordinationContextResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:portType name="RegistrationCoordinatorPortType">
+ <wsdl:operation name="RegisterOperation">
+ <wsdl:input message="wscoor:Register"/>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:portType name="RegistrationRequesterPortType">
+ <wsdl:operation name="RegisterResponseOperation">
+ <wsdl:input message="wscoor:RegisterResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+ <!-- Optional Syncronous RPC Port Types -->
+ <wsdl:portType name="ActivationPortType">
+ <wsdl:operation name="CreateCoordinationContextOperation">
+ <wsdl:input message="wscoor:CreateCoordinationContext"/>
+ <wsdl:output message="wscoor:CreateCoordinationContextResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:portType name="RegistrationPortType">
+ <wsdl:operation name="RegisterOperation">
+ <wsdl:input message="wscoor:Register"/>
+ <wsdl:output message="wscoor:RegisterResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+
+
+
+<wsdl:binding name="ActivationCoordinatorPortTypeBinding" type="wscoor:ActivationCoordinatorPortType">
+ <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
+ <wsdl:operation name="CreateCoordinationContextOperation">
+ <soap:operation soapAction="http://xxx"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ </wsdl:operation>
+</wsdl:binding>
+<wsdl:binding name="ActivationRequesterPortTypeBinding" type="wscoor:ActivationRequesterPortType">
+ <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
+ <wsdl:operation name="CreateCoordinationContextResponseOperation">
+ <soap:operation soapAction="http://xxx"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ </wsdl:operation>
+</wsdl:binding>
+<wsdl:binding name="RegistrationCoordinatorPortTypeBinding" type="wscoor:RegistrationCoordinatorPortType">
+ <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
+ <wsdl:operation name="RegisterOperation">
+ <soap:operation soapAction="http://xxx"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ </wsdl:operation>
+</wsdl:binding>
+<wsdl:binding name="RegistrationRequesterPortTypeBinding" type="wscoor:RegistrationRequesterPortType">
+ <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
+ <wsdl:operation name="RegisterResponseOperation">
+ <soap:operation soapAction="http://xxx"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ </wsdl:operation>
+</wsdl:binding>
+
+
+
+<wsdl:binding name="ActivationPortTypeBinding" type="wscoor:ActivationPortType">
+ <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
+ <wsdl:operation name="CreateCoordinationContextOperation">
+ <soap:operation soapAction="http://xxx"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+</wsdl:binding>
+<wsdl:binding name="RegistrationPortTypeBinding" type="wscoor:RegistrationPortType">
+ <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
+ <wsdl:operation name="RegisterOperation">
+ <soap:operation soapAction="http://xxx"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+</wsdl:binding>
+<wsdl:service name="xxx">
+ <wsdl:port binding="wscoor:ActivationCoordinatorPortTypeBinding" name="ActivationCoordinator">
+ <soap:address location="http://localhost:8081/axis/services/ActivationCoordinator"/>
+ </wsdl:port>
+ <wsdl:port binding="wscoor:ActivationRequesterPortTypeBinding" name="ActivationRequester">
+ <soap:address location="http://localhost:8081/axis/services/ActivationRequester"/>
+ </wsdl:port>
+ <wsdl:port binding="wscoor:RegistrationCoordinatorPortTypeBinding" name="RegistrationCoordinator">
+ <soap:address location="http://localhost:8081/axis/services/RegistrationCoordinator"/>
+ </wsdl:port>
+ <wsdl:port binding="wscoor:RegistrationRequesterPortTypeBinding" name="RegistrationRequester">
+ <soap:address location="http://localhost:8081/axis/services/RegistrationRequester"/>
+ </wsdl:port>
+
+ <wsdl:port binding="wscoor:ActivationPortTypeBinding" name="Activation">
+ <soap:address location="http://localhost:8081/axis/services/Activation"/>
+ </wsdl:port>
+ <wsdl:port binding="wscoor:RegistrationPortTypeBinding" name="Registration">
+ <soap:address location="http://localhost:8081/axis/services/Registration"/>
+ </wsdl:port>
+
+</wsdl:service>
+
+</wsdl:definitions>
Added: webservices/kandula/trunk/java/schema/wscoor.xsd
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/schema/wscoor.xsd?rev=233989&view=auto
==============================================================================
--- webservices/kandula/trunk/java/schema/wscoor.xsd (added)
+++ webservices/kandula/trunk/java/schema/wscoor.xsd Fri Aug 19 19:59:21 2005
@@ -0,0 +1,105 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Legal Disclaimer
+
+The presentation, distribution or other dissemination of the information
+contained in this specification is not a license, either expressly or impliedly,
+to any intellectual property owned or controlled by BEA or IBM or Microsoft and\or any other
+third party. BEA and IBM and Microsoft and\or any other third party may have patents, patent
+applications, trademarks, copyrights, or other intellectual property rights
+covering subject matter in this document. The furnishing of this document
+does not give you any license to BEA's and IBM's and Microsoft's or any other third party's
+patents, trademarks, copyrights, or other intellectual property.
+
+This specification and the information contained herein is provided on an "AS IS"
+ basis and to the maximum extent permitted by applicable law, BEA and IBM and Microsoft provides
+the document AS IS AND WITH ALL FAULTS, and hereby disclaims all other warranties
+and conditions, either express, implied or statutory, including, but not limited
+to, any (if any) implied warranties, duties or conditions of merchantability, of
+fitness for a particular purpose, of accuracy or completeness of responses, of
+results, of workmanlike effort, of lack of viruses, and of lack of negligence,
+all with regard to the document. ALSO, THERE IS NO WARRANTY OR CONDITION OF
+TITLE, QUIET ENJOYMENT, QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR
+NON-INFRINGEMENT OF ANY INTELLECTUAL PROPERTY RIGHTS WITH REGARD TO THE DOCUMENT.
+
+IN NO EVENT WILL BEA or IBM or MICROSOFT BE LIABLE TO ANY OTHER PARTY FOR THE COST OF PROCURING
+SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS OF USE, LOSS OF DATA, OR ANY
+INCIDENTAL, CONSEQUENTIAL, DIRECT, INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER
+CONTRACT, TORT, WARRANTY, OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY
+OTHER AGREEMENT RELATING TO THIS DOCUMENT, WHETHER OR NOT SUCH PARTY HAD ADVANCE
+NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
+
+Copyright Notice
+
+Copyright 2001, 2002 BEA Systems and IBM Corporation and Microsoft Corporation. All rights reserved.
+-->
+<xsd:schema targetNamespace="http://schemas.xmlsoap.org/ws/2003/09/wscoor"
+
+xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing"
+xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/07/utility"
+xmlns:wscoor="http://schemas.xmlsoap.org/ws/2003/09/wscoor"
+xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.0">
+ <xsd:import namespace="http://schemas.xmlsoap.org/ws/2002/07/utility" schemaLocation="utility.xsd"/>
+
+<!-- schemaLocation="http://schemas.xmlsoap.org/ws/2002/07/utility" -->
+ <xsd:import namespace="http://schemas.xmlsoap.org/ws/2004/03/addressing" schemaLocation="addr.xsd"/>
+
+
+<!-- schemaLocation="http://schemas.xmlsoap.org/ws/2004/03/addressing" -->
+ <xsd:complexType name="CoordinationContextType" abstract="false">
+ <xsd:complexContent>
+ <xsd:extension base="wsu:ContextType">
+ <xsd:sequence>
+ <xsd:element name="CoordinationType" type="xsd:anyURI"/>
+ <xsd:element name="RegistrationService" type="wsa:EndpointReferenceType"/>
+ <xsd:any namespace="##any" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+ <xsd:element name="CoordinationContext" type="wscoor:CoordinationContextType"/>
+ <xsd:complexType name="CreateCoordinationContextType">
+ <xsd:sequence>
+ <xsd:element ref="wsu:Expires" minOccurs="0"/>
+ <xsd:element name="CurrentContext" type="wscoor:CoordinationContextType" minOccurs="0"/>
+ <xsd:element name="CoordinationType" type="xsd:anyURI"/>
+ <xsd:any namespace="##any" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:anyAttribute namespace="##other" processContents="lax"/>
+ </xsd:complexType>
+ <xsd:element name="CreateCoordinationContext" type="wscoor:CreateCoordinationContextType"/>
+ <xsd:complexType name="CreateCoordinationContextResponseType">
+ <xsd:sequence>
+ <xsd:element name="CoordinationContext" type="wscoor:CoordinationContextType" minOccurs="0"/>
+ <xsd:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:anyAttribute namespace="##other" processContents="lax"/>
+ </xsd:complexType>
+ <xsd:element name="CreateCoordinationContextResponse" type="wscoor:CreateCoordinationContextResponseType"/>
+ <xsd:complexType name="RegisterType">
+ <xsd:sequence>
+ <xsd:element name="ProtocolIdentifier" type="xsd:anyURI"/>
+ <xsd:element name="ParticipantProtocolService" type="wsa:EndpointReferenceType"/>
+ <xsd:any namespace="##any" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:anyAttribute namespace="##other" processContents="lax"/>
+ </xsd:complexType>
+ <xsd:element name="Register" type="wscoor:RegisterType"/>
+ <xsd:complexType name="RegisterResponseType">
+ <xsd:sequence>
+ <xsd:element name="CoordinatorProtocolService" type="wsa:EndpointReferenceType"/>
+ <xsd:any namespace="##any" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:anyAttribute namespace="##other" processContents="lax"/>
+ </xsd:complexType>
+ <xsd:element name="RegisterResponse" type="wscoor:RegisterResponseType"/>
+ <xsd:simpleType name="ErrorCodes">
+ <xsd:restriction base="xsd:QName">
+ <xsd:enumeration value="wscoor:AlreadyRegistered"/>
+ <xsd:enumeration value="wscoor:InvalidState"/>
+ <xsd:enumeration value="wscoor:InvalidProtocol"/>
+ <xsd:enumeration value="wscoor:NoActivity"/>
+ <xsd:enumeration value="wscoor:InvalidCreateParameters"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+</xsd:schema>
Added: webservices/kandula/trunk/java/src/org/apache/kandula/Constants.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/Constants.java?rev=233989&view=auto
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/Constants.java (added)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/Constants.java Fri Aug 19 19:59:21 2005
@@ -0,0 +1,35 @@
+/*
+ * 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.kandula;
+
+/**
+ * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
+ */
+abstract public interface Constants {
+
+ //public static final String WS_COOR="http://schemas.xmlsoap.org/ws/2003/09/wscoor";
+ public static final String WS_AT = "http://schemas.xmlsoap.org/ws/2004/10/wsat";
+ public static final String WS_BA = "http://schemas.xmlsoap.org/ws/2004/10/wsba";
+ public static final String WS_AT_COMPLETION = "http://schemas.xmlsoap.org/ws/2004/10/wsat/Completion";
+ public static final String WS_AT_DURABLE2PC = "http://schemas.xmlsoap.org/ws/2004/10/wsat/Durable2PC";
+ public static final String WS_AT_VOLATILE2PC = "http://schemas.xmlsoap.org/ws/2004/10/wsat/Volatile2PC";
+
+ public static final String SUB_VOLATILE_REGISTERED = "registered for volatile 2PC";
+
+ public static final String SUB_DURABLE_REGISTERED = "registered for durable 2PC";
+
+}
Added: webservices/kandula/trunk/java/src/org/apache/kandula/KandulaException.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/KandulaException.java?rev=233989&view=auto
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/KandulaException.java (added)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/KandulaException.java Fri Aug 19 19:59:21 2005
@@ -0,0 +1,57 @@
+/*
+ * 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.kandula;
+
+/**
+ * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
+ */
+public class KandulaException extends Exception {
+
+ /**
+ *
+ */
+ public KandulaException() {
+ super();
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * @param arg0
+ */
+ public KandulaException(String arg0) {
+ super(arg0);
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * @param arg0
+ */
+ public KandulaException(Throwable arg0) {
+ super(arg0);
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * @param arg0
+ * @param arg1
+ */
+ public KandulaException(String arg0, Throwable arg1) {
+ super(arg0, arg1);
+ // TODO Auto-generated constructor stub
+ }
+
+}
Added: webservices/kandula/trunk/java/src/org/apache/kandula/Status.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/Status.java?rev=233989&view=auto
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/Status.java (added)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/Status.java Fri Aug 19 19:59:21 2005
@@ -0,0 +1,54 @@
+/*
+ * 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.kandula;
+
+/**
+ * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
+ */
+abstract public interface Status {
+ interface ParticipantStatus {
+
+ public static final int STATUS_VOLATILE_PREPARING = 20;
+
+ public static final int STATUS_DURABLE_PREPARING = 21;
+
+ public static final int STATUS_PREPARED = 22;
+
+ public static final int STATUS_ABORTED = 23;
+
+ public static final int STATUS_READ_ONLY = 24;
+ }
+ interface CoordinatorStatus {
+
+ public static final int STATUS_NONE = 6;
+
+ public static final int STATUS_COMMITTING = 8;
+
+ public static final int STATUS_PREPARING = 10;
+
+ public static final int STATUS_PREPARING_DURABLE = 11;
+
+ public static final int STATUS_PREPARING_VOLATILE = 12;
+
+ public static final int STATUS_PREPARED_SUCCESS = 13;
+
+ public static final int STATUS_ABORTING = 9;
+
+ public static final int STATUS_ACTIVE = 0;
+
+ }
+}
\ No newline at end of file
Added: webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/Coordinator.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/Coordinator.java?rev=233989&view=auto
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/Coordinator.java (added)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/Coordinator.java Fri Aug 19 19:59:21 2005
@@ -0,0 +1,71 @@
+/*
+ * 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.kandula.coordinator;
+
+import org.apache.kandula.KandulaException;
+import org.apache.kandula.coordinator.context.ActivityContext;
+import org.apache.kandula.typemapping.CoordinationContext;
+
+/**
+ * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
+ */
+public interface Coordinator {
+ /**
+ * @param expires TODO
+ * @param CoordinationProtocolType
+ * (eg: ws-AT)
+ * @return the Coordination Context created
+ *
+ * Initiators can use this to Create new Distributed transactions.This will
+ * take in Coordination protocol Type as a parameter and will create an
+ * instance of the reapective ActivityContext. This created
+ * CoordinationContext will contain an unique activity identifier &
+ * Coordinator Registration EPR in addition to the Coordination protocol
+ * type. This Coordination Context will be used to convey the information
+ * about the transaction between initiator,Participants and coordinator.
+ */
+ public abstract ActivityContext createCoordinationContext(
+ String coordinationType, long expires) throws KandulaException;
+
+ /**
+ * @param Coordinationcontext
+ * @return the interposed Coordination Context created
+ *
+ * Participants decided to use this Coordinator as a interposed
+ * sub-coordinator.The newly created CoordinationContext will contain the
+ * same ActivityIdentifier & Protocol type. Registration EPR of the earlier
+ * CoordinationContext will be replaced by the RegistrationEPR of this
+ * Coordinator.
+ */
+ public abstract ActivityContext createCoordinationContext(
+ CoordinationContext coorContext) throws KandulaException;
+
+ /**
+ * @param CoordinationSubProtocols
+ * (eg: Completion, 2PC)
+ * @param participantEPR
+ * @param Activity-id
+ * @return Should return the particular Coordinators End Point Reference
+ *
+ * This method provides the functional logic for participants to register
+ * for a particular protocol in the transaction activity which was created
+ * by a initiator. Registration request will be forwarded to repective
+ * protocol coordinators.
+ */
+ public abstract String registerParticipant(String protocol,
+ String participantEPR, String id) throws KandulaException;
+}
\ No newline at end of file
Added: webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/CoordinatorImpl.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/CoordinatorImpl.java?rev=233989&view=auto
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/CoordinatorImpl.java (added)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/CoordinatorImpl.java Fri Aug 19 19:59:21 2005
@@ -0,0 +1,107 @@
+/*
+ * 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.kandula.coordinator;
+
+import org.apache.kandula.KandulaException;
+import org.apache.kandula.coordinator.at.ATCoordinator;
+import org.apache.kandula.coordinator.at.ATCoordinatorImpl;
+import org.apache.kandula.coordinator.context.ActivityContext;
+import org.apache.kandula.coordinator.context.ContextFactory;
+import org.apache.kandula.storage.StorageFactory;
+import org.apache.kandula.storage.Store;
+import org.apache.kandula.typemapping.CoordinationContext;
+
+/**
+ * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
+ *
+ * This class implements the operations defined in WS-Coordination specification
+ */
+
+public class CoordinatorImpl implements Coordinator {
+ Store store;
+
+ public CoordinatorImpl() {
+ StorageFactory storageFactory = StorageFactory.getInstance();
+ store = storageFactory.getStore();
+ }
+
+ /**
+ * @param Coordination
+ * Type
+ * @return the Coordination Context created
+ *
+ * Initiators can use this to Create new Distributed transactions.This will
+ * take in the Coordination Type and will create an instance of the
+ * reapective ActivityContext. The Coordination Context created by this can
+ * be used to convey the information about the transaction between
+ * initiator,Participants and coordinator
+ * @throws KandulaException
+ */
+ public ActivityContext createCoordinationContext(String coordinationType, long expires) throws KandulaException {
+ ContextFactory factory = ContextFactory.getInstance();
+ ActivityContext context = factory
+ .createActivity(coordinationType);
+ context.getCoordinationContext().setExpires(expires);
+ store.putContext(context.getCoordinationContext().getActivityID(), context);
+ return context;
+ }
+
+ /**
+ * @param Coordinationcontext
+ * @return the interposed Coordination Context created
+ *
+ * Participants decided to use this Coordinator as a interposed
+ * sub-coordinator.The newly created CoordinationContext will contain the
+ * same ActivityIdentifier & Protocol type. Registration EPR of the earlier
+ * CoordinationContext will be replaced by the RegistrationEPR of this
+ * Coordinator.
+ */
+ public ActivityContext createCoordinationContext(CoordinationContext coorContext) throws KandulaException{
+ ContextFactory factory = ContextFactory.getInstance();
+ ActivityContext context = factory
+ .createActivity(coorContext);
+ store.putContext(context.getCoordinationContext().getActivityID(), context);
+ return context;
+ }
+
+ /**
+ * @param coordinationProtocol
+ * @param participantEPR
+ * @param Activity-id
+ * @return Should return the particular Coordiators End Point Reference
+ *
+ * This method provides the functional logic for participants to register
+ * for a particular transaction activity which was created by a initiator.
+ * Registration request will be forwarded to repective protocol coordinators.
+ * @throws KandulaException
+ */
+ public String registerParticipant(String id, String protocol, String participantEPR) throws KandulaException {
+
+ ActivityContext context = getCoordinationContext(id);
+ if (context == null) {
+ throw new IllegalStateException(
+ "No Activity Found for this Activity ID");
+ }
+ //TODO use "switch case" when BA is present
+ ATCoordinator atCoordinator = new ATCoordinatorImpl();
+ return atCoordinator.register(context,protocol,participantEPR);
+ }
+
+ private ActivityContext getCoordinationContext(String id) {
+ return store.getContext(id);
+ }
+}
\ No newline at end of file
Added: webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/CoordinatorUtils.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/CoordinatorUtils.java?rev=233989&view=auto
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/CoordinatorUtils.java (added)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/CoordinatorUtils.java Fri Aug 19 19:59:21 2005
@@ -0,0 +1,81 @@
+/*
+ * 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.kandula.coordinator;
+
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.util.Random;
+
+import org.apache.kandula.coordinator.context.ActivityContext;
+
+/**
+ * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
+ */
+public class CoordinatorUtils {
+ private static Random myRand = null;
+
+ public static ActivityContext getActivityContext(String id) {
+ return null;
+ }
+
+ /**
+ * MD5 a random string with localhost/date etc will return 128 bits
+ * construct a string of 18 characters from those bits.
+ *
+ * @return string
+ */
+ public static String getRandomStringOf18Characters() {
+ if (myRand == null) {
+ myRand = new Random();
+ }
+ long rand = myRand.nextLong();
+ String sid;
+ try {
+ sid = InetAddress.getLocalHost().toString();
+ } catch (UnknownHostException e) {
+ sid = Thread.currentThread().getName();
+ }
+ long time = System.currentTimeMillis();
+ StringBuffer sb = new StringBuffer();
+ sb.append(sid);
+ sb.append(":");
+ sb.append(Long.toString(time));
+ sb.append(":");
+ sb.append(Long.toString(rand));
+ MessageDigest md5 = null;
+ try {
+ md5 = MessageDigest.getInstance("MD5");
+ } catch (NoSuchAlgorithmException e) {
+ System.out.println("Error: " + e);
+ }
+ md5.update(sb.toString().getBytes());
+ byte[] array = md5.digest();
+ StringBuffer sb2 = new StringBuffer();
+ for (int j = 0; j < array.length; ++j) {
+ int b = array[j] & 0xFF;
+ sb2.append(Integer.toHexString(b));
+ }
+ int begin = myRand.nextInt();
+ if (begin < 0)
+ begin = begin * -1;
+ begin = begin % 8;
+ return new String(sb2.toString().substring(begin, begin + 18))
+ .toUpperCase();
+ }
+}
\ No newline at end of file
Added: webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/at/ATCoordinator.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/at/ATCoordinator.java?rev=233989&view=auto
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/at/ATCoordinator.java (added)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/at/ATCoordinator.java Fri Aug 19 19:59:21 2005
@@ -0,0 +1,90 @@
+/*
+ * 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.kandula.coordinator.at;
+
+import org.apache.kandula.KandulaException;
+import org.apache.kandula.coordinator.context.ActivityContext;
+
+/**
+ * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
+ */
+public interface ATCoordinator {
+
+ public abstract String register(ActivityContext context, String protocol,
+ String participantEPR) throws KandulaException;
+
+ /**
+ * @param Activity
+ * Id taken from the Request
+ * @return should be a notification.
+ * This wraps the Commit operation defined
+ * in Ws-AtomicTransaction specification.
+ */
+ public abstract String commitOperation(String id) throws IllegalAccessException ;
+
+ /**
+ * @param Activity
+ * Id taken from the Request
+ * @return should be a notification.
+ * This wraps the rollback operation defined
+ * in Ws-AtomicTransaction specification.
+ */
+ public abstract String rollbackOperation(String id) throws IllegalAccessException ;
+
+ /**
+ * @param context
+ * @return the status of the Activity after the volatile preparation
+ * @see This methode issues the oneway prepare() message. Does not wait till
+ * partipants responds. Used in 2PC after user commits as well as in
+ * subordinate scenerio, when parent issues volatile prepare(). One can
+ * check if there are any more participants to be responded by checking
+ * the hasMorePreparing() methode of the context.
+ */
+ public abstract int volatilePrepare(ActivityContext context);
+
+ /**
+ * @param context
+ * @return the status of the Activity after the Durable preparation
+ * @see This methode issues the oneway prepare() message. Does not wait till
+ * partipants responds. Used in 2PC after user commits as well as in
+ * subordinate scenerio, when parent issues Durable prepare(). One can
+ * check if there are any more participants to be responded by checking
+ * the hasMorePreparing() methode of the context.
+ */
+ public abstract int durablePrepare(ActivityContext context);
+
+ /**
+ * @param context
+ * @return the status of the Activity
+ * @see This will send the commit() messages to all the participants
+ * registered for the Transaction Must check whether all the
+ * participants have replied to the prepare()
+ */
+ public abstract int commit(ActivityContext context);
+
+ /**
+ * @param context
+ * @return the status of the Activity
+ * @see This will send the rollback() messages to all the participants
+ * registered for the Transaction Do not have to check whether all the
+ * participants have replied to the prepare()
+ */
+ public abstract int abort(ActivityContext context);
+
+ public String addParticipant(ActivityContext context, String protocol,
+ String participantEPR) throws KandulaException;
+}
\ No newline at end of file
Added: webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/at/ATCoordinatorImpl.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/at/ATCoordinatorImpl.java?rev=233989&view=auto
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/at/ATCoordinatorImpl.java (added)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/at/ATCoordinatorImpl.java Fri Aug 19 19:59:21 2005
@@ -0,0 +1,271 @@
+/*
+ * 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.kandula.coordinator.at;
+
+import java.util.Iterator;
+
+import org.apache.kandula.Constants;
+import org.apache.kandula.KandulaException;
+import org.apache.kandula.Status;
+import org.apache.kandula.Status.CoordinatorStatus;
+import org.apache.kandula.coordinator.CoordinatorUtils;
+import org.apache.kandula.coordinator.context.ActivityContext;
+import org.apache.kandula.coordinator.context.at.ATActivityContext;
+
+/**
+ * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
+ */
+public class ATCoordinatorImpl implements ATCoordinator {
+
+ public String register(ActivityContext context, String protocol,
+ String participantEPR) throws KandulaException {
+ context.lock();
+ switch (context.getStatus()) {
+ case CoordinatorStatus.STATUS_PREPARING_DURABLE:
+ context.unlock();
+ this.abort(context);
+ throw new IllegalStateException(
+ "Coordinator is in preparing state - Durable ");
+ case CoordinatorStatus.STATUS_PREPARED_SUCCESS:
+ context.unlock();
+ throw new IllegalStateException(
+ "Coordinator is in prepared success state");
+ case CoordinatorStatus.STATUS_COMMITTING:
+ context.unlock();
+ throw new IllegalStateException(
+ "Coordinator is in committing state");
+ case CoordinatorStatus.STATUS_ABORTING:
+ throw new IllegalStateException("Coordinator is in Aborting state");
+ case CoordinatorStatus.STATUS_ACTIVE:
+ case CoordinatorStatus.STATUS_PREPARING_VOLATILE:
+ return addParticipant(context,participantEPR, protocol);
+ case CoordinatorStatus.STATUS_NONE:
+ default:
+ context.unlock();
+ throw new IllegalStateException();
+ }
+ }
+
+ /**
+ * @param Activity
+ * Id taken from the Request
+ * @return should be a notification This wraps the Commit operation defined
+ * in Ws-AtomicTransaction specification.
+ */
+ public String commitOperation(String id) throws IllegalAccessException {
+ ActivityContext context = CoordinatorUtils.getActivityContext(id);
+ // if store throws a Exception capture it
+ if (context == null) {
+ throw new IllegalStateException(
+ "No Activity Found for this Activity ID");
+ }
+
+ /*
+ * Check for states Do we need to lock the activity
+ */
+ context.lock();
+ switch (context.getStatus()) {
+ case CoordinatorStatus.STATUS_NONE:
+ case CoordinatorStatus.STATUS_ABORTING:
+ context.unlock();
+ return "Aborted";
+ case CoordinatorStatus.STATUS_PREPARING_DURABLE:
+ case CoordinatorStatus.STATUS_PREPARING_VOLATILE:
+ case CoordinatorStatus.STATUS_PREPARED_SUCCESS:
+ //If prepared success Ignore this message
+ context.unlock();
+ return null;
+ case CoordinatorStatus.STATUS_COMMITTING:
+ context.unlock();
+ return "Committed";
+ case Status.CoordinatorStatus.STATUS_ACTIVE:
+ int result;
+ result = volatilePrepare(context);
+
+ if (result == Status.CoordinatorStatus.STATUS_ABORTING) {
+ context.lock();
+ context.setStatus(Status.CoordinatorStatus.STATUS_ABORTING);
+ context.unlock();
+ abort(context);
+ }
+
+ result = commit(context);
+ return null;
+ default:
+ context.unlock();
+ return null;
+ }
+
+ }
+
+ public String rollbackOperation(String id) throws IllegalAccessException {
+ ActivityContext context = CoordinatorUtils.getActivityContext(id);
+ // if store throws a Exception capture it
+ if (context == null) {
+ throw new IllegalStateException(
+ "No Activity Found for this Activity ID");
+ }
+ /*
+ * Check for states Do we need to lock the activity
+ */
+ context.lock();
+ switch (context.getStatus()) {
+ case CoordinatorStatus.STATUS_NONE:
+ case CoordinatorStatus.STATUS_ABORTING:
+ context.unlock();
+ return "Aborted";
+ case CoordinatorStatus.STATUS_PREPARING_DURABLE:
+ case CoordinatorStatus.STATUS_PREPARING_VOLATILE:
+ case CoordinatorStatus.STATUS_PREPARED_SUCCESS:
+ //If prepared success Ignore this message
+ context.unlock();
+ return null;
+ case CoordinatorStatus.STATUS_COMMITTING:
+ context.unlock();
+ return "Committed";
+ case Status.CoordinatorStatus.STATUS_ACTIVE:
+ context.setStatus(Status.CoordinatorStatus.STATUS_ABORTING);
+ context.unlock();
+ int result = abort(context);
+ // if (result ==fdsfsfd)
+ // {
+ // throw new Exception
+ // }
+
+ return null;
+ default:
+ context.unlock();
+ return null;
+ }
+ }
+
+ /**
+ * @param context
+ * @return the status of the Activity after the volatile preparation
+ * @see This methode issues the oneway prepare() message. Does not wait till
+ * partipants responds. Used in 2PC after user commits as well as in
+ * subordinate scenerio, when parent issues volatile prepare(). One can
+ * check if there are any more participants to be responded by checking
+ * the hasMorePreparing() methode of the context.
+ */
+ public int volatilePrepare(ActivityContext context) {
+ ATActivityContext atContext = (ATActivityContext) context;
+ Iterator volatilePartipantIterator = atContext
+ .getRegisteredParticipants(Constants.WS_AT_VOLATILE2PC);
+ if (volatilePartipantIterator.hasNext()) {
+ atContext
+ .setStatus(Status.CoordinatorStatus.STATUS_PREPARING_VOLATILE);
+ atContext.unlock();
+ while (volatilePartipantIterator.hasNext()) {
+ atContext.countPreparing();
+ // participantPortType port
+ // port.prepare
+ }
+ }
+ return atContext.getStatus();
+ }
+
+ /**
+ * @param context
+ * @return the status of the Activity after the Durable preparation
+ * @see This methode issues the oneway prepare() message. Does not wait till
+ * partipants responds. Used in 2PC after user commits as well as in
+ * subordinate scenerio, when parent issues Durable prepare(). One can
+ * check if there are any more participants to be responded by checking
+ * the hasMorePreparing() methode of the context.
+ */
+ public int durablePrepare(ActivityContext context) {
+ ATActivityContext atContext = (ATActivityContext) context;
+ Iterator durablePartipantIterator = atContext
+ .getRegisteredParticipants(Constants.WS_AT_DURABLE2PC);
+ if (durablePartipantIterator.hasNext()) {
+ // wait till all the Volatile prepare()'s are done
+ while (atContext.hasMorePreparing()) {
+ if (atContext.getStatus() == Status.CoordinatorStatus.STATUS_ABORTING)
+ return Status.CoordinatorStatus.STATUS_ABORTING;
+ }
+ atContext.lock();
+ atContext
+ .setStatus(Status.CoordinatorStatus.STATUS_PREPARING_DURABLE);
+ atContext.unlock();
+ while (durablePartipantIterator.hasNext()) {
+ atContext.countPreparing();
+ //port.prepare
+ }
+ }
+ return atContext.getStatus();
+ }
+
+ /**
+ * @param context
+ * @return the status of the Activity
+ * @see This will send the commit() messages to all the participants
+ * registered for the Transaction Must check whether all the
+ * participants have replied to the prepare()
+ */
+ public int commit(ActivityContext context) {
+ // check whether all participants are prepared
+ ATActivityContext atContext = (ATActivityContext) context;
+ while (atContext.hasMorePreparing()) {
+ if (atContext.getStatus() == Status.CoordinatorStatus.STATUS_ABORTING)
+ return Status.CoordinatorStatus.STATUS_ABORTING;
+ }
+ atContext.lock();
+ atContext.setStatus(Status.CoordinatorStatus.STATUS_COMMITTING);
+ atContext.unlock();
+ Iterator participants = atContext.getAllParticipants();
+
+ while (participants.hasNext()) {
+ //port.commit(participant)
+ }
+ return Status.CoordinatorStatus.STATUS_COMMITTING;
+ }
+
+ /**
+ * @param context
+ * @return the status of the Activity
+ * @see This will send the rollback() messages to all the participants
+ * registered for the Transaction Do not have to check whether all the
+ * participants have replied to the prepare()
+ */
+ public int abort(ActivityContext context) {
+ // check whether all participants are prepared
+ context.lock();
+ context.setStatus(Status.CoordinatorStatus.STATUS_ABORTING);
+ context.unlock();
+ Iterator participants = context.getAllParticipants();
+
+ while (participants.hasNext()) {
+ //port.rollback(participant)
+ }
+ return Status.CoordinatorStatus.STATUS_ABORTING;
+ }
+
+ public String addParticipant(ActivityContext context, String protocol,
+ String participantEPR) throws KandulaException {
+ ATActivityContext atContext = (ATActivityContext) context;
+ if (protocol.equals(Constants.WS_AT_DURABLE2PC))
+ return atContext.addParticipant(participantEPR, protocol);
+ else if (protocol.equals(Constants.WS_AT_VOLATILE2PC))
+ return atContext.addParticipant(participantEPR, protocol);
+ else if (protocol.equals(Constants.WS_AT_COMPLETION))
+ return atContext.addParticipant(participantEPR, protocol);
+ else
+ throw new KandulaException(new IllegalArgumentException(
+ "Unsupported Protocol"));
+ }
+}
\ No newline at end of file
Added: webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/at/ATSubCoordinator.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/at/ATSubCoordinator.java?rev=233989&view=auto
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/at/ATSubCoordinator.java (added)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/at/ATSubCoordinator.java Fri Aug 19 19:59:21 2005
@@ -0,0 +1,61 @@
+/*
+ * 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.kandula.coordinator.at;
+
+import org.apache.kandula.Constants;
+import org.apache.kandula.KandulaException;
+import org.apache.kandula.coordinator.context.ActivityContext;
+import org.apache.kandula.coordinator.context.at.ATActivityContext;
+
+/**
+ * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
+ */
+public class ATSubCoordinator extends ATCoordinatorImpl {
+
+ public String commitOperation(String id) throws IllegalAccessException {
+ throw new IllegalAccessException(
+ "This activity is a Sub Ordinate activity. Completion Protocol not supported.");
+ }
+
+ public String rollbackOperation(String id) throws IllegalAccessException {
+ throw new IllegalAccessException(
+ "This activity is a Sub Ordinate activity. Completion Protocol not supported.");
+ }
+
+ public String addParticipant(ActivityContext context, String protocol,
+ String participantEPR) throws KandulaException {
+ ATActivityContext atContext = (ATActivityContext) context;
+ if (protocol.equals(Constants.WS_AT_DURABLE2PC)) {
+ if (!atContext.getSubDurableRegistered()) {
+ //have to register with the parent coordinator
+ atContext.setSubDurableRegistered(true);
+ }
+ return atContext.addParticipant(participantEPR, protocol);
+ }
+
+ else if (protocol.equals(Constants.WS_AT_VOLATILE2PC)) {
+ if (!atContext.getSubDurableRegistered()) {
+ //have to register with the parent coordinator
+ atContext.setSubDurableRegistered(true);
+ }
+ return atContext.addParticipant(participantEPR, protocol);
+ } else
+ throw new KandulaException(new IllegalArgumentException(
+ "Unsupported Protocol"));
+ }
+
+}
\ No newline at end of file
Added: webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/ba/BACoordinator.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/ba/BACoordinator.java?rev=233989&view=auto
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/ba/BACoordinator.java (added)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/ba/BACoordinator.java Fri Aug 19 19:59:21 2005
@@ -0,0 +1,28 @@
+/*
+ * 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.kandula.coordinator.ba;
+
+import org.apache.kandula.coordinator.context.ActivityContext;
+
+/**
+ * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
+ */
+public interface BACoordinator {
+ public abstract String register(ActivityContext context, String protocol,
+ String participantEPR);
+
+}
\ No newline at end of file
Added: webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/context/ActivityContext.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/context/ActivityContext.java?rev=233989&view=auto
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/context/ActivityContext.java (added)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/context/ActivityContext.java Fri Aug 19 19:59:21 2005
@@ -0,0 +1,49 @@
+/*
+ * 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.kandula.coordinator.context;
+
+import java.util.Iterator;
+
+import org.apache.kandula.KandulaException;
+import org.apache.kandula.typemapping.CoordinationContext;
+
+/**
+ * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
+ */
+public interface ActivityContext {
+
+ public abstract String addParticipant(String participantEPR, String protocol) throws KandulaException;
+
+ public abstract Iterator getRegisteredParticipants(String protocol);
+
+ public abstract Iterator getAllParticipants();
+
+ public abstract int getStatus();
+
+ public abstract void setStatus(int value);
+
+ public abstract void lock();
+
+ public abstract void unlock();
+
+ public abstract void setProperty(Object key, Object value);
+
+ public abstract Object getProperty(Object key);
+
+ public abstract CoordinationContext getCoordinationContext();
+
+}
\ No newline at end of file
Added: webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/context/ActivityContextImpl.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/context/ActivityContextImpl.java?rev=233989&view=auto
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/context/ActivityContextImpl.java (added)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/context/ActivityContextImpl.java Fri Aug 19 19:59:21 2005
@@ -0,0 +1,104 @@
+/*
+ * 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.kandula.coordinator.context;
+
+import java.util.HashMap;
+
+import org.apache.kandula.Status.CoordinatorStatus;
+import org.apache.kandula.coordinator.CoordinatorUtils;
+import org.apache.kandula.typemapping.CoordinationContext;
+import org.apache.kandula.typemapping.EndPointReference;
+import org.apache.kandula.utility.EndpointReferenceFactory;
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.impl.schema.SchemaTypeLoaderImpl;
+import org.xmlsoap.schemas.ws.x2003.x09.wscoor.impl.CoordinationContextTypeImpl;
+
+/**
+ * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
+ */
+public abstract class ActivityContextImpl implements ActivityContext {
+
+ private HashMap propertyBag;
+
+ private String activityID;
+
+ private int status = CoordinatorStatus.STATUS_NONE;
+
+ private boolean locked = false;
+
+ protected CoordinationContext coordinationContext;
+
+ protected ActivityContextImpl(){
+ }
+
+ public ActivityContextImpl(String coordinationType) {
+ activityID = CoordinatorUtils.getRandomStringOf18Characters();
+ coordinationContext = CoordinationContext.Factory.newInstance();
+ coordinationContext.setActivityID(activityID);
+ coordinationContext.setRegistrationService(EndpointReferenceFactory.getInstance().getRegistrationEndpoint());
+ coordinationContext.setCoordinationType(coordinationType);
+ }
+
+ public CoordinationContext getCoordinationContext() {
+ return coordinationContext;
+ }
+
+ protected void setCoordinationContext(CoordinationContext context)
+ {
+ this.coordinationContext = context;
+ }
+
+ public int getStatus() {
+ return status;
+ }
+
+ public void setStatus(int value) {
+ status = value;
+ }
+
+ public synchronized void lock() {
+ if (locked) {
+ while (locked) {
+ try {
+ wait();
+ } catch (InterruptedException ex) {
+ // ignore
+ }
+ if (status == CoordinatorStatus.STATUS_NONE)
+ throw new IllegalStateException();
+ }
+ }
+
+ locked = true;
+ }
+
+ public synchronized void unlock() {
+ if (!locked)
+ throw new IllegalStateException();
+ locked = false;
+ notify();
+ }
+
+ public void setProperty(Object key, Object value) {
+ propertyBag.put(key, value);
+
+ }
+
+ public Object getProperty(Object key) {
+ return propertyBag.get(key);
+ }
+}
Added: webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/context/ContextFactory.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/context/ContextFactory.java?rev=233989&view=auto
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/context/ContextFactory.java (added)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/context/ContextFactory.java Fri Aug 19 19:59:21 2005
@@ -0,0 +1,51 @@
+/*
+ * 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.kandula.coordinator.context;
+
+import org.apache.kandula.KandulaException;
+import org.apache.kandula.coordinator.context.at.ATActivityContext;
+import org.apache.kandula.typemapping.CoordinationContext;
+
+/**
+ * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
+ */
+public class ContextFactory {
+ static ContextFactory instance = new ContextFactory();
+
+ public static ContextFactory getInstance() {
+ return instance;
+ }
+
+ public ActivityContext createActivity(String protocol)
+ throws KandulaException {
+ if (org.apache.kandula.Constants.WS_AT.equalsIgnoreCase(protocol)) {
+ return new ATActivityContext();
+ } else{
+ throw new KandulaException(new IllegalArgumentException(
+ "Unsupported Protocol Type"));
+ }
+ }
+
+ public ActivityContext createActivity(CoordinationContext context) throws KandulaException {
+ if (org.apache.kandula.Constants.WS_AT.equalsIgnoreCase(context.getCoordinationType())) {
+ return new ATActivityContext(context);
+ } else{
+ throw new KandulaException(new IllegalArgumentException(
+ "Unsupported Protocol Type"));
+ }
+ }
+}
\ No newline at end of file
Added: webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/context/Participant.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/context/Participant.java?rev=233989&view=auto
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/context/Participant.java (added)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/context/Participant.java Fri Aug 19 19:59:21 2005
@@ -0,0 +1,52 @@
+ /*
+ * 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.kandula.coordinator.context;
+
+/**
+ * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
+ *
+ * Used to store the details about the participant & to store the runtime status
+ * of Participants
+ */
+public class Participant {
+ private String epr;
+ private String protocol;
+ private int status;
+
+ /**
+ * @param epr
+ * @param protocol
+ * @param activityId
+ */
+ public Participant(String epr, String protocol) {
+ super();
+ this.epr = epr;
+ this.protocol = protocol;
+ }
+
+ public void setStatus(int status)
+ {
+ this.status = status;
+ }
+
+ public int getStatus()
+ {
+ return status;
+ }
+
+
+}
\ No newline at end of file
Added: webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/context/at/ATActivityContext.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/context/at/ATActivityContext.java?rev=233989&view=auto
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/context/at/ATActivityContext.java (added)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/context/at/ATActivityContext.java Fri Aug 19 19:59:21 2005
@@ -0,0 +1,154 @@
+/*
+ * 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.kandula.coordinator.context.at;
+
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.LinkedList;
+
+import org.apache.kandula.Constants;
+import org.apache.kandula.KandulaException;
+import org.apache.kandula.coordinator.context.ActivityContext;
+import org.apache.kandula.coordinator.context.ActivityContextImpl;
+import org.apache.kandula.coordinator.context.Participant;
+import org.apache.kandula.typemapping.CoordinationContext;
+import org.apache.kandula.typemapping.EndPointReference;
+import org.apache.kandula.utility.EndpointReferenceFactory;
+
+/**
+ * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
+ */
+public class ATActivityContext extends ActivityContextImpl implements
+ ActivityContext {
+
+ private int preparingParticipantsCount = 0;
+
+ private boolean subOrdinate = false;
+
+ private Hashtable volatileParticipantsTable;
+
+ private Hashtable durableParticipantsTable;
+
+ private boolean subVolatileRegistered = false;
+
+ private boolean subDurableRegistered = false;
+
+ private EndPointReference parentEPR;
+
+ public ATActivityContext() {
+ super(Constants.WS_AT);
+ volatileParticipantsTable = new Hashtable();
+ durableParticipantsTable = new Hashtable();
+ }
+
+ public ATActivityContext(CoordinationContext context) {
+ subOrdinate = true;
+ parentEPR = context.getRegistrationService();
+ context.setRegistrationService(EndpointReferenceFactory.getInstance()
+ .getRegistrationEndpoint());
+ volatileParticipantsTable = new Hashtable();
+ durableParticipantsTable = new Hashtable();
+ setCoordinationContext(context);
+ }
+
+ /**
+ * @param participantEPR
+ * @param protocol
+ * @return Coordinator protocol service.
+ * @throws KandulaException
+ */
+ public String addParticipant(String participantEPR, String protocol)
+ throws KandulaException {
+ if (protocol.equals(Constants.WS_AT_VOLATILE2PC)) {
+ return addVolatileParticipant(participantEPR);
+ } else if (protocol.equals(Constants.WS_AT_DURABLE2PC)) {
+ return addDurableParticipant(participantEPR);
+ }
+ return "2PC port EPR";
+ }
+
+ public String addVolatileParticipant(String participantEPR)
+ throws KandulaException {
+ if (volatileParticipantsTable.contains(participantEPR))
+ throw new KandulaException("wscoor:Already Registered");
+ volatileParticipantsTable.put(participantEPR, new Participant(
+ participantEPR, Constants.WS_AT_VOLATILE2PC));
+ return "2PC port";
+ }
+
+ public String addDurableParticipant(String participantEPR)
+ throws KandulaException {
+ if (durableParticipantsTable.contains(participantEPR))
+ throw new KandulaException("wscoor:Already Registered");
+ durableParticipantsTable.put(participantEPR, new Participant(
+ participantEPR, Constants.WS_AT_DURABLE2PC));
+ return "2PC port";
+ }
+
+ public Iterator getRegisteredParticipants(String protocol) {
+ if (protocol.equals(Constants.WS_AT_VOLATILE2PC)) {
+ return volatileParticipantsTable.values().iterator();
+ } else if (protocol.equals(Constants.WS_AT_DURABLE2PC)) {
+ return durableParticipantsTable.values().iterator();
+ }
+ return null;
+ }
+
+ public Iterator getAllParticipants() {
+ LinkedList list = new LinkedList(volatileParticipantsTable.values());
+ list.addAll(durableParticipantsTable.values());
+ return list.iterator();
+ }
+
+ public void countPreparing() {
+ preparingParticipantsCount++;
+
+ }
+
+ public boolean hasMorePreparing() {
+ if (preparingParticipantsCount > 0) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ public boolean getSubVolatileRegistered() {
+
+ return subVolatileRegistered;
+ }
+
+ public boolean getSubDurableRegistered() {
+ return subDurableRegistered;
+ }
+
+ public void setSubVolatileRegistered(boolean value) {
+ subVolatileRegistered = value;
+ }
+
+ public void setSubDurableRegistered(boolean value) {
+ subDurableRegistered = value;
+ }
+ // public void prepared(Participant participant)
+ // {
+ // if (participant.getStatus()==Status.ParticipantStatus.STATUS_ABORTED)
+ // {
+ // //throw new
+ // }
+ // }
+
+}
\ No newline at end of file
Added: webservices/kandula/trunk/java/src/org/apache/kandula/storage/Axis1Store.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/storage/Axis1Store.java?rev=233989&view=auto
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/storage/Axis1Store.java (added)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/storage/Axis1Store.java Fri Aug 19 19:59:21 2005
@@ -0,0 +1,50 @@
+/*
+ * 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.kandula.storage;
+
+import org.apache.kandula.coordinator.context.ActivityContext;
+
+/**
+ * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
+ */
+public class Axis1Store implements Store {
+
+ /* (non-Javadoc)
+ * @see org.apache.kandula.storage.Store#putContext(java.lang.String, org.apache.kandula.coordinator.context.CoordinationContext)
+ */
+ public void putContext(String id, ActivityContext context) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.kandula.storage.Store#getContext(java.lang.String)
+ */
+ public ActivityContext getContext(String id) {
+
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.kandula.storage.Store#forgetContext(java.lang.String)
+ */
+ public void forgetContext(String id) {
+ // TODO Auto-generated method stub
+
+ }
+
+}
Added: webservices/kandula/trunk/java/src/org/apache/kandula/storage/Axis2Store.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/storage/Axis2Store.java?rev=233989&view=auto
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/storage/Axis2Store.java (added)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/storage/Axis2Store.java Fri Aug 19 19:59:21 2005
@@ -0,0 +1,46 @@
+/*
+ * 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.kandula.storage;
+
+import org.apache.kandula.coordinator.context.ActivityContext;
+
+/**
+ * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
+ */
+public class Axis2Store implements Store{
+
+ /* (non-Javadoc)
+ * @see org.apache.kandula.storage.Store#putContext(java.lang.String, org.apache.kandula.coordinator.context.CoordinationContext)
+ */
+ public void putContext(String id, ActivityContext context) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.kandula.storage.Store#getContext(java.lang.String)
+ */
+ public ActivityContext getContext(String id) {
+ return null;
+
+ }
+
+ public void forgetContext(String id)
+ {
+ }
+
+}
Added: webservices/kandula/trunk/java/src/org/apache/kandula/storage/StorageFactory.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/storage/StorageFactory.java?rev=233989&view=auto
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/storage/StorageFactory.java (added)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/storage/StorageFactory.java Fri Aug 19 19:59:21 2005
@@ -0,0 +1,32 @@
+/*
+ * 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.kandula.storage;
+
+/**
+ * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
+ */
+public class StorageFactory {
+ static StorageFactory instance = new StorageFactory();
+ public static StorageFactory getInstance()
+ {
+ return instance;
+ }
+ public Store getStore()
+ {
+ return null;
+ }
+}
Added: webservices/kandula/trunk/java/src/org/apache/kandula/storage/Store.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/storage/Store.java?rev=233989&view=auto
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/storage/Store.java (added)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/storage/Store.java Fri Aug 19 19:59:21 2005
@@ -0,0 +1,28 @@
+/*
+ * 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.kandula.storage;
+
+import org.apache.kandula.coordinator.context.ActivityContext;
+
+/**
+ * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
+ */
+public interface Store {
+ void putContext(String id,ActivityContext context);
+ ActivityContext getContext(String id);
+ void forgetContext(String id);
+}
Added: webservices/kandula/trunk/java/src/org/apache/kandula/typemapping/CoordinationContext.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/typemapping/CoordinationContext.java?rev=233989&view=auto
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/typemapping/CoordinationContext.java (added)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/typemapping/CoordinationContext.java Fri Aug 19 19:59:21 2005
@@ -0,0 +1,54 @@
+/*
+ * 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.kandula.typemapping;
+
+import org.apache.kandula.typemapping.xmlbeansimpl.XmlBeansTypeCoordinationContext;
+
+/**
+ * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
+ */
+public interface CoordinationContext {
+ public abstract String getActivityID();
+
+ public abstract String getCoordinationType();
+
+ public abstract EndPointReference getRegistrationService();
+
+ public abstract long getExpires();
+
+ public abstract void setActivityID(String value);
+
+ public abstract void setCoordinationType(String value);
+
+ public abstract void setRegistrationService(EndPointReference value);
+
+ public abstract void setExpires(long value);
+
+ public abstract Object getCoordinationContextType();
+
+ public static final class Factory {
+ public static CoordinationContext newInstance() {
+ return new XmlBeansTypeCoordinationContext();
+ }
+ public static CoordinationContext newInstance(Object contextType) {
+ return new XmlBeansTypeCoordinationContext(contextType);
+ }
+
+ private Factory() {
+ } // No instance of this class allowed
+ }
+}
\ No newline at end of file
Added: webservices/kandula/trunk/java/src/org/apache/kandula/typemapping/EndPointReference.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/typemapping/EndPointReference.java?rev=233989&view=auto
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/typemapping/EndPointReference.java (added)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/typemapping/EndPointReference.java Fri Aug 19 19:59:21 2005
@@ -0,0 +1,44 @@
+/*
+ * 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.kandula.typemapping;
+
+import org.apache.kandula.typemapping.xmlbeansimpl.XmlBeansTypeEndPointReference;
+
+/**
+ * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
+ */
+public interface EndPointReference {
+
+ public abstract Object getEndPointReferenceType();
+
+ public abstract String getPortTypeLocalPart();
+
+ public static final class Factory {
+
+ public static EndPointReference newInstance() {
+ return new XmlBeansTypeEndPointReference();
+ }
+
+ public static EndPointReference newInstance(Object contextType) {
+ return new XmlBeansTypeEndPointReference(contextType);
+ }
+
+ private Factory() {
+ } // No instance of this class allowed
+ }
+}
+
Added: webservices/kandula/trunk/java/src/org/apache/kandula/typemapping/xmlbeansimpl/XmlBeansTypeCoordinationContext.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/typemapping/xmlbeansimpl/XmlBeansTypeCoordinationContext.java?rev=233989&view=auto
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/typemapping/xmlbeansimpl/XmlBeansTypeCoordinationContext.java (added)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/typemapping/xmlbeansimpl/XmlBeansTypeCoordinationContext.java Fri Aug 19 19:59:21 2005
@@ -0,0 +1,88 @@
+/*
+ * 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.kandula.typemapping.xmlbeansimpl;
+
+import org.apache.kandula.typemapping.CoordinationContext;
+import org.apache.kandula.typemapping.EndPointReference;
+import org.xmlsoap.schemas.ws.x2002.x07.utility.AttributedDateTime;
+import org.xmlsoap.schemas.ws.x2002.x07.utility.AttributedURI;
+import org.xmlsoap.schemas.ws.x2003.x09.wscoor.CoordinationContextType;
+import org.xmlsoap.schemas.ws.x2004.x03.addressing.EndpointReferenceType;
+
+/**
+ * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
+ */
+public class XmlBeansTypeCoordinationContext implements CoordinationContext {
+ private CoordinationContextType contextType;
+
+ public XmlBeansTypeCoordinationContext() {
+ super();
+ EndpointReferenceType epr = EndpointReferenceType.Factory.newInstance();
+ contextType = CoordinationContextType.Factory.newInstance();
+ }
+ /**
+ * @param contextType
+ */
+ public XmlBeansTypeCoordinationContext(Object contextType) {
+ super();
+ this.contextType = (CoordinationContextType)contextType;
+ }
+
+ public String getActivityID() {
+ return contextType.getIdentifier().getId();
+ }
+
+ public String getCoordinationType() {
+ return contextType.getCoordinationType();
+ }
+
+ public EndPointReference getRegistrationService() {
+ return null;//contextType.getRegistrationService().
+ }
+
+ public long getExpires() {
+ return Long.parseLong(contextType.getExpires().getId());
+ }
+
+ public void setActivityID(String value) {
+ AttributedURI uri = AttributedURI.Factory.newInstance();
+ uri.setId(value);
+ contextType.setIdentifier(uri);
+
+ }
+
+ public void setCoordinationType(String value) {
+ contextType.setCoordinationType(value);
+
+ }
+
+ public void setRegistrationService(EndPointReference value) {
+ contextType.setRegistrationService((EndpointReferenceType)value.getEndPointReferenceType());
+
+ }
+
+ public void setExpires(long value) {
+ AttributedDateTime dateTime = AttributedDateTime.Factory.newInstance();
+ dateTime.setId(new Long(value).toString());
+ contextType.setExpires(dateTime);
+ }
+
+ public Object getCoordinationContextType() {
+ return contextType;
+ }
+
+}
Added: webservices/kandula/trunk/java/src/org/apache/kandula/typemapping/xmlbeansimpl/XmlBeansTypeEndPointReference.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/typemapping/xmlbeansimpl/XmlBeansTypeEndPointReference.java?rev=233989&view=auto
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/typemapping/xmlbeansimpl/XmlBeansTypeEndPointReference.java (added)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/typemapping/xmlbeansimpl/XmlBeansTypeEndPointReference.java Fri Aug 19 19:59:21 2005
@@ -0,0 +1,51 @@
+/*
+ * 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.kandula.typemapping.xmlbeansimpl;
+
+import org.apache.kandula.typemapping.EndPointReference;
+import org.xmlsoap.schemas.ws.x2004.x03.addressing.EndpointReferenceType;
+
+/**
+ * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
+ */
+public class XmlBeansTypeEndPointReference implements EndPointReference {
+
+ EndpointReferenceType eprType;
+
+ /**
+ *
+ */
+ public XmlBeansTypeEndPointReference() {
+ super();
+ eprType = EndpointReferenceType.Factory.newInstance();
+ }
+ /**
+ * @param eprType
+ */
+ public XmlBeansTypeEndPointReference(Object eprType) {
+ super();
+ this.eprType = (EndpointReferenceType)eprType;
+ }
+ public Object getEndPointReferenceType() {
+ return eprType;
+ }
+ public String getPortTypeLocalPart()
+ {
+ return eprType.getPortType().getQNameValue().getLocalPart();
+ }
+
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: kandula-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: kandula-dev-help@ws.apache.org