Search in sources :

Example 6 with HandleDataStore

use of com.cosylab.acs.maci.manager.HandleDataStore in project ACS by ACS-Community.

the class DeserializeManagerFromFile method main.

/**
	 * @param args
	 */
public static void main(String[] args) throws Throwable {
    File f = new File(args[0]);
    ObjectInputStream obj = new ObjectInputStream(new FileInputStream(f));
    // we cast directly to the implementation
    ManagerImpl manager = (ManagerImpl) obj.readObject();
    {
        //
        // list all active components
        //
        HandleDataStore components = manager.getComponents();
        System.out.println("Capacity of handle data store: " + components.capacity());
        System.out.println(components.size() + " component(s) stored:");
        int h = components.first();
        while (h != 0) {
            ComponentInfo componentInfo = (ComponentInfo) components.get(h);
            System.out.println("\tName            : " + componentInfo.name);
            System.out.println("\tHandle          : " + componentInfo.h + ", " + HandleHelper.toString(componentInfo.h));
            System.out.println("\tType            : " + componentInfo.type);
            System.out.println("\tCode            : " + componentInfo.code);
            System.out.println("\tContainer name  : " + componentInfo.container_name);
            System.out.println("\tContainer handle: " + HandleHelper.toString(componentInfo.container));
            System.out.println("\tClients         : count = " + componentInfo.clients.length);
            for (int j = 0; j < componentInfo.clients.length; j++) System.out.println("\t             \t" + componentInfo.clients[j]);
            System.out.println("\t-------------------------------");
            h = components.next(h);
        }
    }
    System.out.println();
    System.out.println();
    System.out.println();
    {
        //
        // list all active containers
        //
        HandleDataStore containers = manager.getContainers();
        System.out.println("Capacity of handle data store: " + containers.capacity());
        System.out.println(containers.size() + " container(s) returned:");
        int h = containers.first();
        while (h != 0) {
            ContainerInfo containersInfo = (ContainerInfo) containers.get(h);
            System.out.println("\tName            : " + containersInfo.name);
            System.out.println("\tHandle          : " + containersInfo.h + ", " + HandleHelper.toString(containersInfo.h));
            System.out.println("\tComponents      : count = " + containersInfo.components.length);
            for (int j = 0; j < containersInfo.components.length; j++) System.out.println("\t             \t" + containersInfo.components[j]);
            System.out.println("\t-------------------------------");
        }
    }
    System.out.println();
    System.out.println();
    System.out.println();
    {
        //
        // list all active clients
        //
        HandleDataStore clients = manager.getClients();
        System.out.println("Capacity of handle data store: " + clients.capacity());
        System.out.println(clients.size() + " clients(s) returned:");
        int h = clients.first();
        while (h != 0) {
            ClientInfo clientsInfo = (ClientInfo) clients.get(h);
            System.out.println("\tName            : " + clientsInfo.name);
            System.out.println("\tHandle          : " + clientsInfo.h + ", " + HandleHelper.toString(clientsInfo.h));
            System.out.println("\tComponents      : count = " + clientsInfo.components.length);
            for (int j = 0; j < clientsInfo.components.length; j++) System.out.println("\t             \t" + clientsInfo.components[j]);
            System.out.println("\t-------------------------------");
        }
    }
    System.out.println();
    System.out.println();
    System.out.println();
    {
        //
        // list all active administrators
        //
        HandleDataStore clients = manager.getAdministrators();
        System.out.println("Capacity of handle data store: " + clients.capacity());
        System.out.println(clients.size() + " administrators(s) returned:");
        int h = clients.first();
        while (h != 0) {
            ClientInfo clientsInfo = (ClientInfo) clients.get(h);
            System.out.println("\tName            : " + clientsInfo.name);
            System.out.println("\tHandle          : " + clientsInfo.h + ", " + HandleHelper.toString(clientsInfo.h));
            System.out.println("\tComponents      : count = " + clientsInfo.components.length);
            for (int j = 0; j < clientsInfo.components.length; j++) System.out.println("\t             \t" + clientsInfo.components[j]);
            System.out.println("\t-------------------------------");
        }
    }
    System.out.println();
    System.out.println();
    System.out.println();
    System.out.println("# of unavailable components in a map: " + manager.getUnavailableComponents().size());
    System.out.println("# of default components in a map: " + manager.getDefaultComponents().size());
    System.out.println("# of active alarms in a map: " + manager.getActiveAlarms().size());
    System.out.println("# of released handles in a map: " + manager.getReleasedHandles().size());
}
Also used : ManagerImpl(com.cosylab.acs.maci.manager.ManagerImpl) ContainerInfo(si.ijs.maci.ContainerInfo) HandleDataStore(com.cosylab.acs.maci.manager.HandleDataStore) ComponentInfo(si.ijs.maci.ComponentInfo) ClientInfo(si.ijs.maci.ClientInfo) File(java.io.File) FileInputStream(java.io.FileInputStream) ObjectInputStream(java.io.ObjectInputStream)

Aggregations

HandleDataStore (com.cosylab.acs.maci.manager.HandleDataStore)6 ManagerImpl (com.cosylab.acs.maci.manager.ManagerImpl)4 ClientProxyImpl (com.cosylab.acs.maci.plug.ClientProxyImpl)2 Properties (java.util.Properties)2 ORB (org.omg.CORBA.ORB)2 POA (org.omg.PortableServer.POA)2 POAManager (org.omg.PortableServer.POAManager)2 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1 ObjectInputStream (java.io.ObjectInputStream)1 ClientInfo (si.ijs.maci.ClientInfo)1 ComponentInfo (si.ijs.maci.ComponentInfo)1 ContainerInfo (si.ijs.maci.ContainerInfo)1