Search in sources :

Example 21 with ClientInfo

use of si.ijs.maci.ClientInfo in project ACS by ACS-Community.

the class DeploymentTree method isMyself.

/**
	 * Little helper for the renderer. Just because it seems nice for the user. The
	 * specified node must contain a ClientInfo user object.
	 */
protected boolean isMyself(DefaultMutableTreeNode node) {
    try {
        // find manager node
        DefaultMutableTreeNode n = node;
        do {
            n = (DefaultMutableTreeNode) n.getParent();
        } while (!(n.getUserObject() instanceof IMaciSupervisor));
        // compare handles
        ClientInfo info = (ClientInfo) node.getUserObject();
        return (maciSupervisor(n).myMaciHandle() == info.h);
    } catch (Exception e) {
        // instead of making the above code rock-stable, let's do it cheap
        return false;
    }
}
Also used : DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) ClientInfo(si.ijs.maci.ClientInfo) CannotRetrieveManagerException(alma.acs.commandcenter.meta.IMaciSupervisor.CannotRetrieveManagerException) CorbaNoPermissionException(alma.acs.commandcenter.meta.IMaciSupervisor.CorbaNoPermissionException) CorbaNotExistException(alma.acs.commandcenter.meta.IMaciSupervisor.CorbaNotExistException) OrbInitException(alma.acs.commandcenter.meta.Firestarter.OrbInitException) CorbaUnknownException(alma.acs.commandcenter.meta.IMaciSupervisor.CorbaUnknownException) NotConnectedToManagerException(alma.acs.commandcenter.meta.IMaciSupervisor.NotConnectedToManagerException) CorbaTransientException(alma.acs.commandcenter.meta.IMaciSupervisor.CorbaTransientException) UnknownErrorException(alma.acs.commandcenter.meta.IMaciSupervisor.UnknownErrorException) IMaciSupervisor(alma.acs.commandcenter.meta.IMaciSupervisor)

Example 22 with ClientInfo

use of si.ijs.maci.ClientInfo in project ACS by ACS-Community.

the class MaciInfo method addInfoNodes.

protected void addInfoNodes(SortingTreeNode node, Map<Object, String> auxiliary) {
    Object info = node.getUserObject();
    int infokey = System.identityHashCode(info);
    if (info instanceof ContainerInfo) {
        //ContainerInfo casted = (ContainerInfo)info;
        node.add(createNode(new InfoDetail("location", auxiliary.get(infokey + ".location"))));
    } else if (info instanceof ClientInfo) {
        ClientInfo casted = (ClientInfo) info;
        node.add(createNode(new InfoDetail("location", auxiliary.get(infokey + ".location"))));
        node.add(createNode(new InfoDetail("components", casted.components, true)));
        node.add(createNode(new InfoDetail("access", casted.access, false)));
        node.add(createNode(new InfoDetail("reference", casted.reference)));
    } else if (info instanceof ComponentInfo) {
        ComponentInfo casted = (ComponentInfo) info;
        node.add(createNode(new InfoDetail("clients", casted.clients, true)));
        node.add(createNode(new InfoDetail("container", casted.container, true)));
        node.add(createNode(new InfoDetail("container_name", casted.container_name)));
        node.add(createNode(new InfoDetail("access", casted.access, false)));
        node.add(createNode(new InfoDetail("reference", casted.reference)));
        node.add(createNode(new InfoDetail("interfaces", casted.interfaces)));
        node.add(createNode(new InfoDetail("type", casted.type)));
        node.add(createNode(new InfoDetail("code", casted.code)));
    }
}
Also used : ContainerInfo(si.ijs.maci.ContainerInfo) ClientInfo(si.ijs.maci.ClientInfo) ComponentInfo(si.ijs.maci.ComponentInfo)

Example 23 with ClientInfo

use of si.ijs.maci.ClientInfo in project ACS by ACS-Community.

the class MaciInfo method setContents.

/**
    * Sets the components, containers, and clients.
    * The given lists must not be changed anymore (otherwise 
    * this method would have to make a copy of them).
    */
protected void setContents(List<ComponentInfo> newComponents, List<ContainerInfo> newContainers, List<ClientInfo> newClientApps, Map<Object, String> auxiliary) {
    // bend references, each assignment is atomic and triggers a flush.
    // note we shall not modify the lists anymore after this point! 
    this.components = newComponents;
    this.containers = newContainers;
    this.clientApps = newClientApps;
    // re-populate the toplevel nodes
    // ---------------------------------------------
    componentNode.removeAllChildren();
    for (ComponentInfo comp : newComponents) {
        SortingTreeNode n = createNode(comp);
        addInfoNodes(n, auxiliary);
        componentNode.add(n);
    }
    containerNode.removeAllChildren();
    for (ContainerInfo cont : newContainers) {
        SortingTreeNode n = createNode(cont);
        addInfoNodes(n, auxiliary);
        // attach components that are active in this container
        for (ComponentInfo comp : newComponents) {
            if (comp.container == cont.h && comp.h != 0)
                n.add(createNode(comp));
        }
        containerNode.add(n);
    }
    clientNode.removeAllChildren();
    for (ClientInfo client : newClientApps) {
        SortingTreeNode n = createNode(client);
        addInfoNodes(n, auxiliary);
        clientNode.add(n);
    }
    // we sort - for some great user experience
    componentNode.sortChildrenByName();
    containerNode.sortChildrenByName();
    clientNode.sortChildrenByName();
    // send out change event
    nodeStructureChanged(managerNode);
}
Also used : ContainerInfo(si.ijs.maci.ContainerInfo) ComponentInfo(si.ijs.maci.ComponentInfo) ClientInfo(si.ijs.maci.ClientInfo)

Example 24 with ClientInfo

use of si.ijs.maci.ClientInfo in project ACS by ACS-Community.

the class MaciSupervisorTest method debug.

// msc: it's not always easy to get the arguments for mocking right.
// the below code registers for any arguments, and prints the arguments.
void debug() throws Exception {
    Mockito.when(manager.login(administrator)).thenAnswer(new Answer<ClientInfo>() {

        public ClientInfo answer(InvocationOnMock invocation) throws Throwable {
            System.out.println(Arrays.toString(invocation.getArguments()));
            Thread.sleep(5000);
            return new ClientInfo();
        }
    });
    Mockito.when(manager.get_component_info(anyInt(), any(int[].class), anyString(), anyString(), anyBoolean())).thenAnswer(new Answer<ComponentInfo[]>() {

        public ComponentInfo[] answer(InvocationOnMock invocation) throws Throwable {
            System.out.println("get_component_info (" + Arrays.toString(invocation.getArguments()) + ")");
            Thread.sleep(5000);
            return new ComponentInfo[] {};
        }
    });
}
Also used : InvocationOnMock(org.mockito.invocation.InvocationOnMock) ClientInfo(si.ijs.maci.ClientInfo)

Aggregations

ClientInfo (si.ijs.maci.ClientInfo)24 ComponentInfo (si.ijs.maci.ComponentInfo)9 ContainerInfo (si.ijs.maci.ContainerInfo)8 Client (si.ijs.maci.Client)6 Manager (si.ijs.maci.Manager)6 POAManager (org.omg.PortableServer.POAManager)5 CBDescIn (alma.ACS.CBDescIn)2 CompletionHolder (alma.ACSErr.CompletionHolder)2 IMaciSupervisor (alma.acs.commandcenter.meta.IMaciSupervisor)2 NoPermissionEx (alma.maciErrType.NoPermissionEx)2 AcsJNoPermissionEx (alma.maciErrType.wrappers.AcsJNoPermissionEx)2 BadParametersException (com.cosylab.acs.maci.BadParametersException)2 CoreException (com.cosylab.acs.maci.CoreException)2 NoResourcesException (com.cosylab.acs.maci.NoResourcesException)2 Monitor (alma.ACS.Monitor)1 MonitorstringSeq (alma.ACS.MonitorstringSeq)1 ROstring (alma.ACS.ROstring)1 ROstringSeq (alma.ACS.ROstringSeq)1 AcsJContainerEx (alma.JavaContainerError.wrappers.AcsJContainerEx)1 OrbInitException (alma.acs.commandcenter.meta.Firestarter.OrbInitException)1