Search in sources :

Example 1 with Container

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

the class AcsContainer method registerWithCorba.

/**
	 * To be called only once from the ctor.
	 * 
	 * @throws AcsJContainerEx
	 */
private void registerWithCorba() throws AcsJContainerEx {
    // activate the Container as a CORBA object.
    org.omg.CORBA.Object obj = m_acsCorba.activateContainer(this, m_containerName);
    if (obj == null) {
        AcsJContainerEx ex = new AcsJContainerEx();
        ex.setContextInfo("failed to register this AcsContainer with the ORB.");
        throw ex;
    }
    Container container;
    try {
        container = ContainerHelper.narrow(obj);
        if (container == null) {
            throw new NullPointerException("Container CORBA-narrow returned a null.");
        }
    } catch (Throwable thr) {
        AcsJContainerEx ex = new AcsJContainerEx();
        ex.setContextInfo("failed to narrow the AcsContainer to CORBA type Container.");
        throw ex;
    }
    m_logger.finer("AcsContainer successfully registered with the ORB as a Container");
}
Also used : AcsJContainerEx(alma.JavaContainerError.wrappers.AcsJContainerEx) Container(si.ijs.maci.Container)

Example 2 with Container

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

the class ManagerProxyImpl method get_container_info.

/**
	 * Get all the information that the Manager has about its known Containers.
	 * To invoke this method, the caller must have INTROSPECT_MANAGER access rights, or it must be the object whose info it is requesting.
	 * Calling this function does not affect the internal state of the Manager.
	 *
	 * @param id Identification of the caller.
	 * @param h Handles of the containers whose information is requested. If this is an empty sequence, the name_wc parameter is used.
	 * @param name_wc Wildcard that the container's name must match in order for its information to be returned.
	 * @return A sequence of ContainerInfo structures containing the entire Manager's knowledge about the containers.
	 *		  If access is denied to a subset of objects, the handles to those objects are set to 0.
	 */
public ContainerInfo[] get_container_info(int id, int[] h, String name_wc) throws NoPermissionEx {
    pendingRequests.incrementAndGet();
    try {
        // invalid info (replacement for null)
        final ContainerInfo invalidInfo = new ContainerInfo("<invalid>", 0, null, new int[0]);
        // returned value
        ContainerInfo[] retVal = null;
        // transform to CORBA specific
        com.cosylab.acs.maci.ContainerInfo[] infos = manager.getContainerInfo(id, h, name_wc);
        if (infos != null) {
            retVal = new ContainerInfo[infos.length];
            for (int i = 0; i < infos.length; i++) if (infos[i] == null)
                retVal[i] = invalidInfo;
            else
                retVal[i] = new ContainerInfo(infos[i].getName(), infos[i].getHandle(), (Container) ((ContainerProxy) infos[i].getContainer()).getClient(), infos[i].getComponents().toArray());
        } else
            retVal = new ContainerInfo[0];
        return retVal;
    } catch (BadParametersException bpe) {
        BadParametersException hbpe = new BadParametersException(bpe.getMessage(), bpe);
        reportException(hbpe);
        // rethrow CORBA specific
        throw new BAD_PARAM(bpe.getMessage());
    } catch (NoResourcesException nre) {
        NoResourcesException hnre = new NoResourcesException(nre.getMessage(), nre);
        reportException(hnre);
        // rethrow CORBA specific
        throw new NO_RESOURCES(nre.getMessage());
    } catch (AcsJNoPermissionEx npe) {
        // rethrow CORBA specific
        throw npe.toNoPermissionEx();
    } catch (Throwable ex) {
        CoreException hce = new CoreException(ex.getMessage(), ex);
        reportException(hce);
        // rethrow CORBA specific
        throw new UNKNOWN(ex.getMessage());
    } finally {
        pendingRequests.decrementAndGet();
    }
}
Also used : BAD_PARAM(org.omg.CORBA.BAD_PARAM) BadParametersException(com.cosylab.acs.maci.BadParametersException) NoResourcesException(com.cosylab.acs.maci.NoResourcesException) Container(si.ijs.maci.Container) AcsJNoPermissionEx(alma.maciErrType.wrappers.AcsJNoPermissionEx) CoreException(com.cosylab.acs.maci.CoreException) ContainerInfo(si.ijs.maci.ContainerInfo) UNKNOWN(org.omg.CORBA.UNKNOWN) NO_RESOURCES(org.omg.CORBA.NO_RESOURCES)

Example 3 with Container

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

the class TreeMouseListener method getLogConfFromContainer.

/**
	 * Get the LoggingConfigurable out of the container
	 * 
	 * @return The LoggingConfigurable for the container
	 */
private LoggingConfigurableOperations getLogConfFromContainer(ContainerInfo info) throws Exception {
    if (info == null) {
        throw new IllegalArgumentException("Invalid null ContainerInfo");
    }
    final Container cnt = info.reference;
    if (cnt == null) {
        throw new Exception("The reference to the container is null in ContainerInfo");
    }
    SwingWorker<LoggingConfigurableOperations, Void> worker = new SwingWorker<LoggingConfigurableOperations, Void>() {

        protected LoggingConfigurableOperations doInBackground() throws Exception {
            LoggingConfigurableOperations logConf;
            try {
                logConf = LoggingConfigurableHelper.narrow(cnt);
            } catch (Throwable t) {
                throw new Exception("Error getting the LoggingConfigurable out of Manager:\n" + t.getMessage(), t);
            }
            return logConf;
        }
    };
    worker.execute();
    return worker.get();
}
Also used : LoggingConfigurableOperations(alma.Logging.LoggingConfigurableOperations) Container(si.ijs.maci.Container) SwingWorker(javax.swing.SwingWorker) LogPaneNotFoundException(alma.acs.gui.loglevel.LogPaneNotFoundException)

Aggregations

Container (si.ijs.maci.Container)3 AcsJContainerEx (alma.JavaContainerError.wrappers.AcsJContainerEx)1 LoggingConfigurableOperations (alma.Logging.LoggingConfigurableOperations)1 LogPaneNotFoundException (alma.acs.gui.loglevel.LogPaneNotFoundException)1 AcsJNoPermissionEx (alma.maciErrType.wrappers.AcsJNoPermissionEx)1 BadParametersException (com.cosylab.acs.maci.BadParametersException)1 CoreException (com.cosylab.acs.maci.CoreException)1 NoResourcesException (com.cosylab.acs.maci.NoResourcesException)1 SwingWorker (javax.swing.SwingWorker)1 BAD_PARAM (org.omg.CORBA.BAD_PARAM)1 NO_RESOURCES (org.omg.CORBA.NO_RESOURCES)1 UNKNOWN (org.omg.CORBA.UNKNOWN)1 ContainerInfo (si.ijs.maci.ContainerInfo)1