Created
May 16, 2012 08:14
-
-
Save paulrobinson/2708619 to your computer and use it in GitHub Desktop.
WS-BA without TXFramework
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class OrderParticipant implements | |
BusinessAgreementWithCoordinatorCompletionParticipant, | |
ConfirmCompletedParticipant { | |
void compensate() throws FaultedException, WrongStateException, SystemException { | |
EmailSender.sendEmail("Unfortunately, we have had to cancel your order for item: " + | |
MockOrderManager.getItem()); | |
} | |
void confirmCompleted(boolean confirmed) { | |
if (confirmed) | |
EmailSender.sendEmail("Your order is now confirmed for the following item: " + | |
MockOrderManager.getItem()); | |
} | |
@Deprecated | |
void unknown() throws SystemException {...} | |
String status() throws SystemException {...} | |
void error() throws SystemException {...} | |
void close() throws WrongStateException, SystemException {...} | |
void cancel() throws FaultedException, WrongStateException, SystemException {...} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@WebService | |
@HandlerChain(file="/context-handlers.xml", name="Context Handlers") | |
public class OrderServiceBAImpl implements OrderServiceBA { | |
@WebMethod | |
public void placeOrder(String item) throws OrderServiceException { | |
BAParticipantManager participantManager; | |
try { | |
OrderParticipant participant = new OrderParticipant(value); | |
BusinessActivityManager am = | |
BusinessActivityManagerFactory.businessActivityManager(); | |
am.enlistForBusinessAgreementWithCoordinatorCompletion( | |
participant, "OrderServiceBAImpl:" + UUID.randomUUID()); | |
} catch (Exception e) { | |
throw new OrderServiceException("Error enlisting participant", e); | |
} | |
MockOrderManager.registerOrder(item); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment