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 2007/02/14 12:08:26 UTC
svn commit: r507487 [3/4] - in
/webservices/kandula/trunk/java/src/org/apache/kandula: ./ ba/ context/
context/impl/ coordinator/ coordinator/at/ coordinator/ba/ initiator/
participant/ participant/at/ participant/ba/ storage/ utility/ wsat/twopc/
wsba...
Added: webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/ba/BAParticipantInformation.java
URL: http://svn.apache.org/viewvc/webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/ba/BAParticipantInformation.java?view=auto&rev=507487
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/ba/BAParticipantInformation.java (added)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/ba/BAParticipantInformation.java Wed Feb 14 03:08:23 2007
@@ -0,0 +1,73 @@
+package org.apache.kandula.coordinator.ba;
+
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.kandula.Status;
+
+public class BAParticipantInformation {
+
+ private String enlistmentId;
+
+ private EndpointReference epr;
+
+ private String protocol;
+
+ private int status;
+
+ boolean criticalParticipant;
+
+ public BAParticipantInformation(EndpointReference epr, String protocol,
+ String enlistmentId) {
+ super();
+ this.epr = epr;
+ this.protocol = protocol;
+ this.enlistmentId = enlistmentId;
+ this.status = Status.BACoordinatorStatus.STATUS_ACTIVE;
+ }
+
+
+
+ /**
+ * @return Returns the Id which this participant is registered with the
+ * coordinator
+ */
+ public String getEnlistmentId() {
+ return enlistmentId;
+ }
+
+ /**
+ * @return Returns the epr of the participant
+ */
+ public EndpointReference getEpr() {
+ return epr;
+ }
+
+ /**
+ * @return Returns the protocol of the participant (Eg: WS-AT, WS-BA)
+ */
+ public String getProtocol() {
+ return protocol;
+ }
+
+ /**
+ * @return Returns the status of the participant
+ */
+ public int getStatus() {
+ return status;
+ }
+
+ public void setEpr(EndpointReference epr) {
+ this.epr = epr;
+ }
+
+ public void setStatus(int status) {
+ this.status = status;
+ }
+
+ public boolean setCriticality(boolean criticality) {
+ return criticalParticipant;
+ }
+
+ public boolean getCriticality() {
+ return criticalParticipant;
+ }
+}
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/initiator/TransactionManager.java
URL: http://svn.apache.org/viewvc/webservices/kandula/trunk/java/src/org/apache/kandula/initiator/TransactionManager.java?view=diff&rev=507487&r1=507486&r2=507487
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/initiator/TransactionManager.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/initiator/TransactionManager.java Wed Feb 14 03:08:23 2007
@@ -1,18 +1,16 @@
/*
- * 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.
- *
+ * 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.initiator;
@@ -37,6 +35,7 @@
import org.apache.kandula.wsat.completion.CompletionInitiatorServiceListener;
import org.apache.kandula.wscoor.ActivationServiceStub;
import org.apache.kandula.wscoor.RegistrationServiceStub;
+import org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContext_type3;
import org.oasis_open.docs.ws_tx.wscoor._2006._06.CreateCoordinationContext;
import org.oasis_open.docs.ws_tx.wscoor._2006._06.CreateCoordinationContextResponse;
import org.oasis_open.docs.ws_tx.wscoor._2006._06.CreateCoordinationContextResponseType;
@@ -46,16 +45,15 @@
import org.oasis_open.docs.ws_tx.wscoor._2006._06.RegisterType;
public class TransactionManager {
-
+
private static ThreadLocal threadInfo = new ThreadLocal();
+
private ConfigurationContext configurationContext;
- public TransactionManager(String axis2Home, String axis2Xml)
- throws AbstractKandulaException {
+ public TransactionManager(String axis2Home, String axis2Xml) throws AbstractKandulaException {
try {
configurationContext = ConfigurationContextFactory
- .createConfigurationContextFromFileSystem(axis2Home,
- axis2Xml);
+ .createConfigurationContextFromFileSystem(axis2Home, axis2Xml);
} catch (DeploymentException e) {
throw new KandulaGeneralException(e);
} catch (AxisFault e1) {
@@ -68,31 +66,30 @@
*/
public void begin(String coordinatorAddress) throws Exception {
- if (threadInfo.get()!=null)
- {
+ if (threadInfo.get() != null) {
throw new IllegalStateException();
}
- InitiatorContext initiatorTransaction = new InitiatorContext(Constants.WS_AT,coordinatorAddress);
+ InitiatorContext initiatorTransaction = new InitiatorContext(Constants.WS_AT,
+ coordinatorAddress);
CoordinationContext coordinationContext = createTransaction(initiatorTransaction);
initiatorTransaction.setCoordinationContext(coordinationContext);
threadInfo.set(initiatorTransaction);
}
-
-
public void commit() throws Exception {
InitiatorContext initiatorTransaction = getTransaction();
CompletionCallback completionCallback = new CompletionCallback(initiatorTransaction);
// Register for completion
- EndpointReference coordinationEPR = registerForCompletion(initiatorTransaction,completionCallback);
- initiatorTransaction.setCoordinationEPR(coordinationEPR);
+ EndpointReference coordinationEPR = registerForCompletion(initiatorTransaction,
+ completionCallback);
+ initiatorTransaction.setCoordinationEPR(coordinationEPR);
CompletionCoordinatorPortTypeRawXMLStub stub = new CompletionCoordinatorPortTypeRawXMLStub(
configurationContext, coordinationEPR);
stub.commitOperation();
while (!completionCallback.isComplete())
Thread.sleep(10);
-
+
if ((completionCallback.getResult() == Status.CoordinatorStatus.STATUS_ABORTING)) {
forgetTransaction();
throw new Exception("Aborted");
@@ -101,12 +98,13 @@
}
public void rollback() throws Exception {
- InitiatorContext initiatorTransaction = getTransaction();
+ InitiatorContext initiatorTransaction = getTransaction();
// Register for completion
CompletionCallback completionCallback = new CompletionCallback(initiatorTransaction);
// Register for completion
- EndpointReference coordinationEPR = registerForCompletion(initiatorTransaction,completionCallback);
- initiatorTransaction.setCoordinationEPR(coordinationEPR);
+ EndpointReference coordinationEPR = registerForCompletion(initiatorTransaction,
+ completionCallback);
+ initiatorTransaction.setCoordinationEPR(coordinationEPR);
CompletionCoordinatorPortTypeRawXMLStub stub = new CompletionCoordinatorPortTypeRawXMLStub(
configurationContext, coordinationEPR);
stub.rollbackOperation();
@@ -132,12 +130,10 @@
// threadInfo.set(null);
// }
- private static InitiatorContext getTransaction()
- throws AbstractKandulaException {
+ public static InitiatorContext getTransaction() throws AbstractKandulaException {
Object key = threadInfo.get();
- if (key!= null)
- {
- return (InitiatorContext)key;
+ if (key != null) {
+ return (InitiatorContext) key;
}
return null;
}
@@ -145,40 +141,48 @@
public static void forgetTransaction() {
threadInfo.set(null);
}
-
- private EndpointReference registerForCompletion(InitiatorContext initiatorTransaction, CompletionCallback completionCallback) throws AxisFault, IOException, MalformedURIException, RemoteException {
+
+ private EndpointReference registerForCompletion(InitiatorContext initiatorTransaction,
+ CompletionCallback completionCallback) throws AxisFault, IOException,
+ MalformedURIException, RemoteException {
RegistrationServiceStub registrationCoordinator = new RegistrationServiceStub(
- configurationContext,null);
- registrationCoordinator._getServiceClient().setTargetEPR(initiatorTransaction
- .getCoordinationContext().getRegistrationService());
- //setup the listener
+ configurationContext, null);
+ registrationCoordinator._getServiceClient().setTargetEPR(
+ initiatorTransaction.getCoordinationContext().getRegistrationService());
+ // setup the listener
CompletionInitiatorServiceListener listener = new CompletionInitiatorServiceListener();
- EndpointReference registrationRequeterPortEPR =listener.getEpr(completionCallback);
-
+ EndpointReference registrationRequeterPortEPR = listener.getEpr(completionCallback);
+
Register register = new Register();
RegisterType registerType = new RegisterType();
registerType.setProtocolIdentifier(new URI(Constants.WS_AT_COMPLETION));
- registerType.setParticipantProtocolService(EndpointReferenceFactory.getADBEPRTypeFromEPR(registrationRequeterPortEPR));
+ registerType.setParticipantProtocolService(EndpointReferenceFactory
+ .getEPRTypeFromEPR(registrationRequeterPortEPR));
register.setRegister(registerType);
- //Actual WS call for registeration
- RegisterResponse registerResponse = registrationCoordinator
- .RegisterOperation(register);
- EndpointReference coordinationEPR = EndpointReferenceFactory
- .getEPR(registerResponse.getRegisterResponse()
- .getCoordinatorProtocolService());
+ // Actual WS call for registeration
+ RegisterResponse registerResponse = registrationCoordinator.RegisterOperation(register);
+ EndpointReference coordinationEPR = EndpointReferenceFactory.getEPR(registerResponse
+ .getRegisterResponse().getCoordinatorProtocolService());
return coordinationEPR;
}
- private CoordinationContext createTransaction(InitiatorContext initiatorTransaction) throws AxisFault, MalformedURIException, RemoteException {
+ private CoordinationContext createTransaction(InitiatorContext initiatorTransaction)
+ throws AxisFault, MalformedURIException, RemoteException {
ActivationServiceStub activationCoordinator = new ActivationServiceStub(
- configurationContext,initiatorTransaction.getActivationEPR());
+ configurationContext, initiatorTransaction.getActivationEPR());
CreateCoordinationContext context = new CreateCoordinationContext();
CreateCoordinationContextType createCoordinationContextType = new CreateCoordinationContextType();
- createCoordinationContextType.setCoordinationType(new URI(initiatorTransaction.getCoordinationType()));
+ createCoordinationContextType.setCoordinationType(new URI(initiatorTransaction
+ .getCoordinationType()));
context.setCreateCoordinationContext(createCoordinationContextType);
- CreateCoordinationContextResponse response = activationCoordinator.CreateCoordinationContextOperation(context);
- CreateCoordinationContextResponseType createCoordinationContextResponse = response.getCreateCoordinationContextResponse();
- CoordinationContext coordinationContext = new ADBCoordinationContext(createCoordinationContextResponse.getCoordinationContext());
+ CreateCoordinationContextResponse response = activationCoordinator
+ .CreateCoordinationContextOperation(context);
+ CreateCoordinationContextResponseType createCoordinationContextResponse = response
+ .getCreateCoordinationContextResponse();
+ CoordinationContext_type3 coordinationContextType = createCoordinationContextResponse.getCoordinationContext();
+ coordinationContextType.setExtraAttributes(null);
+ CoordinationContext coordinationContext = new ADBCoordinationContext(
+ coordinationContextType);
return coordinationContext;
}
}
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/initiator/TransactionOutHandler.java
URL: http://svn.apache.org/viewvc/webservices/kandula/trunk/java/src/org/apache/kandula/initiator/TransactionOutHandler.java?view=diff&rev=507487&r1=507486&r2=507487
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/initiator/TransactionOutHandler.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/initiator/TransactionOutHandler.java Wed Feb 14 03:08:23 2007
@@ -18,11 +18,8 @@
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
-import java.util.Iterator;
import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.util.StAXUtils;
@@ -36,7 +33,6 @@
import org.apache.kandula.context.AbstractContext;
import org.apache.kandula.context.CoordinationContext;
import org.apache.kandula.faults.AbstractKandulaException;
-import org.apache.kandula.faults.KandulaGeneralException;
import org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContext_type3;
import org.xmlsoap.schemas.ws._2004._08.addressing.ReferenceParametersType;
@@ -47,13 +43,10 @@
*/
private static final Log log = LogFactory.getLog(TransactionOutHandler.class);
- private static ThreadLocal threadInfo = new ThreadLocal();
-
private static final long serialVersionUID = 4133392345837905499L;
public InvocationResponse invoke(MessageContext msgContext) throws AxisFault {
- InitiatorContext initiatorTransaction;
String wsaAction = msgContext.getWSAAction();
if ((wsaAction != Constants.WS_COOR_CREATE_COORDINATIONCONTEXT)
&& (wsaAction != Constants.WS_COOR_REGISTER)
@@ -62,8 +55,7 @@
try {
context = TransactionManager.getTransaction();
} catch (AbstractKandulaException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ throw new AxisFault(e);
}
if (context == null) {
context = msgContext.getProperty(Constants.Configuration.TRANSACTION_CONTEXT);
@@ -98,8 +90,11 @@
referenceParametersType.addExtraElement(omElement);
soapHeader.addChild(context_type32.getOMElement(new QName(Constants.WS_COOR,
"CoordinationContext"), soapHeader.getOMFactory()));
+ log.info("Transaction Context found for message ID" + msgContext.getMessageID()
+ + ". Participant ID :" + registrationID);
} else {
soapHeader.addChild(coorContext.toOM());
+ log.info("Transaction Context found for message ID" + msgContext.getMessageID());
}
} else {
@@ -108,18 +103,5 @@
}
}
return InvocationResponse.CONTINUE;
- }
-
- private static void addParticipantIdentifier(OMElement coorContext, String participantID) {
- // Opps.. OMSourcedElementImpl.build() is broken
- coorContext.getFirstOMChild();
- OMElement registrationEPRElement = coorContext.getFirstChildWithName(new QName(
- "RegistrationService", Constants.WS_COOR));
- OMElement refParameters = registrationEPRElement.getFirstChildWithName(new QName(
- "ReferenceParameters", "http://schemas.xmlsoap.org/ws/2004/08/addressing"));
- OMElement omElement = registrationEPRElement.getOMFactory().createOMElement(
- Constants.PARTICIPANT_ID_PARAMETER, null);
- omElement.setText(participantID);
- refParameters.addChild(omElement);
}
}
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/participant/KandulaResource.java
URL: http://svn.apache.org/viewvc/webservices/kandula/trunk/java/src/org/apache/kandula/participant/KandulaResource.java?view=diff&rev=507487&r1=507486&r2=507487
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/participant/KandulaResource.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/participant/KandulaResource.java Wed Feb 14 03:08:23 2007
@@ -16,13 +16,10 @@
*/
package org.apache.kandula.participant;
-public interface KandulaResource {
- public boolean commit();
-
- public void rollback();
-
- public Vote prepare();
+import org.apache.kandula.context.impl.ParticipantContext;
- public String getProtocol();
+public interface KandulaResource {
+ public void init(ParticipantContext context);
+ public String getProtocol();
}
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/participant/ParticipantUtility.java
URL: http://svn.apache.org/viewvc/webservices/kandula/trunk/java/src/org/apache/kandula/participant/ParticipantUtility.java?view=diff&rev=507487&r1=507486&r2=507487
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/participant/ParticipantUtility.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/participant/ParticipantUtility.java Wed Feb 14 03:08:23 2007
@@ -26,7 +26,7 @@
import org.apache.axis2.context.MessageContext;
import org.apache.axis2.databinding.types.URI;
import org.apache.kandula.Constants;
-import org.apache.kandula.context.impl.ATParticipantContext;
+import org.apache.kandula.context.impl.ParticipantContext;
import org.apache.kandula.faults.AbstractKandulaException;
import org.apache.kandula.utility.EndpointReferenceFactory;
import org.apache.kandula.utility.KandulaConfiguration;
@@ -40,7 +40,7 @@
public class ParticipantUtility {
public static void registerParticipant(
- ATParticipantContext participantContext,
+ ParticipantContext participantContext,
MessageContext messageContext) throws AxisFault {
try {
ConfigurationContext axis2ConfigurationContext = KandulaConfiguration
@@ -50,8 +50,8 @@
.getConfigurationContext();
}
EndpointReference participantProtocolService = EndpointReferenceFactory
- .getInstance().get2PCParticipantEndpoint(
- participantContext.getID());
+ .getInstance().getParticipantEndpoint(
+ participantContext.getID(),participantContext.getRegistrationProtocol());
RegistrationServiceStub registrationCoordinator = new RegistrationServiceStub(
axis2ConfigurationContext, null);
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/participant/TransactionInHandler.java
URL: http://svn.apache.org/viewvc/webservices/kandula/trunk/java/src/org/apache/kandula/participant/TransactionInHandler.java?view=diff&rev=507487&r1=507486&r2=507487
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/participant/TransactionInHandler.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/participant/TransactionInHandler.java Wed Feb 14 03:08:23 2007
@@ -24,14 +24,22 @@
import org.apache.axis2.context.MessageContext;
import org.apache.axis2.description.Parameter;
import org.apache.axis2.handlers.AbstractHandler;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.apache.kandula.Constants;
import org.apache.kandula.context.AbstractContext;
import org.apache.kandula.context.CoordinationContext;
-import org.apache.kandula.context.impl.ATParticipantContext;
+import org.apache.kandula.context.impl.ParticipantContext;
import org.apache.kandula.context.impl.SimpleCoordinationContext;
+import org.apache.kandula.participant.ba.ParticipantOutHandler;
import org.apache.kandula.storage.StorageUtils;
public class TransactionInHandler extends AbstractHandler {
+ /**
+ * Field log
+ */
+ private static final Log log = LogFactory.getLog(ParticipantOutHandler.class);
+
private static final long serialVersionUID = 2098581248112968550L;
@@ -42,7 +50,7 @@
&& (wsaAction != Constants.WS_COOR_REGISTER)
&& (wsaAction != Constants.WS_AT_COMMIT)
&& (wsaAction != Constants.WS_AT_ROLLBACK)) {
- ATParticipantContext context = new ATParticipantContext();
+ ParticipantContext context = new ParticipantContext();
SOAPHeader header = msgContext.getEnvelope().getHeader();
OMElement coordinationElement = header
.getFirstChildWithName(new QName(Constants.WS_COOR,
@@ -57,18 +65,19 @@
StorageUtils.putContext(context,context.getID(),msgContext);
msgContext.setProperty(AbstractContext.REQUESTER_ID,context.getID());
- Parameter resourceFile = msgContext.getParameter(
- Constants.KANDULA_RESOURCE);
+ msgContext.getOperationContext().setProperty(AbstractContext.REQUESTER_ID,context.getID());
+ Parameter resourceFile = msgContext.getParameter(Constants.KANDULA_RESOURCE);
//Resource not given. Registration delayed to the business logic
if (resourceFile != null) {
try {
- resource = (KandulaResource) Class.forName((String)resourceFile.getValue())
+ resource = (KandulaResource) Class.forName((String) resourceFile.getValue())
.newInstance();
+ context.setResource(resource);
} catch (Exception e) {
+ log.fatal("TransactionInHandler: Activity ID :"+context.getCoordinationContext().getActivityID()+" : "+e);
throw new AxisFault(e);
}
- context.setResource(resource);
ParticipantUtility.registerParticipant(context,msgContext);
}
}
Added: webservices/kandula/trunk/java/src/org/apache/kandula/participant/at/KandulaAtomicResource.java
URL: http://svn.apache.org/viewvc/webservices/kandula/trunk/java/src/org/apache/kandula/participant/at/KandulaAtomicResource.java?view=auto&rev=507487
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/participant/at/KandulaAtomicResource.java (added)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/participant/at/KandulaAtomicResource.java Wed Feb 14 03:08:23 2007
@@ -0,0 +1,19 @@
+package org.apache.kandula.participant.at;
+
+import org.apache.kandula.context.impl.ParticipantContext;
+import org.apache.kandula.participant.KandulaResource;
+
+public abstract class KandulaAtomicResource implements KandulaResource{
+
+ protected ParticipantContext context=null;
+
+ public void init(ParticipantContext context)
+ {
+ this.context = context;
+ }
+ public abstract boolean commit();
+
+ public abstract void rollback();
+
+ public abstract Vote prepare();
+}
\ No newline at end of file
Copied: webservices/kandula/trunk/java/src/org/apache/kandula/participant/at/ParticipantTransactionCoordinator.java (from r501063, webservices/kandula/trunk/java/src/org/apache/kandula/participant/ParticipantTransactionCoordinator.java)
URL: http://svn.apache.org/viewvc/webservices/kandula/trunk/java/src/org/apache/kandula/participant/at/ParticipantTransactionCoordinator.java?view=diff&rev=507487&p1=webservices/kandula/trunk/java/src/org/apache/kandula/participant/ParticipantTransactionCoordinator.java&r1=501063&p2=webservices/kandula/trunk/java/src/org/apache/kandula/participant/at/ParticipantTransactionCoordinator.java&r2=507487
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/participant/ParticipantTransactionCoordinator.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/participant/at/ParticipantTransactionCoordinator.java Wed Feb 14 03:08:23 2007
@@ -14,11 +14,11 @@
* limitations under the License.
*
*/
-package org.apache.kandula.participant;
+package org.apache.kandula.participant.at;
import org.apache.kandula.Status;
import org.apache.kandula.context.AbstractContext;
-import org.apache.kandula.context.impl.ATParticipantContext;
+import org.apache.kandula.context.impl.ParticipantContext;
import org.apache.kandula.faults.AbstractKandulaException;
import org.apache.kandula.faults.InvalidStateException;
import org.apache.kandula.wsat.twopc.CoordinatorPortTypeRawXMLStub;
@@ -28,7 +28,7 @@
public void prepare(AbstractContext context)
throws AbstractKandulaException {
CoordinatorPortTypeRawXMLStub stub;
- ATParticipantContext atContext = (ATParticipantContext) context;
+ ParticipantContext atContext = (ParticipantContext) context;
atContext.lock();
switch (context.getStatus()) {
case (Status.CoordinatorStatus.STATUS_NONE):
@@ -52,7 +52,7 @@
case (Status.CoordinatorStatus.STATUS_ACTIVE):
atContext.setStatus(Status.CoordinatorStatus.STATUS_PREPARING);
atContext.unlock();
- KandulaResource resource = atContext.getResource();
+ KandulaAtomicResource resource = (KandulaAtomicResource)atContext.getResource();
Vote vote = resource.prepare();
stub = new CoordinatorPortTypeRawXMLStub(atContext
.getCoordinationEPR());
@@ -71,8 +71,8 @@
}
public void commit(AbstractContext context) throws AbstractKandulaException {
- ATParticipantContext atContext = (ATParticipantContext) context;
- boolean outcome = atContext.getResource().commit();
+ ParticipantContext atContext = (ParticipantContext) context;
+ boolean outcome = ((KandulaAtomicResource)atContext.getResource()).commit();
CoordinatorPortTypeRawXMLStub stub = new CoordinatorPortTypeRawXMLStub(
atContext.getCoordinationEPR());
if (outcome) {
@@ -107,8 +107,8 @@
}
public void rollback(AbstractContext context) throws AbstractKandulaException {
- ATParticipantContext atContext = (ATParticipantContext) context;
- atContext.getResource().rollback();
+ ParticipantContext atContext = (ParticipantContext) context;
+ ((KandulaAtomicResource)atContext.getResource()).rollback();
CoordinatorPortTypeRawXMLStub stub = new CoordinatorPortTypeRawXMLStub(
atContext.getCoordinationEPR());
stub.abortedOperation();
Copied: webservices/kandula/trunk/java/src/org/apache/kandula/participant/at/Vote.java (from r501063, webservices/kandula/trunk/java/src/org/apache/kandula/participant/Vote.java)
URL: http://svn.apache.org/viewvc/webservices/kandula/trunk/java/src/org/apache/kandula/participant/at/Vote.java?view=diff&rev=507487&p1=webservices/kandula/trunk/java/src/org/apache/kandula/participant/Vote.java&r1=501063&p2=webservices/kandula/trunk/java/src/org/apache/kandula/participant/at/Vote.java&r2=507487
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/participant/Vote.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/participant/at/Vote.java Wed Feb 14 03:08:23 2007
@@ -14,7 +14,7 @@
* limitations under the License.
*
*/
-package org.apache.kandula.participant;
+package org.apache.kandula.participant.at;
public class Vote {
Added: webservices/kandula/trunk/java/src/org/apache/kandula/participant/ba/BAParticipantTransactionCoordinator.java
URL: http://svn.apache.org/viewvc/webservices/kandula/trunk/java/src/org/apache/kandula/participant/ba/BAParticipantTransactionCoordinator.java?view=auto&rev=507487
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/participant/ba/BAParticipantTransactionCoordinator.java (added)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/participant/ba/BAParticipantTransactionCoordinator.java Wed Feb 14 03:08:23 2007
@@ -0,0 +1,224 @@
+package org.apache.kandula.participant.ba;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.kandula.Constants;
+import org.apache.kandula.Status;
+import org.apache.kandula.context.AbstractContext;
+import org.apache.kandula.context.impl.ParticipantContext;
+import org.apache.kandula.faults.AbstractKandulaException;
+import org.apache.kandula.faults.InvalidStateException;
+import org.apache.kandula.storage.StorageUtils;
+import org.apache.kandula.wsba.BACoordinatorCompletionParticipantServiceStub;
+import org.apache.kandula.wsba.BAParticipantCompletionCoordinatorServiceStub;
+
+public class BAParticipantTransactionCoordinator {
+
+ private static final Log log = LogFactory.getLog(BAParticipantTransactionCoordinator.class);
+
+ public void complete(ParticipantContext context) throws AbstractKandulaException {
+ BAParticipantTransactionSentCoordinator sentCoordinator;
+ switch (context.getStatus()) {
+ case (Status.BAParticipantStatus.STATUS_ACTIVE):
+ KandulaBusinessActivityResource resource = (KandulaBusinessActivityResource) context
+ .getResource();
+ context.setStatus(Status.BAParticipantStatus.STATUS_COMPLETING);
+ resource.complete();
+ sentCoordinator = new BAParticipantTransactionSentCoordinator();
+ sentCoordinator.completed(context);
+ break;
+ case (Status.BAParticipantStatus.STATUS_COMPLETED):
+ sentCoordinator = new BAParticipantTransactionSentCoordinator();
+ sentCoordinator.completed(context);
+ break;
+ case (Status.BAParticipantStatus.STATUS_WORK_DONE):
+ context.setStatus(Status.BAParticipantStatus.STATUS_COMPLETING);
+ sentCoordinator = new BAParticipantTransactionSentCoordinator();
+ sentCoordinator.completed(context);
+ break;
+ case (Status.BAParticipantStatus.STATUS_CANCELLING):
+ case (Status.BAParticipantStatus.STATUS_COMPLETING):
+ case (Status.BAParticipantStatus.STATUS_CLOSING):
+ case (Status.BAParticipantStatus.STATUS_COMPENSATING):
+ case (Status.BAParticipantStatus.STATUS_FAULTING_COMPENSATING):
+ case (Status.BAParticipantStatus.STATUS_ENDED):
+ break;
+
+ case (Status.BAParticipantStatus.STATUS_FAULTING_ACTIVE):
+ case (Status.BAParticipantStatus.STATUS_FAULTING_COMPLETED):
+ // TODO resend fault
+ // try{
+ // CCPStub = new BACoordinatorCompletionParticipantServiceStub();
+ // Failed failed= new Failed();
+ // CCPStub.FailedOperation(failed);
+ // context.setStatus(Status.BAParticipantStatus.STATUS_FAULTING_ACTIVE_COMPLETED);
+ // }catch(Exception e){
+ //
+ // }
+ break;
+
+ case (Status.BAParticipantStatus.STATUS_EXITING):
+ sentCoordinator = new BAParticipantTransactionSentCoordinator();
+ sentCoordinator.exit(context);
+ break;
+ }
+ }
+
+ public void close(ParticipantContext context) throws AbstractKandulaException {
+
+ switch (context.getStatus()) {
+ case (Status.BAParticipantStatus.STATUS_ACTIVE):
+ case (Status.BAParticipantStatus.STATUS_CANCELLING):
+ case (Status.BAParticipantStatus.STATUS_COMPLETING):
+ case (Status.BAParticipantStatus.STATUS_COMPENSATING):
+ case (Status.BAParticipantStatus.STATUS_FAULTING_ACTIVE):
+ case (Status.BAParticipantStatus.STATUS_FAULTING_COMPLETED):
+ case (Status.BAParticipantStatus.STATUS_FAULTING_COMPENSATING):
+ case (Status.BAParticipantStatus.STATUS_EXITING):
+ log.fatal("WS_BA : " + context.getCoordinationContext().getActivityID()
+ + " : completeOperation :" + context.getID() + " : " + " Coordinator is in"
+ + context.getStatus() + " (invalid) state");
+ throw new InvalidStateException();
+
+ case (Status.BAParticipantStatus.STATUS_COMPLETED):
+ KandulaBusinessActivityResource resource = (KandulaBusinessActivityResource) context
+ .getResource();
+
+ context.setStatus(Status.BAParticipantStatus.STATUS_CLOSING);
+ resource.close();
+ BAParticipantTransactionSentCoordinator sentCoordinator = new BAParticipantTransactionSentCoordinator();
+ sentCoordinator.closed(context);
+ break;
+
+ case (Status.BAParticipantStatus.STATUS_ENDED):
+ BAParticipantTransactionSentCoordinator sentCoordinator1 = new BAParticipantTransactionSentCoordinator();
+ sentCoordinator1.closed(context);
+ break;
+ case (Status.BAParticipantStatus.STATUS_CLOSING):
+ break;
+ }
+
+ }
+
+ public void cancel(ParticipantContext context) throws AbstractKandulaException {
+ BAParticipantTransactionSentCoordinator coordinator;
+ switch (context.getStatus()) {
+ case (Status.BAParticipantStatus.STATUS_CANCELLING):
+ case (Status.BAParticipantStatus.STATUS_CLOSING):
+ case (Status.BAParticipantStatus.STATUS_COMPENSATING):
+ case (Status.BAParticipantStatus.STATUS_FAULTING_COMPENSATING):
+ break;
+
+ case (Status.BAParticipantStatus.STATUS_ACTIVE):
+ case (Status.BAParticipantStatus.STATUS_COMPLETING):
+ case (Status.BAParticipantStatus.STATUS_WORK_DONE):
+ KandulaBusinessActivityResource resource = (KandulaBusinessActivityResource) context
+ .getResource();
+ context.setStatus(Status.BAParticipantStatus.STATUS_CANCELLING);
+ resource.cancel();
+ BAParticipantTransactionSentCoordinator sentCoordinator = new BAParticipantTransactionSentCoordinator();
+ sentCoordinator.canceled(context);
+ break;
+
+ case (Status.BAParticipantStatus.STATUS_COMPLETED):
+ coordinator = new BAParticipantTransactionSentCoordinator();
+ coordinator.completed(context);
+ break;
+ case (Status.BAParticipantStatus.STATUS_FAULTING_ACTIVE):
+ case (Status.BAParticipantStatus.STATUS_FAULTING_COMPLETED):
+ // resend fault
+ break;
+
+ case (Status.BAParticipantStatus.STATUS_EXITING):
+ coordinator = new BAParticipantTransactionSentCoordinator();
+ coordinator.exit(context);
+ break;
+ case (Status.BAParticipantStatus.STATUS_ENDED):
+ coordinator = new BAParticipantTransactionSentCoordinator();
+ coordinator.canceled(context);
+ break;
+ }
+ }
+
+ public void exited(ParticipantContext context) throws AbstractKandulaException {
+
+ BACoordinatorCompletionParticipantServiceStub CCPStub;
+ switch (context.getStatus()) {
+ case (Status.BAParticipantStatus.STATUS_ACTIVE):
+ case (Status.BAParticipantStatus.STATUS_CANCELLING):
+ case (Status.BAParticipantStatus.STATUS_COMPLETING):
+ case (Status.BAParticipantStatus.STATUS_COMPLETED):
+ case (Status.BAParticipantStatus.STATUS_CLOSING):
+ case (Status.BAParticipantStatus.STATUS_COMPENSATING):
+ case (Status.BAParticipantStatus.STATUS_FAULTING_ACTIVE):
+ case (Status.BAParticipantStatus.STATUS_FAULTING_COMPLETED):
+ case (Status.BAParticipantStatus.STATUS_FAULTING_COMPENSATING):
+ log.fatal("WS_BA : " + context.getCoordinationContext().getActivityID() + " : exited :"
+ + context.getID() + " : " + " Coordinator is in" + context.getStatus()
+ + " (invalid) state");
+ throw new InvalidStateException();
+ case (Status.BAParticipantStatus.STATUS_EXITING):
+ case (Status.BAParticipantStatus.STATUS_ENDED):
+ context.setStatus(Status.BAParticipantStatus.STATUS_ENDED);
+ StorageUtils.forgetContext(context.getID());
+ break;
+ }
+
+ }
+
+ public void compensate(ParticipantContext context) throws AbstractKandulaException {
+ BAParticipantTransactionSentCoordinator sentCoordinator;
+ switch (context.getStatus()) {
+ case (Status.BAParticipantStatus.STATUS_ACTIVE):
+ case (Status.BAParticipantStatus.STATUS_CANCELLING):
+ case (Status.BAParticipantStatus.STATUS_COMPLETING):
+ case (Status.BAParticipantStatus.STATUS_CLOSING):
+ case (Status.BAParticipantStatus.STATUS_FAULTING_ACTIVE):
+ case (Status.BAParticipantStatus.STATUS_FAULTING_COMPLETED):
+ case (Status.BAParticipantStatus.STATUS_EXITING):
+ throw new InvalidStateException();
+
+ case (Status.BAParticipantStatus.STATUS_COMPLETED):
+ KandulaBusinessActivityResource resource = (KandulaBusinessActivityResource) context
+ .getResource();
+ context.setStatus(Status.BAParticipantStatus.STATUS_COMPENSATING);
+ resource.compensate();
+ sentCoordinator = new BAParticipantTransactionSentCoordinator();
+ sentCoordinator.compensated(context);
+ case (Status.BAParticipantStatus.STATUS_COMPENSATING):
+ break;
+ case (Status.BAParticipantStatus.STATUS_FAULTING_COMPENSATING):
+ //resend fault
+ break;
+ case (Status.BAParticipantStatus.STATUS_ENDED):
+ sentCoordinator = new BAParticipantTransactionSentCoordinator();
+ sentCoordinator.compensated(context);
+ break;
+ }
+ }
+
+ public void Faulted(ParticipantContext context) throws AbstractKandulaException {
+ BACoordinatorCompletionParticipantServiceStub CCPStub;
+ switch (context.getStatus()) {
+ case (Status.BAParticipantStatus.STATUS_ACTIVE):
+ case (Status.BAParticipantStatus.STATUS_CANCELLING):
+ case (Status.BAParticipantStatus.STATUS_COMPLETING):
+ case (Status.BAParticipantStatus.STATUS_COMPLETED):
+ case (Status.BAParticipantStatus.STATUS_CLOSING):
+ case (Status.BAParticipantStatus.STATUS_COMPENSATING):
+ case (Status.BAParticipantStatus.STATUS_EXITING):
+ log.fatal("WS_BA : " + context.getCoordinationContext().getActivityID()
+ + " : Faulted :" + context.getID() + " : " + " Coordinator is in"
+ + context.getStatus() + " (invalid) state");
+ throw new InvalidStateException();
+ case (Status.BAParticipantStatus.STATUS_FAULTING_ACTIVE):
+ case (Status.BAParticipantStatus.STATUS_FAULTING_COMPLETED):
+ case (Status.BAParticipantStatus.STATUS_FAULTING_COMPENSATING):
+ context.setStatus(Status.BAParticipantStatus.STATUS_ENDED);
+ StorageUtils.forgetContext(context.getID());
+ break;
+ case (Status.BAParticipantStatus.STATUS_ENDED):
+ break;
+ }
+ }
+}
Added: webservices/kandula/trunk/java/src/org/apache/kandula/participant/ba/BAParticipantTransactionSentCoordinator.java
URL: http://svn.apache.org/viewvc/webservices/kandula/trunk/java/src/org/apache/kandula/participant/ba/BAParticipantTransactionSentCoordinator.java?view=auto&rev=507487
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/participant/ba/BAParticipantTransactionSentCoordinator.java (added)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/participant/ba/BAParticipantTransactionSentCoordinator.java Wed Feb 14 03:08:23 2007
@@ -0,0 +1,261 @@
+package org.apache.kandula.participant.ba;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axis2.context.MessageContext;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.kandula.Constants;
+import org.apache.kandula.Status;
+import org.apache.kandula.context.AbstractContext;
+import org.apache.kandula.context.impl.BAActivityContext;
+import org.apache.kandula.context.impl.ParticipantContext;
+import org.apache.kandula.faults.AbstractKandulaException;
+import org.apache.kandula.faults.InvalidStateException;
+import org.apache.kandula.faults.KandulaGeneralException;
+import org.apache.kandula.storage.StorageUtils;
+import org.apache.kandula.utility.KandulaConfiguration;
+import org.apache.kandula.wsba.BACoordinatorCompletionCoordinatorServiceStub;
+import org.apache.kandula.wsba.BACoordinatorCompletionParticipantServiceStub;
+import org.apache.kandula.wsba.BAParticipantCompletionCoordinatorServiceStub;
+import org.apache.kandula.wsba.BAParticipantCompletionParticipantServiceStub;
+import org.oasis_open.docs.ws_tx.wsba._2006._06.Canceled;
+import org.oasis_open.docs.ws_tx.wsba._2006._06.Closed;
+import org.oasis_open.docs.ws_tx.wsba._2006._06.Compensated;
+import org.oasis_open.docs.ws_tx.wsba._2006._06.Completed;
+import org.oasis_open.docs.ws_tx.wsba._2006._06.ExceptionType;
+import org.oasis_open.docs.ws_tx.wsba._2006._06.Exit;
+import org.oasis_open.docs.ws_tx.wsba._2006._06.Fail;
+import org.oasis_open.docs.ws_tx.wsba._2006._06.NotificationType;
+
+public class BAParticipantTransactionSentCoordinator {
+
+ private static final Log log = LogFactory.getLog(BAParticipantTransactionSentCoordinator.class);
+
+ public void completed(ParticipantContext context) throws AbstractKandulaException {
+
+ context.lock();
+ switch (context.getStatus()) {
+ case (Status.BAParticipantStatus.STATUS_COMPLETING):
+ case (Status.BAParticipantStatus.STATUS_COMPLETED):
+ context.unlock();
+ try {
+ BAParticipantCompletionCoordinatorServiceStub serviceStub = new BAParticipantCompletionCoordinatorServiceStub(
+ MessageContext.getCurrentMessageContext().getConfigurationContext(), null);
+ serviceStub._getServiceClient().getOptions().setTo(context.getCoordinationEPR());
+ Completed completed = new Completed();
+ completed.setCompleted(new NotificationType());
+ context.setStatus(Status.BAParticipantStatus.STATUS_COMPLETED);
+ serviceStub.CompletedOperation(completed);
+ } catch (Exception e) {
+ log.fatal("WS_BA : " + context.getCoordinationContext().getActivityID()
+ + " : completed :" + context.getID() + " : " + e);
+ throw new KandulaGeneralException(e);
+ }
+ break;
+ case (Status.BAParticipantStatus.STATUS_CANCELLING):
+ case (Status.BAParticipantStatus.STATUS_COMPENSATING):
+ case (Status.BAParticipantStatus.STATUS_ACTIVE):
+ case (Status.BAParticipantStatus.STATUS_CLOSING):
+ case (Status.BAParticipantStatus.STATUS_FAULTING):
+ case (Status.BAParticipantStatus.STATUS_EXITING):
+ case (Status.BAParticipantStatus.STATUS_ENDED):
+ log.fatal("WS_BA : " + context.getCoordinationContext().getActivityID()
+ + " : completed :" + context.getID() + " : " + " Participant is in"
+ + context.getStatus() + " (invalid) state");
+ throw new InvalidStateException(" Participant is in" + context.getStatus()
+ + " (invalid) state");
+ }
+ }
+
+ public void closed(ParticipantContext context) throws AbstractKandulaException {
+ BACoordinatorCompletionCoordinatorServiceStub coordinatorStub;
+ switch (context.getStatus()) {
+ case (Status.BAParticipantStatus.STATUS_ACTIVE):
+ case (Status.BAParticipantStatus.STATUS_CANCELLING):
+ case (Status.BAParticipantStatus.STATUS_COMPLETING):
+ case (Status.BAParticipantStatus.STATUS_COMPLETED):
+ case (Status.BAParticipantStatus.STATUS_COMPENSATING):
+ case (Status.BAParticipantStatus.STATUS_FAULTING):
+ case (Status.BAParticipantStatus.STATUS_EXITING):
+ log.fatal("WS_BA : " + context.getCoordinationContext().getActivityID() + " : closed :"
+ + context.getID() + " : " + " Participant is in" + context.getStatus()
+ + " (invalid) state");
+ throw new InvalidStateException(" Participant is in" + context.getStatus()
+ + " (invalid) state");
+ case (Status.BAParticipantStatus.STATUS_CLOSING):
+ case (Status.BAParticipantStatus.STATUS_ENDED):
+ try {
+ coordinatorStub = new BACoordinatorCompletionCoordinatorServiceStub(MessageContext
+ .getCurrentMessageContext().getConfigurationContext(), null);
+ coordinatorStub._getServiceClient().getOptions()
+ .setTo(context.getCoordinationEPR());
+ Closed closed = new Closed();
+ closed.setClosed(new NotificationType());
+ coordinatorStub.ClosedOperation(closed);
+ context.setStatus(Status.BAParticipantStatus.STATUS_ENDED);
+ StorageUtils.forgetContext(context.getID());
+ } catch (Exception e) {
+ log.fatal("WS_BA : " + context.getCoordinationContext().getActivityID()
+ + " : closed :" + context.getID() + " : " + e);
+ throw new KandulaGeneralException(e);
+ }
+ break;
+ }
+ }
+
+ public void canceled(ParticipantContext context) throws AbstractKandulaException {
+ switch (context.getStatus()) {
+ case (Status.BAParticipantStatus.STATUS_ACTIVE):
+ case (Status.BAParticipantStatus.STATUS_COMPLETING):
+ case (Status.BAParticipantStatus.STATUS_COMPLETED):
+ case (Status.BAParticipantStatus.STATUS_CLOSING):
+ case (Status.BAParticipantStatus.STATUS_COMPENSATING):
+ case (Status.BAParticipantStatus.STATUS_FAULTING):
+ case (Status.BAParticipantStatus.STATUS_EXITING):
+ log.fatal("WS_BA : " + context.getCoordinationContext().getActivityID()
+ + " : canceled :" + context.getID() + " : " + " Participant is in"
+ + context.getStatus() + " (invalid) state");
+ throw new InvalidStateException(" Participant is in" + context.getStatus()
+ + " (invalid) state");
+
+ case (Status.BAParticipantStatus.STATUS_CANCELLING):
+ case (Status.BAParticipantStatus.STATUS_ENDED):
+ try {
+ BACoordinatorCompletionCoordinatorServiceStub coordinatorServiceStub;
+ coordinatorServiceStub = new BACoordinatorCompletionCoordinatorServiceStub(
+ MessageContext.getCurrentMessageContext().getConfigurationContext(), null);
+ coordinatorServiceStub._getServiceClient().getOptions().setTo(
+ context.getCoordinationEPR());
+ Canceled canceled = new Canceled();
+ canceled.setCanceled(new NotificationType());
+ coordinatorServiceStub.CanceledOperation(canceled);
+ context.setStatus(Status.BAParticipantStatus.STATUS_ENDED);
+ StorageUtils.forgetContext(context.getID());
+ } catch (Exception e) {
+ log.fatal("WS_BA : " + context.getCoordinationContext().getActivityID()
+ + " : canceled :" + context.getID() + " : " + e);
+ throw new KandulaGeneralException(e);
+ }
+ break;
+ }
+ }
+
+ public void exit(ParticipantContext context) throws AbstractKandulaException {
+ BACoordinatorCompletionCoordinatorServiceStub coordinatorStub;
+ switch (context.getStatus()) {
+ case (Status.BAParticipantStatus.STATUS_ACTIVE):
+ case (Status.BAParticipantStatus.STATUS_COMPLETING):
+ case (Status.BAParticipantStatus.STATUS_EXITING):
+ try {
+ coordinatorStub = new BACoordinatorCompletionCoordinatorServiceStub(MessageContext
+ .getCurrentMessageContext().getConfigurationContext(), null);
+ coordinatorStub._getServiceClient().getOptions()
+ .setTo(context.getCoordinationEPR());
+ Exit exit = new Exit();
+ exit.setExit(new NotificationType());
+ context.setStatus(Status.BAParticipantStatus.STATUS_EXITING);
+ coordinatorStub.ExitOperation(exit);
+ } catch (Exception e) {
+ log.fatal("WS_BA : " + context.getCoordinationContext().getActivityID()
+ + " : closed :" + context.getID() + " : " + e);
+ throw new KandulaGeneralException(e);
+ }
+ break;
+ case (Status.BAParticipantStatus.STATUS_CANCELLING):
+ case (Status.BAParticipantStatus.STATUS_COMPLETED):
+ case (Status.BAParticipantStatus.STATUS_CLOSING):
+ case (Status.BAParticipantStatus.STATUS_COMPENSATING):
+ case (Status.BAParticipantStatus.STATUS_FAULTING):
+ case (Status.BAParticipantStatus.STATUS_ENDED):
+ log.fatal("WS_BA : " + context.getCoordinationContext().getActivityID() + " : exit :"
+ + context.getID() + " : " + " Participant is in" + context.getStatus()
+ + " (invalid) state");
+ throw new InvalidStateException(" Participant is in" + context.getStatus()
+ + " (invalid) state");
+ }
+ }
+
+ public void compensated(ParticipantContext context) throws AbstractKandulaException {
+ BACoordinatorCompletionCoordinatorServiceStub coordinatorStub;
+ switch (context.getStatus()) {
+ case (Status.BAParticipantStatus.STATUS_ACTIVE):
+ case (Status.BAParticipantStatus.STATUS_CANCELLING):
+ case (Status.BAParticipantStatus.STATUS_COMPLETING):
+ case (Status.BAParticipantStatus.STATUS_COMPLETED):
+ case (Status.BAParticipantStatus.STATUS_CLOSING):
+ case (Status.BAParticipantStatus.STATUS_FAULTING):
+ case (Status.BAParticipantStatus.STATUS_EXITING):
+ log.fatal("WS_BA : " + context.getCoordinationContext().getActivityID()
+ + " : compensated :" + context.getID() + " : " + " Participant is in"
+ + context.getStatus() + " (invalid) state");
+ throw new InvalidStateException(" Participant is in" + context.getStatus()
+ + " (invalid) state");
+ case (Status.BAParticipantStatus.STATUS_COMPENSATING):
+ case (Status.BAParticipantStatus.STATUS_ENDED):
+ try {
+ coordinatorStub = new BACoordinatorCompletionCoordinatorServiceStub(MessageContext
+ .getCurrentMessageContext().getConfigurationContext(), null);
+ coordinatorStub._getServiceClient().getOptions()
+ .setTo(context.getCoordinationEPR());
+ Compensated compensated = new Compensated();
+ compensated.setCompensated(new NotificationType());
+ context.setStatus(Status.BAParticipantStatus.STATUS_ENDED);
+ coordinatorStub.CompensatedOperation(compensated);
+ } catch (Exception e) {
+ log.fatal("WS_BA : " + context.getCoordinationContext().getActivityID()
+ + " : compensated :" + context.getID() + " : " + e);
+ throw new KandulaGeneralException(e);
+ }
+ break;
+ }
+ }
+
+ public void fault(ParticipantContext context) throws AbstractKandulaException {
+ switch (context.getStatus()) {
+ case (Status.BAParticipantStatus.STATUS_ACTIVE):
+ case (Status.BAParticipantStatus.STATUS_COMPLETING):
+ context.setStatus(Status.BAParticipantStatus.STATUS_FAULTING_ACTIVE);
+ sendFaultMessage(context);
+ break;
+ case (Status.BAParticipantStatus.STATUS_CANCELLING):
+ case (Status.BAParticipantStatus.STATUS_COMPLETED):
+ case (Status.BAParticipantStatus.STATUS_CLOSING):
+ case (Status.BAParticipantStatus.STATUS_EXITING):
+ case (Status.BAParticipantStatus.STATUS_ENDED):
+ log.fatal("WS_BA : " + context.getCoordinationContext().getActivityID() + " : Fault :"
+ + context.getID() + " : " + " Participant is in" + context.getStatus()
+ + " (invalid) state");
+ throw new InvalidStateException(" Participant is in" + context.getStatus()
+ + " (invalid) state");
+ case (Status.BAParticipantStatus.STATUS_COMPENSATING):
+ context.setStatus(Status.BAParticipantStatus.STATUS_FAULTING_COMPENSATING);
+ sendFaultMessage(context);
+ break;
+ case (Status.BAParticipantStatus.STATUS_FAULTING):
+ context.setStatus(Status.BAParticipantStatus.STATUS_FAULTING);
+ sendFaultMessage(context);
+ break;
+ }
+ }
+
+ private void sendFaultMessage(ParticipantContext context) throws AbstractKandulaException {
+ BACoordinatorCompletionCoordinatorServiceStub coordinatorStub;
+ try {
+ coordinatorStub = new BACoordinatorCompletionCoordinatorServiceStub(
+ KandulaConfiguration.getInstance().getPariticipantAxis2ConfigurationContext(),
+ null);
+ coordinatorStub._getServiceClient().getOptions().setTo(context.getCoordinationEPR());
+ Fail fail = new Fail();
+ ExceptionType exceptionType = new ExceptionType();
+ exceptionType.setExceptionIdentifier(new QName("Bimalee"));
+ fail.setFail(exceptionType);
+ context.setStatus(Status.BAParticipantStatus.STATUS_ENDED);
+ coordinatorStub.FailOperation(fail);
+ } catch (Exception e) {
+ log.fatal("WS_BA : " + context.getCoordinationContext().getActivityID()
+ + " : compensated :" + context.getID() + " : " + e);
+ throw new KandulaGeneralException(e);
+ }
+ }
+}
Added: webservices/kandula/trunk/java/src/org/apache/kandula/participant/ba/KandulaBusinessActivityResource.java
URL: http://svn.apache.org/viewvc/webservices/kandula/trunk/java/src/org/apache/kandula/participant/ba/KandulaBusinessActivityResource.java?view=auto&rev=507487
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/participant/ba/KandulaBusinessActivityResource.java (added)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/participant/ba/KandulaBusinessActivityResource.java Wed Feb 14 03:08:23 2007
@@ -0,0 +1,29 @@
+package org.apache.kandula.participant.ba;
+
+import org.apache.kandula.context.impl.ParticipantContext;
+import org.apache.kandula.faults.AbstractKandulaException;
+import org.apache.kandula.participant.KandulaResource;
+
+public abstract class KandulaBusinessActivityResource implements KandulaResource{
+
+ protected ParticipantContext context= null;
+
+ public void init(ParticipantContext context)
+ {
+ this.context =context;
+ }
+ public abstract boolean compensate();
+
+ public abstract void complete() throws AbstractKandulaException;
+
+ public abstract void close();
+
+ public abstract void cancel();
+
+ public void exit() throws AbstractKandulaException
+ {
+ BAParticipantTransactionSentCoordinator coordinator = new BAParticipantTransactionSentCoordinator();
+ coordinator.exit(context);
+ }
+
+}
\ No newline at end of file
Added: webservices/kandula/trunk/java/src/org/apache/kandula/participant/ba/ParticipantOutFaultHandler.java
URL: http://svn.apache.org/viewvc/webservices/kandula/trunk/java/src/org/apache/kandula/participant/ba/ParticipantOutFaultHandler.java?view=auto&rev=507487
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/participant/ba/ParticipantOutFaultHandler.java (added)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/participant/ba/ParticipantOutFaultHandler.java Wed Feb 14 03:08:23 2007
@@ -0,0 +1,45 @@
+package org.apache.kandula.participant.ba;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.handlers.AbstractHandler;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.kandula.Constants;
+import org.apache.kandula.Status;
+import org.apache.kandula.context.AbstractContext;
+import org.apache.kandula.context.impl.ParticipantContext;
+import org.apache.kandula.faults.AbstractKandulaException;
+import org.apache.kandula.storage.StorageUtils;
+
+public class ParticipantOutFaultHandler extends AbstractHandler {
+
+ /**
+ * Field log
+ */
+ private static final Log log = LogFactory.getLog(ParticipantOutFaultHandler.class);
+
+ public InvocationResponse invoke(MessageContext msgContext) throws AxisFault {
+
+ Object property = msgContext.getOperationContext()
+ .getProperty(AbstractContext.REQUESTER_ID);
+ if (property != null) {
+ String reqID = (String) property;
+ AbstractContext context = StorageUtils.getContext(msgContext, reqID);
+ if (context != null) {
+ ParticipantContext participantContext = (ParticipantContext) context;
+ if (participantContext.getRegistrationProtocol().equals(Constants.WS_BA_CC)
+ || participantContext.getRegistrationProtocol().equals(Constants.WS_BA_PC)) {
+ // Notify the coordinator if the participant is wsba-pc
+ BAParticipantTransactionSentCoordinator coordinator = new BAParticipantTransactionSentCoordinator();
+ try {
+ coordinator.fault(participantContext);
+ } catch (AbstractKandulaException e) {
+ throw new AxisFault(e);
+ }
+ }
+ }
+ }
+ return InvocationResponse.CONTINUE;
+ }
+}
Added: webservices/kandula/trunk/java/src/org/apache/kandula/participant/ba/ParticipantOutHandler.java
URL: http://svn.apache.org/viewvc/webservices/kandula/trunk/java/src/org/apache/kandula/participant/ba/ParticipantOutHandler.java?view=auto&rev=507487
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/participant/ba/ParticipantOutHandler.java (added)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/participant/ba/ParticipantOutHandler.java Wed Feb 14 03:08:23 2007
@@ -0,0 +1,48 @@
+package org.apache.kandula.participant.ba;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.handlers.AbstractHandler;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.kandula.Constants;
+import org.apache.kandula.Status;
+import org.apache.kandula.context.AbstractContext;
+import org.apache.kandula.context.impl.ParticipantContext;
+import org.apache.kandula.faults.AbstractKandulaException;
+import org.apache.kandula.storage.StorageUtils;
+
+public class ParticipantOutHandler extends AbstractHandler {
+
+ /**
+ * Field log
+ */
+ private static final Log log = LogFactory.getLog(ParticipantOutHandler.class);
+
+ public InvocationResponse invoke(MessageContext msgContext) throws AxisFault {
+
+ String wsaAction = msgContext.getWSAAction();
+ Object property = msgContext.getOperationContext()
+ .getProperty(AbstractContext.REQUESTER_ID);
+ if (property != null) {
+ String reqID = (String) property;
+ AbstractContext context = StorageUtils.getContext(msgContext, reqID);
+ if (context != null) {
+ ParticipantContext participantContext = (ParticipantContext) context;
+ if (participantContext.getRegistrationProtocol().equals(Constants.WS_BA_CC)) {
+ participantContext.setStatus(Status.BAParticipantStatus.STATUS_WORK_DONE);
+ } else if (participantContext.getRegistrationProtocol().equals(Constants.WS_BA_PC)) {
+ // Notify the coordinator if the participant is wsba-pc
+ BAParticipantTransactionSentCoordinator coordinator = new BAParticipantTransactionSentCoordinator();
+ try {
+ participantContext.setStatus(Status.BAParticipantStatus.STATUS_COMPLETING);
+ coordinator.completed(participantContext);
+ } catch (AbstractKandulaException e) {
+ throw new AxisFault(e);
+ }
+ }
+ }
+ }
+ return InvocationResponse.CONTINUE;
+ }
+}
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/storage/StorageUtils.java
URL: http://svn.apache.org/viewvc/webservices/kandula/trunk/java/src/org/apache/kandula/storage/StorageUtils.java?view=diff&rev=507487&r1=507486&r2=507487
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/storage/StorageUtils.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/storage/StorageUtils.java Wed Feb 14 03:08:23 2007
@@ -16,34 +16,59 @@
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.context.MessageContext;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.apache.kandula.Constants;
import org.apache.kandula.context.AbstractContext;
+import org.apache.kandula.coordinator.Coordinator;
public class StorageUtils {
+
+ private static final Log log = LogFactory.getLog(StorageUtils.class);
+
+ public static AbstractContext getContext(MessageContext messageContext, String id) {
+ log.info("Kandula : Retrieved Context " + id + " from the store.");
+ Store store = getStore(messageContext.getServiceContext().getConfigurationContext());
+ return (AbstractContext) store.get(id);
+ }
+
public static AbstractContext getContext(String id) {
+ log.info("Kandula : Retrieved Context " + id + " from the store.");
Store store = getStore(MessageContext.getCurrentMessageContext().getServiceContext()
.getConfigurationContext());
return (AbstractContext) store.get(id);
}
public static void putContext(AbstractContext context) {
+ log.info("Kandula : Stored Context " + context.getCoordinationContext().getActivityID()
+ + " on the store.");
Store store = getStore(MessageContext.getCurrentMessageContext().getServiceContext()
.getConfigurationContext());
store.put(context.getCoordinationContext().getActivityID(), context);
}
public static void putContext(AbstractContext context, String id, MessageContext messageContext) {
+ log.info("Kandula : Stored Context " + context.getCoordinationContext().getActivityID()
+ + " on the store.");
Store store = getStore(messageContext.getServiceContext().getConfigurationContext());
store.put(id, context);
}
+ public static void forgetContext(String id) {
+ log.info("Kandula : Forgot Context " + id + " from the store.");
+ Store store = getStore(MessageContext.getCurrentMessageContext().getServiceContext()
+ .getConfigurationContext());
+ store.forget(id);
+ }
+
public static Store getStore(ConfigurationContext configurationContext) {
if (configurationContext == null)
return null;
Store store;
Object storeObect = configurationContext.getProperty(Constants.KANDULA_STORE);
if (storeObect == null) {
- store = new SimpleStore();
+ store = Coordinator.store;
+ // store = new SimpleStore();
configurationContext.setProperty(Constants.KANDULA_STORE, store);
} else {
store = (Store) storeObect;
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/utility/EndpointReferenceFactory.java
URL: http://svn.apache.org/viewvc/webservices/kandula/trunk/java/src/org/apache/kandula/utility/EndpointReferenceFactory.java?view=diff&rev=507487&r1=507486&r2=507487
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/utility/EndpointReferenceFactory.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/utility/EndpointReferenceFactory.java Wed Feb 14 03:08:23 2007
@@ -68,10 +68,10 @@
}
public EndpointReference getCompletionEndpoint(String id) {
-
EndpointReference epr = new EndpointReference(configuration.getLocationForEPR()
+ "/axis2/services/CompletionCoordinator");
EndpointReferenceFactory.addReferenceProperty(epr, Constants.TRANSACTION_ID_PARAMETER, id);
+
return epr;
}
@@ -87,11 +87,25 @@
return epr;
}
- public EndpointReference get2PCParticipantEndpoint(String id) {
-
- EndpointReference epr = new EndpointReference(configuration.getLocationForEPR()
- + "/axis2/services/AtomicTransactionParticipant");
- EndpointReferenceFactory.addReferenceProperty(epr, Constants.REQUESTER_ID_PARAMETER, id);
+ public EndpointReference getParticipantEndpoint(String id, String protocol) {
+ EndpointReference epr = null;
+ if (protocol.equals(Constants.WS_AT_VOLATILE2PC)
+ || protocol.equals(Constants.WS_AT_DURABLE2PC)) {
+ epr = new EndpointReference(configuration.getLocationForEPR()
+ + "/axis2/services/AtomicTransactionParticipant");
+ EndpointReferenceFactory
+ .addReferenceProperty(epr, Constants.REQUESTER_ID_PARAMETER, id);
+ } else if (protocol.equals(Constants.WS_BA_CC)) {
+ epr = new EndpointReference(configuration.getLocationForEPR()
+ + "/axis2/services/BACoordinatorCompletionParticipantService");
+ EndpointReferenceFactory
+ .addReferenceProperty(epr, Constants.REQUESTER_ID_PARAMETER, id);
+ } else if (protocol.equals(Constants.WS_BA_CC)) {
+ epr = new EndpointReference(configuration.getLocationForEPR()
+ + "/axis2/services/BAParticipantCompletionParticipantService");
+ EndpointReferenceFactory
+ .addReferenceProperty(epr, Constants.REQUESTER_ID_PARAMETER, id);
+ }
return epr;
}
@@ -138,7 +152,7 @@
return new String(sb2.toString().substring(begin, begin + 18)).toUpperCase();
}
- public static void addReferenceProperty(EndpointReference epr, QName key, String Value) {
+ public static void addReferenceProperty(EndpointReference epr, QName key, String value) {
// We'll have to live with reference parameters for the moment
// Since Axis2 Addressing does not support ref properties well
HashMap refProperties;
@@ -147,7 +161,7 @@
}
OMLinkedListImplFactory factory = new OMLinkedListImplFactory();
OMElement omElement = factory.createOMElement(key, null);
- omElement.setText(Value);
+ omElement.setText(value);
refProperties.put(key, omElement);
epr.setReferenceParameters(refProperties);
}
@@ -175,18 +189,18 @@
return epr;
}
- public static void endpointToOM(EndpointReference epr, OMElement parentEPR, SOAPFactory factory) {
+ public static void endpointToOM(EndpointReference epr, OMElement parentElement, SOAPFactory factory) {
OMNamespace wsAddressing = factory.createOMNamespace(
AddressingConstants.Submission.WSA_NAMESPACE,
AddressingConstants.WSA_DEFAULT_PREFIX);
OMElement addressElement = factory.createOMElement("Address", wsAddressing);
addressElement.setText(epr.getAddress());
- parentEPR.addChild(addressElement);
+ parentElement.addChild(addressElement);
Map referenceValues = epr.getAllReferenceParameters();
if (referenceValues != null) {
OMElement refPropertyElement = factory.createOMElement("ReferenceParameters",
wsAddressing);
- parentEPR.addChild(refPropertyElement);
+ parentElement.addChild(refPropertyElement);
Iterator iterator = referenceValues.keySet().iterator();
while (iterator.hasNext()) {
QName key = (QName) iterator.next();
@@ -200,7 +214,7 @@
}
}
- public static OMElement endpointToOM(EndpointReference epr) {
+ public static OMElement endpointAddressToOM(EndpointReference epr) {
OMFactory factory = OMAbstractFactory.getOMFactory();
OMNamespace wsAddressing = factory.createOMNamespace(
AddressingConstants.Submission.WSA_NAMESPACE,
@@ -211,32 +225,59 @@
return addressElement;
}
- // bims
- public EndpointReference getAtoimcOutcomeCoordinatorEndpoint(String activityId,
+ public EndpointReference getAtomicOutcomePCCoordinatorEndpoint(String activityId,
String enlistmentId) {
// Activity ID to find Activity Context , EnlistmentID to find
// participant in activity
EndpointReference epr = new EndpointReference(configuration.getLocationForEPR()
- + "/axis2/services/AtomicBACoordinator");
+ + "/axis2/services/BAParticipantCompletionCoordinatorService");
+ EndpointReferenceFactory.addReferenceProperty(epr, Constants.TRANSACTION_ID_PARAMETER, activityId);
+ EndpointReferenceFactory.addReferenceProperty(epr, Constants.ENLISTMENT_ID_PARAMETER,
+ enlistmentId);
+ return epr;
+ }
+
+ public EndpointReference getMixedOutcomePCCoordinatorEndpoint(String activityId,
+ String enlistmentId) {
+ // Activity ID to find Activity Context , EnlistmentID to find
+ // participant in activity
+ EndpointReference epr = new EndpointReference(configuration.getLocationForEPR()
+ + "/axis2/services/BAParticipantCompletionCoordinatorService");
EndpointReferenceFactory.addReferenceProperty(epr, Constants.BA_ID_PARAMETER, activityId);
EndpointReferenceFactory.addReferenceProperty(epr, Constants.ENLISTMENT_ID_PARAMETER,
enlistmentId);
return epr;
}
+
+ public EndpointReference getAtomicOutcomeCCCoordinatorEndpoint(String activityId,
+ String enlistmentId) {
+ // Activity ID to find Activity Context , EnlistmentID to find
+ // participant in activity
+ EndpointReference epr = new EndpointReference(configuration.getLocationForEPR()
+ + "/axis2/services/BACoordinatorCompletionCoordinatorService");
+ EndpointReferenceFactory.addReferenceProperty(epr, Constants.TRANSACTION_ID_PARAMETER, activityId);
+ EndpointReferenceFactory.addReferenceProperty(epr, Constants.ENLISTMENT_ID_PARAMETER,
+ enlistmentId);
+ return epr;
+ }
- // bims
- public EndpointReference getMixedOutcomeCoordinatorEndpoint(String activityId,
+ public EndpointReference getMixedOutcomeCCCoordinatorEndpoint(String activityId,
String enlistmentId) {
// Activity ID to find Activity Context , EnlistmentID to find
// participant in activity
EndpointReference epr = new EndpointReference(configuration.getLocationForEPR()
- + "/axis2/services/MixedBACoordinator");
+ + "/axis2/services/BACoordinatorCompletionCoordinatorService");
EndpointReferenceFactory.addReferenceProperty(epr, Constants.BA_ID_PARAMETER, activityId);
EndpointReferenceFactory.addReferenceProperty(epr, Constants.ENLISTMENT_ID_PARAMETER,
enlistmentId);
return epr;
}
+ /**
+ * Util method to convert ADB generated EPR to a org.apache.axis2.addressing.EndpointReference
+ * @param endpointReferenceType
+ * @return
+ */
public static EndpointReference getEPR(EndpointReferenceType endpointReferenceType) {
EndpointReference endpointReference = new EndpointReference(endpointReferenceType
.getAddress().getAnyURI().toString());
@@ -257,7 +298,7 @@
* @return
* @throws MalformedURIException
*/
- public static EndpointReferenceType getADBEPRTypeFromEPR(EndpointReference endpointReference)
+ public static EndpointReferenceType getEPRTypeFromEPR(EndpointReference endpointReference)
throws MalformedURIException {
EndpointReferenceType endpointReferenceType = new EndpointReferenceType();
AttributedURI attributedURI = new AttributedURI();
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/utility/KandulaConfiguration.java
URL: http://svn.apache.org/viewvc/webservices/kandula/trunk/java/src/org/apache/kandula/utility/KandulaConfiguration.java?view=diff&rev=507487&r1=507486&r2=507487
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/utility/KandulaConfiguration.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/utility/KandulaConfiguration.java Wed Feb 14 03:08:23 2007
@@ -74,13 +74,16 @@
String debug = "false";
+ private ConfigurationContext coordinatorConfigurationContext = null;
+
+ private ConfigurationContext participantConfigurationContext = null;
+
private KandulaConfiguration() {
String port = null;
String host = null;
- InputStream in = getClass().getClassLoader().getResourceAsStream(
- PROPERTY_FILE);
+ InputStream in = getClass().getClassLoader().getResourceAsStream(PROPERTY_FILE);
properties = new Properties();
try {
properties.load(in);
@@ -96,19 +99,16 @@
debug = "true";
}
- participantAxis2Xml = properties
- .getProperty(PARTICIPANT_AXIS2_CONF);
+ participantAxis2Xml = properties.getProperty(PARTICIPANT_AXIS2_CONF);
// if (participantAxis2Xml == null) {
// participantAxis2Xml = "axis2.xml";
// }
- kandulaListenerRepository = properties
- .getProperty(KANDULA_LISTENER_REPO);
+ kandulaListenerRepository = properties.getProperty(KANDULA_LISTENER_REPO);
// if (kandulaListenerRepository == null) {
// kandulaListenerRepository = ".";
// }
- kandulaListenerAxis2Xml = properties
- .getProperty(KANDULA_LISTENER_AXIS2XML);
+ kandulaListenerAxis2Xml = properties.getProperty(KANDULA_LISTENER_AXIS2XML);
// if (kandulaListenerAxis2Xml == null) {
// kandulaListenerRepository += "/axis2.xml";
// }
@@ -153,27 +153,28 @@
return instance;
}
-
/**
* @return a ConfigurationContext according to the coordinator Axis2.xml & repository configured.
* @throws AbstractKandulaException
*/
public ConfigurationContext getPariticipantAxis2ConfigurationContext()
throws AbstractKandulaException {
- try {
- if (coordinatorAxis2Conf != null && coordinatorAxis2Conf != "")
- {
- return ConfigurationContextFactory
- .createConfigurationContextFromFileSystem(
- participantRepository, participantAxis2Xml);
- }
-
- } catch (DeploymentException e) {
- throw new KandulaGeneralException(e);
- } catch (AxisFault e1) {
- throw new KandulaGeneralException(e1);
+ if (participantConfigurationContext == null) {
+ try {
+ if (coordinatorAxis2Conf != null && coordinatorAxis2Conf != "") {
+
+ participantConfigurationContext = ConfigurationContextFactory
+ .createConfigurationContextFromFileSystem(participantRepository,
+ participantAxis2Xml);
+ }
+
+ } catch (DeploymentException e) {
+ throw new KandulaGeneralException(e);
+ } catch (AxisFault e1) {
+ throw new KandulaGeneralException(e1);
+ }
}
- return null;
+ return participantConfigurationContext;
}
public String getParticipantRepository() {
@@ -186,19 +187,20 @@
public ConfigurationContext getCoordinatorAxis2ConfigurationContext()
throws AbstractKandulaException {
- try {
- if (coordinatorAxis2Conf != null && coordinatorAxis2Conf != "")
- {
- return ConfigurationContextFactory
- .createConfigurationContextFromFileSystem(
- coordinatorRepo, coordinatorAxis2Conf);
- }
- } catch (DeploymentException e) {
- throw new KandulaGeneralException(e);
- } catch (AxisFault e1) {
- throw new KandulaGeneralException(e1);
+ if (coordinatorConfigurationContext == null) {
+ try {
+ if (coordinatorAxis2Conf != null && coordinatorAxis2Conf != "") {
+ coordinatorConfigurationContext = ConfigurationContextFactory
+ .createConfigurationContextFromFileSystem(coordinatorRepo,
+ coordinatorAxis2Conf);
+ }
+ } catch (DeploymentException e) {
+ throw new KandulaGeneralException(e);
+ } catch (AxisFault e1) {
+ throw new KandulaGeneralException(e1);
+ }
}
- return null;
+ return coordinatorConfigurationContext;
}
public String getCoordinatorRepo() {
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/CoordinatorPortTypeRawXMLSkeleton.java
URL: http://svn.apache.org/viewvc/webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/CoordinatorPortTypeRawXMLSkeleton.java?view=diff&rev=507487&r1=507486&r2=507487
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/CoordinatorPortTypeRawXMLSkeleton.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/CoordinatorPortTypeRawXMLSkeleton.java Wed Feb 14 03:08:23 2007
@@ -23,7 +23,7 @@
import org.apache.kandula.context.impl.ATActivityContext;
import org.apache.kandula.coordinator.at.ATCoordinator;
import org.apache.kandula.faults.AbstractKandulaException;
-import org.apache.kandula.participant.Vote;
+import org.apache.kandula.participant.at.Vote;
import org.apache.kandula.storage.StorageUtils;
/**
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/ParticipantPortTypeRawXMLSkeleton.java
URL: http://svn.apache.org/viewvc/webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/ParticipantPortTypeRawXMLSkeleton.java?view=diff&rev=507487&r1=507486&r2=507487
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/ParticipantPortTypeRawXMLSkeleton.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/ParticipantPortTypeRawXMLSkeleton.java Wed Feb 14 03:08:23 2007
@@ -22,7 +22,7 @@
import org.apache.kandula.Constants;
import org.apache.kandula.context.AbstractContext;
import org.apache.kandula.faults.AbstractKandulaException;
-import org.apache.kandula.participant.ParticipantTransactionCoordinator;
+import org.apache.kandula.participant.at.ParticipantTransactionCoordinator;
import org.apache.kandula.storage.StorageUtils;
/**
Added: webservices/kandula/trunk/java/src/org/apache/kandula/wsba/BACoordinatorCompletionCoordinatorServiceSkeleton.java
URL: http://svn.apache.org/viewvc/webservices/kandula/trunk/java/src/org/apache/kandula/wsba/BACoordinatorCompletionCoordinatorServiceSkeleton.java?view=auto&rev=507487
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/wsba/BACoordinatorCompletionCoordinatorServiceSkeleton.java (added)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/wsba/BACoordinatorCompletionCoordinatorServiceSkeleton.java Wed Feb 14 03:08:23 2007
@@ -0,0 +1,273 @@
+/*
+ * 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.wsba;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.MessageContext;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.kandula.Constants;
+import org.apache.kandula.context.AbstractContext;
+import org.apache.kandula.context.impl.BAActivityContext;
+import org.apache.kandula.coordinator.ba.BACoordinator;
+import org.apache.kandula.faults.AbstractKandulaException;
+import org.apache.kandula.faults.NoActivityException;
+import org.apache.kandula.storage.StorageUtils;
+
+/**
+ * BACoordinatorCompletionCoordinatorServiceSkeleton java skeleton for the
+ * axisService
+ */
+public class BACoordinatorCompletionCoordinatorServiceSkeleton {
+
+ private static final Log log = LogFactory
+ .getLog(BACoordinatorCompletionCoordinatorServiceSkeleton.class);
+
+ public void CompensatedOperation(org.oasis_open.docs.ws_tx.wsba._2006._06.Compensated param0)
+ throws AxisFault {
+ OMElement header = MessageContext.getCurrentMessageContext().getEnvelope().getHeader();
+ String activityId = header.getFirstChildWithName(Constants.TRANSACTION_ID_PARAMETER)
+ .getText();
+ String enlistmentId = header.getFirstChildWithName(Constants.ENLISTMENT_ID_PARAMETER)
+ .getText();
+ try {
+ AbstractContext context = StorageUtils.getContext(activityId);
+ if (context != null) {
+ BAActivityContext baContext = (BAActivityContext) context;
+ BACoordinator atomicBACoordinator = new BACoordinator();
+ atomicBACoordinator.compensatedOperation(baContext, enlistmentId);
+ } else {
+ log.fatal("WS_BA : message "
+ + MessageContext.getCurrentMessageContext().getMessageID()
+ + " : CompensatedOperation : Business Activity Not Found");
+ throw new NoActivityException("CompensatedOperation : Business Activity Not Found");
+ }
+ } catch (AbstractKandulaException e) {
+ log.fatal("WS_BA : message " + MessageContext.getCurrentMessageContext().getMessageID()
+ + " : CompensatedOperation :" + e);
+ throw new AxisFault(e);
+ }
+ }
+
+ /**
+ * Auto generated method signature
+ *
+ * @param param1
+ * @throws AxisFault
+ *
+ */
+ public void ClosedOperation(org.oasis_open.docs.ws_tx.wsba._2006._06.Closed param1)
+ throws AxisFault {
+ OMElement header = MessageContext.getCurrentMessageContext().getEnvelope().getHeader();
+ String activityId = header.getFirstChildWithName(Constants.TRANSACTION_ID_PARAMETER)
+ .getText();
+ String enlistmentId = header.getFirstChildWithName(Constants.ENLISTMENT_ID_PARAMETER)
+ .getText();
+ try {
+ AbstractContext context = StorageUtils.getContext(activityId);
+ if (context != null) {
+ BAActivityContext baContext = (BAActivityContext) context;
+ BACoordinator atomicBACoordinator = new BACoordinator();
+ atomicBACoordinator.closedOperation(baContext, enlistmentId);
+ } else {
+ log.fatal("WS_BA : message "
+ + MessageContext.getCurrentMessageContext().getMessageID()
+ + " : ClosedOperation : Business Activity Not Found");
+ throw new NoActivityException("ClosedOperation : Business Activity Not Found");
+ }
+ } catch (AbstractKandulaException e) {
+ log.fatal("WS_BA : message " + MessageContext.getCurrentMessageContext().getMessageID()
+ + " : ClosedOperation :" + e);
+ throw new AxisFault(e);
+ }
+ }
+
+ /**
+ * Auto generated method signature
+ *
+ * @param param2
+ * @throws AxisFault
+ *
+ */
+ public void ExitOperation(org.oasis_open.docs.ws_tx.wsba._2006._06.Exit param2)
+ throws AxisFault
+
+ {
+ OMElement header = MessageContext.getCurrentMessageContext().getEnvelope().getHeader();
+ String activityId = header.getFirstChildWithName(Constants.TRANSACTION_ID_PARAMETER)
+ .getText();
+ String enlistmentId = header.getFirstChildWithName(Constants.ENLISTMENT_ID_PARAMETER)
+ .getText();
+ try {
+ AbstractContext context = StorageUtils.getContext(activityId);
+ if (context != null) {
+ BAActivityContext baContext = (BAActivityContext) context;
+ BACoordinator atomicBACoordinator = new BACoordinator();
+ atomicBACoordinator.exitOperation(baContext, enlistmentId);
+ } else {
+ log.fatal("WS_BA : message "
+ + MessageContext.getCurrentMessageContext().getMessageID()
+ + " : ExitOperation : Business Activity Not Found");
+ throw new NoActivityException("ClosedOperation : Business Activity Not Found");
+ }
+ } catch (AbstractKandulaException e) {
+ log.fatal("WS_BA : message " + MessageContext.getCurrentMessageContext().getMessageID()
+ + " : ExitOperation :" + e);
+ throw new AxisFault(e);
+ }
+ }
+
+ /**
+ * Auto generated method signature
+ *
+ * @param param3
+ * @throws AxisFault
+ *
+ */
+ public void CompletedOperation(org.oasis_open.docs.ws_tx.wsba._2006._06.Completed param3)
+ throws AxisFault {
+ OMElement header = MessageContext.getCurrentMessageContext().getEnvelope().getHeader();
+ String activityId = header.getFirstChildWithName(Constants.TRANSACTION_ID_PARAMETER)
+ .getText();
+ String enlistmentId = header.getFirstChildWithName(Constants.ENLISTMENT_ID_PARAMETER)
+ .getText();
+ try {
+ AbstractContext context = StorageUtils.getContext(activityId);
+ if (context != null) {
+ BAActivityContext baContext = (BAActivityContext) context;
+ BACoordinator atomicBACoordinator = new BACoordinator();
+ atomicBACoordinator.completedOperation(baContext, enlistmentId);
+ } else {
+ log.fatal("WS_BA : message "
+ + MessageContext.getCurrentMessageContext().getMessageID()
+ + " : CompletedOperation : Business Activity Not Found");
+ throw new NoActivityException("ClosedOperation : Business Activity Not Found");
+ }
+ } catch (AbstractKandulaException e) {
+ log.fatal("WS_BA : message " + MessageContext.getCurrentMessageContext().getMessageID()
+ + " : CompletedOperation :" + e);
+ throw new AxisFault(e);
+ }
+ }
+
+ /**
+ * Auto generated method signature
+ *
+ * @param param4
+ *
+ */
+ public void CannotComplete(org.oasis_open.docs.ws_tx.wsba._2006._06.CannotComplete param4)
+
+ {
+ // Todo fill this with the necessary business logic
+
+ }
+
+ /**
+ * Auto generated method signature
+ *
+ * @param param5
+ *
+ */
+ public void GetStatusOperation(org.oasis_open.docs.ws_tx.wsba._2006._06.GetStatus param5)
+
+ {
+ // Todo fill this with the necessary business logic
+
+ }
+
+ /**
+ * Auto generated method signature
+ *
+ * @param param6
+ * @throws AxisFault
+ *
+ */
+ public void FailOperation(org.oasis_open.docs.ws_tx.wsba._2006._06.Fail param6)
+ throws AxisFault
+
+ {
+ OMElement header = MessageContext.getCurrentMessageContext().getEnvelope().getHeader();
+ String activityId = header.getFirstChildWithName(Constants.TRANSACTION_ID_PARAMETER)
+ .getText();
+ String enlistmentId = header.getFirstChildWithName(Constants.ENLISTMENT_ID_PARAMETER)
+ .getText();
+ try {
+ AbstractContext context = StorageUtils.getContext(activityId);
+ if (context != null) {
+ BAActivityContext baContext = (BAActivityContext) context;
+ BACoordinator atomicBACoordinator = new BACoordinator();
+ atomicBACoordinator.faultOperation(baContext, enlistmentId);
+ } else {
+ log.fatal("WS_BA : message "
+ + MessageContext.getCurrentMessageContext().getMessageID()
+ + " : FailOperation : Business Activity Not Found");
+ throw new NoActivityException("ClosedOperation : Business Activity Not Found");
+ }
+ } catch (AbstractKandulaException e) {
+ log.fatal("WS_BA : message " + MessageContext.getCurrentMessageContext().getMessageID()
+ + " : FailOperation :" + e);
+ throw new AxisFault(e);
+ }
+
+ }
+
+ /**
+ * Auto generated method signature
+ *
+ * @param param7
+ *
+ */
+ public void StatusOperation(org.oasis_open.docs.ws_tx.wsba._2006._06.Status param7)
+
+ {
+ // Todo fill this with the necessary business logic
+
+ }
+
+ /**
+ * Auto generated method signature
+ *
+ * @param param8
+ * @throws AxisFault
+ *
+ */
+ public void CanceledOperation(org.oasis_open.docs.ws_tx.wsba._2006._06.Canceled param8)
+ throws AxisFault
+
+ {
+ OMElement header = MessageContext.getCurrentMessageContext().getEnvelope().getHeader();
+ String activityId = header.getFirstChildWithName(Constants.TRANSACTION_ID_PARAMETER)
+ .getText();
+ String enlistmentId = header.getFirstChildWithName(Constants.ENLISTMENT_ID_PARAMETER)
+ .getText();
+ try {
+ AbstractContext context = StorageUtils.getContext(activityId);
+ if (context != null) {
+ BAActivityContext baContext = (BAActivityContext) context;
+ BACoordinator atomicBACoordinator = new BACoordinator();
+ atomicBACoordinator.canceledOperation(baContext, enlistmentId);
+ }
+ } catch (AbstractKandulaException e) {
+ log.fatal("WS_BA : message " + MessageContext.getCurrentMessageContext().getMessageID()
+ + " : CanceledOperation :" + e);
+ throw new AxisFault(e);
+ }
+ }
+
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: kandula-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: kandula-dev-help@ws.apache.org