Search in sources :

Example 1 with Monitor

use of alma.ACS.Monitor 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();
}
Also used : POAManager(org.omg.PortableServer.POAManager) Manager(si.ijs.maci.Manager) ROstring(alma.ACS.ROstring) CBDescIn(alma.ACS.CBDescIn) Monitor(alma.ACS.Monitor) CompletionHolder(alma.ACSErr.CompletionHolder) ClientInfo(si.ijs.maci.ClientInfo)

Aggregations

CBDescIn (alma.ACS.CBDescIn)1 Monitor (alma.ACS.Monitor)1 ROstring (alma.ACS.ROstring)1 CompletionHolder (alma.ACSErr.CompletionHolder)1 POAManager (org.omg.PortableServer.POAManager)1 ClientInfo (si.ijs.maci.ClientInfo)1 Manager (si.ijs.maci.Manager)1