Rearranging packages
Introducing seperate KandulaConfiguration.java to handle configuration
EndpointReferenceFactory.java cleaned
diff --git a/project.xml b/project.xml
index 0b49f02..a9d185c 100644
--- a/project.xml
+++ b/project.xml
@@ -192,7 +192,7 @@
<dependency>
<groupId>ws-commons</groupId>
<artifactId>XmlSchema</artifactId>
- <version>SNAPSHOT</version>
+ <version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>axis</groupId>
diff --git a/src/endpoints.conf b/src/endpoints.conf
index 62021cf..59aabbe 100644
--- a/src/endpoints.conf
+++ b/src/endpoints.conf
@@ -7,4 +7,4 @@
PARTICIPANT_AXIS2_CONF=target/testing-repository/axis2.xml
KANDULA_LISTENER_REPOSITORY=target/initiator-repository
KANDULA_LISTENER_AXIS2XML=target/initiator-repository/axis2.xml
-KANDULA_LISTENER_PORT=5050
\ No newline at end of file
+KANDULA_LISTENER_PORT=5050
diff --git a/src/org/apache/kandula/context/AbstractContext.java b/src/org/apache/kandula/context/AbstractContext.java
index 0a4ed79..6147826 100644
--- a/src/org/apache/kandula/context/AbstractContext.java
+++ b/src/org/apache/kandula/context/AbstractContext.java
@@ -20,8 +20,6 @@
import org.apache.axis2.addressing.EndpointReference;
import org.apache.kandula.Status;
-import org.apache.kandula.context.coordination.CoordinationContext;
-import org.apache.kandula.utility.EPRHandlingUtils;
import org.apache.kandula.utility.EndpointReferenceFactory;
/**
@@ -51,7 +49,7 @@
public AbstractContext(String coordinationType) {
propertyBag = new HashMap();
- activityID = EPRHandlingUtils.getRandomStringOf18Characters();
+ activityID = EndpointReferenceFactory.getRandomStringOf18Characters();
EndpointReference registrationEpr = EndpointReferenceFactory
.getInstance().getRegistrationEndpoint(activityID);
coordinationContext = CoordinationContext.Factory.newContext(
diff --git a/src/org/apache/kandula/context/ContextFactory.java b/src/org/apache/kandula/context/ContextFactory.java
index 51e84c5..02cc98f 100644
--- a/src/org/apache/kandula/context/ContextFactory.java
+++ b/src/org/apache/kandula/context/ContextFactory.java
@@ -17,8 +17,7 @@
package org.apache.kandula.context;
import org.apache.axis2.addressing.EndpointReference;
-import org.apache.kandula.context.at.ATActivityContext;
-import org.apache.kandula.context.coordination.CoordinationContext;
+import org.apache.kandula.context.impl.ATActivityContext;
import org.apache.kandula.faults.InvalidProtocolException;
/**
@@ -40,6 +39,13 @@
}
}
+ /**
+ * To be used by the initaitor TxManager to create the initial context
+ * @param protocol
+ * @param activationEPR
+ * @return
+ * @throws InvalidProtocolException
+ */
public AbstractContext createActivity(String protocol,
EndpointReference activationEPR) throws InvalidProtocolException {
if (org.apache.kandula.Constants.WS_AT.equalsIgnoreCase(protocol)) {
diff --git a/src/org/apache/kandula/coordinator/Coordinator.java b/src/org/apache/kandula/coordinator/Coordinator.java
index 8558550..1a76b21 100644
--- a/src/org/apache/kandula/coordinator/Coordinator.java
+++ b/src/org/apache/kandula/coordinator/Coordinator.java
@@ -19,7 +19,7 @@
import org.apache.axis2.addressing.EndpointReference;
import org.apache.kandula.context.AbstractContext;
import org.apache.kandula.context.ContextFactory;
-import org.apache.kandula.context.coordination.CoordinationContext;
+import org.apache.kandula.context.CoordinationContext;
import org.apache.kandula.faults.AbstractKandulaException;
import org.apache.kandula.storage.StorageFactory;
import org.apache.kandula.storage.Store;
diff --git a/src/org/apache/kandula/coordinator/at/ATCoordinator.java b/src/org/apache/kandula/coordinator/at/ATCoordinator.java
index 5f78e8d..426b331 100644
--- a/src/org/apache/kandula/coordinator/at/ATCoordinator.java
+++ b/src/org/apache/kandula/coordinator/at/ATCoordinator.java
@@ -23,11 +23,10 @@
import org.apache.kandula.Status;
import org.apache.kandula.Status.CoordinatorStatus;
import org.apache.kandula.context.AbstractContext;
-import org.apache.kandula.context.at.ATActivityContext;
+import org.apache.kandula.context.impl.ATActivityContext;
import org.apache.kandula.coordinator.Registerable;
import org.apache.kandula.faults.AbstractKandulaException;
import org.apache.kandula.faults.InvalidStateException;
-import org.apache.kandula.participant.Participant;
import org.apache.kandula.participant.Vote;
import org.apache.kandula.storage.StorageFactory;
import org.apache.kandula.storage.Store;
@@ -216,7 +215,7 @@
atContext.unlock();
while (volatilePartipantIterator.hasNext()) {
atContext.countPreparing();
- stub.prepareOperation(((Participant) volatilePartipantIterator
+ stub.prepareOperation(((ATParticipantInformation) volatilePartipantIterator
.next()).getEpr());
}
}
@@ -225,7 +224,7 @@
public void countVote(String activityID, Vote vote, String enlistmentID)
throws AbstractKandulaException {
ATActivityContext context = (ATActivityContext) store.get(activityID);
- Participant participant = context.getParticipant(enlistmentID);
+ ATParticipantInformation participant = context.getParticipant(enlistmentID);
if (Vote.PREPARED.equals(vote)) {
participant.setStatus(Status.CoordinatorStatus.STATUS_PREPARED);
@@ -260,7 +259,7 @@
atContext.unlock();
while (durablePartipantIterator.hasNext()) {
atContext.countPreparing();
- stub.prepareOperation(((Participant) durablePartipantIterator
+ stub.prepareOperation(((ATParticipantInformation) durablePartipantIterator
.next()).getEpr());
}
}
@@ -284,7 +283,7 @@
atContext.unlock();
Iterator participants = atContext.getAll2PCParticipants();
while (participants.hasNext()) {
- Participant participant = (Participant) participants.next();
+ ATParticipantInformation participant = (ATParticipantInformation) participants.next();
if (!(Status.CoordinatorStatus.STATUS_READ_ONLY == participant
.getStatus())) {
stub.commitOperation(participant.getEpr());
@@ -313,7 +312,7 @@
while (participants.hasNext()) {
stub
- .rollbackOperation(((Participant) participants.next())
+ .rollbackOperation(((ATParticipantInformation) participants.next())
.getEpr());
}
CompletionInitiatorPortTypeRawXMLStub completionStub = new CompletionInitiatorPortTypeRawXMLStub(
diff --git a/src/org/apache/kandula/coordinator/at/ATSubCoordinator.java b/src/org/apache/kandula/coordinator/at/ATSubCoordinator.java
index 94b4c2d..88e0822 100644
--- a/src/org/apache/kandula/coordinator/at/ATSubCoordinator.java
+++ b/src/org/apache/kandula/coordinator/at/ATSubCoordinator.java
@@ -19,7 +19,7 @@
import org.apache.axis2.addressing.EndpointReference;
import org.apache.kandula.Constants;
import org.apache.kandula.context.AbstractContext;
-import org.apache.kandula.context.at.ATActivityContext;
+import org.apache.kandula.context.impl.ATActivityContext;
import org.apache.kandula.faults.AbstractKandulaException;
import org.apache.kandula.faults.InvalidProtocolException;
diff --git a/src/org/apache/kandula/faults/AlreadyRegisteredException.java b/src/org/apache/kandula/faults/AlreadyRegisteredException.java
index 809aaeb..806a918 100644
--- a/src/org/apache/kandula/faults/AlreadyRegisteredException.java
+++ b/src/org/apache/kandula/faults/AlreadyRegisteredException.java
@@ -21,6 +21,9 @@
*/
public class AlreadyRegisteredException extends AbstractKandulaException {
+
+ private static final long serialVersionUID = 354170092780305997L;
+
/**
*
*/
diff --git a/src/org/apache/kandula/faults/ContextRefusedException.java b/src/org/apache/kandula/faults/ContextRefusedException.java
index 4bf8918..67af922 100644
--- a/src/org/apache/kandula/faults/ContextRefusedException.java
+++ b/src/org/apache/kandula/faults/ContextRefusedException.java
@@ -22,6 +22,11 @@
public class ContextRefusedException extends AbstractKandulaException {
/**
+ *
+ */
+ private static final long serialVersionUID = -8743352104016426531L;
+
+ /**
*
*/
public ContextRefusedException() {
diff --git a/src/org/apache/kandula/faults/InvalidParameterException.java b/src/org/apache/kandula/faults/InvalidParameterException.java
index 416d201..4dc277b 100644
--- a/src/org/apache/kandula/faults/InvalidParameterException.java
+++ b/src/org/apache/kandula/faults/InvalidParameterException.java
@@ -22,6 +22,11 @@
public class InvalidParameterException extends AbstractKandulaException {
/**
+ *
+ */
+ private static final long serialVersionUID = -6973003681131477662L;
+
+ /**
*
*/
public InvalidParameterException() {
diff --git a/src/org/apache/kandula/faults/InvalidProtocolException.java b/src/org/apache/kandula/faults/InvalidProtocolException.java
index 028ae6a..8f79206 100644
--- a/src/org/apache/kandula/faults/InvalidProtocolException.java
+++ b/src/org/apache/kandula/faults/InvalidProtocolException.java
@@ -22,6 +22,11 @@
public class InvalidProtocolException extends AbstractKandulaException {
/**
+ *
+ */
+ private static final long serialVersionUID = -2145946140688935653L;
+
+ /**
*
*/
public InvalidProtocolException() {
diff --git a/src/org/apache/kandula/faults/InvalidStateException.java b/src/org/apache/kandula/faults/InvalidStateException.java
index d246552..c5b6ac1 100644
--- a/src/org/apache/kandula/faults/InvalidStateException.java
+++ b/src/org/apache/kandula/faults/InvalidStateException.java
@@ -22,6 +22,11 @@
public class InvalidStateException extends AbstractKandulaException {
/**
+ *
+ */
+ private static final long serialVersionUID = 2526517532679685749L;
+
+ /**
*
*/
public InvalidStateException() {
diff --git a/src/org/apache/kandula/faults/KandulaGeneralException.java b/src/org/apache/kandula/faults/KandulaGeneralException.java
index 91480da..e0c21cb 100644
--- a/src/org/apache/kandula/faults/KandulaGeneralException.java
+++ b/src/org/apache/kandula/faults/KandulaGeneralException.java
@@ -22,6 +22,11 @@
public class KandulaGeneralException extends AbstractKandulaException {
/**
+ *
+ */
+ private static final long serialVersionUID = 3605851255933308674L;
+
+ /**
*
*/
public KandulaGeneralException(Exception e) {
diff --git a/src/org/apache/kandula/faults/NoActivityException.java b/src/org/apache/kandula/faults/NoActivityException.java
index 7b02426..34f1f8c 100644
--- a/src/org/apache/kandula/faults/NoActivityException.java
+++ b/src/org/apache/kandula/faults/NoActivityException.java
@@ -22,6 +22,11 @@
public class NoActivityException extends AbstractKandulaException {
/**
+ *
+ */
+ private static final long serialVersionUID = -1625567169353147393L;
+
+ /**
*
*/
public NoActivityException() {
diff --git a/src/org/apache/kandula/initiator/ATInitiatorTransaction.java b/src/org/apache/kandula/initiator/ATInitiatorTransaction.java
index b46b082..17a94d2 100644
--- a/src/org/apache/kandula/initiator/ATInitiatorTransaction.java
+++ b/src/org/apache/kandula/initiator/ATInitiatorTransaction.java
@@ -17,7 +17,7 @@
package org.apache.kandula.initiator;
import org.apache.axis2.addressing.EndpointReference;
-import org.apache.kandula.context.coordination.CoordinationContext;
+import org.apache.kandula.context.CoordinationContext;
/**
* @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
diff --git a/src/org/apache/kandula/initiator/TransactionManager.java b/src/org/apache/kandula/initiator/TransactionManager.java
index 2971e93..02bc625 100644
--- a/src/org/apache/kandula/initiator/TransactionManager.java
+++ b/src/org/apache/kandula/initiator/TransactionManager.java
@@ -20,7 +20,7 @@
import org.apache.kandula.Status;
import org.apache.kandula.context.AbstractContext;
import org.apache.kandula.context.ContextFactory;
-import org.apache.kandula.context.at.ATActivityContext;
+import org.apache.kandula.context.impl.ATActivityContext;
import org.apache.kandula.faults.AbstractKandulaException;
import org.apache.kandula.faults.InvalidStateException;
import org.apache.kandula.storage.StorageFactory;
diff --git a/src/org/apache/kandula/initiator/TransactionOutHandler.java b/src/org/apache/kandula/initiator/TransactionOutHandler.java
index 598cd78..5c3714c 100644
--- a/src/org/apache/kandula/initiator/TransactionOutHandler.java
+++ b/src/org/apache/kandula/initiator/TransactionOutHandler.java
@@ -21,12 +21,14 @@
import org.apache.axis2.handlers.AbstractHandler;
import org.apache.kandula.Constants;
import org.apache.kandula.context.AbstractContext;
-import org.apache.kandula.context.coordination.CoordinationContext;
+import org.apache.kandula.context.CoordinationContext;
import org.apache.kandula.faults.AbstractKandulaException;
import org.apache.ws.commons.soap.SOAPHeader;
public class TransactionOutHandler extends AbstractHandler {
+ private static final long serialVersionUID = 4133392345837905499L;
+
public void invoke(MessageContext msgContext) throws AxisFault {
AbstractContext context;
diff --git a/src/org/apache/kandula/participant/Participant.java b/src/org/apache/kandula/participant/Participant.java
deleted file mode 100644
index c8cf8e9..0000000
--- a/src/org/apache/kandula/participant/Participant.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * 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 org.apache.axis2.addressing.EndpointReference;
-
-/**
- * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a> <p/>
- * Used to store the details about the participant & to store the
- * runtime status of Participants
- */
-//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
- * @param enlistmentId
- */
- public Participant(EndpointReference epr, String protocol,
- String enlistmentId) {
- super();
- this.epr = epr;
- 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.
- */
- public void setEpr(EndpointReference epr) {
- this.epr = epr;
- }
-
- /**
- * @return Returns the status.
- */
- public int getStatus() {
- return status;
- }
-
- /**
- * @param status -
- * The status to set.
- */
- public void setStatus(int status) {
- this.status = status;
- }
-
- /**
- * @return Returns the protocol.
- */
- public String getProtocol() {
- return protocol;
- }
-}
\ No newline at end of file
diff --git a/src/org/apache/kandula/participant/ParticipantTransactionManager.java b/src/org/apache/kandula/participant/ParticipantTransactionCoordinator.java
similarity index 96%
rename from src/org/apache/kandula/participant/ParticipantTransactionManager.java
rename to src/org/apache/kandula/participant/ParticipantTransactionCoordinator.java
index ed63647..6bcfd08 100644
--- a/src/org/apache/kandula/participant/ParticipantTransactionManager.java
+++ b/src/org/apache/kandula/participant/ParticipantTransactionCoordinator.java
@@ -18,7 +18,7 @@
import org.apache.kandula.Status;
import org.apache.kandula.context.AbstractContext;
-import org.apache.kandula.context.at.ATParticipantContext;
+import org.apache.kandula.context.impl.ATParticipantContext;
import org.apache.kandula.faults.AbstractKandulaException;
import org.apache.kandula.faults.InvalidStateException;
import org.apache.kandula.wsat.twopc.CoordinatorPortTypeRawXMLStub;
@@ -26,7 +26,7 @@
/**
* @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
*/
-public class ParticipantTransactionManager {
+public class ParticipantTransactionCoordinator {
public void prepare(AbstractContext context)
throws AbstractKandulaException {
diff --git a/src/org/apache/kandula/participant/TransactionInHandler.java b/src/org/apache/kandula/participant/TransactionInHandler.java
index d787190..36a5da6 100644
--- a/src/org/apache/kandula/participant/TransactionInHandler.java
+++ b/src/org/apache/kandula/participant/TransactionInHandler.java
@@ -26,20 +26,22 @@
import org.apache.axis2.handlers.AbstractHandler;
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.context.CoordinationContext;
+import org.apache.kandula.context.impl.ATParticipantContext;
+import org.apache.kandula.context.impl.SimpleCoordinationContext;
import org.apache.kandula.faults.AbstractKandulaException;
import org.apache.kandula.storage.StorageFactory;
import org.apache.kandula.storage.Store;
-import org.apache.kandula.utility.EPRHandlingUtils;
+import org.apache.kandula.utility.KandulaConfiguration;
import org.apache.kandula.utility.EndpointReferenceFactory;
import org.apache.kandula.wscoor.RegistrationCoordinatorPortTypeRawXMLStub;
import org.apache.ws.commons.om.OMElement;
import org.apache.ws.commons.soap.SOAPHeader;
public class TransactionInHandler extends AbstractHandler {
- private ThreadLocal threadInfo = new ThreadLocal();
+
+ private static final long serialVersionUID = 2098581248112968550L;
+// private ThreadLocal threadInfo = new ThreadLocal();
public void invoke(MessageContext msgContext) throws AxisFault {
KandulaResource resource;
@@ -61,9 +63,9 @@
// business logic receives the message
String resourceFile = (String) msgContext.getParameter(
Constants.KANDULA_RESOURCE).getValue();
- String participantRepository = EndpointReferenceFactory.getInstance()
+ String participantRepository = KandulaConfiguration.getInstance()
.getParticipantRepository();
- String participantAxis2Xml = EndpointReferenceFactory.getInstance()
+ String participantAxis2Xml = KandulaConfiguration.getInstance()
.getParticipantAxis2Conf();
try {
@@ -74,11 +76,11 @@
}
context.setResource(resource);
- String id = EPRHandlingUtils.getRandomStringOf18Characters();
+ String id = EndpointReferenceFactory.getRandomStringOf18Characters();
Store store = StorageFactory.getInstance().getStore();
context.setProperty(AbstractContext.REQUESTER_ID, id);
store.put(id, context);
- ParticipantTransactionManager txManager = new ParticipantTransactionManager();
+// ParticipantTransactionCoordinator txManager = new ParticipantTransactionCoordinator();
try {
RegistrationCoordinatorPortTypeRawXMLStub stub = new RegistrationCoordinatorPortTypeRawXMLStub(
participantRepository, participantAxis2Xml, coorContext
diff --git a/src/org/apache/kandula/storage/Axis1Store.java b/src/org/apache/kandula/storage/Axis1Store.java
deleted file mode 100644
index 7436e5b..0000000
--- a/src/org/apache/kandula/storage/Axis1Store.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright 2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.kandula.storage;
-
-/**
- * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
- */
-public class Axis1Store implements Store {
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.kandula.storage.Store#putContext(java.lang.String,
- * org.apache.kandula.context.coordination.CoordinationContext)
- */
- public void put(Object id, Object context) {
- // TODO Auto-generated method stub
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.kandula.storage.Store#getContext(java.lang.String)
- */
- public Object get(Object id) {
-
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.kandula.storage.Store#forgetContext(java.lang.String)
- */
- public void forget(Object id) {
- // TODO Auto-generated method stub
-
- }
-
-}
\ No newline at end of file
diff --git a/src/org/apache/kandula/storage/Axis2Store.java b/src/org/apache/kandula/storage/Axis2Store.java
deleted file mode 100644
index 4c8e045..0000000
--- a/src/org/apache/kandula/storage/Axis2Store.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.kandula.storage;
-
-/**
- * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
- */
-public class Axis2Store implements Store {
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.kandula.storage.Store#putContext(java.lang.String,
- * org.apache.kandula.context.coordination.CoordinationContext)
- */
- public void put(Object id, Object context) {
- // TODO Auto-generated method stub
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.kandula.storage.Store#getContext(java.lang.String)
- */
- public Object get(Object id) {
- return null;
-
- }
-
- public void forget(Object id) {
- }
-
-}
\ No newline at end of file
diff --git a/src/org/apache/kandula/utility/EPRHandlingUtils.java b/src/org/apache/kandula/utility/EPRHandlingUtils.java
deleted file mode 100644
index a3d4c15..0000000
--- a/src/org/apache/kandula/utility/EPRHandlingUtils.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * 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.utility;
-
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Random;
-
-import javax.xml.namespace.QName;
-
-import org.apache.axis2.addressing.AddressingConstants;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.addressing.AddressingConstants.Final;
-import org.apache.ws.commons.om.OMElement;
-import org.apache.ws.commons.om.OMNamespace;
-import org.apache.ws.commons.om.impl.llom.factory.OMLinkedListImplFactory;
-import org.apache.ws.commons.soap.SOAPFactory;
-
-/**
- * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
- */
-public class EPRHandlingUtils {
-
- public static void endpointToOM(EndpointReference epr, OMElement parentEPR,
- 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);
- Map referenceValues = epr.getAllReferenceParameters();
- if (referenceValues != null) {
- OMElement refPropertyElement = factory.createOMElement(
- "ReferenceParameters", wsAddressing);
- parentEPR.addChild(refPropertyElement);
- Iterator iterator = referenceValues.keySet().iterator();
- while (iterator.hasNext()) {
- QName key = (QName) iterator.next();
- OMElement omElement = (OMElement) referenceValues.get(key);
- refPropertyElement.addChild(omElement);
- if (Final.WSA_NAMESPACE.equals(wsAddressing)) {
- omElement.addAttribute(
- Final.WSA_IS_REFERENCE_PARAMETER_ATTRIBUTE,
- Final.WSA_TYPE_ATTRIBUTE_VALUE, wsAddressing);
- }
- }
- }
- }
-
- public static EndpointReference endpointFromOM(OMElement eprElement) {
- EndpointReference epr;
- epr = new EndpointReference(eprElement.getFirstChildWithName(
- new QName("Address")).getText());
- HashMap referenceProperties = new HashMap();
- OMElement referencePropertiesElement = eprElement
- .getFirstChildWithName(new QName("ReferenceParameters"));
- Iterator propertyIter = referencePropertiesElement.getChildElements();
- while (propertyIter.hasNext()) {
- OMElement element = (OMElement) propertyIter.next();
-
- //TODO do we need to detach the OMElement
- referenceProperties.put(element.getQName(), element
- .cloneOMElement());
- }
- //will have to live with Ref parameters for some time :: Till axis2
- // @ing gets stable
- epr.setReferenceParameters(referenceProperties);
- return epr;
- }
-
- 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;
- if ((refProperties = (HashMap) epr.getAllReferenceParameters()) == null) {
- refProperties = new HashMap();
- }
- OMLinkedListImplFactory factory = new OMLinkedListImplFactory();
- OMElement omElement = factory.createOMElement(key, null);
- omElement.setText(Value);
- refProperties.put(key, omElement);
- epr.setReferenceParameters(refProperties);
- }
-
- /**
- * MD5 a random string with localhost/date etc will return 128 bits
- * construct a string of 18 characters from those bits.
- *
- * @return string
- */
- public static String getRandomStringOf18Characters() {
- Random myRand = new Random();
- long rand = myRand.nextLong();
- String sid;
- try {
- sid = InetAddress.getLocalHost().toString();
- } catch (UnknownHostException e) {
- sid = Thread.currentThread().getName();
- }
- long time = System.currentTimeMillis();
- StringBuffer sb = new StringBuffer();
- sb.append(sid);
- sb.append(":");
- sb.append(Long.toString(time));
- sb.append(":");
- sb.append(Long.toString(rand));
- MessageDigest md5 = null;
- try {
- md5 = MessageDigest.getInstance("MD5");
- } catch (NoSuchAlgorithmException e) {
- //System.out.println("Error: " + e);
- //todo heve to be properly handle
- }
- md5.update(sb.toString().getBytes());
- byte[] array = md5.digest();
- StringBuffer sb2 = new StringBuffer();
- for (int j = 0; j < array.length; ++j) {
- int b = array[j] & 0xFF;
- sb2.append(Integer.toHexString(b));
- }
- int begin = myRand.nextInt();
- if (begin < 0)
- begin = begin * -1;
- begin = begin % 8;
- return new String(sb2.toString().substring(begin, begin + 18))
- .toUpperCase();
- }
-}
\ No newline at end of file
diff --git a/src/org/apache/kandula/utility/EndpointReferenceFactory.java b/src/org/apache/kandula/utility/EndpointReferenceFactory.java
index f9fc1ea..547164f 100644
--- a/src/org/apache/kandula/utility/EndpointReferenceFactory.java
+++ b/src/org/apache/kandula/utility/EndpointReferenceFactory.java
@@ -17,136 +17,40 @@
package org.apache.kandula.utility;
import java.io.IOException;
-import java.io.InputStream;
import java.net.InetAddress;
-import java.util.Properties;
+import java.net.UnknownHostException;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Random;
+import javax.xml.namespace.QName;
+
+import org.apache.axis2.addressing.AddressingConstants;
import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.addressing.AddressingConstants.Final;
import org.apache.kandula.Constants;
import org.apache.kandula.wsat.completion.CompletionInitiatorServiceListener;
+import org.apache.ws.commons.om.OMElement;
+import org.apache.ws.commons.om.OMNamespace;
+import org.apache.ws.commons.om.impl.llom.factory.OMLinkedListImplFactory;
+import org.apache.ws.commons.soap.SOAPFactory;
/**
- * @author Dasarath Weeratunge
* @author <a href="mailto:thilina@apache.org"> Thilina Gunarathne </a>
*/
public class EndpointReferenceFactory {
- static final String PROPERTY_FILE = "endpoints.conf";
-
- // static final String PROTOCOL_PROPERTY = "protocol";
-
- static final String HOST_PROPERTY = "host";
-
- static final String PORT_PROPERTY = "port";
-
- static final String TCPMON_ENABLE = "tcpmon_enable";
-
- static final String PARTICIPANT_REPO = "PARTICIPANT_REPOSITORY";
-
- static final String PARTICIPANT_AXIS2_CONF = "PARTICIPANT_AXIS2_CONF";
-
- static final String KANDULA_LISTENER_REPO = "KANDULA_LISTENER_REPOSITORY";
-
- static final String KANDULA_LISTENER_AXIS2XML = "KANDULA_LISTENER_AXIS2XML";
-
- static final String LISTENER_PORT = "KANDULA_LISTENER_PORT";
-
- static final String COORDINATOR_AXIS2XML = "COORDINATOR_AXIS2XML";
-
- static final String COORDINATOR_REPOSITORY = "COORDINATOR_REPOSITORY";
private static EndpointReferenceFactory instance = null;
- Properties properties = null;
-
- String location = null;
-
- String participantRepository = null;
-
- String participantAxis2Xml = null;
-
- String kandulaListenerRepository = null;
-
- String kandulaListenerAxis2Xml = null;
-
- String kandulaListenerPort = null;
-
- String coordinatorRepo;
-
- String coordinatorAxis2Conf;
-
- String debug = "false";
+ private KandulaConfiguration configuration;
private EndpointReferenceFactory() {
- String port = null;
-
- String host = null;
- InputStream in = getClass().getClassLoader().getResourceAsStream(
- PROPERTY_FILE);
- properties = new Properties();
- try {
- properties.load(in);
- in.close();
- host = properties.getProperty(HOST_PROPERTY);
- port = properties.getProperty(PORT_PROPERTY);
- participantRepository = properties.getProperty(PARTICIPANT_REPO);
- if (participantRepository == null) {
- participantRepository = ".";
- }
-
- if (properties.getProperty("tcpmon_enable").equals("true")) {
- debug = "true";
- }
-
- participantAxis2Xml = properties
- .getProperty(PARTICIPANT_AXIS2_CONF);
- if (participantAxis2Xml == null) {
- participantAxis2Xml = "axis2.xml";
- }
-
- kandulaListenerRepository = properties
- .getProperty(KANDULA_LISTENER_REPO);
- if (kandulaListenerRepository == null) {
- kandulaListenerRepository = ".";
- }
- kandulaListenerAxis2Xml = properties
- .getProperty(KANDULA_LISTENER_AXIS2XML);
- if (kandulaListenerAxis2Xml == null) {
- kandulaListenerRepository += "/axis2.xml";
- }
-
- coordinatorAxis2Conf = properties.getProperty(COORDINATOR_AXIS2XML);
- if (coordinatorAxis2Conf == null) {
- coordinatorAxis2Conf = "axis2.xml";
- }
-
- coordinatorRepo = properties.getProperty(COORDINATOR_REPOSITORY);
- if (coordinatorRepo == null) {
- coordinatorAxis2Conf = ".";
- }
-
- kandulaListenerPort = properties.getProperty(LISTENER_PORT);
- if (kandulaListenerPort == null) {
- kandulaListenerPort = "5050";
- }
-
- if (port == null) {
- port = "8080";
- }
-
- if (host == null) {
- host = InetAddress.getLocalHost().getHostAddress();
- }
-
- location = "http://" + host + ":" + port;
- System.out.println(location);
- } catch (Exception e) {
- if (e instanceof RuntimeException)
- throw (RuntimeException) e;
- else
- throw new RuntimeException(e);
- }
+ configuration = KandulaConfiguration.getInstance();
}
@@ -158,9 +62,10 @@
public EndpointReference getRegistrationEndpoint(String id) {
- EndpointReference epr = new EndpointReference(location
+ EndpointReference epr = new EndpointReference(configuration
+ .getLocationForEPR()
+ "/axis2/services/RegistrationCoordinator");
- EPRHandlingUtils.addReferenceProperty(epr,
+ EndpointReferenceFactory.addReferenceProperty(epr,
Constants.TRANSACTION_ID_PARAMETER, id);
return epr;
}
@@ -177,80 +82,150 @@
CompletionInitiatorServiceListener serviceListener = CompletionInitiatorServiceListener
.getInstance();
EndpointReference epr = serviceListener.getEpr();
- EPRHandlingUtils.addReferenceProperty(epr,
+ EndpointReferenceFactory.addReferenceProperty(epr,
Constants.REQUESTER_ID_PARAMETER, id);
return epr;
}
public EndpointReference getCompletionEndpoint(String id) {
- EndpointReference epr = new EndpointReference(location
+ EndpointReference epr = new EndpointReference(configuration
+ .getLocationForEPR()
+ "/axis2/services/CompletionCoordinator");
- EPRHandlingUtils.addReferenceProperty(epr,
+ EndpointReferenceFactory.addReferenceProperty(epr,
Constants.TRANSACTION_ID_PARAMETER, id);
return epr;
}
public EndpointReference get2PCCoordinatorEndpoint(String activityId,
String enlistmentId) {
- //Activity ID to find Activity Context , EnlistmentID to find
+ // Activity ID to find Activity Context , EnlistmentID to find
// participant in activity
- EndpointReference epr = new EndpointReference(location
+ EndpointReference epr = new EndpointReference(configuration
+ .getLocationForEPR()
+ "/axis2/services/AtomicTransactionCoordinator");
- EPRHandlingUtils.addReferenceProperty(epr,
+ EndpointReferenceFactory.addReferenceProperty(epr,
Constants.TRANSACTION_ID_PARAMETER, activityId);
- EPRHandlingUtils.addReferenceProperty(epr,
+ EndpointReferenceFactory.addReferenceProperty(epr,
Constants.ENLISTMENT_ID_PARAMETER, enlistmentId);
return epr;
}
public EndpointReference get2PCParticipantEndpoint(String id) {
- EndpointReference epr = new EndpointReference(location
+ EndpointReference epr = new EndpointReference(configuration
+ .getLocationForEPR()
+ "/axis2/services/AtomicTransactionParticipant");
- EPRHandlingUtils.addReferenceProperty(epr,
+ EndpointReferenceFactory.addReferenceProperty(epr,
Constants.REQUESTER_ID_PARAMETER, id);
return epr;
}
- public String getParticipantRepository() {
- return participantRepository;
- }
-
- public String getParticipantAxis2Conf() {
- return participantAxis2Xml;
- }
-
- public String getCoordinatorRepo() {
- return coordinatorRepo;
- }
-
- public String getCoordinatorAxis2Conf() {
- return coordinatorAxis2Conf;
- }
-
- public String getKadulaListenerPort() {
- return kandulaListenerPort;
- }
-
- public String getKadulaListenerPortForEPR() {
- if (debug.equals("true"))
- return (Integer.parseInt(kandulaListenerPort) + 1) + "";
- else
- return kandulaListenerPort;
- }
-
/**
- * @return Returns the kandulaListenerRepository.
+ * MD5 a random string with localhost/date etc will return 128 bits
+ * construct a string of 18 characters from those bits.
+ *
+ * @return string
*/
- public String getKandulaListenerRepository() {
- return kandulaListenerRepository;
+ public static String getRandomStringOf18Characters() {
+ Random myRand = new Random();
+ long rand = myRand.nextLong();
+ String sid;
+ try {
+ sid = InetAddress.getLocalHost().toString();
+ } catch (UnknownHostException e) {
+ sid = Thread.currentThread().getName();
+ }
+ long time = System.currentTimeMillis();
+ StringBuffer sb = new StringBuffer();
+ sb.append(sid);
+ sb.append(":");
+ sb.append(Long.toString(time));
+ sb.append(":");
+ sb.append(Long.toString(rand));
+ MessageDigest md5 = null;
+ try {
+ md5 = MessageDigest.getInstance("MD5");
+ } catch (NoSuchAlgorithmException e) {
+ // System.out.println("Error: " + e);
+ // todo heve to be properly handle
+ }
+ md5.update(sb.toString().getBytes());
+ byte[] array = md5.digest();
+ StringBuffer sb2 = new StringBuffer();
+ for (int j = 0; j < array.length; ++j) {
+ int b = array[j] & 0xFF;
+ sb2.append(Integer.toHexString(b));
+ }
+ int begin = myRand.nextInt();
+ if (begin < 0)
+ begin = begin * -1;
+ begin = begin % 8;
+ return new String(sb2.toString().substring(begin, begin + 18))
+ .toUpperCase();
}
- public String getKandulaListenerAxis2Xml() {
- return kandulaListenerAxis2Xml;
+ 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;
+ if ((refProperties = (HashMap) epr.getAllReferenceParameters()) == null) {
+ refProperties = new HashMap();
+ }
+ OMLinkedListImplFactory factory = new OMLinkedListImplFactory();
+ OMElement omElement = factory.createOMElement(key, null);
+ omElement.setText(Value);
+ refProperties.put(key, omElement);
+ epr.setReferenceParameters(refProperties);
}
- public String getLocationForEPR(){
- return location;
+
+ public static EndpointReference endpointFromOM(OMElement eprElement) {
+ EndpointReference epr;
+ epr = new EndpointReference(eprElement.getFirstChildWithName(
+ new QName("Address")).getText());
+ HashMap referenceProperties = new HashMap();
+ OMElement referencePropertiesElement = eprElement
+ .getFirstChildWithName(new QName("ReferenceParameters"));
+ Iterator propertyIter = referencePropertiesElement.getChildElements();
+ while (propertyIter.hasNext()) {
+ OMElement element = (OMElement) propertyIter.next();
+
+ // TODO do we need to detach the OMElement
+ referenceProperties.put(element.getQName(), element
+ .cloneOMElement());
+ }
+ // will have to live with Ref parameters for some time :: Till axis2
+ // @ing gets stable
+ epr.setReferenceParameters(referenceProperties);
+ return epr;
+ }
+
+ public static void endpointToOM(EndpointReference epr, OMElement parentEPR,
+ 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);
+ Map referenceValues = epr.getAllReferenceParameters();
+ if (referenceValues != null) {
+ OMElement refPropertyElement = factory.createOMElement(
+ "ReferenceParameters", wsAddressing);
+ parentEPR.addChild(refPropertyElement);
+ Iterator iterator = referenceValues.keySet().iterator();
+ while (iterator.hasNext()) {
+ QName key = (QName) iterator.next();
+ OMElement omElement = (OMElement) referenceValues.get(key);
+ refPropertyElement.addChild(omElement);
+ if (Final.WSA_NAMESPACE.equals(wsAddressing)) {
+ omElement.addAttribute(
+ Final.WSA_IS_REFERENCE_PARAMETER_ATTRIBUTE,
+ Final.WSA_TYPE_ATTRIBUTE_VALUE, wsAddressing);
+ }
+ }
+ }
}
}
\ No newline at end of file
diff --git a/src/org/apache/kandula/utility/KandulaConfiguration.java b/src/org/apache/kandula/utility/KandulaConfiguration.java
new file mode 100644
index 0000000..e38c60b
--- /dev/null
+++ b/src/org/apache/kandula/utility/KandulaConfiguration.java
@@ -0,0 +1,198 @@
+/*
+ * 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.utility;
+
+import java.io.InputStream;
+import java.net.InetAddress;
+import java.util.Properties;
+
+
+
+
+/**
+ * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
+ */
+public class KandulaConfiguration {
+ static final String PROPERTY_FILE = "endpoints.conf";
+
+ // static final String PROTOCOL_PROPERTY = "protocol";
+
+ static final String HOST_PROPERTY = "host";
+
+ static final String PORT_PROPERTY = "port";
+
+ static final String TCPMON_ENABLE = "tcpmon_enable";
+
+ static final String PARTICIPANT_REPO = "PARTICIPANT_REPOSITORY";
+
+ static final String PARTICIPANT_AXIS2_CONF = "PARTICIPANT_AXIS2_CONF";
+
+ static final String KANDULA_LISTENER_REPO = "KANDULA_LISTENER_REPOSITORY";
+
+ static final String KANDULA_LISTENER_AXIS2XML = "KANDULA_LISTENER_AXIS2XML";
+
+ static final String LISTENER_PORT = "KANDULA_LISTENER_PORT";
+
+ static final String COORDINATOR_AXIS2XML = "COORDINATOR_AXIS2XML";
+
+ static final String COORDINATOR_REPOSITORY = "COORDINATOR_REPOSITORY";
+
+ private static KandulaConfiguration instance = null;
+
+ Properties properties = null;
+
+ String location = null;
+
+ String participantRepository = null;
+
+ String participantAxis2Xml = null;
+
+ String kandulaListenerRepository = null;
+
+ String kandulaListenerAxis2Xml = null;
+
+ String kandulaListenerPort = null;
+
+ String coordinatorRepo;
+
+ String coordinatorAxis2Conf;
+
+ String debug = "false";
+
+ private KandulaConfiguration() {
+
+ String port = null;
+
+ String host = null;
+ InputStream in = getClass().getClassLoader().getResourceAsStream(
+ PROPERTY_FILE);
+ properties = new Properties();
+ try {
+ properties.load(in);
+ in.close();
+ host = properties.getProperty(HOST_PROPERTY);
+ port = properties.getProperty(PORT_PROPERTY);
+ participantRepository = properties.getProperty(PARTICIPANT_REPO);
+ if (participantRepository == null) {
+ participantRepository = ".";
+ }
+
+ if (properties.getProperty("tcpmon_enable").equals("true")) {
+ debug = "true";
+ }
+
+ participantAxis2Xml = properties
+ .getProperty(PARTICIPANT_AXIS2_CONF);
+ if (participantAxis2Xml == null) {
+ participantAxis2Xml = "axis2.xml";
+ }
+
+ kandulaListenerRepository = properties
+ .getProperty(KANDULA_LISTENER_REPO);
+ if (kandulaListenerRepository == null) {
+ kandulaListenerRepository = ".";
+ }
+ kandulaListenerAxis2Xml = properties
+ .getProperty(KANDULA_LISTENER_AXIS2XML);
+ if (kandulaListenerAxis2Xml == null) {
+ kandulaListenerRepository += "/axis2.xml";
+ }
+
+ coordinatorAxis2Conf = properties.getProperty(COORDINATOR_AXIS2XML);
+ if (coordinatorAxis2Conf == null) {
+ coordinatorAxis2Conf = "axis2.xml";
+ }
+
+ coordinatorRepo = properties.getProperty(COORDINATOR_REPOSITORY);
+ if (coordinatorRepo == null) {
+ coordinatorAxis2Conf = ".";
+ }
+
+ kandulaListenerPort = properties.getProperty(LISTENER_PORT);
+ if (kandulaListenerPort == null) {
+ kandulaListenerPort = "5050";
+ }
+
+ if (port == null) {
+ port = "8080";
+ }
+
+ if (host == null) {
+ host = InetAddress.getLocalHost().getHostAddress();
+ }
+
+ location = "http://" + host + ":" + port;
+ System.out.println(location);
+ } catch (Exception e) {
+ if (e instanceof RuntimeException)
+ throw (RuntimeException) e;
+ else
+ throw new RuntimeException(e);
+ }
+
+ }
+
+ public static KandulaConfiguration getInstance() {
+ if (instance == null)
+ instance = new KandulaConfiguration();
+ return instance;
+ }
+ public String getParticipantRepository() {
+ return participantRepository;
+ }
+
+ public String getParticipantAxis2Conf() {
+ return participantAxis2Xml;
+ }
+
+ public String getCoordinatorRepo() {
+ return coordinatorRepo;
+ }
+
+ public String getCoordinatorAxis2Conf() {
+ return coordinatorAxis2Conf;
+ }
+
+ public String getKadulaListenerPort() {
+ return kandulaListenerPort;
+ }
+ public String getKadulaListenerPortForEPR() {
+ if (debug.equals("true"))
+ return (Integer.parseInt(kandulaListenerPort) + 1) + "";
+ else
+ return kandulaListenerPort;
+ }
+
+ /**
+ * @return Returns the kandulaListenerRepository.
+ */
+ public String getKandulaListenerRepository() {
+ return kandulaListenerRepository;
+ }
+
+ public String getKandulaListenerAxis2Xml() {
+ return kandulaListenerAxis2Xml;
+ }
+ public String getLocationForEPR(){
+ return location;
+ }
+// public static EndpointReferenceFactory getInstance() {
+// if (instance == null)
+// instance = new EndpointReferenceFactory();
+// return instance;
+// }
+}
\ No newline at end of file
diff --git a/src/org/apache/kandula/utility/KandulaListener.java b/src/org/apache/kandula/utility/KandulaListener.java
index 2fc50c0..86be00d 100644
--- a/src/org/apache/kandula/utility/KandulaListener.java
+++ b/src/org/apache/kandula/utility/KandulaListener.java
@@ -45,14 +45,14 @@
public int serverPort;
private KandulaListener() throws IOException {
- EndpointReferenceFactory endpointReferenceFactory = EndpointReferenceFactory
+ KandulaConfiguration configuration = KandulaConfiguration
.getInstance();
responseConfigurationContext = new org.apache.axis2.context.ConfigurationContextFactory()
.createConfigurationContextFromFileSystem(
- endpointReferenceFactory.getKandulaListenerRepository(),
- endpointReferenceFactory.getKandulaListenerAxis2Xml());
+ configuration.getKandulaListenerRepository(),
+ configuration.getKandulaListenerAxis2Xml());
try {
- serverPort = Integer.parseInt(EndpointReferenceFactory
+ serverPort = Integer.parseInt(KandulaConfiguration
.getInstance().getKadulaListenerPort());
} catch (Exception e) {
serverPort = 5059;
@@ -115,7 +115,7 @@
return "http://"
+ InetAddress.getLocalHost().getHostAddress()
+ ":"
- + EndpointReferenceFactory.getInstance()
+ + KandulaConfiguration.getInstance()
.getKadulaListenerPortForEPR() + "/axis2/services/";
}
}
\ No newline at end of file
diff --git a/src/org/apache/kandula/wsat/completion/CompletionCoordinatorPortTypeRawXMLSkeleton.java b/src/org/apache/kandula/wsat/completion/CompletionCoordinatorPortTypeRawXMLSkeleton.java
index fbf4432..85caf0d 100644
--- a/src/org/apache/kandula/wsat/completion/CompletionCoordinatorPortTypeRawXMLSkeleton.java
+++ b/src/org/apache/kandula/wsat/completion/CompletionCoordinatorPortTypeRawXMLSkeleton.java
@@ -19,7 +19,6 @@
import org.apache.axis2.AxisFault;
import org.apache.axis2.context.MessageContext;
import org.apache.kandula.Constants;
-import org.apache.kandula.context.AbstractContext;
import org.apache.kandula.coordinator.at.ATCoordinator;
import org.apache.kandula.faults.AbstractKandulaException;
import org.apache.kandula.storage.StorageFactory;
@@ -41,7 +40,6 @@
* @throws AxisFault
*/
public OMElement commitOperation(OMElement requestElement) throws AxisFault {
- AbstractContext context;
String activityId;
//log.info("Visited Commit operation");
StorageFactory.getInstance().setConfigurationContext(
@@ -63,7 +61,7 @@
public OMElement rollbackOperation(OMElement requestElement)
throws AxisFault {
- AbstractContext context;
+
String activityId;
StorageFactory.getInstance().setConfigurationContext(
msgContext.getServiceContext().getConfigurationContext());
diff --git a/src/org/apache/kandula/wsat/completion/CompletionInitiatorPortTypeRawXMLStub.java b/src/org/apache/kandula/wsat/completion/CompletionInitiatorPortTypeRawXMLStub.java
index fcdd16a..559e8ce 100644
--- a/src/org/apache/kandula/wsat/completion/CompletionInitiatorPortTypeRawXMLStub.java
+++ b/src/org/apache/kandula/wsat/completion/CompletionInitiatorPortTypeRawXMLStub.java
@@ -22,7 +22,7 @@
import org.apache.axis2.description.OutOnlyAxisOperation;
import org.apache.kandula.Constants;
import org.apache.kandula.faults.AbstractKandulaException;
-import org.apache.kandula.utility.EndpointReferenceFactory;
+import org.apache.kandula.utility.KandulaConfiguration;
import org.apache.kandula.wsat.AbstractATNotifierStub;
/**
@@ -39,8 +39,8 @@
*/
public CompletionInitiatorPortTypeRawXMLStub(
EndpointReference targetEndpoint) throws AbstractKandulaException {
- super(EndpointReferenceFactory.getInstance().getCoordinatorRepo(),
- EndpointReferenceFactory.getInstance()
+ super(KandulaConfiguration.getInstance().getCoordinatorRepo(),
+ KandulaConfiguration.getInstance()
.getCoordinatorAxis2Conf(), new AxisService(
"CompletionInitiatorPortType"));
this.toEPR = targetEndpoint;
diff --git a/src/org/apache/kandula/wsat/twopc/CoordinatorPortTypeRawXMLStub.java b/src/org/apache/kandula/wsat/twopc/CoordinatorPortTypeRawXMLStub.java
index 009ecd4..e168b4b 100644
--- a/src/org/apache/kandula/wsat/twopc/CoordinatorPortTypeRawXMLStub.java
+++ b/src/org/apache/kandula/wsat/twopc/CoordinatorPortTypeRawXMLStub.java
@@ -22,7 +22,7 @@
import org.apache.axis2.description.OutOnlyAxisOperation;
import org.apache.kandula.Constants;
import org.apache.kandula.faults.AbstractKandulaException;
-import org.apache.kandula.utility.EndpointReferenceFactory;
+import org.apache.kandula.utility.KandulaConfiguration;
import org.apache.kandula.wsat.AbstractATNotifierStub;
/**
@@ -37,8 +37,8 @@
public CoordinatorPortTypeRawXMLStub(EndpointReference targetEndpoint)
throws AbstractKandulaException {
super(
- EndpointReferenceFactory.getInstance()
- .getParticipantRepository(), EndpointReferenceFactory
+ KandulaConfiguration.getInstance()
+ .getParticipantRepository(), KandulaConfiguration
.getInstance().getParticipantAxis2Conf(),
new AxisService("CoordinatorPortType"));
this.toEPR = targetEndpoint;
diff --git a/src/org/apache/kandula/wsat/twopc/ParticipantPortTypeRawXMLSkeleton.java b/src/org/apache/kandula/wsat/twopc/ParticipantPortTypeRawXMLSkeleton.java
index bf9a0b3..8649443 100644
--- a/src/org/apache/kandula/wsat/twopc/ParticipantPortTypeRawXMLSkeleton.java
+++ b/src/org/apache/kandula/wsat/twopc/ParticipantPortTypeRawXMLSkeleton.java
@@ -21,7 +21,7 @@
import org.apache.kandula.Constants;
import org.apache.kandula.context.AbstractContext;
import org.apache.kandula.faults.AbstractKandulaException;
-import org.apache.kandula.participant.ParticipantTransactionManager;
+import org.apache.kandula.participant.ParticipantTransactionCoordinator;
import org.apache.kandula.storage.StorageFactory;
import org.apache.kandula.storage.Store;
import org.apache.ws.commons.om.OMElement;
@@ -45,7 +45,7 @@
Constants.REQUESTER_ID_PARAMETER).getText();
Store store = StorageFactory.getInstance().getStore();
AbstractContext context = (AbstractContext) store.get(requesterID);
- ParticipantTransactionManager txManager = new ParticipantTransactionManager();
+ ParticipantTransactionCoordinator txManager = new ParticipantTransactionCoordinator();
try {
txManager.prepare(context);
} catch (AbstractKandulaException e) {
@@ -65,7 +65,7 @@
Constants.REQUESTER_ID_PARAMETER).getText();
Store store = StorageFactory.getInstance().getStore();
AbstractContext context = (AbstractContext) store.get(requesterID);
- ParticipantTransactionManager txManager = new ParticipantTransactionManager();
+ ParticipantTransactionCoordinator txManager = new ParticipantTransactionCoordinator();
try {
txManager.commit(context);
} catch (AbstractKandulaException e) {
@@ -84,7 +84,7 @@
Constants.REQUESTER_ID_PARAMETER).getText();
Store store = StorageFactory.getInstance().getStore();
AbstractContext context = (AbstractContext) store.get(requesterID);
- ParticipantTransactionManager txManager = new ParticipantTransactionManager();
+ ParticipantTransactionCoordinator txManager = new ParticipantTransactionCoordinator();
try {
txManager.rollback(context);
} catch (AbstractKandulaException e) {
diff --git a/src/org/apache/kandula/wsat/twopc/ParticipantPortTypeRawXMLStub.java b/src/org/apache/kandula/wsat/twopc/ParticipantPortTypeRawXMLStub.java
index 681c911..02b2dff 100644
--- a/src/org/apache/kandula/wsat/twopc/ParticipantPortTypeRawXMLStub.java
+++ b/src/org/apache/kandula/wsat/twopc/ParticipantPortTypeRawXMLStub.java
@@ -22,7 +22,7 @@
import org.apache.axis2.description.OutOnlyAxisOperation;
import org.apache.kandula.Constants;
import org.apache.kandula.faults.AbstractKandulaException;
-import org.apache.kandula.utility.EndpointReferenceFactory;
+import org.apache.kandula.utility.KandulaConfiguration;
import org.apache.kandula.wsat.AbstractATNotifierStub;
/**
@@ -37,8 +37,8 @@
* @throws AbstractKandulaException
*/
public ParticipantPortTypeRawXMLStub() throws AbstractKandulaException {
- super(EndpointReferenceFactory.getInstance().getCoordinatorRepo(),
- EndpointReferenceFactory.getInstance()
+ super(KandulaConfiguration.getInstance().getCoordinatorRepo(),
+ KandulaConfiguration.getInstance()
.getCoordinatorAxis2Conf(), new AxisService(
"ParticipantPortType"));
diff --git a/src/org/apache/kandula/wscoor/ActivationCoordinatorPortTypeRawXMLStub.java b/src/org/apache/kandula/wscoor/ActivationCoordinatorPortTypeRawXMLStub.java
index 59232ef..2e4e02f 100644
--- a/src/org/apache/kandula/wscoor/ActivationCoordinatorPortTypeRawXMLStub.java
+++ b/src/org/apache/kandula/wscoor/ActivationCoordinatorPortTypeRawXMLStub.java
@@ -40,7 +40,7 @@
import org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver;
import org.apache.kandula.Constants;
import org.apache.kandula.faults.KandulaGeneralException;
-import org.apache.kandula.utility.EPRHandlingUtils;
+import org.apache.kandula.utility.EndpointReferenceFactory;
import org.apache.kandula.utility.KandulaListener;
import org.apache.ws.commons.om.OMAbstractFactory;
import org.apache.ws.commons.om.OMElement;
@@ -114,7 +114,7 @@
SOAPEnvelope env = createSOAPEnvelope(coordinationType);
messageContext.setEnvelope(env);
replyToEpr = setupListener();
- EPRHandlingUtils.addReferenceProperty(replyToEpr,
+ EndpointReferenceFactory.addReferenceProperty(replyToEpr,
Constants.REQUESTER_ID_PARAMETER, id);
options.setReplyTo(replyToEpr);
options.setTo(this.toEPR);
diff --git a/src/org/apache/kandula/wscoor/ActivationRequesterPortTypeRawXMLSkeleton.java b/src/org/apache/kandula/wscoor/ActivationRequesterPortTypeRawXMLSkeleton.java
index cbcfbc3..2307fc3 100644
--- a/src/org/apache/kandula/wscoor/ActivationRequesterPortTypeRawXMLSkeleton.java
+++ b/src/org/apache/kandula/wscoor/ActivationRequesterPortTypeRawXMLSkeleton.java
@@ -19,7 +19,7 @@
import org.apache.axis2.context.MessageContext;
import org.apache.kandula.Constants;
import org.apache.kandula.context.AbstractContext;
-import org.apache.kandula.context.coordination.CoordinationContext;
+import org.apache.kandula.context.CoordinationContext;
import org.apache.kandula.storage.StorageFactory;
import org.apache.ws.commons.om.OMElement;
diff --git a/src/org/apache/kandula/wscoor/RegistrationCoordinatorPortTypeRawXMLStub.java b/src/org/apache/kandula/wscoor/RegistrationCoordinatorPortTypeRawXMLStub.java
index 9e00402..9bc78ab 100644
--- a/src/org/apache/kandula/wscoor/RegistrationCoordinatorPortTypeRawXMLStub.java
+++ b/src/org/apache/kandula/wscoor/RegistrationCoordinatorPortTypeRawXMLStub.java
@@ -41,7 +41,7 @@
import org.apache.kandula.Constants;
import org.apache.kandula.faults.AbstractKandulaException;
import org.apache.kandula.faults.KandulaGeneralException;
-import org.apache.kandula.utility.EPRHandlingUtils;
+import org.apache.kandula.utility.EndpointReferenceFactory;
import org.apache.kandula.utility.KandulaListener;
import org.apache.ws.commons.om.OMAbstractFactory;
import org.apache.ws.commons.om.OMElement;
@@ -110,7 +110,7 @@
protocolType, epr);
messageContext.setEnvelope(env);
replyToEpr = setupListener();
- EPRHandlingUtils.addReferenceProperty(replyToEpr,
+ EndpointReferenceFactory.addReferenceProperty(replyToEpr,
Constants.REQUESTER_ID_PARAMETER, id);
options.setReplyTo(replyToEpr);
options.setTo(this.toEPR);
@@ -138,7 +138,7 @@
OMElement protocolService = factory.createOMElement(
"ParticipantProtocolService", wsCoor);
- EPRHandlingUtils.endpointToOM(epr, protocolService, factory);
+ EndpointReferenceFactory.endpointToOM(epr, protocolService, factory);
request.addChild(protocolService);
env.getBody().addChild(request);
return env;
diff --git a/src/org/apache/kandula/wscoor/RegistrationPortTypeRawXMLSkeleton.java b/src/org/apache/kandula/wscoor/RegistrationPortTypeRawXMLSkeleton.java
index 4bb01ca..a7d4500 100644
--- a/src/org/apache/kandula/wscoor/RegistrationPortTypeRawXMLSkeleton.java
+++ b/src/org/apache/kandula/wscoor/RegistrationPortTypeRawXMLSkeleton.java
@@ -25,7 +25,7 @@
import org.apache.kandula.coordinator.Coordinator;
import org.apache.kandula.faults.AbstractKandulaException;
import org.apache.kandula.storage.StorageFactory;
-import org.apache.kandula.utility.EPRHandlingUtils;
+import org.apache.kandula.utility.EndpointReferenceFactory;
import org.apache.ws.commons.om.OMAbstractFactory;
import org.apache.ws.commons.om.OMElement;
import org.apache.ws.commons.om.OMNamespace;
@@ -57,7 +57,7 @@
OMElement participantEPRElement = request
.getFirstChildWithName(new QName("ParticipantProtocolService"));
//Extracting the participant EPR
- participantEPR = EPRHandlingUtils.endpointFromOM(participantEPRElement);
+ participantEPR = EndpointReferenceFactory.endpointFromOM(participantEPRElement);
OMElement header = msgContext.getEnvelope().getHeader();
activityId = header.getFirstChildWithName(
@@ -94,7 +94,7 @@
"CoordinatorProtocolService", wsCoor);
OMElement coordinatorProtocolService = factory.createOMElement(
"CoordinatorProtocolService", wsCoor);
- EPRHandlingUtils.endpointToOM(epr, coordinatorProtocolService, factory);
+ EndpointReferenceFactory.endpointToOM(epr, coordinatorProtocolService, factory);
protocolService.addChild(coordinatorProtocolService);
return protocolService;
}
diff --git a/src/org/apache/kandula/wscoor/RegistrationRequesterPortTypeRawXMLSkeleton.java b/src/org/apache/kandula/wscoor/RegistrationRequesterPortTypeRawXMLSkeleton.java
index 2fe98d8..c3683a3 100644
--- a/src/org/apache/kandula/wscoor/RegistrationRequesterPortTypeRawXMLSkeleton.java
+++ b/src/org/apache/kandula/wscoor/RegistrationRequesterPortTypeRawXMLSkeleton.java
@@ -21,9 +21,9 @@
import org.apache.axis2.context.MessageContext;
import org.apache.kandula.Constants;
import org.apache.kandula.context.AbstractContext;
-import org.apache.kandula.context.at.ATActivityContext;
+import org.apache.kandula.context.impl.ATActivityContext;
import org.apache.kandula.storage.StorageFactory;
-import org.apache.kandula.utility.EPRHandlingUtils;
+import org.apache.kandula.utility.EndpointReferenceFactory;
import org.apache.ws.commons.om.OMElement;
/**
@@ -44,7 +44,7 @@
OMElement header = msgContext.getEnvelope().getHeader();
String requesterID = header.getFirstChildWithName(
Constants.REQUESTER_ID_PARAMETER).getText();
- EndpointReference coordinatorService = EPRHandlingUtils
+ EndpointReference coordinatorService = EndpointReferenceFactory
.endpointFromOM(response.getFirstElement());
// TODO: remove this
ConfigurationContext configurationContext = StorageFactory
diff --git a/test/org/apache/kandula/coordinator/CoordinatorImplTest.java b/test/org/apache/kandula/coordinator/CoordinatorImplTest.java
index a0f6d83..b599980 100644
--- a/test/org/apache/kandula/coordinator/CoordinatorImplTest.java
+++ b/test/org/apache/kandula/coordinator/CoordinatorImplTest.java
@@ -22,8 +22,8 @@
import org.apache.kandula.Constants;
import org.apache.kandula.Status;
import org.apache.kandula.context.AbstractContext;
-import org.apache.kandula.context.at.ATActivityContext;
-import org.apache.kandula.context.coordination.CoordinationContext;
+import org.apache.kandula.context.CoordinationContext;
+import org.apache.kandula.context.impl.ATActivityContext;
import org.apache.kandula.faults.AbstractKandulaException;
/**
diff --git a/test/org/apache/kandula/integration/CreateCoordinationContextTest.java b/test/org/apache/kandula/integration/CreateCoordinationContextTest.java
index cb358fd..8d799cb 100644
--- a/test/org/apache/kandula/integration/CreateCoordinationContextTest.java
+++ b/test/org/apache/kandula/integration/CreateCoordinationContextTest.java
@@ -85,14 +85,14 @@
TransactionManager tm = new TransactionManager(
Constants.WS_AT,
new EndpointReference(
- "http://localhost:8081/axis2/services/ActivationCoordinator"));
+ "http://localhost:8082/axis2/services/ActivationCoordinator"));
tm.begin("target/initiator-repository","target/initiator-repository/axis2.xml");
// Thread.sleep(10000);
KandulaDemoServiceStub stub = new KandulaDemoServiceStub(
"target/initiator-repository",
new EndpointReference(
- "http://localhost:8081/axis2/services/KandulaDemoService"));
+ "http://localhost:8082/axis2/services/KandulaDemoService"));
stub.creditOperation();
// try{
tm.commit();
diff --git a/test/org/apache/kandula/integration/KandulaDemoServiceStub.java b/test/org/apache/kandula/integration/KandulaDemoServiceStub.java
index c50136f..b638c95 100644
--- a/test/org/apache/kandula/integration/KandulaDemoServiceStub.java
+++ b/test/org/apache/kandula/integration/KandulaDemoServiceStub.java
@@ -53,10 +53,10 @@
static {
- //creating the Service
+ // creating the Service
_service = new AxisService("KandulaDemoService");
- //creating the operations
+ // creating the operations
AxisOperation operationDesc;
operations = new org.apache.axis2.description.AxisOperation[1];
@@ -73,7 +73,7 @@
public KandulaDemoServiceStub(String axis2Home,
EndpointReference targetEndpoint) throws java.lang.Exception {
this.toEPR = targetEndpoint;
- //creating the configuration
+ // creating the configuration
configurationContext = new org.apache.axis2.context.ConfigurationContextFactory()
.createConfigurationContextFromFileSystem(axis2Home, axis2Home
+ "/axis2.xml");
@@ -97,10 +97,12 @@
SOAPEnvelope env = createSOAPEnvelope();
messageContext.setEnvelope(env);
+ // _service.engageModule("addressing");
+
options.setAction("creditOperation");
options.setTo(this.toEPR);
- // messageSender
- // .setSenderTransport(org.apache.axis2.Constants.TRANSPORT_HTTP);
+ // messageSender
+ // .setSenderTransport(org.apache.axis2.Constants.TRANSPORT_HTTP);
OperationClient client = operations[0].createClient(serviceContext,
options);
client.addMessageContext(messageContext);
@@ -110,8 +112,7 @@
private SOAPEnvelope createSOAPEnvelope() {
- SOAPFactory factory = OMAbstractFactory
- .getSOAP12Factory();
+ SOAPFactory factory = OMAbstractFactory.getSOAP12Factory();
SOAPEnvelope env = factory.getDefaultEnvelope();
return env;
}