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/09/01 07:15:14 UTC
svn commit: r265654 - in
/webservices/kandula/trunk/java/src/org/apache/kandula/participant: ./
standalone/ standalone/Transaction.java standalone/TransactionManager.java
standalone/handler/ standalone/handler/TransactionHandler.java
Author: thilina
Date: Wed Aug 31 22:14:58 2005
New Revision: 265654
URL: http://svn.apache.org/viewcvs?rev=265654&view=rev
Log:
adding the requestor (initiator) implementation
Added:
webservices/kandula/trunk/java/src/org/apache/kandula/participant/
webservices/kandula/trunk/java/src/org/apache/kandula/participant/standalone/
webservices/kandula/trunk/java/src/org/apache/kandula/participant/standalone/Transaction.java
webservices/kandula/trunk/java/src/org/apache/kandula/participant/standalone/TransactionManager.java
webservices/kandula/trunk/java/src/org/apache/kandula/participant/standalone/handler/
webservices/kandula/trunk/java/src/org/apache/kandula/participant/standalone/handler/TransactionHandler.java
Added: webservices/kandula/trunk/java/src/org/apache/kandula/participant/standalone/Transaction.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/participant/standalone/Transaction.java?rev=265654&view=auto
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/participant/standalone/Transaction.java (added)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/participant/standalone/Transaction.java Wed Aug 31 22:14:58 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.participant.standalone;
+
+
+import java.rmi.RemoteException;
+
+import org.apache.kandula.typemapping.CoordinationContext;
+
+
+/**
+ * @author Dasarath Weeratunge
+ * @author <a href="mailto:thilina@apache.org"> Thilina Gunarathne </a>
+ */
+public class Transaction {
+ private static String COMPLETION_PROTOCOL= "http://schemas.xmlsoap.org/ws/2003/09/wsat#Completion";
+
+ private CoordinationContext ctx;
+ //private CompletionRPCPort compPort;
+
+ public Transaction(CoordinationContext ctx) throws RemoteException {
+ this.ctx= ctx;
+ //compPort= new CompletionRPCPort(ctx.register(COMPLETION_PROTOCOL, null));
+ }
+
+ public CoordinationContext getCoordinationContex() {
+ return ctx;
+ }
+
+// public void rollback() throws RemoteException {
+// compPort.rollback();
+// }
+//
+// public void commit() throws RemoteException {
+// compPort.commit();
+// }
+}
Added: webservices/kandula/trunk/java/src/org/apache/kandula/participant/standalone/TransactionManager.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/participant/standalone/TransactionManager.java?rev=265654&view=auto
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/participant/standalone/TransactionManager.java (added)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/participant/standalone/TransactionManager.java Wed Aug 31 22:14:58 2005
@@ -0,0 +1,119 @@
+/*
+ * 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.participant.standalone;
+
+import java.rmi.RemoteException;
+
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.kandula.KandulaException;
+import org.apache.kandula.coordinator.context.ActivityContext;
+import org.apache.kandula.coordinator.context.ContextFactory;
+import org.apache.kandula.coordinator.context.at.ATActivityContext;
+import org.apache.kandula.storage.StorageFactory;
+import org.apache.kandula.storage.Store;
+import org.apache.kandula.wscoor.ActivationCoordinatorPortTypeRawXMLStub;
+
+/**
+ * @author Dasarath Weeratunge
+ * @author <a href="mailto:thilina@apache.org"> Thilina Gunarathne </a>
+ */
+
+public class TransactionManager {
+
+ ThreadLocal threadInfo;
+ //till we get reply to reference properties correctly in Axis 2 Addressing
+ public static String tempID;
+
+ public TransactionManager(String coordinationType,
+ EndpointReference coordEPR) throws KandulaException {
+ threadInfo = new ThreadLocal();
+ ActivityContext context = ContextFactory.getInstance().createActivity(
+ coordinationType, coordEPR);
+ if (threadInfo.get() != null)
+ throw new IllegalStateException();
+ threadInfo.set(context.getProperty(ATActivityContext.REQUESTER_ID));
+ //TODO remove this when we get replyTo reference properties correctly
+ tempID = (String)context.getProperty(ATActivityContext.REQUESTER_ID);
+ Store store = StorageFactory.getInstance().getStore();
+ store.putContext(context.getProperty(ATActivityContext.REQUESTER_ID),
+ context);
+ }
+
+ /**
+ * @throws Exception
+ */
+ public void begin() throws Exception {
+ ActivityContext context = getTransaction();
+ String id = (String) context
+ .getProperty(ATActivityContext.REQUESTER_ID);
+ threadInfo.set(id);
+ ActivationCoordinatorPortTypeRawXMLStub activationCoordinator = new ActivationCoordinatorPortTypeRawXMLStub(
+ ".", (EndpointReference) context
+ .getProperty(ATActivityContext.ACTIVATION_EPR));
+ activationCoordinator.createCoordinationContextOperation(
+ org.apache.kandula.Constants.WS_AT, id);
+ while (context.getCoordinationContext()==null)
+ {
+ //allow other threads to execute
+ Thread.sleep(10);
+ }
+
+ }
+
+ public void commit() throws RemoteException {
+ // Transaction tx= getTransaction();
+ // if (tx == null)
+ // throw new IllegalStateException();
+ // forget();
+ // tx.commit();
+ }
+
+ public void rollback() throws RemoteException {
+ // Transaction tx= getTransaction();
+ // if (tx == null)
+ // throw new IllegalStateException();
+ // forget();
+ // tx.rollback();
+ }
+
+ // public Transaction suspend() {
+ // Transaction tx= getTransaction();
+ // forget();
+ // return tx;
+ // }
+ //
+ // public void resume(Transaction tx) {
+ // if (threadInfo.get() != null)
+ // throw new IllegalStateException();
+ // else
+ // threadInfo.set(tx);
+ // }
+ //
+ // public void forget() {
+ // threadInfo.set(null);
+ // }
+
+ public ActivityContext getTransaction() throws KandulaException{
+ Object key = threadInfo.get();
+ ActivityContext context = StorageFactory.getInstance().getStore()
+ .getContext(key);
+ if (context == null) {
+ throw new KandulaException("IllegalState");
+ }
+ return context;
+ }
+}
\ No newline at end of file
Added: webservices/kandula/trunk/java/src/org/apache/kandula/participant/standalone/handler/TransactionHandler.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/participant/standalone/handler/TransactionHandler.java?rev=265654&view=auto
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/participant/standalone/handler/TransactionHandler.java (added)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/participant/standalone/handler/TransactionHandler.java Wed Aug 31 22:14:58 2005
@@ -0,0 +1,39 @@
+/*
+ * 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.participant.standalone.handler;
+
+
+
+
+/**
+ * @author Dasarath Weeratunge
+ */
+//public class TransactionHandler extends BasicHandler {
+//// TransactionManager tm= TransactionManager.getInstance();
+//// public void invoke(MessageContext msgContext) throws AxisFault {
+//// Transaction tx= tm.getTransaction();
+//// if (tx != null) {
+//// try {
+//// SOAPHeader header= msgContext.getCurrentMessage().getSOAPEnvelope().getHeader();
+//// tx.getCoordinationContex().toSOAPHeaderElement(header);
+//// }
+//// catch (Exception e) {
+//// throw AxisFault.makeFault(e);
+//// }
+//// }
+//// }
+//}
---------------------------------------------------------------------
To unsubscribe, e-mail: kandula-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: kandula-dev-help@ws.apache.org