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/10/11 05:39:31 UTC
svn commit: r312797 - in
/webservices/kandula/trunk/java/src/org/apache/kandula: ./ context/
context/at/ context/coordination/ coordinator/at/ participant/ utility/
wsat/completion/ wsat/twopc/ wscoor/
Author: thilina
Date: Mon Oct 10 20:37:33 2005
New Revision: 312797
URL: http://svn.apache.org/viewcvs?rev=312797&view=rev
Log:
Tying together the stubs/skeletons with logic. Changed to handle wsa:submission reference parameters.
Refactored coordination/SimpleCoordinationContext.java and moved common code pieces to KandulaUtils.java
Few other changes due to Axis2 deployment changes
Added:
webservices/kandula/trunk/java/src/org/apache/kandula/participant/TransactionInHandler.java
Modified:
webservices/kandula/trunk/java/src/org/apache/kandula/Constants.java
webservices/kandula/trunk/java/src/org/apache/kandula/context/AbstractContext.java
webservices/kandula/trunk/java/src/org/apache/kandula/context/Participant.java
webservices/kandula/trunk/java/src/org/apache/kandula/context/at/ATActivityContext.java
webservices/kandula/trunk/java/src/org/apache/kandula/context/coordination/SimpleCoordinationContext.java
webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/at/ATCoordinator.java
webservices/kandula/trunk/java/src/org/apache/kandula/participant/KandulaResource.java
webservices/kandula/trunk/java/src/org/apache/kandula/participant/ParticipantTransactionManager.java
webservices/kandula/trunk/java/src/org/apache/kandula/utility/EndpointReferenceFactory.java
webservices/kandula/trunk/java/src/org/apache/kandula/utility/KandulaListener.java
webservices/kandula/trunk/java/src/org/apache/kandula/utility/KandulaUtils.java
webservices/kandula/trunk/java/src/org/apache/kandula/wsat/completion/CompletionCoordinatorPortTypeRawXMLStub.java
webservices/kandula/trunk/java/src/org/apache/kandula/wsat/completion/CompletionInitiatorPortTypeRawXMLStub.java
webservices/kandula/trunk/java/src/org/apache/kandula/wsat/completion/CompletionInitiatorServiceListener.java
webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/CoordinatorPortTypeRawXMLSkeleton.java
webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/CoordinatorPortTypeRawXMLStub.java
webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/ParticipantPortTypeRawXMLSkeleton.java
webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/ParticipantPortTypeRawXMLStub.java
webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/ParticipantServiceListener.java
webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/ActivationCoordinatorPortTypeRawXMLStub.java
webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/ActivationPortTypeRawXMLAsyncMessageReceiver.java
webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/ActivationRequesterPortTypeRawXMLSkeleton.java
webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/RegistrationCoordinatorPortTypeRawXMLStub.java
webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/RegistrationPortTypeRawXMLAsyncMessageReceiver.java
webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/RegistrationRequesterPortTypeRawXMLSkeleton.java
Modified: 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=312797&r1=312796&r2=312797&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/Constants.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/Constants.java Mon Oct 10 20:37:33 2005
@@ -1,70 +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;
-
-/**
- * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
- */
-abstract public interface Constants {
-
- //WS-Coordination URI's
-
- public static final String WS_COOR = "http://schemas.xmlsoap.org/ws/2004/10/wscoor";
-
- public static final String WS_COOR_CREATE_COORDINATIONCONTEXT = "http://schemas.xmlsoap.org/ws/2004/10/wscoor/CreateCoordinationContext";
-
- public static final String WS_COOR_CREATE_COORDINATIONCONTEXT_RESPONSE = "http://schemas.xmlsoap.org/ws/2004/10/wscoor/CreateCoordinationContextResponse";
-
- public static final String WS_COOR_REGISTER = "http://schemas.xmlsoap.org/ws/2004/10/wscoor/Register";
-
- public static final String WS_COOR_REGISTER_RESPONSE = "http://schemas.xmlsoap.org/ws/2004/10/wscoor/RegisterResponse";
-
- //WS-AT URI's
-
- public static final String WS_AT = "http://schemas.xmlsoap.org/ws/2004/10/wsat";
-
- public static final String WS_AT_COMPLETION = "http://schemas.xmlsoap.org/ws/2004/10/wsat/Completion";
-
- public static final String WS_AT_COMMIT = "http://schemas.xmlsoap.org/ws/2004/10/wsat/Commit";
-
- public static final String WS_AT_COMMITTED = "http://schemas.xmlsoap.org/ws/2004/10/wsat/Committed";
-
- public static final String WS_AT_ROLLBACK = "http://schemas.xmlsoap.org/ws/2004/10/wsat/Rollback";
-
- public static final String WS_AT_ABORTED = "http://schemas.xmlsoap.org/ws/2004/10/wsat/Aborted";
-
- 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 WS_AT_PREPARE = "http://schemas.xmlsoap.org/ws/2004/10/wsat/Prepare";
-
- public static final String WS_AT_PREPARED = "http://schemas.xmlsoap.org/ws/2004/10/wsat/Preapared";
-
- public static final String WS_AT_REPLAY = "http://schemas.xmlsoap.org/ws/2004/10/wsat/Replay";
-
- public static final String WS_AT_READONLY = "http://schemas.xmlsoap.org/ws/2004/10/wsat/ReadOnly";
-
- public static final String SUB_VOLATILE_REGISTERED = "registered for volatile 2PC";
-
- public static final String SUB_DURABLE_REGISTERED = "registered for durable 2PC";
-
- //WS-BA URI's
-
- public static final String WS_BA = "http://schemas.xmlsoap.org/ws/2004/10/wsba";
-
+/*
+ * 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;
+
+import javax.xml.namespace.QName;
+
+/**
+ * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
+ */
+abstract public interface Constants {
+
+ //WS-Coordination URI's
+
+ public static final String WS_COOR = "http://schemas.xmlsoap.org/ws/2004/10/wscoor";
+
+ public static final String WS_COOR_CREATE_COORDINATIONCONTEXT = "http://schemas.xmlsoap.org/ws/2004/10/wscoor/CreateCoordinationContext";
+
+ public static final String WS_COOR_CREATE_COORDINATIONCONTEXT_RESPONSE = "http://schemas.xmlsoap.org/ws/2004/10/wscoor/CreateCoordinationContextResponse";
+
+ public static final String WS_COOR_REGISTER = "http://schemas.xmlsoap.org/ws/2004/10/wscoor/Register";
+
+ public static final String WS_COOR_REGISTER_RESPONSE = "http://schemas.xmlsoap.org/ws/2004/10/wscoor/RegisterResponse";
+
+ //WS-AT URI's
+
+ public static final String WS_AT = "http://schemas.xmlsoap.org/ws/2004/10/wsat";
+
+ public static final String WS_AT_COMPLETION = "http://schemas.xmlsoap.org/ws/2004/10/wsat/Completion";
+
+ public static final String WS_AT_COMMIT = "http://schemas.xmlsoap.org/ws/2004/10/wsat/Commit";
+
+ public static final String WS_AT_COMMITTED = "http://schemas.xmlsoap.org/ws/2004/10/wsat/Committed";
+
+ public static final String WS_AT_ROLLBACK = "http://schemas.xmlsoap.org/ws/2004/10/wsat/Rollback";
+
+ public static final String WS_AT_ABORTED = "http://schemas.xmlsoap.org/ws/2004/10/wsat/Aborted";
+
+ 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 WS_AT_PREPARE = "http://schemas.xmlsoap.org/ws/2004/10/wsat/Prepare";
+
+ public static final String WS_AT_PREPARED = "http://schemas.xmlsoap.org/ws/2004/10/wsat/Preapared";
+
+ public static final String WS_AT_REPLAY = "http://schemas.xmlsoap.org/ws/2004/10/wsat/Replay";
+
+ public static final String WS_AT_READONLY = "http://schemas.xmlsoap.org/ws/2004/10/wsat/ReadOnly";
+
+ public static final String SUB_VOLATILE_REGISTERED = "registered for volatile 2PC";
+
+ public static final String SUB_DURABLE_REGISTERED = "registered for durable 2PC";
+
+ //WS-BA URI's
+
+ public static final String WS_BA = "http://schemas.xmlsoap.org/ws/2004/10/wsba";
+
+ //Kandula Specific Constants----------------------------------------------------------------------------------------------------
+ public static String KANDULA_URI = "http://ws.apache.org/kandula";
+
+ public static String KANDULA_RESOURCE = "KandulaResource";
+
+ public static String KANDULA_PRE = "kand";
+
+ public static final QName TRANSACTION_ID_PARAMETER = new QName(
+ KANDULA_URI, "TransactionID",KANDULA_PRE);
+
+ public static final QName REQUESTER_ID_PARAMETER = new QName(
+ KANDULA_URI, "RequesterID",KANDULA_PRE);
+
+ public static final QName ENLISTMENT_ID_PARAMETER = new QName(
+ KANDULA_URI, "EnlistmentID",KANDULA_PRE);
+
+
+
}
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/context/AbstractContext.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/context/AbstractContext.java?rev=312797&r1=312796&r2=312797&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/context/AbstractContext.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/context/AbstractContext.java Mon Oct 10 20:37:33 2005
@@ -18,8 +18,6 @@
import java.util.HashMap;
-import javax.xml.namespace.QName;
-
import org.apache.axis2.addressing.AnyContentType;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.kandula.Status.CoordinatorStatus;
@@ -42,6 +40,12 @@
protected CoordinationContext coordinationContext = null;
+ public static String REQUESTER_ID = "requesterID";
+
+ public static String COORDINATION_EPR = "coordinationEPR";
+
+ public static String ACTIVATION_EPR = "activationEPR";
+
protected AbstractContext() {
propertyBag = new HashMap();
}
@@ -52,9 +56,6 @@
EndpointReference registrationEpr = EndpointReferenceFactory
.getInstance().getRegistrationEndpoint(activityID);
AnyContentType referenceProp = new AnyContentType();
- referenceProp.addReferenceValue(new QName(
- "http://webservice.apache.org/~thilina", "myapp", "ID"),
- activityID);
registrationEpr.setReferenceProperties(referenceProp);
coordinationContext = CoordinationContext.Factory.newContext(
activityID, coordinationType, registrationEpr);
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/context/Participant.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/context/Participant.java?rev=312797&r1=312796&r2=312797&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/context/Participant.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/context/Participant.java Mon Oct 10 20:37:33 2005
@@ -25,16 +25,15 @@
*/
//TODO see whether we can avoid this class
public class Participant {
-
+
private EndpointReference epr;
private String protocol;
private int status;
-
+
private String enlistmentId;
-
/**
* @param epr
* @param protocol
@@ -47,38 +46,44 @@
this.protocol = protocol;
this.enlistmentId = enlistmentId;
}
-
+
/**
* @return Returns the enlistmentId.
*/
public String getEnlistmentId() {
return enlistmentId;
}
-
+
/**
* @return Returns the epr.
*/
public EndpointReference getEpr() {
return epr;
}
+
/**
- * @param epr The epr to set.
+ * @param epr
+ * The epr to set.
*/
public void setEpr(EndpointReference epr) {
this.epr = epr;
}
+
/**
* @return Returns the status.
*/
public int getStatus() {
return status;
}
+
/**
- * @param status The status to set.
+ * @param status
+ * The status to set.
*/
public void setStatus(int status) {
this.status = status;
}
+
/**
* @return Returns the protocol.
*/
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/context/at/ATActivityContext.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/context/at/ATActivityContext.java?rev=312797&r1=312796&r2=312797&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/context/at/ATActivityContext.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/context/at/ATActivityContext.java Mon Oct 10 20:37:33 2005
@@ -54,12 +54,6 @@
private EndpointReference parentEPR;
- public static String REQUESTER_ID = "requesterID";
-
- public static String COORDINATION_EPR = "coordinationEPR";
-
- public static String ACTIVATION_EPR = "activationEPR";
-
/**
* Used when creating new activities
*/
@@ -107,11 +101,11 @@
String protocol) throws AbstractKandulaException {
String enlistmentID = KandulaUtils.getRandomStringOf18Characters();
if (Constants.WS_AT_VOLATILE2PC.equals(protocol)) {
- addVolatileParticipant(participantEPR,enlistmentID);
+ addVolatileParticipant(participantEPR, enlistmentID);
return EndpointReferenceFactory.getInstance().get2PCEndpoint(
this.activityID);
} else if (Constants.WS_AT_DURABLE2PC.equals(protocol)) {
- addDurableParticipant(participantEPR,enlistmentID);
+ addDurableParticipant(participantEPR, enlistmentID);
return EndpointReferenceFactory.getInstance().get2PCEndpoint(
this.activityID);
} else if (Constants.WS_AT_COMPLETION.equals(protocol)) {
@@ -123,19 +117,21 @@
}
}
- public void addVolatileParticipant(EndpointReference participantEPR, String enlistmentID)
- throws AbstractKandulaException {
+ public void addVolatileParticipant(EndpointReference participantEPR,
+ String enlistmentID) throws AbstractKandulaException {
if (volatileParticipantsTable.contains(participantEPR))
throw new AlreadyRegisteredException();
- Participant participant = new Participant(participantEPR, Constants.WS_AT_VOLATILE2PC,enlistmentID);
+ Participant participant = new Participant(participantEPR,
+ Constants.WS_AT_VOLATILE2PC, enlistmentID);
volatileParticipantsTable.put(enlistmentID, participant);
}
- public void addDurableParticipant(EndpointReference participantEPR, String enlistmentID)
- throws AlreadyRegisteredException {
+ public void addDurableParticipant(EndpointReference participantEPR,
+ String enlistmentID) throws AlreadyRegisteredException {
if (durableParticipantsTable.contains(participantEPR))
throw new AlreadyRegisteredException();
- Participant participant = new Participant(participantEPR, Constants.WS_AT_DURABLE2PC,enlistmentID);
+ Participant participant = new Participant(participantEPR,
+ Constants.WS_AT_DURABLE2PC, enlistmentID);
durableParticipantsTable.put(enlistmentID, participant);
}
@@ -154,19 +150,13 @@
list.addAll(durableParticipantsTable.values());
return list.iterator();
}
-
- public Participant getParticipant(String enlistmentId)
- {
- if (volatileParticipantsTable.containsKey(enlistmentId))
- {
- return (Participant)volatileParticipantsTable.get(enlistmentId);
- }
- else if (durableParticipantsTable.containsKey(enlistmentId))
- {
- return (Participant)durableParticipantsTable.get(enlistmentId);
- }
- else
- {
+
+ public Participant getParticipant(String enlistmentId) {
+ if (volatileParticipantsTable.containsKey(enlistmentId)) {
+ return (Participant) volatileParticipantsTable.get(enlistmentId);
+ } else if (durableParticipantsTable.containsKey(enlistmentId)) {
+ return (Participant) durableParticipantsTable.get(enlistmentId);
+ } else {
return null;
}
}
@@ -182,9 +172,8 @@
preparingParticipantsCount++;
}
-
- public void decrementPreparing()
- {
+
+ public void decrementPreparing() {
preparingParticipantsCount--;
}
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/context/coordination/SimpleCoordinationContext.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/context/coordination/SimpleCoordinationContext.java?rev=312797&r1=312796&r2=312797&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/context/coordination/SimpleCoordinationContext.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/context/coordination/SimpleCoordinationContext.java Mon Oct 10 20:37:33 2005
@@ -16,14 +16,9 @@
*/
package org.apache.kandula.context.coordination;
-import java.util.Iterator;
-
import javax.xml.namespace.QName;
-import org.apache.axis2.addressing.AddressingConstants;
-import org.apache.axis2.addressing.AnyContentType;
import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.addressing.AddressingConstants.Final;
import org.apache.axis2.om.OMAbstractFactory;
import org.apache.axis2.om.OMElement;
import org.apache.axis2.om.OMNamespace;
@@ -128,34 +123,8 @@
contextElement.addChild(coorTypeElement);
OMElement registrationServiceElement = factory.createOMElement(
"RegistrationService", wsCoor);
- OMNamespace wsAddressing = factory.createOMNamespace(
- AddressingConstants.Submission.WSA_NAMESPACE,
- AddressingConstants.WSA_DEFAULT_PRFIX);
- OMElement addressElement = factory.createOMElement("Address",
- wsAddressing);
- addressElement.setText(registrationServiceEpr.getAddress());
- registrationServiceElement.addChild(addressElement);
- AnyContentType referenceValues = registrationServiceEpr
- .getReferenceProperties();
- if (referenceValues != null) {
- OMElement refPropertyElement = factory.createOMElement(
- "ReferenceProperties", wsAddressing);
- registrationServiceElement.addChild(refPropertyElement);
- Iterator iterator = referenceValues.getKeys();
- while (iterator.hasNext()) {
- QName key = (QName) iterator.next();
- String value = referenceValues.getReferenceValue(key);
- OMElement omElement = factory.createOMElement(key,
- refPropertyElement);
- refPropertyElement.addChild(omElement);
- if (Final.WSA_NAMESPACE.equals(wsAddressing)) {
- omElement.addAttribute(
- Final.WSA_IS_REFERENCE_PARAMETER_ATTRIBUTE,
- Final.WSA_TYPE_ATTRIBUTE_VALUE, wsAddressing);
- }
- omElement.setText(value);
- }
- }
+ KandulaUtils.endpointToOM(registrationServiceEpr,
+ registrationServiceElement, factory);
contextElement.addChild(registrationServiceElement);
return contextElement;
}
Modified: 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=312797&r1=312796&r2=312797&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/at/ATCoordinator.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/at/ATCoordinator.java Mon Oct 10 20:37:33 2005
@@ -38,12 +38,14 @@
* @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
*/
public class ATCoordinator implements Registerable {
-
+
private Store store;
+
public ATCoordinator() {
StorageFactory storageFactory = StorageFactory.getInstance();
store = storageFactory.getStore();
}
+
public EndpointReference register(AbstractContext context, String protocol,
EndpointReference participantEPR) throws AbstractKandulaException {
ATActivityContext atContext = (ATActivityContext) context;
@@ -72,7 +74,7 @@
case CoordinatorStatus.STATUS_ACTIVE:
case CoordinatorStatus.STATUS_PREPARING_VOLATILE:
atContext.unlock();
- return atContext.addParticipant( participantEPR,protocol);
+ return atContext.addParticipant(participantEPR, protocol);
case CoordinatorStatus.STATUS_NONE:
default:
atContext.unlock();
@@ -88,8 +90,8 @@
*/
public void commitOperation(String id) throws AbstractKandulaException {
CompletionInitiatorPortTypeRawXMLStub stub;
- ATActivityContext atContext = (ATActivityContext)store.get(id);
-
+ ATActivityContext atContext = (ATActivityContext) store.get(id);
+
if (atContext == null) {
throw new IllegalStateException(
"No Activity Found for this Activity ID");
@@ -125,13 +127,12 @@
volatilePrepare(atContext);
// wait till all the Volatile prepare()'s are done
while (atContext.hasMorePreparing()) {
- if (atContext.getStatus() == Status.CoordinatorStatus.STATUS_ABORTING)
- {
+ if (atContext.getStatus() == Status.CoordinatorStatus.STATUS_ABORTING) {
abortActivity(atContext);
- stub = new CompletionInitiatorPortTypeRawXMLStub(".", atContext
- .getCompletionParticipant());
- stub.abortedOperation();
- return;
+ stub = new CompletionInitiatorPortTypeRawXMLStub(".",
+ atContext.getCompletionParticipant());
+ stub.abortedOperation();
+ return;
}
}
durablePrepare(atContext);
@@ -153,7 +154,7 @@
public void rollbackOperation(String id) throws Exception {
CompletionInitiatorPortTypeRawXMLStub stub;
- ATActivityContext atContext = (ATActivityContext)store.get(id);
+ ATActivityContext atContext = (ATActivityContext) store.get(id);
// if store throws a Exception capture it
if (atContext == null) {
@@ -223,21 +224,17 @@
}
}
}
-
- public void countVote(String activityID, Vote vote,String enlistmentID) throws AbstractKandulaException
- {
- ATActivityContext context = (ATActivityContext)store.get(activityID);
+
+ public void countVote(String activityID, Vote vote, String enlistmentID)
+ throws AbstractKandulaException {
+ ATActivityContext context = (ATActivityContext) store.get(activityID);
Participant participant = context.getParticipant(enlistmentID);
-
- if (Vote.PREPARED.equals(vote))
- {
- participant.setStatus(Status.CoordinatorStatus.STATUS_PREPARED);
- }
- else if (Vote.READ_ONLY.equals(vote))
- {
- participant.setStatus(Status.CoordinatorStatus.STATUS_READ_ONLY);
- }else if(Vote.ABORT.equals(vote))
- {
+
+ if (Vote.PREPARED.equals(vote)) {
+ participant.setStatus(Status.CoordinatorStatus.STATUS_PREPARED);
+ } else if (Vote.READ_ONLY.equals(vote)) {
+ participant.setStatus(Status.CoordinatorStatus.STATUS_READ_ONLY);
+ } else if (Vote.ABORT.equals(vote)) {
participant.setStatus(Status.ParticipantStatus.STATUS_ABORTED);
abortActivity(context);
}
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/participant/KandulaResource.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/participant/KandulaResource.java?rev=312797&r1=312796&r2=312797&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/participant/KandulaResource.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/participant/KandulaResource.java Mon Oct 10 20:37:33 2005
@@ -25,4 +25,6 @@
public void rollback();
public Vote prepare();
+
+ public String getProtocol();
}
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/participant/ParticipantTransactionManager.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/participant/ParticipantTransactionManager.java?rev=312797&r1=312796&r2=312797&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/participant/ParticipantTransactionManager.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/participant/ParticipantTransactionManager.java Mon Oct 10 20:37:33 2005
@@ -25,6 +25,7 @@
* @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
*/
public class ParticipantTransactionManager {
+
public Vote prepare(AbstractContext context) throws InvalidStateException {
ATParticipantContext atContext = (ATParticipantContext) context;
atContext.lock();
@@ -50,5 +51,32 @@
context.unlock();
throw new InvalidStateException();
}
+ }
+
+ public void commit(AbstractContext context) throws InvalidStateException {
+ // ATParticipantContext atContext = (ATParticipantContext) context;
+ // atContext.lock();
+ // switch (context.getStatus()) {
+ // case (Status.CoordinatorStatus.STATUS_NONE):
+ // //TODO send aborted
+ // atContext.unlock();
+ // return Vote.ABORT;
+ // case (Status.CoordinatorStatus.STATUS_PREPARING):
+ // case (Status.CoordinatorStatus.STATUS_PREPARED):
+ // case (Status.CoordinatorStatus.STATUS_COMMITTING):
+ // //Ignore the message
+ // atContext.unlock();
+ // return Vote.NONE;
+ // case (Status.CoordinatorStatus.STATUS_PREPARED_SUCCESS):
+ // atContext.unlock();
+ // return Vote.PREPARED;
+ // case (Status.CoordinatorStatus.STATUS_ACTIVE):
+ // atContext.setStatus(Status.CoordinatorStatus.STATUS_PREPARING);
+ // KandulaResource resource = atContext.getResource();
+ // return resource.prepare();
+ // default:
+ // context.unlock();
+ // throw new InvalidStateException();
+ // }
}
}
Added: webservices/kandula/trunk/java/src/org/apache/kandula/participant/TransactionInHandler.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/participant/TransactionInHandler.java?rev=312797&view=auto
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/participant/TransactionInHandler.java (added)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/participant/TransactionInHandler.java Mon Oct 10 20:37:33 2005
@@ -0,0 +1,92 @@
+/*
+ * 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;
+
+import java.io.IOException;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.handlers.AbstractHandler;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.soap.SOAPHeader;
+import org.apache.kandula.Constants;
+import org.apache.kandula.context.AbstractContext;
+import org.apache.kandula.context.at.ATParticipantContext;
+import org.apache.kandula.context.coordination.CoordinationContext;
+import org.apache.kandula.context.coordination.SimpleCoordinationContext;
+import org.apache.kandula.faults.AbstractKandulaException;
+import org.apache.kandula.storage.StorageFactory;
+import org.apache.kandula.storage.Store;
+import org.apache.kandula.utility.KandulaUtils;
+import org.apache.kandula.wscoor.RegistrationCoordinatorPortTypeRawXMLStub;
+
+public class TransactionInHandler extends AbstractHandler {
+ private ThreadLocal threadInfo = new ThreadLocal();
+
+ public void invoke(MessageContext msgContext) throws AxisFault {
+ KandulaResource resource;
+ ATParticipantContext context = new ATParticipantContext();
+ SOAPHeader header = msgContext.getEnvelope().getHeader();
+ OMElement coordinationElement = header.getFirstChildWithName(new QName(
+ Constants.WS_COOR, "CoordinationContext"));
+ if (coordinationElement == null) {
+ throw new AxisFault(
+ "Transaction Handler engaged.. No Coordination Context found");
+ }
+ CoordinationContext coorContext = new SimpleCoordinationContext(
+ coordinationElement);
+ context.setCoordinationContext(coorContext);
+
+ // TODO : See whether we can allow the user to set this when the business logiv receives the message
+ String resourceFile = (String) msgContext.getParameter(
+ Constants.KANDULA_RESOURCE).getValue();
+ try {
+ resource = (KandulaResource) Class.forName(resourceFile)
+ .newInstance();
+ } catch (ClassNotFoundException e) {
+ throw new AxisFault(e);
+ } catch (InstantiationException e) {
+ throw new AxisFault(e);
+ } catch (IllegalAccessException e) {
+ throw new AxisFault(e);
+ }
+ context.setResource(resource);
+
+ String id = KandulaUtils.getRandomStringOf18Characters();
+ Store store = StorageFactory.getInstance().getStore();
+ context.setProperty(AbstractContext.REQUESTER_ID, id);
+ store.put(id, context);
+ ParticipantTransactionManager txManager = new ParticipantTransactionManager();
+ try {
+ RegistrationCoordinatorPortTypeRawXMLStub stub = new RegistrationCoordinatorPortTypeRawXMLStub(
+ ".", coorContext.getRegistrationService());
+ // TODO: try to get the protocol through configuration parameter
+ stub.registerOperation(resource.getProtocol(), coorContext
+ .getRegistrationService(), id);
+ } catch (IOException e) {
+ throw new AxisFault(e);
+ } catch (AbstractKandulaException e) {
+ AxisFault e1 = new AxisFault(e);
+ e1.setFaultCode(e.getFaultCode());
+ throw e1;
+ }
+
+ }
+}
+
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/utility/EndpointReferenceFactory.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/utility/EndpointReferenceFactory.java?rev=312797&r1=312796&r2=312797&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/utility/EndpointReferenceFactory.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/utility/EndpointReferenceFactory.java Mon Oct 10 20:37:33 2005
@@ -19,10 +19,9 @@
import java.io.IOException;
import java.util.Properties;
-import javax.xml.namespace.QName;
-
import org.apache.axis2.addressing.AnyContentType;
import org.apache.axis2.addressing.EndpointReference;
+import org.apache.kandula.Constants;
import org.apache.kandula.wsat.completion.CompletionInitiatorServiceListener;
/**
@@ -68,11 +67,10 @@
public EndpointReference getRegistrationEndpoint(String id) {
//TODO set this somehow reading the conf file
EndpointReference epr = new EndpointReference(
- "http://localhost:8081/axis/services/RegistrationCoordinator");
- AnyContentType refProperties = new AnyContentType();
- refProperties.addReferenceValue(new QName(
- "http://ws.apache.org/Kandula", "id"), id);
- epr.setReferenceProperties(refProperties);
+ "http://localhost:8082/axis/services/RegistrationCoordinator");
+ AnyContentType refParameters = new AnyContentType();
+ refParameters.addReferenceValue(Constants.TRANSACTION_ID_PARAMETER, id);
+ epr.setReferenceParameters(refParameters);
return epr;
}
@@ -81,10 +79,9 @@
CompletionInitiatorServiceListener serviceListener = CompletionInitiatorServiceListener
.getInstance();
EndpointReference epr = serviceListener.getEpr();
- AnyContentType refProperties = new AnyContentType();
- refProperties.addReferenceValue(new QName(
- "http://ws.apache.org/Kandula", "id"), id);
- epr.setReferenceProperties(refProperties);
+ AnyContentType refParameters = new AnyContentType();
+ refParameters.addReferenceValue(Constants.REQUESTER_ID_PARAMETER, id);
+ epr.setReferenceParameters(refParameters);
return epr;
}
@@ -92,21 +89,19 @@
//TODO set this somehow reading the conf file
EndpointReference epr = new EndpointReference(
"http://localhost:8082/axis/services/CompletionCoordinator");
- AnyContentType refProperties = new AnyContentType();
- refProperties.addReferenceValue(new QName(
- "http://ws.apache.org/Kandula", "id"), id);
- epr.setReferenceProperties(refProperties);
+ AnyContentType refParameters = new AnyContentType();
+ refParameters.addReferenceValue(Constants.TRANSACTION_ID_PARAMETER, id);
+ epr.setReferenceParameters(refParameters);
return epr;
}
public EndpointReference get2PCEndpoint(String id) {
//TODO set this somehow reading the conf file
EndpointReference epr = new EndpointReference(
- "http://localhost:8081/axis/services/RegistrationCoordinator");
- AnyContentType refProperties = new AnyContentType();
- refProperties.addReferenceValue(new QName(
- "http://ws.apache.org/Kandula", "id"), id);
- epr.setReferenceProperties(refProperties);
+ "http://localhost:8082/axis/services/RegistrationCoordinator");
+ AnyContentType refParameters = new AnyContentType();
+ refParameters.addReferenceValue(Constants.TRANSACTION_ID_PARAMETER, id);
+ epr.setReferenceParameters(refParameters);
return epr;
}
// public EndpointReferenceTypeImpl
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/utility/KandulaListener.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/utility/KandulaListener.java?rev=312797&r1=312796&r2=312797&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/utility/KandulaListener.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/utility/KandulaListener.java Mon Oct 10 20:37:33 2005
@@ -92,6 +92,6 @@
public String getHost() throws UnknownHostException {
return "http://" + InetAddress.getLocalHost().getHostAddress() + ":"
- + SERVER_PORT + "/axis2/services/";
+ + (SERVER_PORT + 1) + "/axis2/services/";
}
}
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/utility/KandulaUtils.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/utility/KandulaUtils.java?rev=312797&r1=312796&r2=312797&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/utility/KandulaUtils.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/utility/KandulaUtils.java Mon Oct 10 20:37:33 2005
@@ -47,10 +47,10 @@
wsAddressing);
addressElement.setText(epr.getAddress());
parentEPR.addChild(addressElement);
- AnyContentType referenceValues = epr.getReferenceProperties();
+ AnyContentType referenceValues = epr.getReferenceParameters();
if (referenceValues != null) {
OMElement refPropertyElement = factory.createOMElement(
- "ReferenceProperties", wsAddressing);
+ "ReferenceParameters", wsAddressing);
parentEPR.addChild(refPropertyElement);
Iterator iterator = referenceValues.getKeys();
while (iterator.hasNext()) {
@@ -75,14 +75,14 @@
new QName("Address")).getText());
AnyContentType referenceProperties = new AnyContentType();
OMElement referencePropertiesElement = eprElement
- .getFirstChildWithName(new QName("ReferenceProperties"));
+ .getFirstChildWithName(new QName("ReferenceParameters"));
Iterator propertyIter = referencePropertiesElement.getChildElements();
while (propertyIter.hasNext()) {
OMElement element = (OMElement) propertyIter.next();
referenceProperties.addReferenceValue(element.getQName(), element
.getText());
}
- epr.setReferenceProperties(referenceProperties);
+ epr.setReferenceParameters(referenceProperties);
return epr;
}
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/wsat/completion/CompletionCoordinatorPortTypeRawXMLStub.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/wsat/completion/CompletionCoordinatorPortTypeRawXMLStub.java?rev=312797&r1=312796&r2=312797&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/wsat/completion/CompletionCoordinatorPortTypeRawXMLStub.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/wsat/completion/CompletionCoordinatorPortTypeRawXMLStub.java Mon Oct 10 20:37:33 2005
@@ -2,6 +2,7 @@
import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.description.OutOnlyOperationDescription;
import org.apache.kandula.Constants;
import org.apache.kandula.faults.AbstractKandulaException;
import org.apache.kandula.wsat.AbstractATNotifierStub;
@@ -21,13 +22,13 @@
org.apache.axis2.description.OperationDescription operation;
operations = new org.apache.axis2.description.OperationDescription[2];
- operation = new org.apache.axis2.description.OperationDescription();
+ operation = new OutOnlyOperationDescription();
operation.setName(new javax.xml.namespace.QName(Constants.WS_AT,
"commitOperation"));
operations[0] = operation;
_service.addOperation(operation);
- operation = new org.apache.axis2.description.OperationDescription();
+ operation = new OutOnlyOperationDescription();
operation.setName(new javax.xml.namespace.QName(Constants.WS_AT,
"rollbackOperation"));
operations[1] = operation;
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/wsat/completion/CompletionInitiatorPortTypeRawXMLStub.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/wsat/completion/CompletionInitiatorPortTypeRawXMLStub.java?rev=312797&r1=312796&r2=312797&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/wsat/completion/CompletionInitiatorPortTypeRawXMLStub.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/wsat/completion/CompletionInitiatorPortTypeRawXMLStub.java Mon Oct 10 20:37:33 2005
@@ -3,6 +3,7 @@
import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.deployment.DeploymentException;
+import org.apache.axis2.description.OutOnlyOperationDescription;
import org.apache.kandula.Constants;
import org.apache.kandula.faults.AbstractKandulaException;
import org.apache.kandula.faults.KandulaGeneralException;
@@ -23,13 +24,13 @@
org.apache.axis2.description.OperationDescription operation;
operations = new org.apache.axis2.description.OperationDescription[2];
- operation = new org.apache.axis2.description.OperationDescription();
+ operation = new OutOnlyOperationDescription();
operation.setName(new javax.xml.namespace.QName(Constants.WS_AT,
"committedOperation"));
operations[0] = operation;
_service.addOperation(operation);
- operation = new org.apache.axis2.description.OperationDescription();
+ operation = new OutOnlyOperationDescription();
operation.setName(new javax.xml.namespace.QName(Constants.WS_AT,
"abortedOperation"));
operations[1] = operation;
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/wsat/completion/CompletionInitiatorServiceListener.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/wsat/completion/CompletionInitiatorServiceListener.java?rev=312797&r1=312796&r2=312797&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/wsat/completion/CompletionInitiatorServiceListener.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/wsat/completion/CompletionInitiatorServiceListener.java Mon Oct 10 20:37:33 2005
@@ -21,6 +21,7 @@
import javax.xml.namespace.QName;
import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.description.InOnlyOperationDescription;
import org.apache.axis2.description.ParameterImpl;
import org.apache.axis2.description.ServiceDescription;
import org.apache.axis2.receivers.AbstractMessageReceiver;
@@ -68,7 +69,7 @@
"committedOperation");
org.apache.axis2.description.OperationDescription committedOperationDesc;
String committedMapping = Constants.WS_AT_COMMITTED;
- committedOperationDesc = new org.apache.axis2.description.OperationDescription();
+ committedOperationDesc = new InOnlyOperationDescription();
committedOperationDesc.setName(committedOperationName);
committedOperationDesc
.setMessageReceiver(new RawXMLINOnlyMessageReceiver());
@@ -80,7 +81,7 @@
"abortedOperation");
org.apache.axis2.description.OperationDescription abortedOperationDesc;
String abortedMapping = Constants.WS_AT_ABORTED;
- abortedOperationDesc = new org.apache.axis2.description.OperationDescription();
+ abortedOperationDesc = new InOnlyOperationDescription();
abortedOperationDesc.setName(abortedOperationName);
abortedOperationDesc
.setMessageReceiver(new RawXMLINOnlyMessageReceiver());
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/CoordinatorPortTypeRawXMLSkeleton.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/CoordinatorPortTypeRawXMLSkeleton.java?rev=312797&r1=312796&r2=312797&view=diff
==============================================================================
--- 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 Mon Oct 10 20:37:33 2005
@@ -21,9 +21,9 @@
public OMElement preparedOperation(OMElement requestElement)
throws AxisFault {
String activityId = Coordinator.ACTIVITY_ID;
- ATCoordinator coordinator= new ATCoordinator();
+ ATCoordinator coordinator = new ATCoordinator();
try {
- coordinator.countVote(activityId,Vote.PREPARED,null);
+ coordinator.countVote(activityId, Vote.PREPARED, null);
} catch (AbstractKandulaException e) {
AxisFault fault = new AxisFault(e);
fault.setFaultCode(e.getFaultCode());
@@ -39,9 +39,9 @@
public OMElement abortedOperation(OMElement requestElement)
throws AxisFault {
String activityId = Coordinator.ACTIVITY_ID;
- ATCoordinator coordinator= new ATCoordinator();
+ ATCoordinator coordinator = new ATCoordinator();
try {
- coordinator.countVote(activityId,Vote.ABORT,null);
+ coordinator.countVote(activityId, Vote.ABORT, null);
} catch (AbstractKandulaException e) {
AxisFault fault = new AxisFault(e);
fault.setFaultCode(e.getFaultCode());
@@ -57,9 +57,9 @@
public OMElement readOnlyOperation(OMElement requestElement)
throws AxisFault {
String activityId = Coordinator.ACTIVITY_ID;
- ATCoordinator coordinator= new ATCoordinator();
+ ATCoordinator coordinator = new ATCoordinator();
try {
- coordinator.countVote(activityId,Vote.READ_ONLY,null);
+ coordinator.countVote(activityId, Vote.READ_ONLY, null);
} catch (AbstractKandulaException e) {
AxisFault fault = new AxisFault(e);
fault.setFaultCode(e.getFaultCode());
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/CoordinatorPortTypeRawXMLStub.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/CoordinatorPortTypeRawXMLStub.java?rev=312797&r1=312796&r2=312797&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/CoordinatorPortTypeRawXMLStub.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/CoordinatorPortTypeRawXMLStub.java Mon Oct 10 20:37:33 2005
@@ -1,6 +1,7 @@
package org.apache.kandula.wsat.twopc;
import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.description.OutOnlyOperationDescription;
import org.apache.kandula.Constants;
import org.apache.kandula.faults.AbstractKandulaException;
import org.apache.kandula.wsat.AbstractATNotifierStub;
@@ -19,29 +20,29 @@
org.apache.axis2.description.OperationDescription operation;
operations = new org.apache.axis2.description.OperationDescription[5];
- operation = new org.apache.axis2.description.OperationDescription();
+ operation = new OutOnlyOperationDescription();
operation.setName(new javax.xml.namespace.QName(Constants.WS_AT,
"PreparedOperation"));
operations[0] = operation;
_service.addOperation(operation);
- operation = new org.apache.axis2.description.OperationDescription();
+ operation = new OutOnlyOperationDescription();
operation.setName(new javax.xml.namespace.QName(Constants.WS_AT,
"AbortedOperation"));
operations[1] = operation;
_service.addOperation(operation);
- operation = new org.apache.axis2.description.OperationDescription();
+ operation = new OutOnlyOperationDescription();
operation.setName(new javax.xml.namespace.QName(Constants.WS_AT,
"ReadOnlyOperation"));
operations[2] = operation;
_service.addOperation(operation);
- operation = new org.apache.axis2.description.OperationDescription();
+ operation = new OutOnlyOperationDescription();
operation.setName(new javax.xml.namespace.QName(Constants.WS_AT,
"CommittedOperation"));
operations[3] = operation;
_service.addOperation(operation);
- operation = new org.apache.axis2.description.OperationDescription();
+ operation = new OutOnlyOperationDescription();
operation.setName(new javax.xml.namespace.QName(Constants.WS_AT,
"ReplayOperation"));
operations[4] = operation;
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/ParticipantPortTypeRawXMLSkeleton.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/ParticipantPortTypeRawXMLSkeleton.java?rev=312797&r1=312796&r2=312797&view=diff
==============================================================================
--- 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 Mon Oct 10 20:37:33 2005
@@ -1,7 +1,14 @@
package org.apache.kandula.wsat.twopc;
+import org.apache.axis2.AxisFault;
import org.apache.axis2.context.MessageContext;
import org.apache.axis2.om.OMElement;
+import org.apache.kandula.Constants;
+import org.apache.kandula.context.AbstractContext;
+import org.apache.kandula.faults.InvalidStateException;
+import org.apache.kandula.participant.ParticipantTransactionManager;
+import org.apache.kandula.storage.StorageFactory;
+import org.apache.kandula.storage.Store;
/*
* Copyright 2004,2005 The Apache Software Foundation.
@@ -32,7 +39,18 @@
this.msgContext = context;
}
- public OMElement prepareOperation(OMElement requestEle) {
+ public OMElement prepareOperation(OMElement requestEle) throws AxisFault {
+ OMElement header = msgContext.getEnvelope().getHeader();
+ String requesterID = header.getFirstChildWithName(
+ Constants.REQUESTER_ID_PARAMETER).getText();
+ Store store = StorageFactory.getInstance().getStore();
+ AbstractContext context = (AbstractContext)store.get(requesterID);
+ ParticipantTransactionManager txManager = new ParticipantTransactionManager();
+ try {
+ txManager.prepare(context);
+ } catch (InvalidStateException e) {
+ throw new AxisFault(e);
+ }
return null;
}
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/ParticipantPortTypeRawXMLStub.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/ParticipantPortTypeRawXMLStub.java?rev=312797&r1=312796&r2=312797&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/ParticipantPortTypeRawXMLStub.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/ParticipantPortTypeRawXMLStub.java Mon Oct 10 20:37:33 2005
@@ -3,6 +3,7 @@
import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.deployment.DeploymentException;
+import org.apache.axis2.description.OutOnlyOperationDescription;
import org.apache.kandula.Constants;
import org.apache.kandula.faults.AbstractKandulaException;
import org.apache.kandula.faults.KandulaGeneralException;
@@ -22,19 +23,19 @@
org.apache.axis2.description.OperationDescription operation;
operations = new org.apache.axis2.description.OperationDescription[3];
- operation = new org.apache.axis2.description.OperationDescription();
+ operation = new OutOnlyOperationDescription();
operation.setName(new javax.xml.namespace.QName(Constants.WS_AT,
"prepareOperation"));
operations[0] = operation;
_service.addOperation(operation);
- operation = new org.apache.axis2.description.OperationDescription();
+ operation = new OutOnlyOperationDescription();
operation.setName(new javax.xml.namespace.QName(Constants.WS_AT,
- "committOperation"));
+ "commitOperation"));
operations[1] = operation;
_service.addOperation(operation);
- operation = new org.apache.axis2.description.OperationDescription();
+ operation = new OutOnlyOperationDescription();
operation.setName(new javax.xml.namespace.QName(Constants.WS_AT,
"rollbackOperation"));
operations[2] = operation;
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/ParticipantServiceListener.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/ParticipantServiceListener.java?rev=312797&r1=312796&r2=312797&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/ParticipantServiceListener.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/ParticipantServiceListener.java Mon Oct 10 20:37:33 2005
@@ -21,6 +21,7 @@
import javax.xml.namespace.QName;
import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.description.InOnlyOperationDescription;
import org.apache.axis2.description.ParameterImpl;
import org.apache.axis2.description.ServiceDescription;
import org.apache.axis2.receivers.AbstractMessageReceiver;
@@ -67,7 +68,7 @@
"prepareOperation");
org.apache.axis2.description.OperationDescription prepareOperationDesc;
String prepareMapping = Constants.WS_AT_PREPARE;
- prepareOperationDesc = new org.apache.axis2.description.OperationDescription();
+ prepareOperationDesc = new InOnlyOperationDescription();
prepareOperationDesc.setName(prepareOperationName);
prepareOperationDesc
.setMessageReceiver(new RawXMLINOnlyMessageReceiver());
@@ -79,7 +80,7 @@
"commitOperation");
org.apache.axis2.description.OperationDescription commitOperationDesc;
String commitMapping = Constants.WS_AT_COMMIT;
- commitOperationDesc = new org.apache.axis2.description.OperationDescription();
+ commitOperationDesc = new InOnlyOperationDescription();
commitOperationDesc.setName(commitOperationName);
commitOperationDesc
.setMessageReceiver(new RawXMLINOnlyMessageReceiver());
@@ -91,7 +92,7 @@
"rollbackOperation");
org.apache.axis2.description.OperationDescription rollbackOperationDesc;
String rollbackMapping = Constants.WS_AT_ROLLBACK;
- rollbackOperationDesc = new org.apache.axis2.description.OperationDescription();
+ rollbackOperationDesc = new InOnlyOperationDescription();
rollbackOperationDesc.setName(rollbackOperationName);
rollbackOperationDesc
.setMessageReceiver(new RawXMLINOnlyMessageReceiver());
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/ActivationCoordinatorPortTypeRawXMLStub.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/ActivationCoordinatorPortTypeRawXMLStub.java?rev=312797&r1=312796&r2=312797&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/ActivationCoordinatorPortTypeRawXMLStub.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/ActivationCoordinatorPortTypeRawXMLStub.java Mon Oct 10 20:37:33 2005
@@ -1,159 +1,160 @@
-/*
- * 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.wscoor;
-
-import java.io.IOException;
-
-import javax.xml.namespace.QName;
-
-import org.apache.axis2.addressing.AddressingConstants;
-import org.apache.axis2.addressing.AnyContentType;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.clientapi.MessageSender;
-import org.apache.axis2.description.ParameterImpl;
-import org.apache.axis2.description.ServiceDescription;
-import org.apache.axis2.om.OMAbstractFactory;
-import org.apache.axis2.om.OMElement;
-import org.apache.axis2.om.OMNamespace;
-import org.apache.axis2.receivers.AbstractMessageReceiver;
-import org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver;
-import org.apache.kandula.Constants;
-import org.apache.kandula.utility.KandulaListener;
-
-/**
- * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
- */
-
-public class ActivationCoordinatorPortTypeRawXMLStub extends
- org.apache.axis2.clientapi.Stub {
-
- public static final String AXIS2_HOME = ".";
-
- protected static org.apache.axis2.description.OperationDescription[] operations;
-
- static {
-
- //creating the Service
- _service = new org.apache.axis2.description.ServiceDescription(
- new javax.xml.namespace.QName(
- "http://schemas.xmlsoap.org/ws/2003/09/wscoor",
- "ActivationCoordinatorPortType"));
-
- //creating the operations
- org.apache.axis2.description.OperationDescription operationDesc;
- operations = new org.apache.axis2.description.OperationDescription[1];
-
- operationDesc = new org.apache.axis2.description.OperationDescription();
- operationDesc.setName(new javax.xml.namespace.QName(
- "http://schemas.xmlsoap.org/ws/2003/09/wscoor",
- "CreateCoordinationContextOperation"));
- operations[0] = operationDesc;
- _service.addOperation(operationDesc);
-
- }
-
- /**
- * Constructor
- */
- public ActivationCoordinatorPortTypeRawXMLStub(String axis2Home,
- EndpointReference targetEndpoint) throws java.lang.Exception {
- this.toEPR = targetEndpoint;
- //creating the configuration
- _configurationContext = new org.apache.axis2.context.ConfigurationContextFactory()
- .buildClientConfigurationContext(axis2Home);
-
- _configurationContext.getAxisConfiguration().addService(_service);
- _serviceContext = _service.getParent().getServiceGroupContext(
- _configurationContext).getServiceContext(
- _service.getName().getLocalPart());
-
- }
-
- public void createCoordinationContextOperation(String coordinationType,
- String id) throws IOException {
-
- EndpointReference replyToEpr;
-
- org.apache.axis2.context.MessageContext messageContext = getMessageContext();
- messageContext.setProperty(AddressingConstants.WS_ADDRESSING_VERSION,
- AddressingConstants.Submission.WSA_NAMESPACE);
- org.apache.axis2.soap.SOAPEnvelope env = createSOAPEnvelope(coordinationType);
- messageContext.setEnvelope(env);
-
- replyToEpr = setupListener();
- AnyContentType refProperties = new AnyContentType();
- refProperties.addReferenceValue(new QName(
- "http://ws.apache.org/kandula", "id"), id);
- replyToEpr.setReferenceParameters(refProperties);
-
- MessageSender messageSender = new MessageSender(_serviceContext);
- messageSender.setReplyTo(replyToEpr);
- messageSender.setTo(this.toEPR);
- messageSender
- .setWsaAction(Constants.WS_COOR_CREATE_COORDINATIONCONTEXT);
- messageSender
- .setSenderTransport(org.apache.axis2.Constants.TRANSPORT_HTTP);
- messageSender.send(operations[0], messageContext);
-
- }
-
- private org.apache.axis2.soap.SOAPEnvelope createSOAPEnvelope(
- String coordinationType) {
- org.apache.axis2.soap.SOAPEnvelope env = super.createEnvelope();
- org.apache.axis2.soap.SOAPFactory factory = OMAbstractFactory
- .getSOAP12Factory();
- OMNamespace wsCoor = factory.createOMNamespace(Constants.WS_COOR,
- "wscoor");
- OMElement request = factory.createOMElement(
- "CreateCoordinationContext", wsCoor);
- OMElement coorType = factory
- .createOMElement("CoordinationType", wsCoor);
- coorType.setText(coordinationType);
- request.addChild(coorType);
- env.getBody().addChild(request);
- return env;
- }
-
- private EndpointReference setupListener() throws IOException {
- QName serviceName = new QName("ActivationRequesterPortType");
- QName operationName = new QName(Constants.WS_COOR,
- "createCoordinationContextResponseOperation");
- org.apache.axis2.description.OperationDescription responseOperationDesc;
- String className = ActivationRequesterPortTypeRawXMLSkeleton.class
- .getName();
- String mapping = Constants.WS_COOR_CREATE_COORDINATIONCONTEXT_RESPONSE;
-
- KandulaListener listener = KandulaListener.getInstance();
- ServiceDescription service = new ServiceDescription(serviceName);
- service.addParameter(new ParameterImpl(
- AbstractMessageReceiver.SERVICE_CLASS, className));
- service.setFileName(className);
-
- responseOperationDesc = new org.apache.axis2.description.OperationDescription();
- responseOperationDesc.setName(operationName);
- responseOperationDesc
- .setMessageReceiver(new RawXMLINOnlyMessageReceiver());
-
- // Adding the WSA Action mapping to the operation
- service.addMapping(mapping, responseOperationDesc);
- service.addOperation(responseOperationDesc);
- listener.addService(service);
- listener.start();
- return new EndpointReference(listener.getHost()
- + serviceName.getLocalPart());
- }
+/*
+ * 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.wscoor;
+
+import java.io.IOException;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axis2.addressing.AddressingConstants;
+import org.apache.axis2.addressing.AnyContentType;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.clientapi.MessageSender;
+import org.apache.axis2.description.InOnlyOperationDescription;
+import org.apache.axis2.description.OutInOperationDescription;
+import org.apache.axis2.description.ParameterImpl;
+import org.apache.axis2.description.ServiceDescription;
+import org.apache.axis2.om.OMAbstractFactory;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMNamespace;
+import org.apache.axis2.receivers.AbstractMessageReceiver;
+import org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver;
+import org.apache.kandula.Constants;
+import org.apache.kandula.utility.KandulaListener;
+
+/**
+ * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
+ */
+
+public class ActivationCoordinatorPortTypeRawXMLStub extends
+ org.apache.axis2.clientapi.Stub {
+
+ public static final String AXIS2_HOME = ".";
+
+ protected static org.apache.axis2.description.OperationDescription[] operations;
+
+ static {
+
+ //creating the Service
+ _service = new org.apache.axis2.description.ServiceDescription(
+ new javax.xml.namespace.QName(
+ "http://schemas.xmlsoap.org/ws/2003/09/wscoor",
+ "ActivationCoordinatorPortType"));
+
+ //creating the operations
+ org.apache.axis2.description.OperationDescription operationDesc;
+ operations = new org.apache.axis2.description.OperationDescription[1];
+
+ operationDesc = new OutInOperationDescription();
+ operationDesc.setName(new javax.xml.namespace.QName(
+ "http://schemas.xmlsoap.org/ws/2003/09/wscoor",
+ "CreateCoordinationContextOperation"));
+ operations[0] = operationDesc;
+ _service.addOperation(operationDesc);
+
+ }
+
+ /**
+ * Constructor
+ */
+ public ActivationCoordinatorPortTypeRawXMLStub(String axis2Home,
+ EndpointReference targetEndpoint) throws java.lang.Exception {
+ this.toEPR = targetEndpoint;
+ //creating the configuration
+ _configurationContext = new org.apache.axis2.context.ConfigurationContextFactory()
+ .buildClientConfigurationContext(axis2Home);
+
+ _configurationContext.getAxisConfiguration().addService(_service);
+ _serviceContext = _service.getParent().getServiceGroupContext(
+ _configurationContext).getServiceContext(
+ _service.getName().getLocalPart());
+
+ }
+
+ public void createCoordinationContextOperation(String coordinationType,
+ String id) throws IOException {
+
+ EndpointReference replyToEpr;
+
+ org.apache.axis2.context.MessageContext messageContext = getMessageContext();
+ messageContext.setProperty(AddressingConstants.WS_ADDRESSING_VERSION,
+ AddressingConstants.Submission.WSA_NAMESPACE);
+ org.apache.axis2.soap.SOAPEnvelope env = createSOAPEnvelope(coordinationType);
+ messageContext.setEnvelope(env);
+
+ replyToEpr = setupListener();
+ AnyContentType refParameters = new AnyContentType();
+ refParameters.addReferenceValue(Constants.REQUESTER_ID_PARAMETER, id);
+ replyToEpr.setReferenceParameters(refParameters);
+
+ MessageSender messageSender = new MessageSender(_serviceContext);
+ messageSender.setReplyTo(replyToEpr);
+ messageSender.setTo(this.toEPR);
+ messageSender
+ .setWsaAction(Constants.WS_COOR_CREATE_COORDINATIONCONTEXT);
+ messageSender
+ .setSenderTransport(org.apache.axis2.Constants.TRANSPORT_HTTP);
+ messageSender.send(operations[0], messageContext);
+
+ }
+
+ private org.apache.axis2.soap.SOAPEnvelope createSOAPEnvelope(
+ String coordinationType) {
+ org.apache.axis2.soap.SOAPEnvelope env = super.createEnvelope();
+ org.apache.axis2.soap.SOAPFactory factory = OMAbstractFactory
+ .getSOAP12Factory();
+ OMNamespace wsCoor = factory.createOMNamespace(Constants.WS_COOR,
+ "wscoor");
+ OMElement request = factory.createOMElement(
+ "CreateCoordinationContext", wsCoor);
+ OMElement coorType = factory
+ .createOMElement("CoordinationType", wsCoor);
+ coorType.setText(coordinationType);
+ request.addChild(coorType);
+ env.getBody().addChild(request);
+ return env;
+ }
+
+ private EndpointReference setupListener() throws IOException {
+ QName serviceName = new QName("ActivationRequesterPortType");
+ QName operationName = new QName(Constants.WS_COOR,
+ "createCoordinationContextResponseOperation");
+ org.apache.axis2.description.OperationDescription responseOperationDesc;
+ String className = ActivationRequesterPortTypeRawXMLSkeleton.class
+ .getName();
+ String mapping = Constants.WS_COOR_CREATE_COORDINATIONCONTEXT_RESPONSE;
+
+ KandulaListener listener = KandulaListener.getInstance();
+ ServiceDescription service = new ServiceDescription(serviceName);
+ service.addParameter(new ParameterImpl(
+ AbstractMessageReceiver.SERVICE_CLASS, className));
+ service.setFileName(className);
+
+ responseOperationDesc = new InOnlyOperationDescription();
+ responseOperationDesc.setName(operationName);
+ responseOperationDesc
+ .setMessageReceiver(new RawXMLINOnlyMessageReceiver());
+
+ // Adding the WSA Action mapping to the operation
+ service.addMapping(mapping, responseOperationDesc);
+ service.addOperation(responseOperationDesc);
+ listener.addService(service);
+ listener.start();
+ return new EndpointReference(listener.getHost()
+ + serviceName.getLocalPart());
+ }
}
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/ActivationPortTypeRawXMLAsyncMessageReceiver.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/ActivationPortTypeRawXMLAsyncMessageReceiver.java?rev=312797&r1=312796&r2=312797&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/ActivationPortTypeRawXMLAsyncMessageReceiver.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/ActivationPortTypeRawXMLAsyncMessageReceiver.java Mon Oct 10 20:37:33 2005
@@ -29,11 +29,8 @@
public void invokeBusinessLogic(
org.apache.axis2.context.MessageContext msgContext,
- org.apache.axis2.context.MessageContext newMsgContext/*
- * ,
- * ServerCallback
- * callback
- */) throws org.apache.axis2.AxisFault {
+ org.apache.axis2.context.MessageContext newMsgContext)
+ throws org.apache.axis2.AxisFault {
try {
@@ -60,7 +57,7 @@
//doc style
response = skel
.createCoordinationContextOperation((org.apache.axis2.om.OMElement) msgContext
- .getEnvelope().getBody().getFirstChild()
+ .getEnvelope().getBody().getFirstElement()
.detach());
//Create a default envelop
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/ActivationRequesterPortTypeRawXMLSkeleton.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/ActivationRequesterPortTypeRawXMLSkeleton.java?rev=312797&r1=312796&r2=312797&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/ActivationRequesterPortTypeRawXMLSkeleton.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/ActivationRequesterPortTypeRawXMLSkeleton.java Mon Oct 10 20:37:33 2005
@@ -2,9 +2,9 @@
import org.apache.axis2.context.MessageContext;
import org.apache.axis2.om.OMElement;
+import org.apache.kandula.Constants;
import org.apache.kandula.context.AbstractContext;
import org.apache.kandula.context.coordination.CoordinationContext;
-import org.apache.kandula.initiator.TransactionManager;
import org.apache.kandula.storage.StorageFactory;
/*
@@ -40,11 +40,14 @@
OMElement responseElement) {
OMElement response = responseElement.getFirstElement();
if ("CoordinationContext".equals(response.getLocalName())) {
- msgContext.getMessageInformationHeaders().getReferenceParameters();
+ OMElement header = msgContext.getEnvelope().getHeader();
+ String requesterID = header.getFirstChildWithName(
+ Constants.REQUESTER_ID_PARAMETER).getText();
+ //msgContext.getMessageInformationHeaders().getReferenceParameters();
CoordinationContext coordinationContext = CoordinationContext.Factory
.newContext(response);
AbstractContext context = (AbstractContext) StorageFactory
- .getInstance().getStore().get(TransactionManager.tempID);
+ .getInstance().getStore().get(requesterID);
context.setCoordinationContext(coordinationContext);
}
return null;
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/RegistrationCoordinatorPortTypeRawXMLStub.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/RegistrationCoordinatorPortTypeRawXMLStub.java?rev=312797&r1=312796&r2=312797&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/RegistrationCoordinatorPortTypeRawXMLStub.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/RegistrationCoordinatorPortTypeRawXMLStub.java Mon Oct 10 20:37:33 2005
@@ -4,9 +4,12 @@
import javax.xml.namespace.QName;
+import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.AnyContentType;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.clientapi.MessageSender;
+import org.apache.axis2.description.InOnlyOperationDescription;
+import org.apache.axis2.description.OutInOperationDescription;
import org.apache.axis2.description.ParameterImpl;
import org.apache.axis2.description.ServiceDescription;
import org.apache.axis2.om.OMAbstractFactory;
@@ -15,6 +18,8 @@
import org.apache.axis2.receivers.AbstractMessageReceiver;
import org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver;
import org.apache.kandula.Constants;
+import org.apache.kandula.faults.AbstractKandulaException;
+import org.apache.kandula.faults.KandulaGeneralException;
import org.apache.kandula.utility.KandulaListener;
import org.apache.kandula.utility.KandulaUtils;
@@ -36,7 +41,7 @@
org.apache.axis2.description.OperationDescription __operation;
_operations = new org.apache.axis2.description.OperationDescription[1];
- __operation = new org.apache.axis2.description.OperationDescription();
+ __operation = new OutInOperationDescription();
__operation.setName(new javax.xml.namespace.QName(
"http://schemas.xmlsoap.org/ws/2003/09/wscoor",
"RegisterOperation"));
@@ -49,12 +54,18 @@
* Constructor
*/
public RegistrationCoordinatorPortTypeRawXMLStub(String axis2Home,
- EndpointReference targetEndpoint) throws java.lang.Exception {
+ EndpointReference targetEndpoint) throws AbstractKandulaException {
this.toEPR = targetEndpoint;
- //creating the configuration
- _configurationContext = new org.apache.axis2.context.ConfigurationContextFactory()
- .buildClientConfigurationContext(axis2Home);
- _configurationContext.getAxisConfiguration().addService(_service);
+ try {
+ //creating the configuration
+ _configurationContext = new org.apache.axis2.context.ConfigurationContextFactory()
+ .buildClientConfigurationContext(axis2Home);
+
+ _configurationContext.getAxisConfiguration().addService(_service);
+ } catch (AxisFault e1) {
+ throw new KandulaGeneralException(e1);
+ }
+
_serviceContext = _service.getParent().getServiceGroupContext(
_configurationContext).getServiceContext(
_service.getName().getLocalPart());
@@ -71,10 +82,9 @@
messageContext.setEnvelope(env);
replyToEpr = setupListener();
- AnyContentType refProperties = new AnyContentType();
- refProperties.addReferenceValue(new QName(
- "http://ws.apache.org/kandula", id), id);
- replyToEpr.setReferenceProperties(refProperties);
+ AnyContentType refParameters = new AnyContentType();
+ refParameters.addReferenceValue(Constants.REQUESTER_ID_PARAMETER, id);
+ replyToEpr.setReferenceParameters(refParameters);
MessageSender messageSender = new MessageSender(_serviceContext);
messageSender.setReplyTo(replyToEpr);
@@ -122,7 +132,7 @@
AbstractMessageReceiver.SERVICE_CLASS, className));
service.setFileName(className);
- responseOperationDesc = new org.apache.axis2.description.OperationDescription();
+ responseOperationDesc = new InOnlyOperationDescription();
responseOperationDesc.setName(operationName);
responseOperationDesc
.setMessageReceiver(new RawXMLINOnlyMessageReceiver());
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/RegistrationPortTypeRawXMLAsyncMessageReceiver.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/RegistrationPortTypeRawXMLAsyncMessageReceiver.java?rev=312797&r1=312796&r2=312797&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/RegistrationPortTypeRawXMLAsyncMessageReceiver.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/RegistrationPortTypeRawXMLAsyncMessageReceiver.java Mon Oct 10 20:37:33 2005
@@ -29,11 +29,8 @@
public void invokeBusinessLogic(
org.apache.axis2.context.MessageContext msgContext,
- org.apache.axis2.context.MessageContext newMsgContext/*
- * ,
- * ServerCallback
- * callback
- */) throws org.apache.axis2.AxisFault {
+ org.apache.axis2.context.MessageContext newMsgContext)
+ throws org.apache.axis2.AxisFault {
try {
@@ -60,7 +57,7 @@
//doc style
response = skel
.registerOperation((org.apache.axis2.om.OMElement) msgContext
- .getEnvelope().getBody().getFirstChild()
+ .getEnvelope().getBody().getFirstElement()
.detach());
//Create a default envelop
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/RegistrationRequesterPortTypeRawXMLSkeleton.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/RegistrationRequesterPortTypeRawXMLSkeleton.java?rev=312797&r1=312796&r2=312797&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/RegistrationRequesterPortTypeRawXMLSkeleton.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/RegistrationRequesterPortTypeRawXMLSkeleton.java Mon Oct 10 20:37:33 2005
@@ -3,9 +3,9 @@
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.context.MessageContext;
import org.apache.axis2.om.OMElement;
+import org.apache.kandula.Constants;
import org.apache.kandula.context.AbstractContext;
import org.apache.kandula.context.at.ATActivityContext;
-import org.apache.kandula.initiator.TransactionManager;
import org.apache.kandula.storage.StorageFactory;
import org.apache.kandula.utility.KandulaUtils;
@@ -41,10 +41,13 @@
public OMElement registerResponseOperation(OMElement responseElement) {
OMElement response = responseElement.getFirstElement();
if ("CoordinatorProtocolService".equals(response.getLocalName())) {
+ OMElement header = msgContext.getEnvelope().getHeader();
+ String requesterID = header.getFirstChildWithName(
+ Constants.REQUESTER_ID_PARAMETER).getText();
EndpointReference coordinatorService = KandulaUtils
.endpointFromOM(response.getFirstElement());
AbstractContext context = (AbstractContext) StorageFactory
- .getInstance().getStore().get(TransactionManager.tempID);
+ .getInstance().getStore().get(requesterID);
context.setProperty(ATActivityContext.COORDINATION_EPR,
coordinatorService);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: kandula-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: kandula-dev-help@ws.apache.org