use of alma.maciErrType.wrappers.AcsJNoPermissionEx in project ACS by ACS-Community.
the class ManagerProxyImpl method get_service.
/**
* Get a service, activating it if necessary (components).
* The client represented by id (the handle) must have adequate access rights to access the service.
* NOTE: a component is also a service, i.e. a service activated by a container.
*
* @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 service_url CURL of the service 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.
* @param status Status of the request. One of COMPONENT_ACTIVATED, COMPONENT_DOES_NO_EXIST and COMPONENT_NOT_ACTIVATED.
* @return Reference to the service. If the service could not be obtained, a nil reference is returned,
* and the status contains an error code detailing the cause of failure (one of the COMPONENT_* constants).
* @see #get_component
*/
public Object get_service(int id, String service_url, boolean activate) throws NoPermissionEx, CannotGetComponentEx {
pendingRequests.incrementAndGet();
try {
// returned value
Object retVal = null;
// returned status
StatusHolder statusHolder = new StatusHolder();
// transform to CORBA specific
URI uri = null;
if (service_url != null)
uri = CURLHelper.createURI(service_url);
Component component = manager.getService(id, uri, activate, statusHolder);
if (component == null || (Object) component.getObject() == null)
throw new AcsJCannotGetComponentEx();
retVal = (Object) component.getObject();
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 (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();
}
}
use of alma.maciErrType.wrappers.AcsJNoPermissionEx in project ACS by ACS-Community.
the class ManagerProxyImpl method get_component_info.
/**
* Get all the information that the Manager has about components.
* To invoke this method, the caller must have INTROSPECT_MANAGER access rights, or it must have adequate privileges to access the Component (the same as with the get_component method).
* Information about all components is returned, unless the active_only parameter is set to true,
* in which case only information about those components that are currently registered with the Manager
* and activated is returned.
* Calling this function does not affect the internal state of the Manager.
*
* @param id Identification of the caller.
* @param h Handles of the components whose information is requested. If this is an empty sequence, the name_wc and type_wc parameters are used.
* @param name_wc Wildcard that the Component's name must match in order for its information to be returned.
* @param type_wc Wildcard that the Component's type must match in order for its information to be returned.
* @param active_only
* @return A sequence of ComponentInfo structures containing the entire Manager's knowledge about the components.
* If access is denied to a subset of objects, the handles to those objects are set to 0.
*/
public ComponentInfo[] get_component_info(int id, int[] h, String name_wc, String type_wc, boolean active_only) throws NoPermissionEx {
pendingRequests.incrementAndGet();
try {
// invalid info (replacement for null)
final ComponentInfo invalidInfo = new ComponentInfo("<invalid>", "<invalid>", null, "<invalid>", new int[0], 0, "<invalid>", 0, 0, new String[0]);
// returned value
ComponentInfo[] retVal = null;
// transform to CORBA specific
com.cosylab.acs.maci.ComponentInfo[] infos = manager.getComponentInfo(id, h, name_wc, type_wc, active_only);
if (infos != null) {
retVal = new ComponentInfo[infos.length];
for (int i = 0; i < infos.length; i++) if (infos[i] == null)
retVal[i] = invalidInfo;
else {
Object obj = null;
if (infos[i].getComponent() != null)
obj = (Object) infos[i].getComponent().getObject();
String[] interfaces;
if (infos[i].getInterfaces() != null)
interfaces = infos[i].getInterfaces();
else
interfaces = new String[0];
retVal[i] = new ComponentInfo(infos[i].getType(), infos[i].getCode(), obj, infos[i].getName(), infos[i].getClients().toArray(), infos[i].getContainer(), infos[i].getContainerName(), infos[i].getHandle(), mapAccessRights(infos[i].getAccessRights()), interfaces);
}
} else
retVal = new ComponentInfo[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();
}
}
use of alma.maciErrType.wrappers.AcsJNoPermissionEx 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();
}
}
use of alma.maciErrType.wrappers.AcsJNoPermissionEx in project ACS by ACS-Community.
the class ManagerProxyImpl method release_component_async.
public void release_component_async(int id, String component_url, CBlong callback, CBDescIn desc) throws NoPermissionEx {
pendingRequests.incrementAndGet();
try {
// simply release Component
URI uri = null;
if (component_url != null)
uri = CURLHelper.createURI(component_url);
final CBlong fcallback = callback;
final CBDescOut descOut = new CBDescOut(0, desc.id_tag);
LongCompletionCallback lcc = null;
if (callback != null) {
lcc = new LongCompletionCallback() {
public void failed(int result, Throwable exception) {
if (exception instanceof AcsJException) {
AcsJException aex = (AcsJException) exception;
fcallback.done(result, aex.toAcsJCompletion().toCorbaCompletion(), descOut);
} else {
AcsJUnexpectedExceptionEx uex = new AcsJUnexpectedExceptionEx(exception);
fcallback.done(result, uex.toAcsJCompletion().toCorbaCompletion(), descOut);
}
}
public void done(int result) {
fcallback.done(result, new ACSErrOKAcsJCompletion().toCorbaCompletion(), descOut);
}
};
}
manager.releaseComponentAsync(id, uri, lcc);
} catch (AcsJNoPermissionEx nop) {
reportException(nop);
// rethrow CORBA specific
throw nop.toNoPermissionEx();
} 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 (Throwable ex) {
CoreException hce = new CoreException(ex.getMessage(), ex);
reportException(hce);
// rethrow CORBA specific
throw new UNKNOWN(ex.getMessage());
} finally {
pendingRequests.decrementAndGet();
}
}
use of alma.maciErrType.wrappers.AcsJNoPermissionEx in project ACS by ACS-Community.
the class ManagerProxyImpl method get_client_info.
/**
* Get all the information that the Manager has about its known clients.
* 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 clients whose information is requested. If this is an empty sequence, the name_wc parameter is used.
* @param name_wc Wildcard that the clients's name must match in order for its information to be returned.
* @return A sequence of ClientInfo 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 ClientInfo[] get_client_info(int id, int[] h, String name_wc) throws NoPermissionEx {
pendingRequests.incrementAndGet();
try {
// invalid info (replacement for null)
final ClientInfo invalidInfo = new ClientInfo(0, null, new int[0], "<invalid>", 0);
// returned value
ClientInfo[] retVal = null;
// transform to CORBA specific
com.cosylab.acs.maci.ClientInfo[] infos = manager.getClientInfo(id, h, name_wc);
if (infos != null) {
retVal = new ClientInfo[infos.length];
for (int i = 0; i < infos.length; i++) if (infos[i] == null)
retVal[i] = invalidInfo;
else
retVal[i] = new ClientInfo(infos[i].getHandle(), ((ClientProxy) infos[i].getClient()).getClient(), infos[i].getComponents().toArray(), infos[i].getName(), mapAccessRights(infos[i].getAccessRights()));
} else
retVal = new ClientInfo[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();
}
}
Aggregations