You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fx-dev@ws.apache.org by th...@apache.org on 2005/09/15 07:23:32 UTC
svn commit: r289151 - in
/webservices/kandula/trunk/java/src/org/apache/kandula: ./ coordinator/
coordinator/at/ coordinator/ba/ initiator/ initiator/handler/ participant/
participant/simple/ storage/ typemapping/ typemapping/xmlbeansimpl/
utility/ wsc...
Author: thilina
Date: Wed Sep 14 22:22:50 2005
New Revision: 289151
URL: http://svn.apache.org/viewcvs?rev=289151&view=rev
Log:
Refactoring + introducing simple/SimpleResource.java
Added:
webservices/kandula/trunk/java/src/org/apache/kandula/initiator/handler/TransactionOutHandler.java
- copied, changed from r280858, webservices/kandula/trunk/java/src/org/apache/kandula/initiator/handler/TransactionHandler.java
webservices/kandula/trunk/java/src/org/apache/kandula/participant/
webservices/kandula/trunk/java/src/org/apache/kandula/participant/simple/
webservices/kandula/trunk/java/src/org/apache/kandula/participant/simple/SimpleResource.java
Removed:
webservices/kandula/trunk/java/src/org/apache/kandula/initiator/handler/TransactionHandler.java
webservices/kandula/trunk/java/src/org/apache/kandula/typemapping/CoordinationContext.java
webservices/kandula/trunk/java/src/org/apache/kandula/typemapping/SimpleCoordinationContext.java
Modified:
webservices/kandula/trunk/java/src/org/apache/kandula/Constants.java
webservices/kandula/trunk/java/src/org/apache/kandula/Status.java
webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/Coordinator.java
webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/CoordinatorUtils.java
webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/Registerable.java
webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/at/ATCoordinator.java
webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/at/ATSubCoordinator.java
webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/ba/BACoordinator.java
webservices/kandula/trunk/java/src/org/apache/kandula/initiator/TransactionManager.java
webservices/kandula/trunk/java/src/org/apache/kandula/storage/Axis1Store.java
webservices/kandula/trunk/java/src/org/apache/kandula/storage/Axis2Store.java
webservices/kandula/trunk/java/src/org/apache/kandula/storage/SimpleStore.java
webservices/kandula/trunk/java/src/org/apache/kandula/storage/StorageFactory.java
webservices/kandula/trunk/java/src/org/apache/kandula/storage/Store.java
webservices/kandula/trunk/java/src/org/apache/kandula/typemapping/xmlbeansimpl/XmlBeansTypeCoordinationContext.java
webservices/kandula/trunk/java/src/org/apache/kandula/typemapping/xmlbeansimpl/XmlBeansTypeEndPointReference.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/wscoor/ActivationCoordinatorPortTypeRawXMLStub.java
webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/ActivationPortTypeRawXMLAsyncMessageReceiver.java
webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/ActivationPortTypeRawXMLSkeleton.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/RegistrationPortTypeRawXMLSkeleton.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=289151&r1=289150&r2=289151&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/Constants.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/Constants.java Wed Sep 14 22:22:50 2005
@@ -21,15 +21,13 @@
*/
abstract public interface Constants {
- public static final String WS_COOR="http://schemas.xmlsoap.org/ws/2004/10/wscoor";
- public static final String WS_AT = "http://schemas.xmlsoap.org/ws/2004/10/wsat";
- public static final String WS_BA = "http://schemas.xmlsoap.org/ws/2004/10/wsba";
- public static final String WS_AT_COMPLETION = "http://schemas.xmlsoap.org/ws/2004/10/wsat/Completion";
- public static final String WS_AT_DURABLE2PC = "http://schemas.xmlsoap.org/ws/2004/10/wsat/Durable2PC";
- public static final String WS_AT_VOLATILE2PC = "http://schemas.xmlsoap.org/ws/2004/10/wsat/Volatile2PC";
-
- public static final String SUB_VOLATILE_REGISTERED = "registered for volatile 2PC";
-
- public static final String SUB_DURABLE_REGISTERED = "registered for durable 2PC";
-
+ public static final String WS_COOR = "http://schemas.xmlsoap.org/ws/2004/10/wscoor";
+ public static final String WS_AT = "http://schemas.xmlsoap.org/ws/2004/10/wsat";
+ public static final String WS_BA = "http://schemas.xmlsoap.org/ws/2004/10/wsba";
+ public static final String WS_AT_COMPLETION = "http://schemas.xmlsoap.org/ws/2004/10/wsat/Completion";
+ public static final String WS_AT_DURABLE2PC = "http://schemas.xmlsoap.org/ws/2004/10/wsat/Durable2PC";
+ public static final String WS_AT_VOLATILE2PC = "http://schemas.xmlsoap.org/ws/2004/10/wsat/Volatile2PC";
+ public static final String SUB_VOLATILE_REGISTERED = "registered for volatile 2PC";
+ public static final String SUB_DURABLE_REGISTERED = "registered for durable 2PC";
+
}
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/Status.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/Status.java?rev=289151&r1=289150&r2=289151&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/Status.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/Status.java Wed Sep 14 22:22:50 2005
@@ -23,21 +23,22 @@
interface ParticipantStatus {
public static final int STATUS_VOLATILE_PREPARING = 20;
-
+
public static final int STATUS_DURABLE_PREPARING = 21;
-
+
public static final int STATUS_PREPARED = 22;
-
- public static final int STATUS_ABORTED = 23;
-
+
+ public static final int STATUS_ABORTED = 23;
+
public static final int STATUS_READ_ONLY = 24;
}
+
interface CoordinatorStatus {
public static final int STATUS_NONE = 6;
public static final int STATUS_COMMITTING = 8;
-
+
public static final int STATUS_PREPARING = 10;
public static final int STATUS_PREPARING_DURABLE = 11;
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/Coordinator.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/Coordinator.java?rev=289151&r1=289150&r2=289151&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/Coordinator.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/Coordinator.java Wed Sep 14 22:22:50 2005
@@ -18,22 +18,20 @@
import org.apache.axis2.addressing.EndpointReference;
import org.apache.kandula.KandulaException;
-import org.apache.kandula.coordinator.at.ATCoordinator;
import org.apache.kandula.context.ActivityContext;
import org.apache.kandula.context.ContextFactory;
+import org.apache.kandula.coordinator.at.ATCoordinator;
import org.apache.kandula.storage.StorageFactory;
import org.apache.kandula.storage.Store;
-import org.apache.kandula.typemapping.CoordinationContext;
+import org.apache.kandula.context.coordination.CoordinationContext;
/**
* @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
- *
- * This class implements the operations defined in WS-Coordination specification
*/
public class Coordinator {
private Store store;
- //till we be able to use refrence propoerties correctly
+ //till we be able to use reference properties correctly
public static String ACTIVITY_ID;
public Coordinator() {
@@ -42,23 +40,22 @@
}
/**
- * @param Coordination
- * Type
+ * @param Coordination Type
* @return the Coordination Context created
- *
- * Initiators can use this to Create new Distributed transactions.This will
- * take in the Coordination Type and will create an instance of the
- * reapective ActivityContext. The Coordination Context created by this can
- * be used to convey the information about the transaction between
- * initiator,Participants and coordinator
+ * <p/>
+ * Initiators can use this to Create new Distributed transactions.This will
+ * take in the Coordination Type and will create an instance of the
+ * reapective ActivityContext. The Coordination Context created by this can
+ * be used to convey the information about the transaction between
+ * initiator,Participants and coordinator
* @throws KandulaException
*/
public ActivityContext createCoordinationContext(String coordinationType,
- long expires) throws KandulaException {
+ long expires) throws KandulaException {
ContextFactory factory = ContextFactory.getInstance();
ActivityContext context = factory.createActivity(coordinationType);
context.getCoordinationContext().setExpires(expires);
- ACTIVITY_ID = context.getCoordinationContext().getActivityID();
+ ACTIVITY_ID = context.getCoordinationContext().getActivityID();
store.putContext(context.getCoordinationContext().getActivityID(),
context);
return context;
@@ -67,12 +64,12 @@
/**
* @param CoordinationContext
* @return the interposed Coordination Context created
- *
- * Participants decided to use this Coordinator as a interposed
- * sub-coordinator.The newly created CoordinationContext will contain the
- * same ActivityIdentifier & Protocol type. Registration EPR of the earlier
- * CoordinationContext will be replaced by the RegistrationEPR of this
- * Coordinator.
+ * <p/>
+ * Participants decided to use this Coordinator as a interposed
+ * sub-coordinator.The newly created CoordinationContext will contain the
+ * same ActivityIdentifier & Protocol type. Registration EPR of the earlier
+ * CoordinationContext will be replaced by the RegistrationEPR of this
+ * Coordinator.
*/
public ActivityContext createCoordinationContext(
CoordinationContext coorContext) throws KandulaException {
@@ -88,15 +85,15 @@
* @param participantEPR
* @param Activity-id
* @return Should return the particular Coordiators End Point Reference
- *
- * This method provides the functional logic for participants to register
- * for a particular transaction activity which was created by a initiator.
- * Registration request will be forwarded to repective protocol
- * coordinators.
+ * <p/>
+ * This method provides the functional logic for participants to register
+ * for a particular transaction activity which was created by a initiator.
+ * Registration request will be forwarded to repective protocol
+ * coordinators.
* @throws KandulaException
*/
public EndpointReference registerParticipant(String id, String protocol,
- EndpointReference participantEPR) throws KandulaException {
+ EndpointReference participantEPR) throws KandulaException {
ActivityContext context = getCoordinationContext(id);
if (context == null) {
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/CoordinatorUtils.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/CoordinatorUtils.java?rev=289151&r1=289150&r2=289151&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/CoordinatorUtils.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/CoordinatorUtils.java Wed Sep 14 22:22:50 2005
@@ -16,14 +16,14 @@
*/
package org.apache.kandula.coordinator;
+import org.apache.kandula.context.ActivityContext;
+
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Random;
-import org.apache.kandula.context.ActivityContext;
-
/**
* @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
*/
@@ -32,50 +32,5 @@
public static ActivityContext getActivityContext(String id) {
return null;
- }
-
- /**
- * MD5 a random string with localhost/date etc will return 128 bits
- * construct a string of 18 characters from those bits.
- *
- * @return string
- */
- public static String getRandomStringOf18Characters() {
- if (myRand == null) {
- myRand = new Random();
- }
- long rand = myRand.nextLong();
- String sid;
- try {
- sid = InetAddress.getLocalHost().toString();
- } catch (UnknownHostException e) {
- sid = Thread.currentThread().getName();
- }
- long time = System.currentTimeMillis();
- StringBuffer sb = new StringBuffer();
- sb.append(sid);
- sb.append(":");
- sb.append(Long.toString(time));
- sb.append(":");
- sb.append(Long.toString(rand));
- MessageDigest md5 = null;
- try {
- md5 = MessageDigest.getInstance("MD5");
- } catch (NoSuchAlgorithmException e) {
- System.out.println("Error: " + e);
- }
- md5.update(sb.toString().getBytes());
- byte[] array = md5.digest();
- StringBuffer sb2 = new StringBuffer();
- for (int j = 0; j < array.length; ++j) {
- int b = array[j] & 0xFF;
- sb2.append(Integer.toHexString(b));
- }
- int begin = myRand.nextInt();
- if (begin < 0)
- begin = begin * -1;
- begin = begin % 8;
- return new String(sb2.toString().substring(begin, begin + 18))
- .toUpperCase();
}
}
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/Registerable.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/Registerable.java?rev=289151&r1=289150&r2=289151&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/Registerable.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/Registerable.java Wed Sep 14 22:22:50 2005
@@ -1,15 +1,27 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
package org.apache.kandula.coordinator;
import org.apache.axis2.addressing.EndpointReference;
-import org.apache.kandula.context.ActivityContext;
import org.apache.kandula.KandulaException;
+import org.apache.kandula.context.ActivityContext;
/**
- * Created by IntelliJ IDEA.
- * User: Thilina
- * Date: Sep 13, 2005
- * Time: 8:17:20 PM
- * To change this template use File | Settings | File Templates.
+ * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
*/
public interface Registerable {
public EndpointReference register(ActivityContext context, String protocol,
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=289151&r1=289150&r2=289151&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 Wed Sep 14 22:22:50 2005
@@ -16,17 +16,17 @@
*/
package org.apache.kandula.coordinator.at;
-import java.util.Iterator;
-
import org.apache.axis2.addressing.EndpointReference;
import org.apache.kandula.Constants;
import org.apache.kandula.KandulaException;
import org.apache.kandula.Status;
import org.apache.kandula.Status.CoordinatorStatus;
-import org.apache.kandula.coordinator.CoordinatorUtils;
-import org.apache.kandula.coordinator.Registerable;
import org.apache.kandula.context.ActivityContext;
import org.apache.kandula.context.at.ATActivityContext;
+import org.apache.kandula.coordinator.CoordinatorUtils;
+import org.apache.kandula.coordinator.Registerable;
+
+import java.util.Iterator;
/**
* @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
@@ -34,37 +34,36 @@
public class ATCoordinator implements Registerable {
public EndpointReference register(ActivityContext context, String protocol,
- EndpointReference participantEPR) throws KandulaException {
+ EndpointReference participantEPR) throws KandulaException {
context.lock();
switch (context.getStatus()) {
- case CoordinatorStatus.STATUS_PREPARING_DURABLE:
- context.unlock();
- this.abort(context);
- throw new IllegalStateException(
- "Coordinator is in preparing state - Durable ");
- case CoordinatorStatus.STATUS_PREPARED_SUCCESS:
- context.unlock();
- throw new IllegalStateException(
- "Coordinator is in prepared success state");
- case CoordinatorStatus.STATUS_COMMITTING:
- context.unlock();
- throw new IllegalStateException(
- "Coordinator is in committing state");
- case CoordinatorStatus.STATUS_ABORTING:
- throw new IllegalStateException("Coordinator is in Aborting state");
- case CoordinatorStatus.STATUS_ACTIVE:
- case CoordinatorStatus.STATUS_PREPARING_VOLATILE:
- return addParticipant(context,protocol, participantEPR);
- case CoordinatorStatus.STATUS_NONE:
- default:
- context.unlock();
- throw new IllegalStateException();
+ case CoordinatorStatus.STATUS_PREPARING_DURABLE:
+ context.unlock();
+ this.abort(context);
+ throw new IllegalStateException(
+ "Coordinator is in preparing state - Durable ");
+ case CoordinatorStatus.STATUS_PREPARED_SUCCESS:
+ context.unlock();
+ throw new IllegalStateException(
+ "Coordinator is in prepared success state");
+ case CoordinatorStatus.STATUS_COMMITTING:
+ context.unlock();
+ throw new IllegalStateException(
+ "Coordinator is in committing state");
+ case CoordinatorStatus.STATUS_ABORTING:
+ throw new IllegalStateException("Coordinator is in Aborting state");
+ case CoordinatorStatus.STATUS_ACTIVE:
+ case CoordinatorStatus.STATUS_PREPARING_VOLATILE:
+ return addParticipant(context, protocol, participantEPR);
+ case CoordinatorStatus.STATUS_NONE:
+ default:
+ context.unlock();
+ throw new IllegalStateException();
}
}
/**
- * @param Activity
- * Id taken from the Request
+ * @param Activity Id taken from the Request
* @return should be a notification This wraps the Commit operation defined
* in Ws-AtomicTransaction specification.
*/
@@ -81,35 +80,35 @@
*/
context.lock();
switch (context.getStatus()) {
- case CoordinatorStatus.STATUS_NONE:
- case CoordinatorStatus.STATUS_ABORTING:
- context.unlock();
- return "Aborted";
- case CoordinatorStatus.STATUS_PREPARING_DURABLE:
- case CoordinatorStatus.STATUS_PREPARING_VOLATILE:
- case CoordinatorStatus.STATUS_PREPARED_SUCCESS:
- //If prepared success Ignore this message
- context.unlock();
- return null;
- case CoordinatorStatus.STATUS_COMMITTING:
- context.unlock();
- return "Committed";
- case Status.CoordinatorStatus.STATUS_ACTIVE:
- int result;
- result = volatilePrepare(context);
-
- if (result == Status.CoordinatorStatus.STATUS_ABORTING) {
- context.lock();
- context.setStatus(Status.CoordinatorStatus.STATUS_ABORTING);
+ case CoordinatorStatus.STATUS_NONE:
+ case CoordinatorStatus.STATUS_ABORTING:
context.unlock();
- abort(context);
- }
-
- result = commit(context);
- return null;
- default:
- context.unlock();
- return null;
+ return "Aborted";
+ case CoordinatorStatus.STATUS_PREPARING_DURABLE:
+ case CoordinatorStatus.STATUS_PREPARING_VOLATILE:
+ case CoordinatorStatus.STATUS_PREPARED_SUCCESS:
+ //If prepared success Ignore this message
+ context.unlock();
+ return null;
+ case CoordinatorStatus.STATUS_COMMITTING:
+ context.unlock();
+ return "Committed";
+ case Status.CoordinatorStatus.STATUS_ACTIVE:
+ int result;
+ result = volatilePrepare(context);
+
+ if (result == Status.CoordinatorStatus.STATUS_ABORTING) {
+ context.lock();
+ context.setStatus(Status.CoordinatorStatus.STATUS_ABORTING);
+ context.unlock();
+ abort(context);
+ }
+
+ result = commit(context);
+ return null;
+ default:
+ context.unlock();
+ return null;
}
}
@@ -126,32 +125,32 @@
*/
context.lock();
switch (context.getStatus()) {
- case CoordinatorStatus.STATUS_NONE:
- case CoordinatorStatus.STATUS_ABORTING:
- context.unlock();
- return "Aborted";
- case CoordinatorStatus.STATUS_PREPARING_DURABLE:
- case CoordinatorStatus.STATUS_PREPARING_VOLATILE:
- case CoordinatorStatus.STATUS_PREPARED_SUCCESS:
- //If prepared success Ignore this message
- context.unlock();
- return null;
- case CoordinatorStatus.STATUS_COMMITTING:
- context.unlock();
- return "Committed";
- case Status.CoordinatorStatus.STATUS_ACTIVE:
- context.setStatus(Status.CoordinatorStatus.STATUS_ABORTING);
- context.unlock();
- int result = abort(context);
- // if (result ==fdsfsfd)
- // {
- // throw new Exception
- // }
-
- return null;
- default:
- context.unlock();
- return null;
+ case CoordinatorStatus.STATUS_NONE:
+ case CoordinatorStatus.STATUS_ABORTING:
+ context.unlock();
+ return "Aborted";
+ case CoordinatorStatus.STATUS_PREPARING_DURABLE:
+ case CoordinatorStatus.STATUS_PREPARING_VOLATILE:
+ case CoordinatorStatus.STATUS_PREPARED_SUCCESS:
+ //If prepared success Ignore this message
+ context.unlock();
+ return null;
+ case CoordinatorStatus.STATUS_COMMITTING:
+ context.unlock();
+ return "Committed";
+ case Status.CoordinatorStatus.STATUS_ACTIVE:
+ context.setStatus(Status.CoordinatorStatus.STATUS_ABORTING);
+ context.unlock();
+ int result = abort(context);
+ // if (result ==fdsfsfd)
+ // {
+ // throw new Exception
+ // }
+
+ return null;
+ default:
+ context.unlock();
+ return null;
}
}
@@ -258,7 +257,7 @@
}
public EndpointReference addParticipant(ActivityContext context, String protocol,
- EndpointReference participantEPR) throws KandulaException {
+ EndpointReference participantEPR) throws KandulaException {
ATActivityContext atContext = (ATActivityContext) context;
if (protocol.equals(Constants.WS_AT_DURABLE2PC))
return atContext.addParticipant(participantEPR, protocol);
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/at/ATSubCoordinator.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/at/ATSubCoordinator.java?rev=289151&r1=289150&r2=289151&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/at/ATSubCoordinator.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/at/ATSubCoordinator.java Wed Sep 14 22:22:50 2005
@@ -38,7 +38,7 @@
}
public EndpointReference addParticipant(ActivityContext context, String protocol,
- EndpointReference participantEPR) throws KandulaException {
+ EndpointReference participantEPR) throws KandulaException {
ATActivityContext atContext = (ATActivityContext) context;
if (protocol.equals(Constants.WS_AT_DURABLE2PC)) {
if (!atContext.getSubDurableRegistered()) {
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/ba/BACoordinator.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/ba/BACoordinator.java?rev=289151&r1=289150&r2=289151&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/ba/BACoordinator.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/ba/BACoordinator.java Wed Sep 14 22:22:50 2005
@@ -16,13 +16,17 @@
*/
package org.apache.kandula.coordinator.ba;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.kandula.KandulaException;
import org.apache.kandula.context.ActivityContext;
+import org.apache.kandula.coordinator.Registerable;
/**
* @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
*/
-public interface BACoordinator {
- public abstract String register(ActivityContext context, String protocol,
- String participantEPR);
+public class BACoordinator implements Registerable {
+ public EndpointReference register(ActivityContext context, String protocol, EndpointReference participantEPR) throws KandulaException {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
}
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/initiator/TransactionManager.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/initiator/TransactionManager.java?rev=289151&r1=289150&r2=289151&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/initiator/TransactionManager.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/initiator/TransactionManager.java Wed Sep 14 22:22:50 2005
@@ -16,8 +16,6 @@
*/
package org.apache.kandula.initiator;
-import java.rmi.RemoteException;
-
import org.apache.axis2.addressing.EndpointReference;
import org.apache.kandula.KandulaException;
import org.apache.kandula.context.ActivityContext;
@@ -29,6 +27,8 @@
import org.apache.kandula.wscoor.ActivationCoordinatorPortTypeRawXMLStub;
import org.apache.kandula.wscoor.RegistrationCoordinatorPortTypeRawXMLStub;
+import java.rmi.RemoteException;
+
/**
* @author Dasarath Weeratunge
* @author <a href="mailto:thilina@apache.org"> Thilina Gunarathne </a>
@@ -42,7 +42,7 @@
public static String tempID;
public TransactionManager(String coordinationType,
- EndpointReference coordEPR) throws KandulaException {
+ EndpointReference coordEPR) throws KandulaException {
threadInfo = new ThreadLocal();
ActivityContext context = ContextFactory.getInstance().createActivity(
coordinationType, coordEPR);
@@ -66,7 +66,7 @@
threadInfo.set(id);
ActivationCoordinatorPortTypeRawXMLStub activationCoordinator = new ActivationCoordinatorPortTypeRawXMLStub(
".", (EndpointReference) context
- .getProperty(ATActivityContext.ACTIVATION_EPR));
+ .getProperty(ATActivityContext.ACTIVATION_EPR));
activationCoordinator.createCoordinationContextOperation(
org.apache.kandula.Constants.WS_AT, id);
while (context.getCoordinationContext() == null) {
Copied: webservices/kandula/trunk/java/src/org/apache/kandula/initiator/handler/TransactionOutHandler.java (from r280858, webservices/kandula/trunk/java/src/org/apache/kandula/initiator/handler/TransactionHandler.java)
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/initiator/handler/TransactionOutHandler.java?p2=webservices/kandula/trunk/java/src/org/apache/kandula/initiator/handler/TransactionOutHandler.java&p1=webservices/kandula/trunk/java/src/org/apache/kandula/initiator/handler/TransactionHandler.java&r1=280858&r2=289151&rev=289151&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/initiator/handler/TransactionHandler.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/initiator/handler/TransactionOutHandler.java Wed Sep 14 22:22:50 2005
@@ -14,26 +14,36 @@
* limitations under the License.
*
*/
-package org.apache.kandula.participant.initiator;
+package org.apache.kandula.initiator.handler;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.MessageInformationHeaders;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.handlers.AbstractHandler;
+import org.apache.axis2.soap.SOAPHeader;
+import org.apache.kandula.context.ActivityContext;
+import org.apache.kandula.context.coordination.CoordinationContext;
+import org.apache.kandula.storage.StorageFactory;
+public class TransactionOutHandler extends AbstractHandler {
+ private ThreadLocal threadInfo = new ThreadLocal();
+
+ public void invoke(MessageContext msgContext) throws AxisFault {
+ Object key = threadInfo.get();
+ if (null != key) {
+ ActivityContext context = StorageFactory.getInstance().getStore()
+ .getContext(key);
+ if (context == null) {
+ throw new AxisFault("IllegalState");
+ }
+
+ MessageInformationHeaders messageInformationHeaders =
+ msgContext.getMessageInformationHeaders();
+ SOAPHeader soapHeader = msgContext.getEnvelope().getHeader();
+ CoordinationContext coorContext = context.getCoordinationContext();
+ soapHeader.addChild(coorContext.toOM());
+ }
+ }
+}
-/**
- * @author Dasarath Weeratunge
- */
-//public class TransactionHandler extends BasicHandler {
-//// TransactionManager tm= TransactionManager.getInstance();
-//// public void invoke(MessageContext msgContext) throws AxisFault {
-//// Transaction tx= tm.getTransaction();
-//// if (tx != null) {
-//// try {
-//// SOAPHeader header= msgContext.getCurrentMessage().getSOAPEnvelope().getHeader();
-//// tx.getCoordinationContex().toSOAPHeaderElement(header);
-//// }
-//// catch (Exception e) {
-//// throw AxisFault.makeFault(e);
-//// }
-//// }
-//// }
-//}
Added: webservices/kandula/trunk/java/src/org/apache/kandula/participant/simple/SimpleResource.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/participant/simple/SimpleResource.java?rev=289151&view=auto
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/participant/simple/SimpleResource.java (added)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/participant/simple/SimpleResource.java Wed Sep 14 22:22:50 2005
@@ -0,0 +1,26 @@
+/*
+ * 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.simple;
+
+/**
+ * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
+ */
+public interface SimpleResource {
+ public void commit();
+ public void rollback();
+ public boolean prepare();
+}
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/storage/Axis1Store.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/storage/Axis1Store.java?rev=289151&r1=289150&r2=289151&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/storage/Axis1Store.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/storage/Axis1Store.java Wed Sep 14 22:22:50 2005
@@ -23,28 +23,28 @@
*/
public class Axis1Store implements Store {
- /* (non-Javadoc)
- * @see org.apache.kandula.storage.Store#putContext(java.lang.String, org.apache.kandula.context.CoordinationContext)
- */
- public void putContext(Object id, ActivityContext context) {
- // TODO Auto-generated method stub
-
- }
+ /* (non-Javadoc)
+ * @see org.apache.kandula.storage.Store#putContext(java.lang.String, org.apache.kandula.context.coordination.CoordinationContext)
+ */
+ public void putContext(Object id, ActivityContext context) {
+ // TODO Auto-generated method stub
- /* (non-Javadoc)
- * @see org.apache.kandula.storage.Store#getContext(java.lang.String)
- */
- public ActivityContext getContext(Object id) {
-
- return null;
- }
+ }
- /* (non-Javadoc)
- * @see org.apache.kandula.storage.Store#forgetContext(java.lang.String)
- */
- public void forgetContext(Object id) {
- // TODO Auto-generated method stub
-
- }
+ /* (non-Javadoc)
+ * @see org.apache.kandula.storage.Store#getContext(java.lang.String)
+ */
+ public ActivityContext getContext(Object id) {
+
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.kandula.storage.Store#forgetContext(java.lang.String)
+ */
+ public void forgetContext(Object id) {
+ // TODO Auto-generated method stub
+
+ }
}
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/storage/Axis2Store.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/storage/Axis2Store.java?rev=289151&r1=289150&r2=289151&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/storage/Axis2Store.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/storage/Axis2Store.java Wed Sep 14 22:22:50 2005
@@ -21,26 +21,25 @@
/**
* @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
*/
-public class Axis2Store implements Store{
+public class Axis2Store implements Store {
- /* (non-Javadoc)
- * @see org.apache.kandula.storage.Store#putContext(java.lang.String, org.apache.kandula.context.CoordinationContext)
- */
- public void putContext(Object id, ActivityContext context) {
- // TODO Auto-generated method stub
-
- }
+ /* (non-Javadoc)
+ * @see org.apache.kandula.storage.Store#putContext(java.lang.String, org.apache.kandula.context.coordination.CoordinationContext)
+ */
+ public void putContext(Object id, ActivityContext context) {
+ // TODO Auto-generated method stub
- /* (non-Javadoc)
- * @see org.apache.kandula.storage.Store#getContext(java.lang.String)
- */
- public ActivityContext getContext(Object id) {
- return null;
-
- }
-
- public void forgetContext(Object id)
- {
- }
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.kandula.storage.Store#getContext(java.lang.String)
+ */
+ public ActivityContext getContext(Object id) {
+ return null;
+
+ }
+
+ public void forgetContext(Object id) {
+ }
}
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/storage/SimpleStore.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/storage/SimpleStore.java?rev=289151&r1=289150&r2=289151&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/storage/SimpleStore.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/storage/SimpleStore.java Wed Sep 14 22:22:50 2005
@@ -16,23 +16,24 @@
*/
package org.apache.kandula.storage;
-import java.util.HashMap;
-
import org.apache.kandula.context.ActivityContext;
+import java.util.HashMap;
+
/**
* @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
*/
public class SimpleStore implements Store {
private HashMap contextMap;
+
/* (non-Javadoc)
- * @see org.apache.kandula.storage.Store#putContext(java.lang.String, org.apache.kandula.context.ActivityContext)
- */
- public SimpleStore()
- {
+ * @see org.apache.kandula.storage.Store#putContext(java.lang.String, org.apache.kandula.context.ActivityContext)
+ */
+ public SimpleStore() {
contextMap = new HashMap();
}
+
public void putContext(Object id, ActivityContext context) {
contextMap.put(id, context);
}
@@ -41,7 +42,7 @@
* @see org.apache.kandula.storage.Store#getContext(java.lang.String)
*/
public ActivityContext getContext(Object id) {
- return (ActivityContext)contextMap.get(id);
+ return (ActivityContext) contextMap.get(id);
}
/* (non-Javadoc)
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/storage/StorageFactory.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/storage/StorageFactory.java?rev=289151&r1=289150&r2=289151&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/storage/StorageFactory.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/storage/StorageFactory.java Wed Sep 14 22:22:50 2005
@@ -21,18 +21,17 @@
* @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
*/
public class StorageFactory {
- private static StorageFactory instance = new StorageFactory();
- private Store store;
- public static StorageFactory getInstance()
- {
- return instance;
- }
- public Store getStore()
- {
- if (store ==null)
- {
- store = new SimpleStore();
- }
- return store;
- }
+ private static StorageFactory instance = new StorageFactory();
+ private Store store;
+
+ public static StorageFactory getInstance() {
+ return instance;
+ }
+
+ public Store getStore() {
+ if (store == null) {
+ store = new SimpleStore();
+ }
+ return store;
+ }
}
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/storage/Store.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/storage/Store.java?rev=289151&r1=289150&r2=289151&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/storage/Store.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/storage/Store.java Wed Sep 14 22:22:50 2005
@@ -22,7 +22,9 @@
* @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
*/
public interface Store {
- void putContext(Object id,ActivityContext context);
- ActivityContext getContext(Object id);
- void forgetContext(Object id);
+ void putContext(Object id, ActivityContext context);
+
+ ActivityContext getContext(Object id);
+
+ void forgetContext(Object id);
}
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/typemapping/xmlbeansimpl/XmlBeansTypeCoordinationContext.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/typemapping/xmlbeansimpl/XmlBeansTypeCoordinationContext.java?rev=289151&r1=289150&r2=289151&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/typemapping/xmlbeansimpl/XmlBeansTypeCoordinationContext.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/typemapping/xmlbeansimpl/XmlBeansTypeCoordinationContext.java Wed Sep 14 22:22:50 2005
@@ -18,7 +18,7 @@
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.om.OMElement;
-import org.apache.kandula.typemapping.CoordinationContext;
+import org.apache.kandula.context.coordination.CoordinationContext;
import org.apache.kandula.typemapping.EndPointReference;
import org.xmlsoap.schemas.ws.x2002.x07.utility.AttributedDateTime;
import org.xmlsoap.schemas.ws.x2002.x07.utility.AttributedURI;
@@ -30,20 +30,21 @@
*/
public class XmlBeansTypeCoordinationContext implements CoordinationContext {
private CoordinationContextType contextType;
-
+
public XmlBeansTypeCoordinationContext() {
super();
EndpointReferenceType epr = EndpointReferenceType.Factory.newInstance();
contextType = CoordinationContextType.Factory.newInstance();
}
+
/**
* @param contextType
*/
public XmlBeansTypeCoordinationContext(Object contextType) {
super();
- this.contextType = (CoordinationContextType)contextType;
+ this.contextType = (CoordinationContextType) contextType;
}
-
+
public String getActivityID() {
return contextType.getIdentifier().getId();
}
@@ -73,7 +74,7 @@
}
public void setRegistrationService(EndpointReference value) {
- // contextType.setRegistrationService((EndpointReferenceType)value.getEndPointReferenceType());
+ // contextType.setRegistrationService((EndpointReferenceType)value.getEndPointReferenceType());
}
@@ -86,9 +87,10 @@
public Object getCoordinationContextType() {
return contextType;
}
+
/* (non-Javadoc)
- * @see org.apache.kandula.typemapping.CoordinationContext#toOM()
- */
+ * @see org.apache.kandula.context.coordination.CoordinationContext#toOM()
+ */
public OMElement toOM() {
// TODO Auto-generated method stub
return null;
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/typemapping/xmlbeansimpl/XmlBeansTypeEndPointReference.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/typemapping/xmlbeansimpl/XmlBeansTypeEndPointReference.java?rev=289151&r1=289150&r2=289151&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/typemapping/xmlbeansimpl/XmlBeansTypeEndPointReference.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/typemapping/xmlbeansimpl/XmlBeansTypeEndPointReference.java Wed Sep 14 22:22:50 2005
@@ -23,28 +23,30 @@
* @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
*/
public class XmlBeansTypeEndPointReference implements EndPointReference {
-
+
EndpointReferenceType eprType;
-
+
/**
*
*/
public XmlBeansTypeEndPointReference() {
super();
- eprType = EndpointReferenceType.Factory.newInstance();
+ eprType = EndpointReferenceType.Factory.newInstance();
}
+
/**
* @param eprType
*/
public XmlBeansTypeEndPointReference(Object eprType) {
super();
- this.eprType = (EndpointReferenceType)eprType;
+ this.eprType = (EndpointReferenceType) eprType;
}
+
public Object getEndPointReferenceType() {
return eprType;
}
- public String getPortTypeLocalPart()
- {
+
+ public String getPortTypeLocalPart() {
return eprType.getPortType().getQNameValue().getLocalPart();
}
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=289151&r1=289150&r2=289151&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 Wed Sep 14 22:22:50 2005
@@ -16,14 +16,16 @@
*/
package org.apache.kandula.utility;
-import java.io.InputStream;
-import java.net.InetAddress;
-import java.util.Properties;
+import org.apache.axis2.addressing.AnyContentType;
+import org.apache.axis2.addressing.EndpointReference;
import javax.xml.namespace.QName;
+import java.util.Properties;
-import org.apache.axis2.addressing.AnyContentType;
-import org.apache.axis2.addressing.EndpointReference;
+/**
+ * @author Dasarath Weeratunge
+ * @author <a href="mailto:thilina@apache.org"> Thilina Gunarathne </a>
+ */
public class EndpointReferenceFactory {
static final String PROPERTY_FILE = "endpoints.conf";
@@ -76,7 +78,7 @@
epr.setReferenceProperties(refProperties);
return epr;
}
-
+
public EndpointReference getCompletionParticipantEndpoint(String id) {
//TODO set this somehow reading the conf file
EndpointReference epr = new EndpointReference(
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=289151&r1=289150&r2=289151&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 Wed Sep 14 22:22:50 2005
@@ -16,12 +16,6 @@
*/
package org.apache.kandula.utility;
-import java.io.IOException;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-
-import javax.xml.namespace.QName;
-
import org.apache.axis2.AxisFault;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.description.ParameterImpl;
@@ -31,6 +25,11 @@
import org.apache.axis2.transport.http.SimpleHTTPServer;
import org.apache.axis2.util.Utils;
+import javax.xml.namespace.QName;
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+
/**
* @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
*/
@@ -72,9 +71,8 @@
}
}
-
- public void stop()
- {
+
+ public void stop() {
receiver.stop();
serverStarted = false;
}
@@ -82,12 +80,11 @@
/**
* @param serviceName
* @param operationName
- * @throws AxisFault
- * To add services with only one operation, which is the
- * frequent case in reponses
+ * @throws AxisFault To add services with only one operation, which is the
+ * frequent case in reponses
*/
public void addService(QName serviceName, QName operationName,
- String className) throws AxisFault {
+ String className) throws AxisFault {
ServiceDescription service = new ServiceDescription(serviceName);
service.addParameter(new ParameterImpl(
AbstractMessageReceiver.SERVICE_CLASS, className));
@@ -110,7 +107,7 @@
}
public String getHost() throws UnknownHostException {
- return "http://"+InetAddress.getLocalHost().getHostAddress() + ":" + SERVER_PORT
+ return "http://" + InetAddress.getLocalHost().getHostAddress() + ":" + SERVER_PORT
+ "/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=289151&r1=289150&r2=289151&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 Wed Sep 14 22:22:50 2005
@@ -16,29 +16,27 @@
*/
package org.apache.kandula.utility;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-import java.util.Iterator;
-import java.util.Random;
-
-import javax.xml.namespace.QName;
-
import org.apache.axis2.addressing.AddressingConstants;
+import org.apache.axis2.addressing.AddressingConstants.Final;
import org.apache.axis2.addressing.AnyContentType;
import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.addressing.AddressingConstants.Final;
import org.apache.axis2.om.OMElement;
import org.apache.axis2.om.OMNamespace;
import org.apache.axis2.soap.SOAPFactory;
+import javax.xml.namespace.QName;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.util.Iterator;
+import java.util.Random;
+
/**
* @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
*/
public class KandulaUtils {
- public static void endpointToOM(EndpointReference epr, OMElement parentEPR,SOAPFactory factory)
- {
+ public static void endpointToOM(EndpointReference epr, OMElement parentEPR, SOAPFactory factory) {
OMNamespace wsAddressing = factory.createOMNamespace(
AddressingConstants.Submission.WSA_NAMESPACE,
AddressingConstants.WSA_DEFAULT_PRFIX);
@@ -67,9 +65,11 @@
}
}
}
+
/**
* 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() {
@@ -103,7 +103,7 @@
sb2.append(Integer.toHexString(b));
}
int begin = myRand.nextInt();
- if(begin < 0) begin = begin * -1;
+ if (begin < 0) begin = begin * -1;
begin = begin % 8;
return new String(sb2.toString().substring(begin, begin + 18)).toUpperCase();
}
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=289151&r1=289150&r2=289151&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 Wed Sep 14 22:22:50 2005
@@ -16,10 +16,6 @@
*/
package org.apache.kandula.wscoor;
-import java.io.IOException;
-
-import javax.xml.namespace.QName;
-
import org.apache.axis2.addressing.AnyContentType;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.clientapi.MessageSender;
@@ -29,6 +25,9 @@
import org.apache.kandula.Constants;
import org.apache.kandula.utility.KandulaListener;
+import javax.xml.namespace.QName;
+import java.io.IOException;
+
/**
* @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
*/
@@ -65,7 +64,7 @@
* Constructor
*/
public ActivationCoordinatorPortTypeRawXMLStub(String axis2Home,
- EndpointReference targetEndpoint) throws java.lang.Exception {
+ EndpointReference targetEndpoint) throws java.lang.Exception {
this.toEPR = targetEndpoint;
//creating the configuration
_configurationContext = new org.apache.axis2.context.ConfigurationContextFactory()
@@ -95,7 +94,7 @@
}
public void createCoordinationContextOperation(String coordinationType,
- String id) throws IOException {
+ String id) throws IOException {
QName serviceName = new QName("ActivationRequesterPortType");
QName operationName = new QName(Constants.WS_COOR,
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=289151&r1=289150&r2=289151&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 Wed Sep 14 22:22:50 2005
@@ -62,7 +62,7 @@
}
newMsgContext.setEnvelope(envelope);
newMsgContext.setSoapAction("CreateCoordinationContextOperation");
- // callback.handleResult(newMsgContext);
+ // callback.handleResult(newMsgContext);
}
} catch (Exception e) {
throw AxisFault.makeFault(e);
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/ActivationPortTypeRawXMLSkeleton.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/ActivationPortTypeRawXMLSkeleton.java?rev=289151&r1=289150&r2=289151&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/ActivationPortTypeRawXMLSkeleton.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/ActivationPortTypeRawXMLSkeleton.java Wed Sep 14 22:22:50 2005
@@ -1,21 +1,22 @@
package org.apache.kandula.wscoor;
-import javax.xml.namespace.QName;
-
import org.apache.axis2.om.OMElement;
import org.apache.kandula.KandulaException;
-import org.apache.kandula.coordinator.Coordinator;
import org.apache.kandula.context.ActivityContext;
+import org.apache.kandula.coordinator.Coordinator;
+
+import javax.xml.namespace.QName;
/**
- * Auto generated java skeleton for the service by the Axis code generator
+ * Auto generated java skeleton for the service by the Axis code generator
*/
public class ActivationPortTypeRawXMLSkeleton {
/**
* Auto generated method signature
- *@param requestElement
+ *
+ * @param requestElement
* @throws KandulaException
*/
public OMElement CreateCoordinationContextOperation(
@@ -23,7 +24,7 @@
throws KandulaException {
ActivityContext context;
Coordinator coordinator = new Coordinator();
-
+
// ActivityContext context;
// Coordinator coordinator = new Coordinator();
// if (requestDoc.getCreateCoordinationContext().getCurrentContext() != null) {
@@ -34,30 +35,27 @@
// {
String coordinationType = requestElement.getFirstChildWithName(new QName("CoordinationType")).getText();
OMElement expiresElement = requestElement.getFirstChildWithName(new QName("Expires"));
- String expires=null;
+ String expires = null;
long expiresL = 0;
- if (expiresElement!=null)
- {
+ if (expiresElement != null) {
expires = expiresElement.getText();
- if ((expires!=null)&&(expires.equals("")))
- {
+ if ((expires != null) && (expires.equals(""))) {
expiresL = Long.parseLong(expires);
- }
- }
- context = coordinator.createCoordinationContext(coordinationType,expiresL);
+ }
+ }
+ context = coordinator.createCoordinationContext(coordinationType, expiresL);
return context.getCoordinationContext().toOM();
-
+
// context(coordinationType, expiresL);
- // }
+ // }
// CreateCoordinationContextResponseDocument responseDoc = CreateCoordinationContextResponseDocument.Factory
// .newInstance();
// CreateCoordinationContextResponseType responseType = CreateCoordinationContextResponseType.Factory
// .newInstance();
// responseType.setCoordinationContext((CoordinationContextType)context.getCoordinationContext().getCoordinationContextType());
// responseDoc.setCreateCoordinationContextResponse(responseType);
- // return new OMElementImpl("Thilina",new OMNamespaceImpl("pre","http://www.thilina.org"));
-
-
+ // return new OMElementImpl("Thilina",new OMNamespaceImpl("pre","http://www.thilina.org"));
+
// if (requestDoc.getCreateCoordinationContext().getCurrentContext() != null) {
// CoordinationContext coorContext = CoordinationContext.Factory.newInstance(requestDoc
// .getCreateCoordinationContext().getCurrentContext());
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=289151&r1=289150&r2=289151&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 Wed Sep 14 22:22:50 2005
@@ -5,7 +5,7 @@
import org.apache.kandula.context.ActivityContext;
import org.apache.kandula.initiator.TransactionManager;
import org.apache.kandula.storage.StorageFactory;
-import org.apache.kandula.typemapping.CoordinationContext;
+import org.apache.kandula.context.coordination.CoordinationContext;
/*
* Copyright 2004,2005 The Apache Software Foundation.
@@ -39,12 +39,11 @@
public OMElement CreateCoordinationContextOperation(OMElement requestElement) {
// OMElement coordinationContextElement = requestElement
// .getFirstChildWithName(new QName("CoordinationContext"));
- if ("CoordinationContext".equals(requestElement.getLocalName()))
- {
- msgContext.getMessageInformationHeaders().getReferenceParameters();
- CoordinationContext coordinationContext =CoordinationContext.Factory.newInstance(requestElement);
- ActivityContext context = StorageFactory.getInstance().getStore().getContext(TransactionManager.tempID);
- context.setCoordinationContext(coordinationContext);
+ if ("CoordinationContext".equals(requestElement.getLocalName())) {
+ msgContext.getMessageInformationHeaders().getReferenceParameters();
+ CoordinationContext coordinationContext = CoordinationContext.Factory.newInstance(requestElement);
+ ActivityContext context = StorageFactory.getInstance().getStore().getContext(TransactionManager.tempID);
+ 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=289151&r1=289150&r2=289151&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 Wed Sep 14 22:22:50 2005
@@ -1,9 +1,5 @@
package org.apache.kandula.wscoor;
-import java.io.IOException;
-
-import javax.xml.namespace.QName;
-
import org.apache.axis2.addressing.AnyContentType;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.clientapi.MessageSender;
@@ -14,6 +10,9 @@
import org.apache.kandula.utility.KandulaListener;
import org.apache.kandula.utility.KandulaUtils;
+import javax.xml.namespace.QName;
+import java.io.IOException;
+
public class RegistrationCoordinatorPortTypeRawXMLStub extends
org.apache.axis2.clientapi.Stub {
@@ -46,7 +45,7 @@
* Constructor
*/
public RegistrationCoordinatorPortTypeRawXMLStub(String axis2Home,
- EndpointReference targetEndpoint) throws java.lang.Exception {
+ EndpointReference targetEndpoint) throws java.lang.Exception {
this.toEPR = targetEndpoint;
//creating the configuration
_configurationContext = new org.apache.axis2.context.ConfigurationContextFactory()
@@ -58,7 +57,7 @@
}
private org.apache.axis2.soap.SOAPEnvelope createSOAPEnvelope(
- String protocolType,EndpointReference epr) {
+ String protocolType, EndpointReference epr) {
org.apache.axis2.soap.SOAPEnvelope env = super.createEnvelope();
org.apache.axis2.soap.SOAPFactory factory = OMAbstractFactory
.getSOAP12Factory();
@@ -70,9 +69,9 @@
"ProtocolIdentifier", wsCoor);
protocolTypeElement.setText(protocolType);
request.addChild(protocolTypeElement);
-
- OMElement protocolService = factory.createOMElement("ParticipantProtocolService",wsCoor);
- KandulaUtils.endpointToOM(epr,protocolService,factory);
+
+ OMElement protocolService = factory.createOMElement("ParticipantProtocolService", wsCoor);
+ KandulaUtils.endpointToOM(epr, protocolService, factory);
request.addChild(protocolService);
env.getBody().addChild(request);
return env;
@@ -81,7 +80,7 @@
}
public void RegisterOperation(String protocolType, EndpointReference epr,
- String id) throws IOException {
+ String id) throws IOException {
QName serviceName = new QName("RegistrationRequesterPortType");
QName operationName = new QName(Constants.WS_COOR, "RegisterOperation");
@@ -104,7 +103,7 @@
messageSender.setTo(this.toEPR);
messageSender.setSoapAction("RegisterOperation");
//_call.setWsaAction("CreateCoordinationContextOperation");
- org.apache.axis2.soap.SOAPEnvelope env = createSOAPEnvelope(protocolType,epr);
+ org.apache.axis2.soap.SOAPEnvelope env = createSOAPEnvelope(protocolType, epr);
messageContext.setEnvelope(env);
System.out.println("visited registration send");
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/RegistrationPortTypeRawXMLSkeleton.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/RegistrationPortTypeRawXMLSkeleton.java?rev=289151&r1=289150&r2=289151&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/RegistrationPortTypeRawXMLSkeleton.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/RegistrationPortTypeRawXMLSkeleton.java Wed Sep 14 22:22:50 2005
@@ -16,11 +16,6 @@
*/
package org.apache.kandula.wscoor;
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import javax.xml.namespace.QName;
-
import org.apache.axis2.addressing.AnyContentType;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.context.MessageContext;
@@ -32,6 +27,10 @@
import org.apache.kandula.coordinator.Coordinator;
import org.apache.kandula.utility.KandulaUtils;
+import javax.xml.namespace.QName;
+import java.util.ArrayList;
+import java.util.Iterator;
+
/**
* @author <a href="mailto:thilina@apache.org"> Thilina Gunarathne </a>
*/
@@ -83,7 +82,7 @@
"CoordinatorProtocolService", wsCoor);
OMElement coordinatorProtocolService = factory.createOMElement(
"CoordinatorProtocolService", wsCoor);
- KandulaUtils.endpointToOM(epr,coordinatorProtocolService,factory);
+ KandulaUtils.endpointToOM(epr, coordinatorProtocolService, factory);
protocolService.addChild(coordinatorProtocolService);
return protocolService;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: kandula-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: kandula-dev-help@ws.apache.org