Hi again,
I collected all cosmetic and non-functional changes to existing files
that we made into one patch file. If you do not want to apply this patch
or parts of it, it is OK with us - it's just some suggestions and
code-style improvements that we made during the development.
The contained changes are:
* always qualify field access (this.field instead of field)
* add an Eclipse generated serialVersion field
* adopt indenting, braces, brackets, newlines
Best regards,
-hannes
Index: src/java/org/apache/kandula/coordinator/ActivationStub.java
===================================================================
--- src/java/org/apache/kandula/coordinator/ActivationStub.java (revision
539901)
+++ src/java/org/apache/kandula/coordinator/ActivationStub.java (working copy)
@@ -43,14 +43,15 @@
super(new
URL(TCPSnifferHelper.redirect(epr.getAddress().toString())),
new Service());
AddressingHeaders headers = new AddressingHeaders(epr, null);
- ((Service) service).setAddressingHeaders(headers);
+ ((Service) this.service).setAddressingHeaders(headers);
}
public CoordinationContext createCoordinationContext(String
coordinationType)
throws RemoteException, MalformedURIException {
+
CreateCoordinationContextType params = new
CreateCoordinationContextType();
params.setCoordinationType(new URI(coordinationType));
CreateCoordinationContextResponseType response =
createCoordinationContextOperation(params);
return new
CoordinationContext(response.getCoordinationContext());
}
-}
\ No newline at end of file
+}
Index: src/java/org/apache/kandula/coordinator/at/AbstractParticipant.java
===================================================================
--- src/java/org/apache/kandula/coordinator/at/AbstractParticipant.java
(revision 539901)
+++ src/java/org/apache/kandula/coordinator/at/AbstractParticipant.java
(working copy)
@@ -52,11 +52,11 @@
protected abstract int getStatus();
protected AbstractParticipant() {
- id = "uuid:" + UUIDGenFactory.getUUIDGen().nextUUID();
+ this.id = "uuid:" + UUIDGenFactory.getUUIDGen().nextUUID();
}
public String getID() {
- return id;
+ return this.id;
}
protected void register(boolean durable, CoordinationContext ctx)
@@ -65,16 +65,17 @@
Expires ex = ctx.getExpires();
if (ex != null)
timeout = ex.get_value().longValue();
- epr =
CoordinationService.getInstance().getParticipantService(this,
- timeout);
- eprOfCoordinator = ctx.register(
+ this.epr =
CoordinationService.getInstance().getParticipantService(this, timeout);
+ this.eprOfCoordinator = ctx.register(
durable ? ATCoordinator.PROTOCOL_ID_DURABLE_2PC
- :
ATCoordinator.PROTOCOL_ID_VOLATILE_2PC, epr);
+ :
ATCoordinator.PROTOCOL_ID_VOLATILE_2PC,
+ this.epr
+ );
}
protected CoordinatorPortType getCoordinator() {
try {
- return new CoordinatorStub(this, eprOfCoordinator);
+ return new CoordinatorStub(this, this.eprOfCoordinator);
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e);
@@ -107,14 +108,12 @@
case
AT2PCStatus.COMMITTING:
cancel();
return;
-
+
case
AT2PCStatus.PREPARED:
try {
p.preparedOperation(null);
} catch
(RemoteException e) {
- // TODO:
- //
identify wscoor:InvalidState Soap fault
- // and
stop
+ // TODO
WSAT identify wscoor:InvalidState Soap fault and stop
e.printStackTrace();
}
}
@@ -170,7 +169,7 @@
return;
case AT2PCStatus.ABORTING:
- throw Coordinator.INVALID_STATE_SOAP_FAULT;
+ throw Coordinator.INVALID_STATE_SOAP_FAULT();
case AT2PCStatus.COMMITTING:
}
@@ -201,7 +200,7 @@
return;
case AT2PCStatus.COMMITTING:
- throw Coordinator.INVALID_STATE_SOAP_FAULT;
+ throw Coordinator.INVALID_STATE_SOAP_FAULT();
}
}
@@ -224,17 +223,17 @@
public synchronized void onFault(Name code) {
System.out.println("[AbstractParticipant] onFault: " + code);
- // FIXME:
+ // FIXME WSAT handle faults
try {
forget();
rollback();
} catch (XAException e) {
- // TODO Auto-generated catch block
+ // TODO WSAT Auto-generated catch block
e.printStackTrace();
}
}
public EndpointReference getEndpointReference() {
- return epr;
+ return this.epr;
}
-}
\ No newline at end of file
+}
Index: src/java/org/apache/kandula/coordinator/at/ATCoordinator.java
===================================================================
--- src/java/org/apache/kandula/coordinator/at/ATCoordinator.java
(revision 539901)
+++ src/java/org/apache/kandula/coordinator/at/ATCoordinator.java
(working copy)
@@ -16,24 +16,19 @@
*/
package org.apache.kandula.coordinator.at;
-import javax.xml.namespace.QName;
-
-import org.apache.kandula.coordinator.Coordinator;
+import org.apache.kandula.coordinator.Callback;
import org.apache.kandula.wsat.CompletionCoordinatorPortType;
import org.apache.kandula.wsat.CoordinatorPortType;
-public interface ATCoordinator extends Coordinator, CoordinatorPortType,
- CompletionCoordinatorPortType {
+public interface ATCoordinator extends CoordinatorPortType,
+ CompletionCoordinatorPortType, Callback {
- final QName PARTICIPANT_REF = new QName("http://ws.apache.org/kandula",
- "ParticipantRef");
+ public final static String COORDINATION_TYPE_ID =
"http://schemas.xmlsoap.org/ws/2004/10/wsat";
- final String COORDINATION_TYPE_ID =
"http://schemas.xmlsoap.org/ws/2004/10/wsat";
+ public final static String PROTOCOL_ID_COMPLETION =
"http://schemas.xmlsoap.org/ws/2004/10/wsat/Completion";
- final String PROTOCOL_ID_COMPLETION =
"http://schemas.xmlsoap.org/ws/2004/10/wsat/Completion";
+ public final static String PROTOCOL_ID_VOLATILE_2PC =
"http://schemas.xmlsoap.org/ws/2004/10/wsat/Volatile2PC";
- final String PROTOCOL_ID_VOLATILE_2PC =
"http://schemas.xmlsoap.org/ws/2004/10/wsat/Volatile2PC";
+ public final static String PROTOCOL_ID_DURABLE_2PC =
"http://schemas.xmlsoap.org/ws/2004/10/wsat/Durable2PC";
- final String PROTOCOL_ID_DURABLE_2PC =
"http://schemas.xmlsoap.org/ws/2004/10/wsat/Durable2PC";
-
-}
\ No newline at end of file
+}
Index: src/java/org/apache/kandula/coordinator/at/ATCoordinatorImpl.java
===================================================================
--- src/java/org/apache/kandula/coordinator/at/ATCoordinatorImpl.java
(revision 539901)
+++ src/java/org/apache/kandula/coordinator/at/ATCoordinatorImpl.java
(working copy)
@@ -55,11 +55,16 @@
super(COORDINATION_TYPE_ID);
}
- public EndpointReference register(String protocol,
- EndpointReference participantProtocolService)
- throws InvalidCoordinationProtocolException {
+ /**
+ * Register a new participant
+ */
+ public EndpointReference register(
+ final String protocol,
+ final EndpointReference participantProtocolService,
+ final String matchcode
+ ) throws InvalidCoordinationProtocolException {
- if (!(status == AT2PCStatus.ACTIVE || status ==
AT2PCStatus.PREPARING_VOLATILE))
+ if (!(this.status == AT2PCStatus.ACTIVE || this.status ==
AT2PCStatus.PREPARING_VOLATILE))
throw new IllegalStateException();
CoordinationService cs = CoordinationService.getInstance();
@@ -68,7 +73,7 @@
if (protocol.equals(PROTOCOL_ID_COMPLETION)) {
if (participantProtocolService != null)
-
completionParticipants.add(participantProtocolService);
+
this.completionParticipants.add(participantProtocolService);
epr = cs.getCompletionCoordinatorService(this);
} else {
@@ -79,10 +84,10 @@
participantRef = "uuid:" + gen.nextUUID();
if (protocol.equals(PROTOCOL_ID_VOLATILE_2PC))
- volatile2PCParticipants.put(participantRef,
+ this.volatile2PCParticipants.put(participantRef,
participantProtocolService);
else if (protocol.equals(PROTOCOL_ID_DURABLE_2PC))
- durable2PCParticipants.put(participantRef,
+ this.durable2PCParticipants.put(participantRef,
participantProtocolService);
else
throw new
InvalidCoordinationProtocolException();
@@ -105,18 +110,18 @@
/*
* Check for which protocols the participants had registered
and remove
*/
- if (volatile2PCParticipants.remove(participantRef) == null)
- durable2PCParticipants.remove(participantRef);
+ if (this.volatile2PCParticipants.remove(participantRef) == null)
+ this.durable2PCParticipants.remove(participantRef);
notifyAll();
}
public void rollback() {
- switch (status) {
+ switch (this.status) {
case AT2PCStatus.ACTIVE:
case AT2PCStatus.PREPARING_VOLATILE:
case AT2PCStatus.PREPARING_DURABLE:
- status = AT2PCStatus.ABORTING;
+ this.status = AT2PCStatus.ABORTING;
terminate();
return;
@@ -127,7 +132,7 @@
}
public void aborted(String participantRef) throws AxisFault {
- switch (status) {
+ switch (this.status) {
case AT2PCStatus.ACTIVE:
case AT2PCStatus.PREPARING_VOLATILE:
case AT2PCStatus.PREPARING_DURABLE:
@@ -148,7 +153,7 @@
}
public void readOnly(String participantRef) throws AxisFault {
- switch (status) {
+ switch (this.status) {
case AT2PCStatus.ACTIVE:
case AT2PCStatus.PREPARING_VOLATILE:
case AT2PCStatus.PREPARING_DURABLE:
@@ -173,7 +178,7 @@
}
public void replay(String participantRef) throws AxisFault {
- switch (status) {
+ switch (this.status) {
case AT2PCStatus.ACTIVE:
case AT2PCStatus.PREPARING_VOLATILE:
case AT2PCStatus.PREPARING_DURABLE:
@@ -206,7 +211,7 @@
if (volatile2PCParticipants.containsKey(participantRef))
trigger(participantRef,
INVALID_STATE_SOAP_FAULT);
else {
- epr = (EndpointReference)
durable2PCParticipants.get(participantRef);
+ epr = (EndpointReference)
this.durable2PCParticipants.get(participantRef);
if (epr == null)
epr =
org.apache.kandula.utils.AddressingHeaders.getReplyToOfCurrentMessage();
if (epr != null)
@@ -230,7 +235,7 @@
* Some fault, e.g. INVALID_STATE
*/
public void prepared(String participantRef) throws AxisFault {
- switch (status) {
+ switch (this.status) {
case AT2PCStatus.ACTIVE:
try {
trigger(participantRef,
INVALID_STATE_SOAP_FAULT);
@@ -246,7 +251,7 @@
*/
case AT2PCStatus.PREPARING_VOLATILE:
case AT2PCStatus.PREPARING_DURABLE:
- preparedParticipants.add(participantRef);
+ this.preparedParticipants.add(participantRef);
notifyAll();
return;
@@ -262,10 +267,10 @@
return;
case AT2PCStatus.ABORTING:
- if (volatile2PCParticipants.remove(participantRef) !=
null)
+ if (this.volatile2PCParticipants.remove(participantRef)
!= null)
trigger(participantRef,
INVALID_STATE_SOAP_FAULT);
else {
- epr = (EndpointReference)
durable2PCParticipants.remove(participantRef);
+ epr = (EndpointReference)
this.durable2PCParticipants.remove(participantRef);
if (epr == null)
epr =
org.apache.kandula.utils.AddressingHeaders.getReplyToOfCurrentMessage();
if (epr != null) {
@@ -280,10 +285,10 @@
return;
case AT2PCStatus.NONE:
- if (volatile2PCParticipants.containsKey(participantRef))
+ if
(this.volatile2PCParticipants.containsKey(participantRef))
trigger(participantRef,
INVALID_STATE_SOAP_FAULT);
else {
- epr = (EndpointReference)
durable2PCParticipants.get(participantRef);
+ epr = (EndpointReference)
this.durable2PCParticipants.get(participantRef);
if (epr == null)
epr =
org.apache.kandula.utils.AddressingHeaders.getReplyToOfCurrentMessage();
if (epr != null)
@@ -298,7 +303,7 @@
}
public void committed(String participantRef) throws AxisFault {
- switch (status) {
+ switch (this.status) {
case AT2PCStatus.ACTIVE:
case AT2PCStatus.PREPARING_VOLATILE:
case AT2PCStatus.PREPARING_DURABLE:
@@ -342,7 +347,7 @@
return true;
int iters = 0; // iteration count
- int status_old = status; // State when beginning to prepare
+ int status_old = this.status; // State when beginning to prepare
/*
* Send the "prepare" message to all unprepared participants.
Retry up
@@ -351,7 +356,7 @@
while (iters < maxRetries) {
Iterator iter = participants.keySet().iterator();
while (iter.hasNext()) {
- if (status == AT2PCStatus.ABORTING)
+ if (this.status == AT2PCStatus.ABORTING)
return false;
try {
/*
@@ -393,10 +398,10 @@
/*
* Are all participants prepared?
*/
- if
(preparedParticipants.containsAll(participants.keySet()))
+ if
(this.preparedParticipants.containsAll(participants.keySet()))
// Yes! - Return true, if the
transaction state did not
// change in the mean time.
- return status == status_old;
+ return this.status == status_old;
}
}
@@ -408,16 +413,16 @@
}
private boolean prepare() {
- status = AT2PCStatus.PREPARING_VOLATILE;
- if (!prepare(volatile2PCParticipants))
+ this.status = AT2PCStatus.PREPARING_VOLATILE;
+ if (! prepare(this.volatile2PCParticipants))
return false;
- status = AT2PCStatus.PREPARING_DURABLE;
- return prepare(durable2PCParticipants);
+ this.status = AT2PCStatus.PREPARING_DURABLE;
+ return prepare(this.durable2PCParticipants);
}
public void commit() {
- switch (status) {
+ switch (this.status) {
case AT2PCStatus.ACTIVE:
break;
@@ -434,21 +439,13 @@
return;
}
- status = AT2PCStatus.COMMITTING;
+ this.status = AT2PCStatus.COMMITTING;
terminate();
}
- private void pause(long millis) {
- try {
- wait(millis);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
private boolean noParticipantsToTerminate() {
- return volatile2PCParticipants.isEmpty()
- && durable2PCParticipants.isEmpty();
+ return this.volatile2PCParticipants.isEmpty()
+ && this.durable2PCParticipants.isEmpty();
}
/**
@@ -469,7 +466,7 @@
* Participant set to operate on. For each retry, send
our message
* to volatile peers first and then to durable
participants.
*/
- Map participants = volatile2PCParticipants;
+ Map participants = this.volatile2PCParticipants;
while (true) {
Iterator iter =
participants.keySet().iterator();
@@ -484,7 +481,7 @@
participantRef,
(EndpointReference)
participants.get(participantRef));
- if (status ==
AT2PCStatus.ABORTING)
+ if (this.status ==
AT2PCStatus.ABORTING)
p.rollbackOperation(null);
else
p.commitOperation(null);
@@ -497,8 +494,8 @@
* After all volatile participants are
notified, continue with
* durable participants. After that, wait for
incoming messages.
*/
- if (participants == volatile2PCParticipants)
- participants = durable2PCParticipants;
+ if (participants ==
this.volatile2PCParticipants)
+ participants =
this.durable2PCParticipants;
else
break;
}
@@ -539,15 +536,15 @@
*/
if (noParticipantsToTerminate()) {
/*
- * TODO shouldn't this message also be acknowledged, at
least if
+ * TODO WSAT shouldn't this message also be
acknowledged, at least if
* there was an exception (e.g. timeout) caught?
*/
- Iterator iter = completionParticipants.iterator();
+ Iterator iter = this.completionParticipants.iterator();
while (iter.hasNext())
try {
CompletionInitiatorStub p = new
CompletionInitiatorStub(
(EndpointReference)
iter.next());
- if (status == AT2PCStatus.ABORTING)
+ if (this.status == AT2PCStatus.ABORTING)
p.abortedOperation(null);
else
p.committedOperation(null);
@@ -555,7 +552,7 @@
e.printStackTrace();
}
}
- status = AT2PCStatus.NONE;
+ this.status = AT2PCStatus.NONE;
}
public synchronized void preparedOperation(Notification parameters)
@@ -591,10 +588,10 @@
}
private EndpointReference getEprToRespond(String participantRef) {
- EndpointReference epr = (EndpointReference)
volatile2PCParticipants.get(participantRef);
+ EndpointReference epr = (EndpointReference)
this.volatile2PCParticipants.get(participantRef);
if (epr != null)
return epr;
- epr = (EndpointReference)
durable2PCParticipants.get(participantRef);
+ epr = (EndpointReference)
this.durable2PCParticipants.get(participantRef);
if (epr != null)
return epr;
return
org.apache.kandula.utils.AddressingHeaders.getReplyToOfCurrentMessage();
@@ -618,9 +615,9 @@
public synchronized void timeout() throws TimedOutException {
System.out.println("[ATCoordinatorImpl] timeout "
- + AT2PCStatus.getStatusName(status));
+ + AT2PCStatus.getStatusName(this.status));
- if (status != AT2PCStatus.NONE) {
+ if (this.status != AT2PCStatus.NONE) {
maxRetries = 8;
rollback();
throw new TimedOutException();
@@ -638,7 +635,7 @@
* @see
org.apache.ws.transaction.coordinator.Callback#onFault(javax.xml.soap.Name)
*/
public synchronized void onFault(Name code) {
- // TODO Auto-generated method stub
+ // TODO WSAT Auto-generated method stub
}
@@ -646,4 +643,4 @@
throw new UnsupportedOperationException();
}
-}
\ No newline at end of file
+}
Index: src/java/org/apache/kandula/coordinator/at/CompletionCoordinatorStub.java
===================================================================
--- src/java/org/apache/kandula/coordinator/at/CompletionCoordinatorStub.java
(revision 539901)
+++ src/java/org/apache/kandula/coordinator/at/CompletionCoordinatorStub.java
(working copy)
@@ -45,7 +45,7 @@
AddressingHeaders headers = new AddressingHeaders(epr,
callback.getEndpointReference());
headers.setFaultTo(cs.getFaultDispatcherService(callback));
- ((Service) service).setAddressingHeaders(headers);
+ ((Service) this.service).setAddressingHeaders(headers);
}
-}
\ No newline at end of file
+}
Index: src/java/org/apache/kandula/coordinator/at/CompletionInitiatorStub.java
===================================================================
--- src/java/org/apache/kandula/coordinator/at/CompletionInitiatorStub.java
(revision 539901)
+++ src/java/org/apache/kandula/coordinator/at/CompletionInitiatorStub.java
(working copy)
@@ -27,20 +27,28 @@
import org.apache.kandula.wsat.CompletionInitiatorBindingStub;
/**
+ * A stub for the CompletionIniator web service.
+ *
* @author Dasarath Weeratunge
+ * @author Hannes Erven, Georg Hicker (C) 2006
*
* Created on Jun 14, 2004
*/
public class CompletionInitiatorStub extends CompletionInitiatorBindingStub {
- public CompletionInitiatorStub(EndpointReference epr) throws AxisFault,
+ /**
+ * Default constructor.
+ * @param epr The endpoint to connect to.
+ * @throws AxisFault
+ * @throws MalformedURLException
+ */
+ public CompletionInitiatorStub(final EndpointReference epr) throws
AxisFault,
MalformedURLException {
super(new
URL(TCPSnifferHelper.redirect(epr.getAddress().toString())),
new Service());
- // FIXME:
+
AddressingHeaders headers = new AddressingHeaders(epr, null);
- ((Service) service).setAddressingHeaders(headers);
-
+ ((Service) this.service).setAddressingHeaders(headers);
}
-}
\ No newline at end of file
+}
Index: src/java/org/apache/kandula/coordinator/at/CoordinatorStub.java
===================================================================
--- src/java/org/apache/kandula/coordinator/at/CoordinatorStub.java
(revision 539901)
+++ src/java/org/apache/kandula/coordinator/at/CoordinatorStub.java
(working copy)
@@ -42,7 +42,7 @@
CoordinationService cs = CoordinationService.getInstance();
AddressingHeaders headers = new AddressingHeaders(epr,
participant.getEndpointReference());
headers.setFaultTo(cs.getFaultDispatcherService(participant));
- ((Service) service).setAddressingHeaders(headers);
+ ((Service) this.service).setAddressingHeaders(headers);
}
-}
\ No newline at end of file
+}
Index: src/java/org/apache/kandula/coordinator/at/ParticipantStub.java
===================================================================
--- src/java/org/apache/kandula/coordinator/at/ParticipantStub.java
(revision 539901)
+++ src/java/org/apache/kandula/coordinator/at/ParticipantStub.java
(working copy)
@@ -45,8 +45,8 @@
cs.getCoordinatorService(coordinator,
participantRef));
headers.setFaultTo(cs.getFaultDispatcherService(coordinator,
participantRef));
- ((Service) service).setAddressingHeaders(headers);
+ ((Service) this.service).setAddressingHeaders(headers);
}
-}
\ No newline at end of file
+}
Index: src/java/org/apache/kandula/coordinator/at/TransactionImpl.java
===================================================================
--- src/java/org/apache/kandula/coordinator/at/TransactionImpl.java
(revision 539901)
+++ src/java/org/apache/kandula/coordinator/at/TransactionImpl.java
(working copy)
@@ -136,17 +136,18 @@
register();
try {
- synchronized (callback) {
- if (!aborted) {
- if (committed)
+ synchronized (this.callback) {
+ if (! this.aborted) {
+ if (this.committed)
throw new
IllegalStateException();
+
getCompletionCoordinatorStub().rollbackOperation(null);
- callback.wait();
+ this.callback.wait();
}
}
- if (timedOut)
+ if (this.timedOut)
throw new TimedOutException();
- if (!aborted)
+ if (! this.aborted)
throw new RollbackException();
} catch (RemoteException e) {
throw e;
@@ -160,29 +161,31 @@
private CompletionCoordinatorStub getCompletionCoordinatorStub()
throws AxisFault, MalformedURLException {
- return new CompletionCoordinatorStub(callback,
- eprOfCompletionCoordinator);
+ return new CompletionCoordinatorStub(
+ this.callback,
+ this.eprOfCompletionCoordinator
+ );
}
public void commit() throws RemoteException {
TransactionManagerImpl tm =
TransactionManagerImpl.getInstance();
TransactionImpl tx = tm.suspend();
- if (!canInitiateCompletion)
+ if (! this.canInitiateCompletion)
register();
try {
- synchronized (callback) {
- if (!committed) {
- if (aborted)
+ synchronized (this.callback) {
+ if (! this.committed) {
+ if (this.aborted)
throw new
IllegalStateException();
getCompletionCoordinatorStub().commitOperation(null);
- callback.wait();
+ this.callback.wait();
}
}
- if (timedOut)
+ if (this.timedOut)
throw new TimedOutException();
- if (!committed)
+ if (! this.committed)
throw new RollbackException();
} catch (RemoteException e) {
throw e;
@@ -193,4 +196,4 @@
tm.resume(tx);
}
}
-}
\ No newline at end of file
+}
Index: src/java/org/apache/kandula/coordinator/at/TxHandler.java
===================================================================
--- src/java/org/apache/kandula/coordinator/at/TxHandler.java (revision
539901)
+++ src/java/org/apache/kandula/coordinator/at/TxHandler.java (working copy)
@@ -31,11 +31,15 @@
* @author Dasarath Weeratunge
*/
public class TxHandler extends BasicHandler {
+ /**
+ *
+ */
+ private static final long serialVersionUID = 5929868712826022266L;
TransactionManagerImpl tm = TransactionManagerImpl.getInstance();
public void invoke(MessageContext mc) throws AxisFault {
if (mc.isClient()) {
- TransactionImpl tx = tm.getTransaction();
+ TransactionImpl tx = this.tm.getTransaction();
if (tx != null) {
try {
SOAPHeader header =
mc.getCurrentMessage().getSOAPEnvelope().getHeader();
@@ -47,7 +51,7 @@
}
else {
if (mc.getPastPivot())
- tm.forget();
+ this.tm.forget();
else {
try {
SOAPHeader header =
mc.getCurrentMessage().getSOAPEnvelope().getHeader();
@@ -56,7 +60,7 @@
SOAPElement e = (SOAPElement)
iter.next();
if (CoordinationContext.is(e)) {
CoordinationContext ctx = new
CoordinationContext(e);
- tm.resume(new
TransactionImpl(ctx));
+ this.tm.resume(new
TransactionImpl(ctx));
return;
}
}
@@ -68,4 +72,4 @@
}
}
-}
\ No newline at end of file
+}
Index: src/java/org/apache/kandula/coordinator/FaultDispatcher.java
===================================================================
--- src/java/org/apache/kandula/coordinator/FaultDispatcher.java
(revision 539901)
+++ src/java/org/apache/kandula/coordinator/FaultDispatcher.java
(working copy)
@@ -18,15 +18,17 @@
public void process(SOAPEnvelope req, SOAPEnvelope resp)
throws javax.xml.soap.SOAPException {
+
SOAPBody body = req.getBody();
SOAPFault fault = body.getFault();
- Callback callback = (Callback)
CallbackRegistry.getInstance().correlateMessage(
- CallbackRegistry.CALLBACK_REF, false);
+ Callback callback =
CallbackRegistry.getInstance().correlateMessage(
+ CallbackRegistry.CALLBACK_REF, false
+ );
if (callback != null)
callback.onFault(fault.getFaultCodeAsName());
MessageContext.getCurrentContext().setResponseMessage(null);
}
-}
\ No newline at end of file
+}
Index:
src/java/org/apache/kandula/coordinator/InvalidCoordinationProtocolException.java
===================================================================
---
src/java/org/apache/kandula/coordinator/InvalidCoordinationProtocolException.java
(revision 539901)
+++
src/java/org/apache/kandula/coordinator/InvalidCoordinationProtocolException.java
(working copy)
@@ -6,8 +6,14 @@
/**
* @author Dasarath Weeratunge
- *
+ * @author Hannes Erven, Georg Hicker (C) 2006
*/
public class InvalidCoordinationProtocolException extends Exception {
+ /**
+ * Generated UID
+ */
+ private static final long serialVersionUID = -6195734385683911667L;
+
+ // Nothing to do here
}
Index: src/java/org/apache/kandula/coordinator/RegistrationStub.java
===================================================================
--- src/java/org/apache/kandula/coordinator/RegistrationStub.java
(revision 539901)
+++ src/java/org/apache/kandula/coordinator/RegistrationStub.java
(working copy)
@@ -42,7 +42,7 @@
super(new
URL(TCPSnifferHelper.redirect(epr.getAddress().toString())),
new Service());
AddressingHeaders headers = new AddressingHeaders(epr, null);
- ((Service) service).setAddressingHeaders(headers);
+ ((Service) this.service).setAddressingHeaders(headers);
}
public EndpointReference registerOperation(String p, EndpointReference
epr)
@@ -53,4 +53,4 @@
return new EndpointReference(
registerOperation(params).getCoordinatorProtocolService());
}
-}
\ No newline at end of file
+}
Index: src/java/org/apache/kandula/coordinator/TimedOutException.java
===================================================================
--- src/java/org/apache/kandula/coordinator/TimedOutException.java
(revision 539901)
+++ src/java/org/apache/kandula/coordinator/TimedOutException.java
(working copy)
@@ -6,8 +6,13 @@
/**
* @author Dasarath Weeratunge
- *
+ * @author Hannes Erven, Georg Hicker (C) 2006
*/
public class TimedOutException extends Exception {
+ /**
+ * Generated UID
+ */
+ private static final long serialVersionUID = -7768373223203523573L;
+ // Nothing to do here
}
Index:
src/java/org/apache/kandula/coordinator/UnsupportedCoordinationTypeException.java
===================================================================
---
src/java/org/apache/kandula/coordinator/UnsupportedCoordinationTypeException.java
(revision 539901)
+++
src/java/org/apache/kandula/coordinator/UnsupportedCoordinationTypeException.java
(working copy)
@@ -6,8 +6,14 @@
/**
* @author Dasarath Weeratunge
- *
+ * @author Hannes Erven, Georg Hicker (C) 2006
*/
public class UnsupportedCoordinationTypeException extends Exception {
+ /**
+ * Generated UID
+ */
+ private static final long serialVersionUID = 6871459976466202936L;
+
+ // Nothing to do here
}
Index: src/java/org/apache/kandula/geronimo/Bridge.java
===================================================================
--- src/java/org/apache/kandula/geronimo/Bridge.java (revision 539901)
+++ src/java/org/apache/kandula/geronimo/Bridge.java (working copy)
@@ -33,12 +33,13 @@
private Map inM = new HashMap();
- TransactionManagerImpl tm;
+ final TransactionManagerImpl tm;
private Bridge() {
try {
- tm = new TransactionManagerImpl(TIMEOUT_S, new
XidFactoryImpl(),
- null, null);
+ this.tm = new TransactionManagerImpl(TIMEOUT_S, new
XidFactoryImpl(),
+ null, null
+ );
} catch (XAException e) {
e.printStackTrace();
throw new RuntimeException(e);
@@ -46,13 +47,13 @@
}
public TransactionManager getTM() {
- return tm;
+ return this.tm;
}
public synchronized Transaction mediate(CoordinationContext ctx)
throws RemoteException {
String id = ctx.getIdentifier().toString();
- Transaction tx = (Transaction) inM.get(id);
+ Transaction tx = (Transaction) this.inM.get(id);
if (tx != null)
return tx;
Expires expires = ctx.getExpires();
@@ -61,8 +62,8 @@
timeout = expires.get_value().longValue();
try {
- tm.begin(timeout);
- tx = tm.suspend();
+ this.tm.begin(timeout);
+ tx = this.tm.suspend();
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e);
@@ -70,7 +71,7 @@
new Mediator(tx, ctx);
- inM.put(id, tx);
+ this.inM.put(id, tx);
return tx;
}
@@ -80,6 +81,6 @@
}
public void forget(String id) {
- inM.remove(id);
+ this.inM.remove(id);
}
-}
\ No newline at end of file
+}
Index: src/java/org/apache/kandula/geronimo/Mediator.java
===================================================================
--- src/java/org/apache/kandula/geronimo/Mediator.java (revision 539901)
+++ src/java/org/apache/kandula/geronimo/Mediator.java (working copy)
@@ -40,7 +40,7 @@
public Mediator(Transaction tx, CoordinationContext ctx)
throws RemoteException {
register(true, ctx);
- id = ctx.getIdentifier().toString();
+ this.id = ctx.getIdentifier().toString();
this.tx = tx;
try {
tx.enlistResource(this);
@@ -50,7 +50,7 @@
}
public void commit(Xid arg0, boolean arg1) throws XAException {
- if (bridged) {
+ if (this.bridged) {
forget();
try {
getCoordinator().committedOperation(null);
@@ -70,7 +70,7 @@
}
public int getTransactionTimeout() throws XAException {
- return timeout;
+ return this.timeout;
}
public boolean isSameRM(XAResource rm) throws XAException {
@@ -78,15 +78,15 @@
}
public int prepare(Xid arg0) throws XAException {
- if (bridged) {
+ if (this.bridged) {
forget();
try {
getCoordinator().abortedOperation(null);
} catch (Exception e) {
}
throw new XAException();
- } else
- return XAResource.XA_RDONLY;
+ }
+ return XAResource.XA_RDONLY;
}
public Xid[] recover(int arg0) throws XAException {
@@ -94,7 +94,7 @@
}
public void rollback(Xid arg0) throws XAException {
- if (bridged) {
+ if (this.bridged) {
forget();
try {
getCoordinator().abortedOperation(null);
@@ -112,27 +112,30 @@
}
public int prepare() throws XAException {
- return tm.prepare(tx);
+ return tm.prepare(this.tx);
}
public void commit() throws XAException {
- tm.commit(tx, false);
+ tm.commit(this.tx, false);
}
public void rollback() throws XAException {
- tm.rollback(tx);
+ tm.rollback(this.tx);
}
public void forget() {
- if (bridged) {
- bridge.forget(id);
- bridged = false;
+ if (this.bridged) {
+ bridge.forget(this.id);
+ this.bridged = false;
}
}
public int getStatus() {
try {
- switch (tx.getStatus()) {
+ if (this.tx == null)
+ return Status.STATUS_NO_TRANSACTION;
+
+ switch (this.tx.getStatus()) {
case Status.STATUS_ACTIVE:
case Status.STATUS_MARKED_ROLLBACK:
return AT2PCStatus.ACTIVE;
@@ -164,4 +167,4 @@
}
}
-}
\ No newline at end of file
+}
Index: src/java/org/apache/kandula/geronimo/TxHandler.java
===================================================================
--- src/java/org/apache/kandula/geronimo/TxHandler.java (revision 539901)
+++ src/java/org/apache/kandula/geronimo/TxHandler.java (working copy)
@@ -29,9 +29,14 @@
import org.apache.kandula.coordinator.CoordinationContext;
public class TxHandler extends BasicHandler {
+ /**
+ * Generated serialUID
+ */
+ private static final long serialVersionUID = -7578239017314816471L;
+
private Bridge bridge = Bridge.getInstance();
- private TransactionManager tm = bridge.getTM();
+ private TransactionManager tm = this.bridge.getTM();
static private ThreadLocal threadInfo = new ThreadLocal();
@@ -53,7 +58,7 @@
if (threadInfo.get() == null)
return;
- tm.suspend();
+ this.tm.suspend();
threadInfo.set(null);
} else {
SOAPHeader header =
mc.getCurrentMessage().getSOAPEnvelope().getHeader();
@@ -62,8 +67,8 @@
SOAPElement e = (SOAPElement)
iter.next();
if (CoordinationContext.is(e)) {
CoordinationContext ctx
= new CoordinationContext(e);
- Transaction tx =
bridge.mediate(ctx);
- tm.resume(tx);
+ Transaction tx =
this.bridge.mediate(ctx);
+ this.tm.resume(tx);
threadInfo.set(tx);
return;
}
@@ -74,4 +79,4 @@
throw AxisFault.makeFault(e);
}
}
-}
\ No newline at end of file
+}
Index: src/java/org/apache/kandula/utils/Service.java
===================================================================
--- src/java/org/apache/kandula/utils/Service.java (revision 539901)
+++ src/java/org/apache/kandula/utils/Service.java (working copy)
@@ -24,11 +24,20 @@
import org.apache.axis.message.addressing.Constants;
public class Service extends org.apache.axis.client.Service {
+ /**
+ * Generated SerialUID
+ */
+ private static final long serialVersionUID = 1511770257237324039L;
+
+ /**
+ * Addressing Headers to set
+ */
AddressingHeaders headers;
// Callback callback;
public Service() {
+ // Nothing to do here
}
// public Service(EndpointReference to) {
@@ -78,7 +87,7 @@
// throw new
ServiceException(e.getMessage());
// }
// }
- call.setProperty(Constants.ENV_ADDRESSING_REQUEST_HEADERS,
headers);
+ call.setProperty(Constants.ENV_ADDRESSING_REQUEST_HEADERS,
this.headers);
return call;
}
@@ -111,4 +120,4 @@
throw new UnsupportedOperationException();
}
-}
\ No newline at end of file
+}
Index: src/java/org/apache/kandula/utils/SoapFaultSender.java
===================================================================
--- src/java/org/apache/kandula/utils/SoapFaultSender.java (revision
539901)
+++ src/java/org/apache/kandula/utils/SoapFaultSender.java (working copy)
@@ -44,14 +44,15 @@
SOAPEnvelope env = new SOAPEnvelope();
SOAPFault faultElement = new SOAPFault(fault);
env.addBodyElement(faultElement);
- // FIXME:
faultElement.setQName(SOAPConstants.SOAP11_CONSTANTS.getFaultQName());
- // FIXME:
+
+ // FIXME _ALL_ Set fault detail
fault.setFaultDetail(null);
try {
call.invoke(env);
} catch (Exception e) {
+ // FIXME _ALL_ catch exception and act upon it?
}
}
-}
\ No newline at end of file
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]