use of alma.ACS.ROstring in project ACS by ACS-Community.
the class BuildingTest method test.
/**
* Main test routine.
*/
public void test() {
initializeCORBA();
Manager manager = resolveManager();
if (manager != null) {
ClientInfo clientInfo = login(manager);
if (clientInfo != null) {
System.out.println("All initialization done.");
//
// get component
//
final String COMPONENT_NAME = "BUILDING1";
org.omg.CORBA.Object obj;
try {
obj = manager.get_component(clientInfo.h, COMPONENT_NAME, true);
Building building = BuildingHelper.narrow(obj);
ROstring version = building.version();
// syncvalue retrival
System.out.println("Version: " + version.get_sync(new CompletionHolder()));
// create a monitor
Monitor monitor = version.create_monitor(new CBstringImpl()._this(orb), new CBDescIn());
// sleep for a while
try {
Thread.sleep(10000);
} catch (InterruptedException ie) {
}
;
monitor.destroy();
} catch (Exception e) {
// CannotGetComponentEx, ComponentConfigurationNotFoundEx
System.err.println("Failed to obtain component: " + COMPONENT_NAME);
}
// release now
try {
manager.release_component(clientInfo.h, COMPONENT_NAME);
} catch (Exception ex) {
ex.printStackTrace();
System.out.println("Failed to release component.");
}
logout(manager, clientInfo);
}
}
finalizeCORBA();
}
Aggregations