Search in sources :

Example 11 with IntArray

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

the class ClientProxyImpl method components_available.

/**
	 * @see si.ijs.maci.ClientOperations#components_available(ComponentInfo[])
	 */
public void components_available(ComponentInfo[] components) {
    try {
        com.cosylab.acs.maci.ComponentInfo[] info = new com.cosylab.acs.maci.ComponentInfo[components.length];
        for (int i = 0; i < components.length; i++) {
            info[i] = new com.cosylab.acs.maci.ComponentInfo(components[i].h, components[i].name, components[i].type, components[i].code, new ComponentProxy(components[i].name, components[i].reference));
            info[i].setContainer(components[i].container);
            info[i].setContainerName(components[i].container_name);
            info[i].setClients(new IntArray(components[i].clients));
            info[i].setInterfaces(components[i].interfaces);
            info[i].setAccessRights(components[i].access);
        }
        client.components_available(info);
    } catch (RemoteException re) {
    // noop.
    }
}
Also used : IntArray(com.cosylab.acs.maci.IntArray) ComponentInfo(si.ijs.maci.ComponentInfo) RemoteException(com.cosylab.acs.maci.RemoteException)

Example 12 with IntArray

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

the class ContainerProxy method get_component_info.

/**
	 * @see com.cosylab.acs.maci.Container#get_component_info(int[])
	 */
public ComponentInfo[] get_component_info(int[] handles) throws RemoteException {
    try {
        // returned value
        ComponentInfo[] retVal = null;
        // transform to CORBA specific 
        si.ijs.maci.ComponentInfo[] infos = container.get_component_info(handles);
        if (infos != null) {
            retVal = new ComponentInfo[infos.length];
            for (int i = 0; i < infos.length; i++) {
                ComponentInfo componentInfo = new ComponentInfo(infos[i].h, infos[i].name, infos[i].type, infos[i].code, new ComponentProxy(infos[i].name, infos[i].reference));
                componentInfo.setContainer(infos[i].container);
                componentInfo.setContainerName(infos[i].container_name);
                componentInfo.setAccessRights(inverseMapAccessRights(infos[i].access));
                componentInfo.setClients(new IntArray(infos[i].clients));
                componentInfo.setInterfaces(infos[i].interfaces);
                retVal[i] = componentInfo;
            }
        }
        return retVal;
    } catch (Exception ex) {
        RemoteException re = new RemoteException("Failed to invoke 'get_component_info()' method.", ex);
        throw re;
    }
}
Also used : IntArray(com.cosylab.acs.maci.IntArray) ComponentInfo(com.cosylab.acs.maci.ComponentInfo) CBComponentInfo(si.ijs.maci.CBComponentInfo) RemoteException(com.cosylab.acs.maci.RemoteException) TimeoutRemoteException(com.cosylab.acs.maci.TimeoutRemoteException) RemoteException(com.cosylab.acs.maci.RemoteException) IOException(java.io.IOException) TimeoutRemoteException(com.cosylab.acs.maci.TimeoutRemoteException) AcsJException(alma.acs.exceptions.AcsJException)

Example 13 with IntArray

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

the class IntArrayTest method testContainment.

/**
	 */
public void testContainment() {
    IntArray ia = new IntArray();
    int i = 0;
    for (; i <= 12; i++) {
        ia.add(i);
        assertEquals(i, ia.get(i));
    }
    // remove odd
    for (i = 0; i < ia.size(); ) if (ia.get(i) % 2 == 1)
        ia.removeAt(i);
    else
        i++;
    for (i = 0; i < ia.size(); i++) assertEquals(i * 2, ia.get(i));
    System.out.println(ia.toString());
}
Also used : IntArray(com.cosylab.acs.maci.IntArray)

Example 14 with IntArray

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

the class IntArrayTest method testAddRemoveContains.

/**
	 */
public void testAddRemoveContains() {
    IntArray ia = new IntArray();
    ia.add(1);
    assertTrue(ia.contains(1));
    ia.add(3);
    assertTrue(ia.contains(1));
    assertTrue(ia.contains(3));
    ia.add(5);
    assertTrue(ia.contains(1));
    assertTrue(ia.contains(3));
    assertTrue(ia.contains(5));
    ia.remove(3);
    assertTrue(!ia.contains(3));
    ia.remove(1);
    assertTrue(!ia.contains(1));
    ia.remove(5);
    assertTrue(!ia.contains(5));
}
Also used : IntArray(com.cosylab.acs.maci.IntArray)

Aggregations

IntArray (com.cosylab.acs.maci.IntArray)14 ComponentInfo (com.cosylab.acs.maci.ComponentInfo)7 RemoteException (com.cosylab.acs.maci.RemoteException)6 AcsJException (alma.acs.exceptions.AcsJException)4 TimeoutRemoteException (com.cosylab.acs.maci.TimeoutRemoteException)4 IOException (java.io.IOException)4 AcsJNoPermissionEx (alma.maciErrType.wrappers.AcsJNoPermissionEx)3 NoDefaultComponentException (com.cosylab.acs.maci.NoDefaultComponentException)3 ComponentCommandDeallocate (com.cosylab.acs.maci.manager.recovery.ComponentCommandDeallocate)3 BadParametersException (com.cosylab.acs.maci.BadParametersException)2 ContainerInfo (com.cosylab.acs.maci.ContainerInfo)2 CoreException (com.cosylab.acs.maci.CoreException)2 NoResourcesException (com.cosylab.acs.maci.NoResourcesException)2 ComponentCommandAllocateHandle (com.cosylab.acs.maci.manager.recovery.ComponentCommandAllocateHandle)2 ComponentCommandSet (com.cosylab.acs.maci.manager.recovery.ComponentCommandSet)2 ContainerInfoCommandComponentAdd (com.cosylab.acs.maci.manager.recovery.ContainerInfoCommandComponentAdd)2 ContainerInfoCommandComponentRemove (com.cosylab.acs.maci.manager.recovery.ContainerInfoCommandComponentRemove)2 UnavailableComponentCommandRemove (com.cosylab.acs.maci.manager.recovery.UnavailableComponentCommandRemove)2 URI (java.net.URI)2 URISyntaxException (java.net.URISyntaxException)2