use of com.arjuna.orbportability.Services in project narayana by jbosstm.
the class TransactionServer method registerTransactionManager.
public static final void registerTransactionManager(final int resolver, ORB myORB, org.omg.CosTransactions.TransactionFactory theOTS) throws Exception {
final Services myServ = new Services(myORB);
if (resolver != com.arjuna.orbportability.Services.BIND_CONNECT) {
String[] params = new String[1];
params[0] = com.arjuna.orbportability.Services.otsKind;
/*
* Register using the default mechanism.
*/
myServ.registerService(theOTS, com.arjuna.orbportability.Services.transactionService, params, resolver);
params = null;
}
}
use of com.arjuna.orbportability.Services in project narayana by jbosstm.
the class ImplicitClient method main.
public static void main(String[] args) throws Exception {
ServerORB orb = new ServerORB();
ORB myORB = orb.getORB();
RootOA myOA = orb.getOA();
String refFile = args[0];
CurrentImple current = OTSImpleManager.current();
// pointer the grid object that will be used.
TranGrid TranGridVar = null;
short h = 0, w = 0, v = 0;
try {
current.begin();
Services serv = new Services(myORB);
TranGridVar = TranGridHelper.narrow(myORB.orb().string_to_object(TestUtility.getService(refFile)));
try {
h = TranGridVar.height();
w = TranGridVar.width();
} catch (Exception e) {
TestUtility.fail("Invocation failed: " + e);
}
System.out.println("height is " + h);
System.out.println("width is " + w);
try {
System.out.println("calling set");
TranGridVar.set((short) 2, (short) 4, (short) 123);
System.out.println("calling get");
v = TranGridVar.get((short) 2, (short) 4);
} catch (Exception sysEx) {
TestUtility.fail("Grid set/get failed: " + sysEx);
sysEx.printStackTrace(System.err);
}
// no problem setting and getting the element:
System.out.println("trangrid[2,4] is " + v);
if (v != 123) {
// oops - we didn't:
current.rollback();
TestUtility.fail("Result not as expected");
} else {
current.commit(true);
}
} catch (Exception e) {
TestUtility.fail("Caught exception: " + e);
e.printStackTrace(System.err);
}
myOA.destroy();
myORB.shutdown();
System.out.println("Passed");
}
use of com.arjuna.orbportability.Services in project narayana by jbosstm.
the class SetGetServer method main.
public static void main(String[] args) throws Exception {
ServerORB orb = new ServerORB();
ORB myORB = orb.getORB();
RootOA myOA = orb.getOA();
String refFile = args[0];
setget_i impl = new setget_i();
Services serv = new Services(myORB);
try {
TestUtility.registerService(refFile, myORB.orb().object_to_string(impl.getReference()));
System.out.println("Ready");
myOA.run();
} catch (Exception e) {
TestUtility.fail("SetGetServer caught exception: " + e);
}
myOA.shutdownObject(impl);
System.out.println("**Object server exiting**");
}
use of com.arjuna.orbportability.Services in project narayana by jbosstm.
the class ImplicitArjunaClient method main.
public static void main(String[] args) throws Exception {
ServerORB orb = new ServerORB();
ORB myORB = orb.getORB();
RootOA myOA = orb.getOA();
String refFile = args[0];
CurrentImple current = OTSImpleManager.current();
// pointer the grid object that will be used.
stack stackVar = null;
try {
current.begin();
try {
Services serv = new Services(myORB);
stackVar = stackHelper.narrow(myORB.orb().string_to_object(TestUtility.getService(refFile)));
} catch (Exception e) {
e.printStackTrace(System.err);
TestUtility.fail(e.toString());
}
System.out.println("pushing 1 onto stack");
stackVar.push(1);
System.out.println("pushing 2 onto stack");
stackVar.push(2);
} catch (Exception e) {
e.printStackTrace(System.err);
TestUtility.fail(e.toString());
}
try {
current.commit(false);
current.begin();
IntHolder val = new IntHolder(-1);
if (stackVar.pop(val) == 0) {
System.out.println("popped top of stack " + val.value);
current.begin();
stackVar.push(3);
System.out.println("pushed 3 onto stack. Aborting nested action.");
current.rollback();
stackVar.pop(val);
System.out.println("popped top of stack is " + val.value);
current.commit(false);
TestUtility.assertEquals(1, val.value);
} else {
TestUtility.fail("Error getting stack value.");
current.rollback();
}
} catch (Exception e) {
e.printStackTrace(System.err);
TestUtility.fail(e.toString());
}
myOA.destroy();
myORB.shutdown();
System.out.println("Passed");
}
use of com.arjuna.orbportability.Services in project narayana by jbosstm.
the class GridServer method main.
public static void main(String[] args) throws Exception {
ServerORB orb = new ServerORB();
ORB myORB = orb.getORB();
RootOA myOA = orb.getOA();
String gridReference = args[0];
grid_i myGrid = new grid_i(100, 100);
Services serv = new Services(myORB);
try {
TestUtility.registerService(gridReference, myORB.orb().object_to_string(myGrid.getReference()));
System.out.println("Ready");
myOA.run();
} catch (Exception e) {
TestUtility.fail("**GridServer caught exception: " + e);
}
myOA.shutdownObject(myGrid);
System.out.println("**Grid server exiting**");
}
Aggregations