use of com.arjuna.ats.arjuna.state.InputObjectState in project narayana by jbosstm.
the class XTSBASubordinateRecoveryModule method recreateCoordinatorCompletionParticipant.
public BusinessAgreementWithCoordinatorCompletionParticipant recreateCoordinatorCompletionParticipant(String id, byte[] recoveryState) throws Exception {
if (id.startsWith(SubordinateBACoordinator.PARTICIPANT_PREFIX)) {
if (!id.endsWith("_CCP")) {
// throw an exception because we don't expect participant completion participants at present
throw new Exception("XTSBASubordinateRecoveryModule : invalid name for subordinate WS-BA coordinator coordinator completion participant participant " + id);
}
// ok, try to recreate the participant
InputObjectState ios = new InputObjectState();
ios.setBuffer(recoveryState);
String className = ios.unpackString();
Class participantClass = this.getClass().getClassLoader().loadClass(className);
BusinessAgreementWithCoordinatorCompletionParticipant participant = (BusinessAgreementWithCoordinatorCompletionParticipant) participantClass.newInstance();
((PersistableParticipant) participant).restoreState(ios);
return participant;
}
return null;
}
use of com.arjuna.ats.arjuna.state.InputObjectState in project narayana by jbosstm.
the class ObjStoreBrowserImpl method types.
@Override
public List<String> types() {
recordTypes.clear();
InputObjectState types = new InputObjectState();
try {
if (StoreManager.getRecoveryStore().allTypes(types)) {
String typeName;
do {
try {
typeName = types.unpackString();
if (!recordTypes.contains(typeName))
recordTypes.add(typeName);
} catch (IOException e) {
typeName = "";
}
} while (typeName.length() != 0);
}
} catch (ObjectStoreException e) {
System.out.println(e);
}
return recordTypes;
}
use of com.arjuna.ats.arjuna.state.InputObjectState in project narayana by jbosstm.
the class BasicActionFinalizer method activate.
/**
* Overloaded version of activate -- sets up the store, performs read_state
* followed by restore_state. The root of the object store to use is
* specified in the <code>root</code> parameter.
*
* @return <code>true</code> if successful, <code>false</code>
* otherwise.
*/
public boolean activate(String root) {
if (tsLogger.logger.isTraceEnabled()) {
tsLogger.logger.trace("BasicAction::activate() for action-id " + get_uid());
}
boolean restored = false;
// Set up store
ParticipantStore aaStore = getStore();
if (aaStore == null)
return false;
try {
// Read object state
InputObjectState oState = aaStore.read_committed(getSavingUid(), type());
if (oState != null) {
synchronized (this) {
restored = restore_state(oState, ObjectType.ANDPERSISTENT);
}
oState = null;
} else {
tsLogger.i18NLogger.warn_coordinator_BasicAction_5(get_uid(), type());
restored = false;
}
return restored;
} catch (ObjectStoreException e) {
tsLogger.logger.warn(e);
return false;
}
}
use of com.arjuna.ats.arjuna.state.InputObjectState in project narayana by jbosstm.
the class RecoveryStoreBean method allObjUids.
// RecoveryStore interface implementation
public ObjectStateWrapper allObjUids(String type, int m) throws ObjectStoreException {
InputObjectState ios = new InputObjectState();
boolean ok = rs.allObjUids(type, ios, m);
return new ObjectStateWrapper(ios, ok);
}
use of com.arjuna.ats.arjuna.state.InputObjectState in project narayana by jbosstm.
the class OTM method getTransactions.
@SuppressWarnings("unchecked")
private synchronized void getTransactions(DefaultMutableTreeNode machineName) {
removeTransactions();
scanningNode = machineName;
DefaultMutableTreeNode top = new DefaultMutableTreeNode(scanningNode);
try {
RecoveryStore recoveryStore = StoreManager.getRecoveryStore();
InputObjectState types = new InputObjectState();
if (recoveryStore.allTypes(types)) {
String fullPathName = null;
boolean found = false;
try {
boolean endOfList = false;
DefaultMutableTreeNode currentNode = null;
DefaultMutableTreeNode currentRoot = top;
topTran.add(currentRoot);
while (!endOfList) {
fullPathName = types.unpackString();
if (fullPathName.compareTo("") == 0)
endOfList = true;
else {
found = true;
InputObjectState uids = new InputObjectState();
String nodeName = stripName(fullPathName);
currentNode = new DefaultMutableTreeNode(nodeName);
addDirectory(currentNode, fullPathName);
currentRoot = findRoot(top, currentNode);
currentRoot.add(currentNode);
if (recoveryStore.allObjUids(fullPathName, uids)) {
Uid theUid = new Uid(Uid.nullUid());
try {
boolean endOfUids = false;
while (!endOfUids) {
theUid = UidHelper.unpackFrom(uids);
if (theUid.equals(Uid.nullUid()))
endOfUids = true;
else {
DefaultMutableTreeNode tranID = new DefaultMutableTreeNode(theUid.stringForm());
tranID.add(new DefaultMutableTreeNode(new String("status: " + statusToString(recoveryStore.currentState(theUid, fullPathName)))));
currentNode.add(tranID);
}
}
} catch (Exception e) {
// end of uids!
}
}
}
if (!found)
currentRoot.add(emptyTx);
}
} catch (Exception e) {
// end of list!
}
}
} catch (Exception e) {
System.err.println(e);
}
DefaultTreeModel model = (DefaultTreeModel) transactions.getModel();
model.reload();
transactions.repaint();
}
Aggregations