You are viewing a plain text version of this content. The canonical link for it is here.
Posted to kandula-dev@ws.apache.org by th...@apache.org on 2006/01/31 13:28:25 UTC
svn commit: r373804 [2/4] - in /webservices/kandula/trunk/java/src: ./
org/apache/kandula/ org/apache/kandula/context/
org/apache/kandula/context/at/ org/apache/kandula/context/coordination/
org/apache/kandula/coordinator/ org/apache/kandula/coordinato...
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/faults/AbstractKandulaException.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/faults/AbstractKandulaException.java?rev=373804&r1=373803&r2=373804&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/faults/AbstractKandulaException.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/faults/AbstractKandulaException.java Tue Jan 31 04:25:53 2006
@@ -21,44 +21,44 @@
*/
public abstract class AbstractKandulaException extends Exception {
- public AbstractKandulaException() {
- super();
- }
-
- /**
- * @param arg0 -
- * String
- */
- public AbstractKandulaException(String arg0) {
- super(arg0);
- }
-
- /**
- * @param arg0 -
- * Throwable
- */
- public AbstractKandulaException(Throwable arg0) {
- super(arg0);
- }
-
- /**
- * @param arg0 -
- * String
- * @param arg1 -
- * Throwable
- */
- public AbstractKandulaException(String arg0, Throwable arg1) {
- super(arg0, arg1);
- }
-
- public abstract String getFaultCode();
-
- public abstract String getFaultSubcode();
-
- public abstract String getFaultReason();
-
- public String getFaultDetail() {
- return this.toString();
- }
+ public AbstractKandulaException() {
+ super();
+ }
+
+ /**
+ * @param arg0 -
+ * String
+ */
+ public AbstractKandulaException(String arg0) {
+ super(arg0);
+ }
+
+ /**
+ * @param arg0 -
+ * Throwable
+ */
+ public AbstractKandulaException(Throwable arg0) {
+ super(arg0);
+ }
+
+ /**
+ * @param arg0 -
+ * String
+ * @param arg1 -
+ * Throwable
+ */
+ public AbstractKandulaException(String arg0, Throwable arg1) {
+ super(arg0, arg1);
+ }
+
+ public abstract String getFaultCode();
+
+ public abstract String getFaultSubcode();
+
+ public abstract String getFaultReason();
+
+ public String getFaultDetail() {
+ return this.toString();
+ }
}
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/faults/AlreadyRegisteredException.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/faults/AlreadyRegisteredException.java?rev=373804&r1=373803&r2=373804&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/faults/AlreadyRegisteredException.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/faults/AlreadyRegisteredException.java Tue Jan 31 04:25:53 2006
@@ -21,59 +21,59 @@
*/
public class AlreadyRegisteredException extends AbstractKandulaException {
- /**
- *
- */
- public AlreadyRegisteredException() {
- super();
- }
-
- /**
- * @param arg0
- */
- public AlreadyRegisteredException(String arg0) {
- super(arg0);
- }
-
- /**
- * @param arg0
- */
- public AlreadyRegisteredException(Throwable arg0) {
- super(arg0);
- }
-
- /**
- * @param arg0
- * @param arg1
- */
- public AlreadyRegisteredException(String arg0, Throwable arg1) {
- super(arg0, arg1);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.kandula.faults.KandulaFault#getFaultCode()
- */
- public String getFaultCode() {
- return "Sender";
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.kandula.faults.KandulaFault#getFaultSubcode()
- */
- public String getFaultSubcode() {
- return "wscoor:AlreadyRegistered";
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.kandula.faults.KandulaFault#getFaultReason()
- */
- public String getFaultReason() {
- return "The participant has already registered for the same protocol.";
- }
+ /**
+ *
+ */
+ public AlreadyRegisteredException() {
+ super();
+ }
+
+ /**
+ * @param arg0
+ */
+ public AlreadyRegisteredException(String arg0) {
+ super(arg0);
+ }
+
+ /**
+ * @param arg0
+ */
+ public AlreadyRegisteredException(Throwable arg0) {
+ super(arg0);
+ }
+
+ /**
+ * @param arg0
+ * @param arg1
+ */
+ public AlreadyRegisteredException(String arg0, Throwable arg1) {
+ super(arg0, arg1);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.kandula.faults.KandulaFault#getFaultCode()
+ */
+ public String getFaultCode() {
+ return "Sender";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.kandula.faults.KandulaFault#getFaultSubcode()
+ */
+ public String getFaultSubcode() {
+ return "wscoor:AlreadyRegistered";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.kandula.faults.KandulaFault#getFaultReason()
+ */
+ public String getFaultReason() {
+ return "The participant has already registered for the same protocol.";
+ }
}
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/faults/ContextRefusedException.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/faults/ContextRefusedException.java?rev=373804&r1=373803&r2=373804&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/faults/ContextRefusedException.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/faults/ContextRefusedException.java Tue Jan 31 04:25:53 2006
@@ -21,59 +21,59 @@
*/
public class ContextRefusedException extends AbstractKandulaException {
- /**
- *
- */
- public ContextRefusedException() {
- super();
- }
-
- /**
- * @param arg0
- */
- public ContextRefusedException(String arg0) {
- super(arg0);
- }
-
- /**
- * @param arg0
- */
- public ContextRefusedException(Throwable arg0) {
- super(arg0);
- }
-
- /**
- * @param arg0
- * @param arg1
- */
- public ContextRefusedException(String arg0, Throwable arg1) {
- super(arg0, arg1);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.kandula.faults.KandulaFault#getFaultCode()
- */
- public String getFaultCode() {
- return "Sender";
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.kandula.faults.KandulaFault#getFaultSubcode()
- */
- public String getFaultSubcode() {
- return "wscoor:ContextRefused";
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.kandula.faults.KandulaFault#getFaultReason()
- */
- public String getFaultReason() {
- return "The coordination context that was provided could not be accepted.";
- }
+ /**
+ *
+ */
+ public ContextRefusedException() {
+ super();
+ }
+
+ /**
+ * @param arg0
+ */
+ public ContextRefusedException(String arg0) {
+ super(arg0);
+ }
+
+ /**
+ * @param arg0
+ */
+ public ContextRefusedException(Throwable arg0) {
+ super(arg0);
+ }
+
+ /**
+ * @param arg0
+ * @param arg1
+ */
+ public ContextRefusedException(String arg0, Throwable arg1) {
+ super(arg0, arg1);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.kandula.faults.KandulaFault#getFaultCode()
+ */
+ public String getFaultCode() {
+ return "Sender";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.kandula.faults.KandulaFault#getFaultSubcode()
+ */
+ public String getFaultSubcode() {
+ return "wscoor:ContextRefused";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.kandula.faults.KandulaFault#getFaultReason()
+ */
+ public String getFaultReason() {
+ return "The coordination context that was provided could not be accepted.";
+ }
}
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/faults/InvalidParameterException.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/faults/InvalidParameterException.java?rev=373804&r1=373803&r2=373804&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/faults/InvalidParameterException.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/faults/InvalidParameterException.java Tue Jan 31 04:25:53 2006
@@ -21,60 +21,60 @@
*/
public class InvalidParameterException extends AbstractKandulaException {
- /**
- *
- */
- public InvalidParameterException() {
- super();
- }
-
- /**
- * @param arg0
- */
- public InvalidParameterException(String arg0) {
- super(arg0);
- }
-
- /**
- * @param arg0
- */
- public InvalidParameterException(Throwable arg0) {
- super(arg0);
- }
-
- /**
- * @param arg0
- * @param arg1
- */
- public InvalidParameterException(String arg0, Throwable arg1) {
- super(arg0, arg1);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.kandula.faults.KandulaFault#getFaultCode()
- */
- public String getFaultCode() {
- return "Sender";
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.kandula.faults.KandulaFault#getFaultSubcode()
- */
- public String getFaultSubcode() {
- return "wscoor:InvalidParameters";
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.kandula.faults.KandulaFault#getFaultReason()
- */
- public String getFaultReason() {
+ /**
+ *
+ */
+ public InvalidParameterException() {
+ super();
+ }
+
+ /**
+ * @param arg0
+ */
+ public InvalidParameterException(String arg0) {
+ super(arg0);
+ }
+
+ /**
+ * @param arg0
+ */
+ public InvalidParameterException(Throwable arg0) {
+ super(arg0);
+ }
+
+ /**
+ * @param arg0
+ * @param arg1
+ */
+ public InvalidParameterException(String arg0, Throwable arg1) {
+ super(arg0, arg1);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.kandula.faults.KandulaFault#getFaultCode()
+ */
+ public String getFaultCode() {
+ return "Sender";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.kandula.faults.KandulaFault#getFaultSubcode()
+ */
+ public String getFaultSubcode() {
+ return "wscoor:InvalidParameters";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.kandula.faults.KandulaFault#getFaultReason()
+ */
+ public String getFaultReason() {
- return "The message contained invalid parameters and could not be processed.x";
- }
+ return "The message contained invalid parameters and could not be processed.x";
+ }
}
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/faults/InvalidProtocolException.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/faults/InvalidProtocolException.java?rev=373804&r1=373803&r2=373804&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/faults/InvalidProtocolException.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/faults/InvalidProtocolException.java Tue Jan 31 04:25:53 2006
@@ -21,59 +21,59 @@
*/
public class InvalidProtocolException extends AbstractKandulaException {
- /**
- *
- */
- public InvalidProtocolException() {
- super();
- }
-
- /**
- * @param arg0
- */
- public InvalidProtocolException(String arg0) {
- super(arg0);
- }
-
- /**
- * @param arg0
- */
- public InvalidProtocolException(Throwable arg0) {
- super(arg0);
- }
-
- /**
- * @param arg0
- * @param arg1
- */
- public InvalidProtocolException(String arg0, Throwable arg1) {
- super(arg0, arg1);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.kandula.faults.KandulaFault#getFaultCode()
- */
- public String getFaultCode() {
- return "Sender";
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.kandula.faults.KandulaFault#getFaultSubcode()
- */
- public String getFaultSubcode() {
- return "wscoor:InvalidProtocol";
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.kandula.faults.KandulaFault#getFaultReason()
- */
- public String getFaultReason() {
- return "The protocol is invalid or is not supported by the coordinator.";
- }
+ /**
+ *
+ */
+ public InvalidProtocolException() {
+ super();
+ }
+
+ /**
+ * @param arg0
+ */
+ public InvalidProtocolException(String arg0) {
+ super(arg0);
+ }
+
+ /**
+ * @param arg0
+ */
+ public InvalidProtocolException(Throwable arg0) {
+ super(arg0);
+ }
+
+ /**
+ * @param arg0
+ * @param arg1
+ */
+ public InvalidProtocolException(String arg0, Throwable arg1) {
+ super(arg0, arg1);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.kandula.faults.KandulaFault#getFaultCode()
+ */
+ public String getFaultCode() {
+ return "Sender";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.kandula.faults.KandulaFault#getFaultSubcode()
+ */
+ public String getFaultSubcode() {
+ return "wscoor:InvalidProtocol";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.kandula.faults.KandulaFault#getFaultReason()
+ */
+ public String getFaultReason() {
+ return "The protocol is invalid or is not supported by the coordinator.";
+ }
}
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/faults/InvalidStateException.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/faults/InvalidStateException.java?rev=373804&r1=373803&r2=373804&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/faults/InvalidStateException.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/faults/InvalidStateException.java Tue Jan 31 04:25:53 2006
@@ -21,59 +21,59 @@
*/
public class InvalidStateException extends AbstractKandulaException {
- /**
- *
- */
- public InvalidStateException() {
- super();
- }
-
- /**
- * @param arg0
- */
- public InvalidStateException(String arg0) {
- super(arg0);
- }
-
- /**
- * @param arg0
- */
- public InvalidStateException(Throwable arg0) {
- super(arg0);
- }
-
- /**
- * @param arg0
- * @param arg1
- */
- public InvalidStateException(String arg0, Throwable arg1) {
- super(arg0, arg1);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.kandula.faults.KandulaFault#getFaultCode()
- */
- public String getFaultCode() {
- return "Sender";
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.kandula.faults.KandulaFault#getFaultSubcode()
- */
- public String getFaultSubcode() {
- return "wscoor:InvalidState";
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.kandula.faults.KandulaFault#getFaultReason()
- */
- public String getFaultReason() {
- return "The message was invalid for the current state of the activity.";
- }
+ /**
+ *
+ */
+ public InvalidStateException() {
+ super();
+ }
+
+ /**
+ * @param arg0
+ */
+ public InvalidStateException(String arg0) {
+ super(arg0);
+ }
+
+ /**
+ * @param arg0
+ */
+ public InvalidStateException(Throwable arg0) {
+ super(arg0);
+ }
+
+ /**
+ * @param arg0
+ * @param arg1
+ */
+ public InvalidStateException(String arg0, Throwable arg1) {
+ super(arg0, arg1);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.kandula.faults.KandulaFault#getFaultCode()
+ */
+ public String getFaultCode() {
+ return "Sender";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.kandula.faults.KandulaFault#getFaultSubcode()
+ */
+ public String getFaultSubcode() {
+ return "wscoor:InvalidState";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.kandula.faults.KandulaFault#getFaultReason()
+ */
+ public String getFaultReason() {
+ return "The message was invalid for the current state of the activity.";
+ }
}
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/faults/KandulaGeneralException.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/faults/KandulaGeneralException.java?rev=373804&r1=373803&r2=373804&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/faults/KandulaGeneralException.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/faults/KandulaGeneralException.java Tue Jan 31 04:25:53 2006
@@ -21,45 +21,45 @@
*/
public class KandulaGeneralException extends AbstractKandulaException {
- /**
- *
- */
- public KandulaGeneralException(Exception e) {
- super(e);
- }
-
- public KandulaGeneralException(String s, Exception e) {
- super(s, e);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.kandula.faults.AbstractKandulaException#getFaultCode()
- */
- public String getFaultCode() {
-
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.kandula.faults.AbstractKandulaException#getFaultSubcode()
- */
- public String getFaultSubcode() {
-
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.kandula.faults.AbstractKandulaException#getFaultReason()
- */
- public String getFaultReason() {
+ /**
+ *
+ */
+ public KandulaGeneralException(Exception e) {
+ super(e);
+ }
+
+ public KandulaGeneralException(String s, Exception e) {
+ super(s, e);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.kandula.faults.AbstractKandulaException#getFaultCode()
+ */
+ public String getFaultCode() {
+
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.kandula.faults.AbstractKandulaException#getFaultSubcode()
+ */
+ public String getFaultSubcode() {
+
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.kandula.faults.AbstractKandulaException#getFaultReason()
+ */
+ public String getFaultReason() {
- return null;
- }
+ return null;
+ }
}
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/faults/NoActivityException.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/faults/NoActivityException.java?rev=373804&r1=373803&r2=373804&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/faults/NoActivityException.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/faults/NoActivityException.java Tue Jan 31 04:25:53 2006
@@ -21,60 +21,60 @@
*/
public class NoActivityException extends AbstractKandulaException {
- /**
- *
- */
- public NoActivityException() {
- super();
- }
-
- /**
- * @param arg0
- */
- public NoActivityException(String arg0) {
- super(arg0);
- }
-
- /**
- * @param arg0
- */
- public NoActivityException(Throwable arg0) {
- super(arg0);
- }
-
- /**
- * @param arg0
- * @param arg1
- */
- public NoActivityException(String arg0, Throwable arg1) {
- super(arg0, arg1);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.kandula.faults.KandulaFault#getFaultCode()
- */
- public String getFaultCode() {
- return "Sender";
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.kandula.faults.KandulaFault#getFaultSubcode()
- */
- public String getFaultSubcode() {
- return "wscoor:NoActivity";
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.kandula.faults.KandulaFault#getFaultReason()
- */
- public String getFaultReason() {
+ /**
+ *
+ */
+ public NoActivityException() {
+ super();
+ }
+
+ /**
+ * @param arg0
+ */
+ public NoActivityException(String arg0) {
+ super(arg0);
+ }
+
+ /**
+ * @param arg0
+ */
+ public NoActivityException(Throwable arg0) {
+ super(arg0);
+ }
+
+ /**
+ * @param arg0
+ * @param arg1
+ */
+ public NoActivityException(String arg0, Throwable arg1) {
+ super(arg0, arg1);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.kandula.faults.KandulaFault#getFaultCode()
+ */
+ public String getFaultCode() {
+ return "Sender";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.kandula.faults.KandulaFault#getFaultSubcode()
+ */
+ public String getFaultSubcode() {
+ return "wscoor:NoActivity";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.kandula.faults.KandulaFault#getFaultReason()
+ */
+ public String getFaultReason() {
- return "The participant is not responding and is presumed to have ended.";
- }
+ return "The participant is not responding and is presumed to have ended.";
+ }
}
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/initiator/ATInitiatorTransaction.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/initiator/ATInitiatorTransaction.java?rev=373804&r1=373803&r2=373804&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/initiator/ATInitiatorTransaction.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/initiator/ATInitiatorTransaction.java Tue Jan 31 04:25:53 2006
@@ -24,41 +24,41 @@
*/
public class ATInitiatorTransaction {
- private EndpointReference coordinationEPR;
+ private EndpointReference coordinationEPR;
- private CoordinationContext coordinationContext;
+ private CoordinationContext coordinationContext;
- public ATInitiatorTransaction(EndpointReference coordinationEPR) {
- this.coordinationEPR = coordinationEPR;
- }
-
- /**
- * @return Returns the coordinationEPR.
- */
- public EndpointReference getCoordinationEPR() {
- return coordinationEPR;
- }
-
- /**
- * @param coordinationEPR
- * The coordinationEPR to set.
- */
- public void setCoordinationEPR(EndpointReference coordinationEPR) {
- this.coordinationEPR = coordinationEPR;
- }
-
- /**
- * @return Returns the coordinationContext.
- */
- public CoordinationContext getCoordinationContext() {
- return coordinationContext;
- }
-
- /**
- * @param coordinationContext
- * The coordinationContext to set.
- */
- public void setCoordinationContext(CoordinationContext coordinationContext) {
- this.coordinationContext = coordinationContext;
- }
+ public ATInitiatorTransaction(EndpointReference coordinationEPR) {
+ this.coordinationEPR = coordinationEPR;
+ }
+
+ /**
+ * @return Returns the coordinationEPR.
+ */
+ public EndpointReference getCoordinationEPR() {
+ return coordinationEPR;
+ }
+
+ /**
+ * @param coordinationEPR
+ * The coordinationEPR to set.
+ */
+ public void setCoordinationEPR(EndpointReference coordinationEPR) {
+ this.coordinationEPR = coordinationEPR;
+ }
+
+ /**
+ * @return Returns the coordinationContext.
+ */
+ public CoordinationContext getCoordinationContext() {
+ return coordinationContext;
+ }
+
+ /**
+ * @param coordinationContext
+ * The coordinationContext to set.
+ */
+ public void setCoordinationContext(CoordinationContext coordinationContext) {
+ this.coordinationContext = coordinationContext;
+ }
}
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=373804&r1=373803&r2=373804&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 Tue Jan 31 04:25:53 2006
@@ -16,9 +16,8 @@
*/
package org.apache.kandula.initiator;
-import java.io.IOException;
-
import org.apache.axis2.addressing.EndpointReference;
+import org.apache.kandula.Status;
import org.apache.kandula.context.AbstractContext;
import org.apache.kandula.context.ContextFactory;
import org.apache.kandula.context.at.ATActivityContext;
@@ -38,91 +37,108 @@
public class TransactionManager {
- private static ThreadLocal threadInfo;
-
- public TransactionManager(String coordinationType,
- EndpointReference coordinatorEPR) throws AbstractKandulaException {
-
- threadInfo = new ThreadLocal();
- AbstractContext context = ContextFactory.getInstance().createActivity(
- coordinationType, coordinatorEPR);
- if (threadInfo.get() != null)
- throw new IllegalStateException();
- threadInfo.set(context.getProperty(ATActivityContext.REQUESTER_ID));
- Store store = StorageFactory.getInstance().getInitiatorStore();
- store.put(context.getProperty(ATActivityContext.REQUESTER_ID), context);
- }
-
- /**
- * @throws Exception
- */
- public void begin() throws Exception {
- AbstractContext context = getTransaction();
- String id = (String) context
- .getProperty(ATActivityContext.REQUESTER_ID);
- ActivationCoordinatorPortTypeRawXMLStub activationCoordinator = new ActivationCoordinatorPortTypeRawXMLStub(
- ".", (EndpointReference) context
- .getProperty(ATActivityContext.ACTIVATION_EPR));
- activationCoordinator.createCoordinationContextOperation(
- org.apache.kandula.Constants.WS_AT, id);
- while (context.getCoordinationContext() == null) {
- //allow other threads to execute
- Thread.sleep(10);
- }
- RegistrationCoordinatorPortTypeRawXMLStub registrationCoordinator = new RegistrationCoordinatorPortTypeRawXMLStub(
- ".", context.getCoordinationContext().getRegistrationService());
- EndpointReference registrationRequeterPortEPR = EndpointReferenceFactory
- .getInstance().getCompletionParticipantEndpoint(id);
- registrationCoordinator.registerOperation(
- org.apache.kandula.Constants.WS_AT_COMPLETION,
- registrationRequeterPortEPR, id);
- while (context.getProperty(ATActivityContext.COORDINATION_EPR) == null) {
- Thread.sleep(10);
- }
- }
-
- public void commit() throws AbstractKandulaException, IOException {
- AbstractContext context = getTransaction();
- EndpointReference coordinationEPR = (EndpointReference) context
- .getProperty(ATActivityContext.COORDINATION_EPR);
- CompletionCoordinatorPortTypeRawXMLStub stub = new CompletionCoordinatorPortTypeRawXMLStub(
- ".", coordinationEPR);
- stub.commitOperation();
- }
-
- public void rollback() throws AbstractKandulaException, IOException {
- AbstractContext context = getTransaction();
- EndpointReference coordinationEPR = (EndpointReference) context
- .getProperty(ATActivityContext.COORDINATION_EPR);
- CompletionCoordinatorPortTypeRawXMLStub stub = new CompletionCoordinatorPortTypeRawXMLStub(
- ".", coordinationEPR);
- stub.rollbackOperation();
- }
-
- // public Transaction suspend() {
- // Transaction tx= getTransaction();
- // forget();
- // return tx;
- // }
- //
- // public void resume(Transaction tx) {
- // if (threadInfo.get() != null)
- // throw new IllegalStateException();
- // else
- // threadInfo.set(tx);
- // }
- //
- // public void forget() {
- // threadInfo.set(null);
- // }
-
- public static AbstractContext getTransaction() throws AbstractKandulaException {
- Object key = threadInfo.get();
- AbstractContext context = (AbstractContext) StorageFactory
- .getInstance().getInitiatorStore().get(key);
- if (context == null) {
- throw new InvalidStateException("No Activity Found");
- }
- return context;
- }
+ private static ThreadLocal threadInfo;
+
+ private String axis2Home, axis2Xml;
+
+ public TransactionManager(String coordinationType,
+ EndpointReference coordinatorEPR) throws AbstractKandulaException {
+
+ threadInfo = new ThreadLocal();
+ AbstractContext context = ContextFactory.getInstance().createActivity(
+ coordinationType, coordinatorEPR);
+ if (threadInfo.get() != null)
+ throw new IllegalStateException();
+ threadInfo.set(context.getProperty(ATActivityContext.REQUESTER_ID));
+ Store store = StorageFactory.getInstance().getInitiatorStore();
+ store.put(context.getProperty(ATActivityContext.REQUESTER_ID), context);
+ }
+
+ /**
+ * @throws Exception
+ */
+ public void begin(String axis2Home, String axis2Xml) throws Exception {
+ this.axis2Home = axis2Home;
+ this.axis2Xml = axis2Xml;
+ AbstractContext context = getTransaction();
+ String id = (String) context
+ .getProperty(ATActivityContext.REQUESTER_ID);
+ ActivationCoordinatorPortTypeRawXMLStub activationCoordinator = new ActivationCoordinatorPortTypeRawXMLStub(
+ axis2Home, axis2Xml, (EndpointReference) context
+ .getProperty(ATActivityContext.ACTIVATION_EPR));
+ activationCoordinator.createCoordinationContextOperation(
+ org.apache.kandula.Constants.WS_AT, id);
+ while (context.getCoordinationContext() == null) {
+ //allow other threads to execute
+ Thread.sleep(10);
+ }
+ RegistrationCoordinatorPortTypeRawXMLStub registrationCoordinator = new RegistrationCoordinatorPortTypeRawXMLStub(
+ axis2Home, axis2Xml, context.getCoordinationContext()
+ .getRegistrationService());
+ EndpointReference registrationRequeterPortEPR = EndpointReferenceFactory
+ .getInstance().getCompletionInitiatorEndpoint(id);
+ registrationCoordinator.registerOperation(
+ org.apache.kandula.Constants.WS_AT_COMPLETION,
+ registrationRequeterPortEPR, id);
+ while (context.getProperty(ATActivityContext.COORDINATION_EPR) == null) {
+ Thread.sleep(10);
+ }
+ }
+
+ public void commit() throws Exception {
+ AbstractContext context = getTransaction();
+ EndpointReference coordinationEPR = (EndpointReference) context
+ .getProperty(ATActivityContext.COORDINATION_EPR);
+ CompletionCoordinatorPortTypeRawXMLStub stub = new CompletionCoordinatorPortTypeRawXMLStub(
+ axis2Home, axis2Xml, coordinationEPR);
+ stub.commitOperation();
+ while ((context.getStatus() != Status.ParticipantStatus.STATUS_COMMITED)
+ & (context.getStatus() != Status.ParticipantStatus.STATUS_ABORTED)) {
+ Thread.sleep(10);
+ }
+ if ((context.getStatus() == Status.ParticipantStatus.STATUS_ABORTED)) {
+ throw new Exception("Aborted");
+ }
+ }
+
+ public void rollback() throws Exception {
+ AbstractContext context = getTransaction();
+ EndpointReference coordinationEPR = (EndpointReference) context
+ .getProperty(ATActivityContext.COORDINATION_EPR);
+ CompletionCoordinatorPortTypeRawXMLStub stub = new CompletionCoordinatorPortTypeRawXMLStub(
+ axis2Home, axis2Xml, coordinationEPR);
+ stub.rollbackOperation();
+ while ((context.getStatus() != Status.ParticipantStatus.STATUS_COMMITED)
+ | (context.getStatus() != Status.ParticipantStatus.STATUS_ABORTED)) {
+ Thread.sleep(10);
+ }
+ }
+
+ // public Transaction suspend() {
+ // Transaction tx= getTransaction();
+ // forget();
+ // return tx;
+ // }
+ //
+ // public void resume(Transaction tx) {
+ // if (threadInfo.get() != null)
+ // throw new IllegalStateException();
+ // else
+ // threadInfo.set(tx);
+ // }
+ //
+ // public void forget() {
+ // threadInfo.set(null);
+ // }
+
+ public static AbstractContext getTransaction()
+ throws AbstractKandulaException {
+ Object key = threadInfo.get();
+ AbstractContext context = (AbstractContext) StorageFactory
+ .getInstance().getInitiatorStore().get(key);
+ if (context == null) {
+ throw new InvalidStateException("No Activity Found");
+ }
+ return context;
+ }
}
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/initiator/TransactionOutHandler.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/initiator/TransactionOutHandler.java?rev=373804&r1=373803&r2=373804&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/initiator/TransactionOutHandler.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/initiator/TransactionOutHandler.java Tue Jan 31 04:25:53 2006
@@ -17,7 +17,6 @@
package org.apache.kandula.initiator;
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;
@@ -27,25 +26,25 @@
import org.apache.kandula.faults.AbstractKandulaException;
public class TransactionOutHandler extends AbstractHandler {
-
+
public void invoke(MessageContext msgContext) throws AxisFault {
-
+
AbstractContext context;
try {
String wsaAction = msgContext.getWSAAction();
if ((wsaAction != Constants.WS_COOR_CREATE_COORDINATIONCONTEXT)
- && (wsaAction != Constants.WS_COOR_REGISTER)) {
+ && (wsaAction != Constants.WS_COOR_REGISTER)
+ && (wsaAction != Constants.WS_AT_COMMIT)
+ && (wsaAction != Constants.WS_AT_ROLLBACK)) {
context = TransactionManager.getTransaction();
- MessageInformationHeaders messageInformationHeaders = msgContext
- .getMessageInformationHeaders();
SOAPHeader soapHeader = msgContext.getEnvelope().getHeader();
CoordinationContext coorContext = context
- .getCoordinationContext();
+ .getCoordinationContext();
soapHeader.addChild(coorContext.toOM());
}
} catch (AbstractKandulaException e) {
throw new AxisFault(e);
- }
+ }
}
}
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/participant/KandulaResource.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/participant/KandulaResource.java?rev=373804&r1=373803&r2=373804&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/participant/KandulaResource.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/participant/KandulaResource.java Tue Jan 31 04:25:53 2006
@@ -20,11 +20,11 @@
* @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
*/
public interface KandulaResource {
- public void commit();
+ public void commit();
- public void rollback();
+ public void rollback();
- public Vote prepare();
+ public Vote prepare();
- public String getProtocol();
+ public String getProtocol();
}
Added: webservices/kandula/trunk/java/src/org/apache/kandula/participant/Participant.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/participant/Participant.java?rev=373804&view=auto
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/participant/Participant.java (added)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/participant/Participant.java Tue Jan 31 04:25:53 2006
@@ -0,0 +1,93 @@
+/*
+ * 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
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/participant/ParticipantTransactionManager.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/participant/ParticipantTransactionManager.java?rev=373804&r1=373803&r2=373804&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/participant/ParticipantTransactionManager.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/participant/ParticipantTransactionManager.java Tue Jan 31 04:25:53 2006
@@ -28,83 +28,84 @@
*/
public class ParticipantTransactionManager {
- public void prepare(AbstractContext context)
- throws AbstractKandulaException {
- CoordinatorPortTypeRawXMLStub stub;
- ATParticipantContext atContext = (ATParticipantContext) context;
- atContext.lock();
- switch (context.getStatus()) {
- case (Status.CoordinatorStatus.STATUS_NONE):
- atContext.unlock();
- stub = new CoordinatorPortTypeRawXMLStub(".", atContext
- .getCoordinationEPR());
- stub.abortedOperation();
- break;
- case (Status.CoordinatorStatus.STATUS_PREPARING):
- case (Status.CoordinatorStatus.STATUS_PREPARED):
- case (Status.CoordinatorStatus.STATUS_COMMITTING):
- //Ignore the message
- atContext.unlock();
- break;
- case (Status.CoordinatorStatus.STATUS_PREPARED_SUCCESS):
- atContext.unlock();
- stub = new CoordinatorPortTypeRawXMLStub(".", atContext
- .getCoordinationEPR());
- stub.preparedOperation();
- break;
- case (Status.CoordinatorStatus.STATUS_ACTIVE):
- atContext.setStatus(Status.CoordinatorStatus.STATUS_PREPARING);
- atContext.unlock();
- KandulaResource resource = atContext.getResource();
- Vote vote = resource.prepare();
- stub = new CoordinatorPortTypeRawXMLStub(".", atContext
- .getCoordinationEPR());
- if (vote == Vote.ABORT) {
- stub.abortedOperation();
- } else if (vote == Vote.PREPARED) {
- stub.preparedOperation();
- } else if (vote == Vote.READ_ONLY) {
- stub.readOnlyOperation();
- }
- break;
- default:
- context.unlock();
- throw new InvalidStateException();
- }
- }
+ public void prepare(AbstractContext context)
+ throws AbstractKandulaException {
+ CoordinatorPortTypeRawXMLStub stub;
+ ATParticipantContext atContext = (ATParticipantContext) context;
+ atContext.lock();
+ switch (context.getStatus()) {
+ case (Status.CoordinatorStatus.STATUS_NONE):
+ atContext.unlock();
+ stub = new CoordinatorPortTypeRawXMLStub(atContext
+ .getCoordinationEPR());
+ stub.abortedOperation();
+ break;
+ case (Status.CoordinatorStatus.STATUS_PREPARING):
+ case (Status.CoordinatorStatus.STATUS_PREPARED):
+ case (Status.CoordinatorStatus.STATUS_COMMITTING):
+ //Ignore the message
+ atContext.unlock();
+ break;
+ case (Status.CoordinatorStatus.STATUS_PREPARED_SUCCESS):
+ atContext.unlock();
+ stub = new CoordinatorPortTypeRawXMLStub(atContext
+ .getCoordinationEPR());
+ stub.preparedOperation();
+ break;
+ case (Status.CoordinatorStatus.STATUS_ACTIVE):
+ atContext.setStatus(Status.CoordinatorStatus.STATUS_PREPARING);
+ atContext.unlock();
+ KandulaResource resource = atContext.getResource();
+ Vote vote = resource.prepare();
+ stub = new CoordinatorPortTypeRawXMLStub(atContext
+ .getCoordinationEPR());
+ if (vote == Vote.ABORT) {
+ stub.abortedOperation();
+ } else if (vote == Vote.PREPARED) {
+ stub.preparedOperation();
+ } else if (vote == Vote.READ_ONLY) {
+ stub.readOnlyOperation();
+ }
+ break;
+ default:
+ context.unlock();
+ throw new InvalidStateException();
+ }
+ }
+
+ public void commit(AbstractContext context) throws InvalidStateException {
+ ATParticipantContext atContext = (ATParticipantContext) context;
+ atContext.getResource().commit();
+ // ATParticipantContext atContext = (ATParticipantContext) context;
+ // atContext.lock();
+ // switch (context.getStatus()) {
+ // case (Status.CoordinatorStatus.STATUS_NONE):
+ // //TODO send aborted
+ // atContext.unlock();
+ // return Vote.ABORT;
+ // case (Status.CoordinatorStatus.STATUS_PREPARING):
+ // case (Status.CoordinatorStatus.STATUS_PREPARED):
+ // case (Status.CoordinatorStatus.STATUS_COMMITTING):
+ // //Ignore the message
+ // atContext.unlock();
+ // return Vote.NONE;
+ // case (Status.CoordinatorStatus.STATUS_PREPARED_SUCCESS):
+ // atContext.unlock();
+ // return Vote.PREPARED;
+ // case (Status.CoordinatorStatus.STATUS_ACTIVE):
+ // atContext.setStatus(Status.CoordinatorStatus.STATUS_PREPARING);
+ // KandulaResource resource = atContext.getResource();
+ // return resource.prepare();
+ // default:
+ // context.unlock();
+ // throw new InvalidStateException();
+ // }
+ }
+
+ public void rollback(AbstractContext context) throws InvalidStateException {
+ ATParticipantContext atContext = (ATParticipantContext) context;
+ atContext.getResource().rollback();
+
+ }
- public void commit(AbstractContext context) throws InvalidStateException {
- ATParticipantContext atContext = (ATParticipantContext) context;
- atContext.getResource().commit();
- // ATParticipantContext atContext = (ATParticipantContext) context;
- // atContext.lock();
- // switch (context.getStatus()) {
- // case (Status.CoordinatorStatus.STATUS_NONE):
- // //TODO send aborted
- // atContext.unlock();
- // return Vote.ABORT;
- // case (Status.CoordinatorStatus.STATUS_PREPARING):
- // case (Status.CoordinatorStatus.STATUS_PREPARED):
- // case (Status.CoordinatorStatus.STATUS_COMMITTING):
- // //Ignore the message
- // atContext.unlock();
- // return Vote.NONE;
- // case (Status.CoordinatorStatus.STATUS_PREPARED_SUCCESS):
- // atContext.unlock();
- // return Vote.PREPARED;
- // case (Status.CoordinatorStatus.STATUS_ACTIVE):
- // atContext.setStatus(Status.CoordinatorStatus.STATUS_PREPARING);
- // KandulaResource resource = atContext.getResource();
- // return resource.prepare();
- // default:
- // context.unlock();
- // throw new InvalidStateException();
- // }
- }
- public void rollback(AbstractContext context) throws InvalidStateException {
- ATParticipantContext atContext = (ATParticipantContext) context;
- atContext.getResource().rollback();
-
- }
-
}
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/participant/TransactionInHandler.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/participant/TransactionInHandler.java?rev=373804&r1=373803&r2=373804&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/participant/TransactionInHandler.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/participant/TransactionInHandler.java Tue Jan 31 04:25:53 2006
@@ -34,62 +34,67 @@
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.EndpointReferenceFactory;
-import org.apache.kandula.utility.KandulaUtils;
import org.apache.kandula.wscoor.RegistrationCoordinatorPortTypeRawXMLStub;
public class TransactionInHandler extends AbstractHandler {
- private ThreadLocal threadInfo = new ThreadLocal();
+ private ThreadLocal threadInfo = new ThreadLocal();
- public void invoke(MessageContext msgContext) throws AxisFault {
- KandulaResource resource;
- StorageFactory.getInstance().setConfigurationContext(msgContext.getServiceContext().getConfigurationContext());
- ATParticipantContext context = new ATParticipantContext();
- SOAPHeader header = msgContext.getEnvelope().getHeader();
- OMElement coordinationElement = header.getFirstChildWithName(new QName(
- Constants.WS_COOR, "CoordinationContext"));
- if (coordinationElement == null) {
- throw new AxisFault(
- "Transaction Handler engaged.. No Coordination Context found");
- }
- CoordinationContext coorContext = new SimpleCoordinationContext(
- coordinationElement);
- context.setCoordinationContext(coorContext);
-
- // TODO : See whether we can allow the user to set the resource when the
- // business logic receives the message
- String resourceFile = (String) msgContext.getParameter(
- Constants.KANDULA_RESOURCE).getValue();
- String participantRepository = EndpointReferenceFactory.getInstance().getPariticipantRepository();
- System.out.println(participantRepository);
- try {
- resource = (KandulaResource) Class.forName(resourceFile)
- .newInstance();
- } catch (Exception e) {
- throw new AxisFault(e);
- }
- context.setResource(resource);
-
- String id = KandulaUtils.getRandomStringOf18Characters();
- Store store = StorageFactory.getInstance().getStore();
- context.setProperty(AbstractContext.REQUESTER_ID, id);
- store.put(id, context);
- ParticipantTransactionManager txManager = new ParticipantTransactionManager();
- try {
- RegistrationCoordinatorPortTypeRawXMLStub stub = new RegistrationCoordinatorPortTypeRawXMLStub(
- participantRepository, coorContext.getRegistrationService());
- EndpointReference participantProtocolService = EndpointReferenceFactory
- .getInstance().get2PCParticipantEndpoint(id);
- stub.registerOperation(resource.getProtocol(),
- participantProtocolService, id);
- } catch (IOException e) {
- throw new AxisFault(e);
- } catch (AbstractKandulaException e) {
- AxisFault e1 = new AxisFault(e);
- e1.setFaultCode(e.getFaultCode());
- throw e1;
- }
+ public void invoke(MessageContext msgContext) throws AxisFault {
+ KandulaResource resource;
+ StorageFactory.getInstance().setConfigurationContext(
+ msgContext.getServiceContext().getConfigurationContext());
+ ATParticipantContext context = new ATParticipantContext();
+ SOAPHeader header = msgContext.getEnvelope().getHeader();
+ OMElement coordinationElement = header.getFirstChildWithName(new QName(
+ Constants.WS_COOR, "CoordinationContext"));
+ if (coordinationElement == null) {
+ throw new AxisFault(
+ "Transaction Handler engaged.. No Coordination Context found");
+ }
+ CoordinationContext coorContext = new SimpleCoordinationContext(
+ coordinationElement);
+ context.setCoordinationContext(coorContext);
- }
+ // TODO : See whether we can allow the user to set the resource when the
+ // business logic receives the message
+ String resourceFile = (String) msgContext.getParameter(
+ Constants.KANDULA_RESOURCE).getValue();
+ String participantRepository = EndpointReferenceFactory.getInstance()
+ .getParticipantRepository();
+ String participantAxis2Xml = EndpointReferenceFactory.getInstance()
+ .getParticipantAxis2Conf();
+
+ try {
+ resource = (KandulaResource) Class.forName(resourceFile)
+ .newInstance();
+ } catch (Exception e) {
+ throw new AxisFault(e);
+ }
+ context.setResource(resource);
+
+ String id = EPRHandlingUtils.getRandomStringOf18Characters();
+ Store store = StorageFactory.getInstance().getStore();
+ context.setProperty(AbstractContext.REQUESTER_ID, id);
+ store.put(id, context);
+ ParticipantTransactionManager txManager = new ParticipantTransactionManager();
+ try {
+ RegistrationCoordinatorPortTypeRawXMLStub stub = new RegistrationCoordinatorPortTypeRawXMLStub(
+ participantRepository, participantAxis2Xml, coorContext
+ .getRegistrationService());
+ EndpointReference participantProtocolService = EndpointReferenceFactory
+ .getInstance().get2PCParticipantEndpoint(id);
+ stub.registerOperation(resource.getProtocol(),
+ participantProtocolService, id);
+ } catch (IOException e) {
+ throw new AxisFault(e);
+ } catch (AbstractKandulaException e) {
+ AxisFault e1 = new AxisFault(e);
+ e1.setFaultCode(e.getFaultCode());
+ throw e1;
+ }
+
+ }
}
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/participant/Vote.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/participant/Vote.java?rev=373804&r1=373803&r2=373804&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/participant/Vote.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/participant/Vote.java Tue Jan 31 04:25:53 2006
@@ -21,21 +21,21 @@
*/
public class Vote {
- public static Vote READ_ONLY = new Vote("VoteReadOnly");
+ public static Vote READ_ONLY = new Vote("VoteReadOnly");
- public static Vote ABORT = new Vote("VoteAbort");
+ public static Vote ABORT = new Vote("VoteAbort");
- public static Vote PREPARED = new Vote("VotePrepared");
+ public static Vote PREPARED = new Vote("VotePrepared");
- public static Vote NONE = new Vote("");
+ public static Vote NONE = new Vote("");
- private String state;
+ private String state;
- public Vote(String outcome) {
- this.state = outcome;
- }
+ public Vote(String outcome) {
+ this.state = outcome;
+ }
- public String getOutcome() {
- return state;
- }
+ public String getOutcome() {
+ return state;
+ }
}
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=373804&r1=373803&r2=373804&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 Tue Jan 31 04:25:53 2006
@@ -21,35 +21,35 @@
*/
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#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) {
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.kandula.storage.Store#getContext(java.lang.String)
+ */
+ public Object get(Object id) {
- return null;
- }
+ return null;
+ }
- /*
- * (non-Javadoc)
- *
- * @see org.apache.kandula.storage.Store#forgetContext(java.lang.String)
- */
- public void forget(Object id) {
- // TODO Auto-generated method stub
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.kandula.storage.Store#forgetContext(java.lang.String)
+ */
+ public void forget(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=373804&r1=373803&r2=373804&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 Tue Jan 31 04:25:53 2006
@@ -21,28 +21,28 @@
*/
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#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#getContext(java.lang.String)
+ */
+ public Object get(Object id) {
+ return null;
- }
+ }
- public void forget(Object id) {
- }
+ public void forget(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=373804&r1=373803&r2=373804&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 Tue Jan 31 04:25:53 2006
@@ -25,38 +25,38 @@
*/
public class SimpleStore implements Store {
- private HashMap contextMap;
+ private HashMap contextMap;
- /*
- * (non-Javadoc)
- *
- * @see org.apache.kandula.storage.Store#putContext(java.lang.String,
- * org.apache.kandula.context.ActivityContext)
- */
- public SimpleStore() {
- contextMap = new HashMap();
- }
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.kandula.storage.Store#putContext(java.lang.String,
+ * org.apache.kandula.context.ActivityContext)
+ */
+ public SimpleStore() {
+ contextMap = new HashMap();
+ }
- public void put(Object id, Object context) {
- contextMap.put(id, context);
- }
+ public void put(Object id, Object context) {
+ contextMap.put(id, context);
+ }
- /*
- * (non-Javadoc)
- *
- * @see org.apache.kandula.storage.Store#getContext(java.lang.String)
- */
- public Object get(Object id) {
- return (AbstractContext) contextMap.get(id);
- }
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.kandula.storage.Store#getContext(java.lang.String)
+ */
+ public Object get(Object id) {
+ return (AbstractContext) contextMap.get(id);
+ }
- /*
- * (non-Javadoc)
- *
- * @see org.apache.kandula.storage.Store#forgetContext(java.lang.String)
- */
- public void forget(Object id) {
- contextMap.remove(id);
- }
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.kandula.storage.Store#forgetContext(java.lang.String)
+ */
+ public void forget(Object id) {
+ contextMap.remove(id);
+ }
}
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=373804&r1=373803&r2=373804&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 Tue Jan 31 04:25:53 2006
@@ -23,50 +23,50 @@
* @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
*/
public class StorageFactory {
- private static StorageFactory instance= new StorageFactory();
+ private static StorageFactory instance = new StorageFactory();
- private ConfigurationContext configurationContext=null;
+ private ConfigurationContext configurationContext = null;
- private Store clientStore =null;
+ private Store clientStore = null;
- private StorageFactory()
- {}
- public static StorageFactory getInstance() {
- return instance;
- }
-
- public Store getStore() {
- if (configurationContext ==null)
- return null;
- Store store = (Store)configurationContext.getProperty(Constants.KANDULA_STORE);
- if (store == null) {
- store = new SimpleStore();
- configurationContext.setProperty(Constants.KANDULA_STORE,store);
- }
- return store;
- }
-
- /*
- * TODO: Have to remove this. This is a hack done to get through the interop
- */
- public Store getInitiatorStore()
- {
- if (clientStore==null)
- {
- clientStore = new SimpleStore();
- }
- return clientStore;
- }
-
- public void setConfigurationContext(ConfigurationContext configurationContext)
- {
- this.configurationContext = configurationContext;
- }
- /*
- * TODO : Remove this... Parts of the Hack done for Interop
- */
- public ConfigurationContext getConfigurationContext()
- {
- return configurationContext;
- }
+ private StorageFactory() {
+ }
+
+ public static StorageFactory getInstance() {
+ return instance;
+ }
+
+ public Store getStore() {
+ if (configurationContext == null)
+ return null;
+ Store store = (Store) configurationContext
+ .getProperty(Constants.KANDULA_STORE);
+ if (store == null) {
+ store = new SimpleStore();
+ configurationContext.setProperty(Constants.KANDULA_STORE, store);
+ }
+ return store;
+ }
+
+ /*
+ * TODO: Have to remove this. This is a hack done to get through the interop
+ */
+ public Store getInitiatorStore() {
+ if (clientStore == null) {
+ clientStore = new SimpleStore();
+ }
+ return clientStore;
+ }
+
+ public void setConfigurationContext(
+ ConfigurationContext configurationContext) {
+ this.configurationContext = configurationContext;
+ }
+
+ /*
+ * TODO : Remove this... Parts of the Hack done for Interop
+ */
+ public ConfigurationContext getConfigurationContext() {
+ return configurationContext;
+ }
}
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=373804&r1=373803&r2=373804&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 Tue Jan 31 04:25:53 2006
@@ -20,9 +20,9 @@
* @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
*/
public interface Store {
- void put(Object id, Object context);
+ void put(Object id, Object context);
- Object get(Object id);
+ Object get(Object id);
- void forget(Object id);
+ void forget(Object id);
}
Added: webservices/kandula/trunk/java/src/org/apache/kandula/utility/EPRHandlingUtils.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/utility/EPRHandlingUtils.java?rev=373804&view=auto
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/utility/EPRHandlingUtils.java (added)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/utility/EPRHandlingUtils.java Tue Jan 31 04:25:53 2006
@@ -0,0 +1,150 @@
+/*
+ * 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.axis2.om.OMElement;
+import org.apache.axis2.om.OMNamespace;
+import org.apache.axis2.om.impl.llom.factory.OMLinkedListImplFactory;
+import org.apache.axis2.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
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=373804&r1=373803&r2=373804&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 Tue Jan 31 04:25:53 2006
@@ -21,7 +21,6 @@
import java.net.InetAddress;
import java.util.Properties;
-import org.apache.axis2.addressing.AnyContentType;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.kandula.Constants;
import org.apache.kandula.wsat.completion.CompletionInitiatorServiceListener;
@@ -41,22 +40,44 @@
static final String PORT_PROPERTY = "port";
static final String TCPMON_ENABLE = "tcpmon_enable";
-
- static final String REPO = "PARTICIPANT_REPOSITORY";
- static final String LISTENER_PORT = "KANDULA_LISTENER_PORT";
+ static final String PARTICIPANT_REPO = "PARTICIPANT_REPOSITORY";
- private static EndpointReferenceFactory instance = null;
+ 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 kandulaListenerPort=null;
+ String participantRepository = null;
+
+ String participantAxis2Xml = null;
+
+ String kandulaListenerRepository = null;
+
+ String kandulaListenerAxis2Xml = null;
+
+ String kandulaListenerPort = null;
- private EndpointReferenceFactory() {
+ String coordinatorRepo;
+
+ String coordinatorAxis2Conf;
+
+ String debug = "false";
+
+ private EndpointReferenceFactory() {
String port = null;
@@ -69,31 +90,58 @@
in.close();
host = properties.getProperty(HOST_PROPERTY);
port = properties.getProperty(PORT_PROPERTY);
- participantRepository = properties.getProperty(REPO);
-
- if (participantRepository ==null)
- {
+ participantRepository = properties.getProperty(PARTICIPANT_REPO);
+ if (participantRepository == null) {
participantRepository = ".";
}
- kandulaListenerPort = properties.getProperty(LISTENER_PORT);
+ 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";
+ }
- if (kandulaListenerPort ==null)
- {
- kandulaListenerPort = "5059";
+ coordinatorRepo = properties.getProperty(COORDINATOR_REPOSITORY);
+ if (coordinatorRepo == null) {
+ coordinatorAxis2Conf = ".";
}
- if (port == null) {
+ 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) {
+ location = "http://" + host + ":" + port;
+ System.out.println(location);
+ } catch (Exception e) {
if (e instanceof RuntimeException)
throw (RuntimeException) e;
else
@@ -112,20 +160,25 @@
EndpointReference epr = new EndpointReference(location
+ "/axis2/services/RegistrationCoordinator");
- AnyContentType refParameters = new AnyContentType();
- refParameters.addReferenceValue(Constants.TRANSACTION_ID_PARAMETER, id);
- epr.setReferenceParameters(refParameters);
+ EPRHandlingUtils.addReferenceProperty(epr,
+ Constants.TRANSACTION_ID_PARAMETER, id);
return epr;
}
- public EndpointReference getCompletionParticipantEndpoint(String id)
+ /**
+ * Sets up a listener in the transaction initiator to recieve notify
+ * messages mentioning the outcome of the transaction These messages include
+ * "aborted" and "commited".
+ *
+ * @throws IOException
+ */
+ public EndpointReference getCompletionInitiatorEndpoint(String id)
throws IOException {
CompletionInitiatorServiceListener serviceListener = CompletionInitiatorServiceListener
.getInstance();
EndpointReference epr = serviceListener.getEpr();
- AnyContentType refParameters = new AnyContentType();
- refParameters.addReferenceValue(Constants.REQUESTER_ID_PARAMETER, id);
- epr.setReferenceParameters(refParameters);
+ EPRHandlingUtils.addReferenceProperty(epr,
+ Constants.REQUESTER_ID_PARAMETER, id);
return epr;
}
@@ -133,23 +186,21 @@
EndpointReference epr = new EndpointReference(location
+ "/axis2/services/CompletionCoordinator");
- AnyContentType refParameters = new AnyContentType();
- refParameters.addReferenceValue(Constants.TRANSACTION_ID_PARAMETER, id);
- epr.setReferenceParameters(refParameters);
+ EPRHandlingUtils.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
+ // participant in activity
EndpointReference epr = new EndpointReference(location
+ "/axis2/services/AtomicTransactionCoordinator");
- AnyContentType refParameters = new AnyContentType();
- refParameters.addReferenceValue(Constants.TRANSACTION_ID_PARAMETER,
- activityId);
- refParameters.addReferenceValue(Constants.ENLISTMENT_ID_PARAMETER,
- enlistmentId);
- epr.setReferenceParameters(refParameters);
+ EPRHandlingUtils.addReferenceProperty(epr,
+ Constants.TRANSACTION_ID_PARAMETER, activityId);
+ EPRHandlingUtils.addReferenceProperty(epr,
+ Constants.ENLISTMENT_ID_PARAMETER, enlistmentId);
return epr;
}
@@ -157,18 +208,46 @@
EndpointReference epr = new EndpointReference(location
+ "/axis2/services/AtomicTransactionParticipant");
- AnyContentType refParameters = new AnyContentType();
- refParameters.addReferenceValue(Constants.REQUESTER_ID_PARAMETER, id);
- epr.setReferenceParameters(refParameters);
+ EPRHandlingUtils.addReferenceProperty(epr,
+ Constants.REQUESTER_ID_PARAMETER, id);
return epr;
}
- public String getPariticipantRepository()
- {
+
+ public String getParticipantRepository() {
return participantRepository;
}
- public String getKadulaListenerPort()
- {
- return kandulaListenerPort;
- }
+ 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;
+ }
}
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=373804&r1=373803&r2=373804&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 Tue Jan 31 04:25:53 2006
@@ -19,7 +19,6 @@
import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;
-import java.net.BindException;
import java.util.HashMap;
import org.apache.axis2.AxisFault;
@@ -27,91 +26,96 @@
import org.apache.axis2.description.AxisOperation;
import org.apache.axis2.description.AxisService;
import org.apache.axis2.transport.http.SimpleHTTPServer;
-import org.apache.axis2.util.Utils;
/**
* @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
*/
public class KandulaListener {
- private static KandulaListener instance = null;
+ private static KandulaListener instance = null;
- private ConfigurationContext responseConfigurationContext;
+ private ConfigurationContext responseConfigurationContext;
- protected static AxisOperation[] operations;
+ protected static AxisOperation[] operations;
- private SimpleHTTPServer receiver = null;
+ private SimpleHTTPServer receiver = null;
- private boolean serverStarted = false;
-
- public int serverPort;
-
- private KandulaListener() throws IOException {
- responseConfigurationContext = new org.apache.axis2.context.ConfigurationContextFactory()
- .buildClientConfigurationContext(".");
- try{
- serverPort = Integer.parseInt(EndpointReferenceFactory.getInstance().getKadulaListenerPort());
- }catch (Exception e)
- {
- serverPort = 5059;
- }
- while (receiver == null) {
- try {
- receiver = new SimpleHTTPServer(responseConfigurationContext,
- serverPort);
- } catch (BindException e) {
- serverPort++;
- }
- }
- }
-
- public static KandulaListener getInstance() throws IOException {
- if (instance == null) {
- instance = new KandulaListener();
- }
- return instance;
- }
-
- public void start() throws IOException {
- if (!serverStarted) {
-
- receiver.start();
- serverStarted = true;
- System.out.print("Server started on port " + serverPort + ".....");
- }
-
- }
-
- public void stop() {
- receiver.stop();
- serverStarted = false;
- }
-
- /**
- * @param service
- * @throws AxisFault
- * To add services with only one operation, which is the
- * frequent case in reponses
- */
- public void addService(AxisService service) throws AxisFault {
- AxisOperation responseOperationDesc;
-
- service.setClassLoader(Thread.currentThread().getContextClassLoader());
- HashMap allServices = responseConfigurationContext
- .getAxisConfiguration().getServices();
-
- if (allServices.get(service.getName().getLocalPart()) == null) {
-
- responseConfigurationContext.getAxisConfiguration().addService(
- service);
- Utils.resolvePhases(receiver.getSystemContext()
- .getAxisConfiguration(), service);
- }
-
- }
-
- public String getHost() throws UnknownHostException {
- return "http://" + InetAddress.getLocalHost().getHostAddress() + ":"
- + (serverPort) + "/axis2/services/";
- }
+ private boolean serverStarted = false;
+
+ public int serverPort;
+
+ private KandulaListener() throws IOException {
+ EndpointReferenceFactory endpointReferenceFactory = EndpointReferenceFactory
+ .getInstance();
+ responseConfigurationContext = new org.apache.axis2.context.ConfigurationContextFactory()
+ .createConfigurationContextFromFileSystem(
+ endpointReferenceFactory.getKandulaListenerRepository(),
+ endpointReferenceFactory.getKandulaListenerAxis2Xml());
+ try {
+ serverPort = Integer.parseInt(EndpointReferenceFactory
+ .getInstance().getKadulaListenerPort());
+ } catch (Exception e) {
+ serverPort = 5059;
+ }
+ while (receiver == null) {
+
+ receiver = new SimpleHTTPServer(responseConfigurationContext,
+ serverPort);
+
+ }
+ }
+
+ public static KandulaListener getInstance() throws IOException {
+ if (instance == null) {
+ instance = new KandulaListener();
+ }
+ return instance;
+ }
+
+ public void start() throws IOException {
+ if (!serverStarted) {
+
+ receiver.start();
+ serverStarted = true;
+ System.out.print("Server started on port " + serverPort + ".....");
+ }
+
+ }
+
+ public void stop() {
+ receiver.stop();
+ serverStarted = false;
+ }
+
+ /**
+ * @param service
+ * @throws AxisFault
+ * To add services with only one operation, which is the
+ * frequent case in reponses
+ */
+ public void addService(AxisService service) throws AxisFault {
+ AxisOperation responseOperationDesc;
+
+ service.setClassLoader(Thread.currentThread().getContextClassLoader());
+ HashMap allServices = responseConfigurationContext
+ .getAxisConfiguration().getServices();
+
+ if (allServices.get(service.getName()) == null) {
+
+ responseConfigurationContext.getAxisConfiguration().addService(
+ service);
+ //TODO : check how to do this or this is neccessary anymore
+ // Utils.resolvePhases(receiver.getSystemContext()
+ // .getAxisConfiguration(), service);
+ }
+
+ }
+
+ public String getHost() throws UnknownHostException {
+ return "http://"
+ + InetAddress.getLocalHost().getHostAddress()
+ + ":"
+ + EndpointReferenceFactory.getInstance()
+ .getKadulaListenerPortForEPR() + "/axis2/services/";
+ }
}
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/wsat/AbstractATNotifierStub.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/wsat/AbstractATNotifierStub.java?rev=373804&r1=373803&r2=373804&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/wsat/AbstractATNotifierStub.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/wsat/AbstractATNotifierStub.java Tue Jan 31 04:25:53 2006
@@ -20,9 +20,16 @@
import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.client.MessageSender;
-import org.apache.axis2.client.Stub;
+import org.apache.axis2.client.OperationClient;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.context.ServiceContext;
+import org.apache.axis2.context.ServiceGroupContext;
+import org.apache.axis2.deployment.DeploymentException;
import org.apache.axis2.description.AxisOperation;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.AxisServiceGroup;
import org.apache.axis2.om.OMAbstractFactory;
import org.apache.axis2.om.OMElement;
import org.apache.axis2.om.OMNamespace;
@@ -33,55 +40,82 @@
/**
* @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
*/
-public abstract class AbstractATNotifierStub extends Stub {
- protected static AxisOperation[] operations;
+public abstract class AbstractATNotifierStub {
+ protected AxisOperation[] operations;
- public AbstractATNotifierStub() {
- super();
- }
-
- /**
- * Provides common functionality for stubs to send notification messages
- *
- * @param localName :
- * name of the notification message
- * @param action :
- * ws-a action value for the notification message
- * @param opIndex :
- * operation index in the operations array
- * @param replyToEPR :
- * notification messages except termination messages should send
- * this
- * @throws IOException
- */
- protected void notify(String localName, String action, int opIndex,
- EndpointReference replyToEPR) throws AbstractKandulaException {
- org.apache.axis2.context.MessageContext messageContext;
- try {
- messageContext = getMessageContext();
-
- org.apache.axis2.soap.SOAPEnvelope env = super.createEnvelope();
- org.apache.axis2.soap.SOAPFactory factory = OMAbstractFactory
- .getSOAP12Factory();
- OMNamespace wsAT = factory.createOMNamespace(Constants.WS_AT,
- "wsat");
- OMElement request = factory.createOMElement(localName, wsAT);
- env.getBody().addChild(request);
- messageContext.setEnvelope(env);
-
- MessageSender messageSender = new MessageSender(_serviceContext);
- messageSender.setTo(this.toEPR);
- if (replyToEPR != null) {
- messageSender.setReplyTo(replyToEPR);
- }
- messageSender.setWsaAction(action);
- messageSender
- .setSenderTransport(org.apache.axis2.Constants.TRANSPORT_HTTP);
- System.out.println(operations[opIndex]);
-
- messageSender.send(operations[opIndex], messageContext);
- } catch (AxisFault e) {
- throw new KandulaGeneralException(e);
- }
- }
+ protected AxisService service;
+
+ protected ConfigurationContext configurationContext;
+
+ protected ServiceContext serviceContext;
+
+ protected EndpointReference toEPR;
+
+ public AbstractATNotifierStub(String axis2Home, String axis2Xml,
+ AxisService service) throws AbstractKandulaException {
+ //creating the configuration
+ this.service = service;
+ try {
+ configurationContext = new org.apache.axis2.context.ConfigurationContextFactory()
+ .createConfigurationContextFromFileSystem(axis2Home,
+ axis2Xml);
+ configurationContext.getAxisConfiguration().addService(service);
+ } catch (DeploymentException e) {
+ throw new KandulaGeneralException(e);
+ } catch (AxisFault e1) {
+ throw new KandulaGeneralException(e1);
+ }
+ ServiceGroupContext sgc = new ServiceGroupContext(
+ this.configurationContext, (AxisServiceGroup) this.service
+ .getParent());
+ this.serviceContext = new ServiceContext(service, sgc);
+ }
+
+ /**
+ * Provides common functionality for stubs to send notification messages
+ *
+ * @param localName :
+ * name of the notification message
+ * @param action :
+ * ws-a action value for the notification message
+ * @param opIndex :
+ * operation index in the operations array
+ * @param replyToEPR :
+ * notification messages except termination messages should send
+ * this
+ * @throws IOException
+ */
+ protected void notify(String localName, String action, int opIndex,
+ EndpointReference replyToEPR) throws AbstractKandulaException {
+ MessageContext messageContext;
+ try {
+ Options options = new Options();
+ messageContext = new MessageContext();
+ OperationClient client = operations[opIndex].createClient(
+ serviceContext, options);
+
+ org.apache.axis2.soap.SOAPFactory factory = OMAbstractFactory
+ .getSOAP12Factory();
+ org.apache.axis2.soap.SOAPEnvelope env = factory
+ .getDefaultEnvelope();
+
+ OMNamespace wsAT = factory.createOMNamespace(Constants.WS_AT,
+ "wsat");
+ OMElement request = factory.createOMElement(localName, wsAT);
+ env.getBody().addChild(request);
+ messageContext.setEnvelope(env);
+
+ options.setTo(this.toEPR);
+ if (replyToEPR != null) {
+ options.setReplyTo(replyToEPR);
+ }
+ options.setAction(action);
+ // options.setTranportOut(org.apache.axis2.Constants.TRANSPORT_HTTP);
+ // System.out.println(operations[opIndex]);
+ client.addMessageContext(messageContext);
+ client.execute(false);
+ } catch (AxisFault e) {
+ throw new KandulaGeneralException(e);
+ }
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: kandula-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: kandula-dev-help@ws.apache.org