use of com.arjuna.mw.wsas.exceptions.SystemException in project narayana by jbosstm.
the class UserActivityImple method end.
/**
* Complete the activity with the completion status provided.
*
* @param cs The CompletionStatus to use.
*
* @exception InvalidActivityException Thrown if the current activity is
* invalid in the execution environment.
* @exception ActiveChildException Thrown if the current activity is a
* @exception WrongStateException Thrown if the current activity is not in a
* state that allows it to be completed, or is incompatible with the
* completion status provided.
* @exception ProtocolViolationException Thrown if the a violation of the
* activity service or HLS protocol occurs.
* @exception NoActivityException Thrown if there is no activity
* associated with the invoking thread or none with the given type of coordinator.
* @exception NoPermissionException Thrown if the invoking thread does
* not have permission to terminate the transaction.
* @exception SystemException Thrown if some other error occurred.
*
* @return the result of completing the activity. Null is valid and must
* be interpreted within the context of any HLS that may exist.
*
* @see com.arjuna.mw.wsas.Outcome
*/
public Outcome end(CompletionStatus cs) throws InvalidActivityException, WrongStateException, ProtocolViolationException, SystemException, NoActivityException, NoPermissionException, ActiveChildException {
ActivityImple currentActivity = current();
if (currentActivity == null) {
throw new NoActivityException();
}
/*
if (currentActivity.parent() != null)
throw new ActiveChildException();
*/
Outcome res = null;
String serviceType = currentActivity.serviceType();
try {
res = currentActivity.end(cs);
} catch (Exception ex) {
wsasLogger.i18NLogger.warn_UserActivityImple_2(ex);
}
HLS hls = HLSManager.getHighLevelService(serviceType);
if (hls != null) {
try {
hls.completed();
} catch (SystemException ex) {
wsasLogger.i18NLogger.warn_UserActivityImple_3(ex);
}
}
pop();
return res;
}
use of com.arjuna.mw.wsas.exceptions.SystemException in project narayana by jbosstm.
the class CoordinatorControl method begin.
/**
* An activity has begun and is active on the current thread.
*/
public void begin() throws SystemException {
try {
BACoordinator coord = new BACoordinator();
int status = coord.start(parentCoordinator());
if (status != ActionStatus.RUNNING)
throw new BegunFailedException(wscfLogger.i18NLogger.get_model_sagas_arjunacore_CoordinatorControl_1() + ActionStatus.stringForm(status));
else {
_coordinators.put(currentActivity(), coord);
}
} catch (SystemException ex) {
throw ex;
} catch (Exception ex) {
throw new UnexpectedException(ex.toString());
}
}
use of com.arjuna.mw.wsas.exceptions.SystemException in project narayana by jbosstm.
the class SagasHLSImple method ensureContextInitialised.
private void ensureContextInitialised() throws SystemException {
if (!initialised) {
synchronized (this) {
if (!initialised) {
// we only do this once no matter what happens
initialised = true;
try {
Class<?> factoryClass = ProtocolRegistry.sharedManager().getProtocolImplementation(coordinationType).getClass();
ContextProvider contextProvider = factoryClass.getAnnotation(ContextProvider.class);
String providerServiceType = contextProvider.serviceType();
if (!providerServiceType.equals(serviceType)) {
throw new SystemException("Invalid serviceType for SOAPContext factory registered for SAGAS 1.1 service expecting " + serviceType + " got " + providerServiceType);
}
Class contextClass = contextProvider.contextImplementation();
if (!SOAPContext.class.isAssignableFrom(contextClass)) {
throw new SystemException("SOAPContext factory registered for SAGAS 1.1 service provides invalid context implementation");
}
CONTEXT_IMPLE_CLASS = contextClass;
} catch (ProtocolNotRegisteredException pnre) {
throw new SystemException("No SOAPContext factory registered for SAGAS 1.1 service");
}
}
}
}
}
use of com.arjuna.mw.wsas.exceptions.SystemException in project narayana by jbosstm.
the class SagasHLSImple method context.
/**
* Return the context augmentation for this HLS, if any on the current
* activity.
*
* @return a context object or null if no augmentation is necessary.
*/
public Context context() throws SystemException {
ensureContextInitialised();
if (CONTEXT_IMPLE_CLASS != null) {
try {
SOAPContext ctx = (SOAPContext) CONTEXT_IMPLE_CLASS.newInstance();
ctx.initialiseContext(_coordManager.currentCoordinator());
return ctx;
} catch (Exception ex) {
ex.printStackTrace();
throw new SystemException(ex.toString());
}
} else {
throw new SystemException("Unable to create SOAPContext for SAGAS 1.1 service");
}
}
use of com.arjuna.mw.wsas.exceptions.SystemException in project narayana by jbosstm.
the class TwoPhaseHLSImple method ensureContextInitialised.
private void ensureContextInitialised() throws SystemException {
if (!initialised) {
synchronized (this) {
if (!initialised) {
try {
Class<?> factoryClass = ProtocolRegistry.sharedManager().getProtocolImplementation(coordinationType).getClass();
ContextProvider contextProvider = factoryClass.getAnnotation(ContextProvider.class);
String providerServiceType = contextProvider.serviceType();
if (!providerServiceType.equals(serviceType)) {
throw new SystemException("Invalid serviceType for SOAPContext factory registered for Two Phase 1.1 service expecting " + serviceType + " got " + providerServiceType);
}
Class contextClass = contextProvider.contextImplementation();
if (!SOAPContext.class.isAssignableFrom(contextClass)) {
throw new SystemException("SOAPContext factory registered for Two Phase 1.1 service provides invalid context implementation");
}
CONTEXT_IMPLE_CLASS = contextClass;
} catch (ProtocolNotRegisteredException pnre) {
throw new SystemException("No SOAPContext factory registered for Two Phase 1.1 service");
} finally {
// we only do this once no matter what happens
initialised = true;
}
}
}
}
}
Aggregations