Search in sources :

Example 1 with AcsJComponentNotAlreadyActivatedEx

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

the class ManagerProxyImpl method get_component_non_sticky.

/**
	 * Get a component, do not activate it and also do not do any reference counting.
	 * The client represented by id (the handle)
	 * must have adequate access rights to access the Component. This is untrue of components:
	 * components always have unlimited access rights to other components.
	 *
	 * @param id Identification of the caller. If this is an invalid handle, or if the caller does not have enough access rights, a maciErrType::NoPermissionEx exception is raised.
	 * @param component_url CURL of the Component whose reference is to be retrieved.
	 * @return Reference to the Component.
	 */
public Object get_component_non_sticky(int id, String component_url) throws NoPermissionEx, CannotGetComponentEx, ComponentNotAlreadyActivatedEx {
    pendingRequests.incrementAndGet();
    try {
        // returned value
        Object retVal = null;
        // transform to CORBA specific
        URI uri = null;
        if (component_url != null)
            uri = CURLHelper.createURI(component_url);
        Component component = manager.getComponentNonSticky(id, uri);
        // extract Component CORBA reference
        if (component != null)
            retVal = (Object) component.getObject();
        // @todo
        if (component == null)
            throw new AcsJComponentNotAlreadyActivatedEx();
        return retVal;
    } catch (URISyntaxException usi) {
        BadParametersException hbpe = new BadParametersException(usi.getMessage(), usi);
        reportException(hbpe);
        // rethrow CORBA specific
        throw new BAD_PARAM(usi.getMessage());
    } 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 (AcsJCannotGetComponentEx cgce) {
        // rethrow CORBA specific
        throw cgce.toCannotGetComponentEx();
    } catch (AcsJComponentNotAlreadyActivatedEx cnaae) {
        // rethrow CORBA specific
        throw cnaae.toComponentNotAlreadyActivatedEx();
    } 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) URISyntaxException(java.net.URISyntaxException) URI(java.net.URI) AcsJCannotGetComponentEx(alma.maciErrType.wrappers.AcsJCannotGetComponentEx) AcsJComponentNotAlreadyActivatedEx(alma.maciErrType.wrappers.AcsJComponentNotAlreadyActivatedEx) BadParametersException(com.cosylab.acs.maci.BadParametersException) NoResourcesException(com.cosylab.acs.maci.NoResourcesException) AcsJNoPermissionEx(alma.maciErrType.wrappers.AcsJNoPermissionEx) CoreException(com.cosylab.acs.maci.CoreException) Object(org.omg.CORBA.Object) UNKNOWN(org.omg.CORBA.UNKNOWN) Component(com.cosylab.acs.maci.Component) NO_RESOURCES(org.omg.CORBA.NO_RESOURCES)

Example 2 with AcsJComponentNotAlreadyActivatedEx

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

the class ManagerProxyImpl method get_component.

/**
	 * Get a Component, activating it if necessary.
	 * The client represented by id (the handle)
	 * must have adequate access rights to access the Component. This is untrue of components:
	 * components always have unlimited access rights to other components.
	 *
	 * @param id Identification of the caller. If this is an invalid handle, or if the caller does not have enough access rights, a maciErrType::NoPermissionEx exception is raised.
	 * @param component_url CURL of the Component whose reference is to be retrieved.
	 * @param activate True if the Component is to be activated in case it does not exist. If set to False, and the Component does not exist, a nil reference is returned and status is set to COMPONENT_NOT_ACTIVATED.
	 * @return Reference to the Component. If the Component could not be activated, an exception is throw.
	 */
public Object get_component(int id, String component_url, boolean activate) throws NoPermissionEx, CannotGetComponentEx, ComponentNotAlreadyActivatedEx, ComponentConfigurationNotFoundEx {
    pendingRequests.incrementAndGet();
    try {
        // returned value
        Object retVal = null;
        // returned status
        StatusHolder statusHolder = new StatusHolder();
        // transform to CORBA specific
        URI uri = null;
        if (component_url != null)
            uri = CURLHelper.createURI(component_url);
        Component component = manager.getComponent(id, uri, activate, statusHolder);
        // extract Component CORBA reference
        if (component != null)
            retVal = (Object) component.getObject();
        /**
			 * @todo GCH 2006.10.11
			 *       notice that we can get a ComponentStatus != COMPONENT_ACTIVATED
			 *       also if the component is properly returned.
			 *       There is an incoherence here in the interfaces that shall be resolved.
			 *       We have to cleanup here or go back to return a status
			 *       to the caller.
			 *       My point is: the caller is interested in more than just 
			 *       getting the component of an indication of failure if not?
			 *       Is it interesting to know that the component was not activated,
			 *       presumably because already active? 
			 */
        if (component == null || component.getObject() == null) {
            if (statusHolder.getStatus() == ComponentStatus.COMPONENT_NOT_ACTIVATED && !activate) {
                AcsJComponentNotAlreadyActivatedEx ex = new AcsJComponentNotAlreadyActivatedEx();
                ex.setCURL(component_url);
                throw ex;
            }
            if (statusHolder.getStatus() == ComponentStatus.COMPONENT_DOES_NO_EXIST) {
                AcsJComponentConfigurationNotFoundEx ex = new AcsJComponentConfigurationNotFoundEx();
                ex.setCURL(component_url);
                throw ex;
            } else {
                AcsJCannotGetComponentEx ex = new AcsJCannotGetComponentEx();
                ex.setCURL(component_url);
                throw ex;
            }
        }
        return retVal;
    } catch (URISyntaxException usi) {
        BadParametersException hbpe = new BadParametersException(usi.getMessage(), usi);
        reportException(hbpe);
        // rethrow CORBA specific
        throw new BAD_PARAM(usi.getMessage());
    } 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 (AcsJCannotGetComponentEx cgce) {
        // rethrow CORBA specific
        throw cgce.toCannotGetComponentEx();
    } catch (AcsJComponentNotAlreadyActivatedEx cnaae) {
        // rethrow CORBA specific
        throw cnaae.toComponentNotAlreadyActivatedEx();
    } catch (AcsJComponentConfigurationNotFoundEx ccnfe) {
        // rethrow CORBA specific
        throw ccnfe.toComponentConfigurationNotFoundEx();
    } 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) URISyntaxException(java.net.URISyntaxException) URI(java.net.URI) AcsJCannotGetComponentEx(alma.maciErrType.wrappers.AcsJCannotGetComponentEx) StatusHolder(com.cosylab.acs.maci.StatusHolder) AcsJComponentNotAlreadyActivatedEx(alma.maciErrType.wrappers.AcsJComponentNotAlreadyActivatedEx) BadParametersException(com.cosylab.acs.maci.BadParametersException) NoResourcesException(com.cosylab.acs.maci.NoResourcesException) AcsJNoPermissionEx(alma.maciErrType.wrappers.AcsJNoPermissionEx) CoreException(com.cosylab.acs.maci.CoreException) Object(org.omg.CORBA.Object) AcsJComponentConfigurationNotFoundEx(alma.maciErrType.wrappers.AcsJComponentConfigurationNotFoundEx) UNKNOWN(org.omg.CORBA.UNKNOWN) Component(com.cosylab.acs.maci.Component) NO_RESOURCES(org.omg.CORBA.NO_RESOURCES)

Example 3 with AcsJComponentNotAlreadyActivatedEx

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

the class ManagerProxyImpl method make_component_immortal.

/**
	 * Change mortality state of an component.
	 * Compnent must be already active, otherwise ComponentNotAlreadyActivatedEx exception will be thrown.
	 * The caller must be an owner of an component or have administator rights,
	 * otherwise NoPermissionEx exception will be thrown.
	 * 
	 * @param id Identification of the caller. The caller must be an owner of an component or have administator rights.
	 * @param component_url The CURL of the component whose mortality to change.
	 * @param immortal_state New mortality state.
	 **/
public void make_component_immortal(int id, String component_url, boolean immortal_state) throws NoPermissionEx, ComponentNotAlreadyActivatedEx {
    pendingRequests.incrementAndGet();
    try {
        // simply release Component
        URI uri = null;
        if (component_url != null)
            uri = CURLHelper.createURI(component_url);
        manager.makeComponentImmortal(id, uri, immortal_state);
    } catch (URISyntaxException usi) {
        BadParametersException hbpe = new BadParametersException(usi.getMessage(), usi);
        reportException(hbpe);
        // rethrow CORBA specific
        throw new BAD_PARAM(usi.getMessage());
    } catch (BadParametersException bpe) {
        BadParametersException hbpe = new BadParametersException(bpe.getMessage(), bpe);
        reportException(hbpe);
        // rethrow CORBA specific
        throw new BAD_PARAM(bpe.getMessage());
    }// @todo 
     catch (NoResourcesException nre) {
        NoResourcesException hnre = new NoResourcesException(nre.getMessage(), nre);
        reportException(hnre);
        // rethrow CORBA specific
        throw new AcsJComponentNotAlreadyActivatedEx().toComponentNotAlreadyActivatedEx();
    } 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 : NoResourcesException(com.cosylab.acs.maci.NoResourcesException) AcsJNoPermissionEx(alma.maciErrType.wrappers.AcsJNoPermissionEx) CoreException(com.cosylab.acs.maci.CoreException) BAD_PARAM(org.omg.CORBA.BAD_PARAM) URISyntaxException(java.net.URISyntaxException) UNKNOWN(org.omg.CORBA.UNKNOWN) URI(java.net.URI) BadParametersException(com.cosylab.acs.maci.BadParametersException) AcsJComponentNotAlreadyActivatedEx(alma.maciErrType.wrappers.AcsJComponentNotAlreadyActivatedEx)

Aggregations

AcsJComponentNotAlreadyActivatedEx (alma.maciErrType.wrappers.AcsJComponentNotAlreadyActivatedEx)3 AcsJNoPermissionEx (alma.maciErrType.wrappers.AcsJNoPermissionEx)3 BadParametersException (com.cosylab.acs.maci.BadParametersException)3 CoreException (com.cosylab.acs.maci.CoreException)3 NoResourcesException (com.cosylab.acs.maci.NoResourcesException)3 URI (java.net.URI)3 URISyntaxException (java.net.URISyntaxException)3 BAD_PARAM (org.omg.CORBA.BAD_PARAM)3 UNKNOWN (org.omg.CORBA.UNKNOWN)3 AcsJCannotGetComponentEx (alma.maciErrType.wrappers.AcsJCannotGetComponentEx)2 Component (com.cosylab.acs.maci.Component)2 NO_RESOURCES (org.omg.CORBA.NO_RESOURCES)2 Object (org.omg.CORBA.Object)2 AcsJComponentConfigurationNotFoundEx (alma.maciErrType.wrappers.AcsJComponentConfigurationNotFoundEx)1 StatusHolder (com.cosylab.acs.maci.StatusHolder)1