Search in sources :

Example 1 with AcsJNoDefaultComponentEx

use of alma.maciErrType.wrappers.AcsJNoDefaultComponentEx in project ACS by ACS-Community.

the class ManagerProxyImpl method get_default_component.

/**
	 * Returns the default component of specific type.
	 * @param	id		identification of the caller.
	 * @param	type	component type, IDL ID.
	 * @return	<code>ComponentInfo</code> of requested component.
	 */
public ComponentInfo get_default_component(int id, String type) throws NoPermissionEx, NoDefaultComponentEx, CannotGetComponentEx {
    pendingRequests.incrementAndGet();
    try {
        // returned value
        ComponentInfo retVal = null;
        // transform to CORBA specific
        com.cosylab.acs.maci.ComponentInfo info = manager.getDefaultComponent(id, type);
        if (info == null || info.getComponent() == null)
            throw new AcsJCannotGetComponentEx();
        Object obj = null;
        obj = (Object) info.getComponent().getObject();
        String[] interfaces;
        if (info.getInterfaces() != null)
            interfaces = info.getInterfaces();
        else
            interfaces = new String[0];
        retVal = new ComponentInfo(info.getType(), info.getCode(), obj, info.getName(), info.getClients().toArray(), info.getContainer(), info.getContainerName(), info.getHandle(), mapAccessRights(info.getAccessRights()), interfaces);
        return retVal;
    } catch (NoDefaultComponentException ndce) {
        NoDefaultComponentException hndce = new NoDefaultComponentException(ndce.getMessage(), ndce);
        reportException(hndce);
        // rethrow CORBA specific
        throw new AcsJNoDefaultComponentEx().toNoDefaultComponentEx();
    } 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 (AcsJCannotGetComponentEx cgce) {
        // rethrow CORBA specific
        throw cgce.toCannotGetComponentEx();
    } 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) AcsJCannotGetComponentEx(alma.maciErrType.wrappers.AcsJCannotGetComponentEx) NoDefaultComponentException(com.cosylab.acs.maci.NoDefaultComponentException) BadParametersException(com.cosylab.acs.maci.BadParametersException) NoResourcesException(com.cosylab.acs.maci.NoResourcesException) AcsJNoDefaultComponentEx(alma.maciErrType.wrappers.AcsJNoDefaultComponentEx) AcsJNoPermissionEx(alma.maciErrType.wrappers.AcsJNoPermissionEx) CoreException(com.cosylab.acs.maci.CoreException) Object(org.omg.CORBA.Object) ComponentInfo(si.ijs.maci.ComponentInfo) UNKNOWN(org.omg.CORBA.UNKNOWN) NO_RESOURCES(org.omg.CORBA.NO_RESOURCES)

Aggregations

AcsJCannotGetComponentEx (alma.maciErrType.wrappers.AcsJCannotGetComponentEx)1 AcsJNoDefaultComponentEx (alma.maciErrType.wrappers.AcsJNoDefaultComponentEx)1 AcsJNoPermissionEx (alma.maciErrType.wrappers.AcsJNoPermissionEx)1 BadParametersException (com.cosylab.acs.maci.BadParametersException)1 CoreException (com.cosylab.acs.maci.CoreException)1 NoDefaultComponentException (com.cosylab.acs.maci.NoDefaultComponentException)1 NoResourcesException (com.cosylab.acs.maci.NoResourcesException)1 BAD_PARAM (org.omg.CORBA.BAD_PARAM)1 NO_RESOURCES (org.omg.CORBA.NO_RESOURCES)1 Object (org.omg.CORBA.Object)1 UNKNOWN (org.omg.CORBA.UNKNOWN)1 ComponentInfo (si.ijs.maci.ComponentInfo)1