use of org.omg.CORBA.UNKNOWN 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();
}
}
use of org.omg.CORBA.UNKNOWN in project ACS by ACS-Community.
the class ManagerProxyImpl method get_dynamic_component.
/**
* Activation of an dynamic component.
* @param id identification of the caller.
* @param c component to be obtained.
* @param mark_as_default mark component as default component of its type.
* @return <code>ComponentInfo</code> of requested component.
*/
public ComponentInfo get_dynamic_component(int id, si.ijs.maci.ComponentSpec c, boolean mark_as_default) throws NoPermissionEx, IncompleteComponentSpecEx, InvalidComponentSpecEx, ComponentSpecIncompatibleWithActiveComponentEx, CannotGetComponentEx {
pendingRequests.incrementAndGet();
try {
// returned value
ComponentInfo retVal = null;
/*
URI uri = null;
if (c.component_name != null)
uri = CURLHelper.createURI(c.component_name);
ComponentSpec componentSpec = new ComponentSpec(uri, c.component_type, c.component_code, c.container_name);
*/
// @todo si.ijs.maci.COMPONENT_SPEC_ANY -> ComponentSpec.COMPSPEC_ANY
ComponentSpec componentSpec = new ComponentSpec(c.component_name, c.component_type, c.component_code, c.container_name);
com.cosylab.acs.maci.ComponentInfo info = manager.getDynamicComponent(id, componentSpec, mark_as_default);
// transform to CORBA specific
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 (URISyntaxException usi)
{
BadParametersException hbpe = new BadParametersException(usi.getMessage(), usi);
hbpe.caughtIn(this, "get_dynamic_component");
hbpe.putValue("c.component_name", c.component_name);
// exception service will handle this
reportException(hbpe);
// rethrow CORBA specific
throw new BAD_PARAM(usi.getMessage());
}*/
catch (AcsJInvalidComponentSpecEx ics) {
// rethrow CORBA specific
throw ics.toInvalidComponentSpecEx();
} catch (AcsJIncompleteComponentSpecEx ics) {
// rethrow CORBA specific
throw ics.toIncompleteComponentSpecEx();
} catch (AcsJComponentSpecIncompatibleWithActiveComponentEx cpiwac) {
// rethrow CORBA specific
throw cpiwac.toComponentSpecIncompatibleWithActiveComponentEx();
} catch (AcsJNoPermissionEx npe) {
// rethrow CORBA specific
throw npe.toNoPermissionEx();
} 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) {
reportException(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();
}
}
use of org.omg.CORBA.UNKNOWN in project narayana by jbosstm.
the class ControlWrapper method register_synchronization.
public final void register_synchronization(Synchronization sync) throws Inactive, SynchronizationUnavailable, SystemException {
try {
if (_controlImpl != null)
_controlImpl.getImplHandle().register_synchronization(sync);
else {
try {
Coordinator coord = _control.get_coordinator();
coord.register_synchronization(sync);
} catch (final Unavailable e2) {
throw new Inactive();
} catch (final Exception e3) {
throw new UNKNOWN();
}
}
} catch (final NullPointerException e1) {
throw new Inactive();
}
}
use of org.omg.CORBA.UNKNOWN in project narayana by jbosstm.
the class XAResourceRecordUnitTest method testNested.
@Test
public void testNested() throws Exception {
ThreadActionData.purgeActions();
OTSImpleManager.current().contextManager().purgeActions();
XAResourceRecord xares = new XAResourceRecord();
assertEquals(xares.prepare_subtransaction(), Vote.VoteRollback);
try {
xares.commit_subtransaction(null);
fail();
} catch (final UNKNOWN ex) {
}
try {
xares.rollback_subtransaction();
fail();
} catch (final UNKNOWN ex) {
}
assertFalse(xares.propagateOnAbort());
assertFalse(xares.propagateOnCommit());
}
use of org.omg.CORBA.UNKNOWN in project narayana by jbosstm.
the class CurrentImple method resume.
/**
* To support checked transactions we can only resume if the action is local
* or we received it implicitly.
*
* If the control refers to a nested transaction then we must recreate the
* entire hierarchy, i.e., the effect of a suspend/resume on the same
* control should be the same as never calling suspend in the first place.
*
* If the control is for a local transaction then it is simple to recreate
* the hierarchy. Otherwise we rely upon the PropagationContext to recreate
* it.
*
* If this control is a "proxy" then create a new proxy instance, so we can
* delete proxies whenever suspend is called.
*
* Should check if "new" transaction is not actually the current one anyway.
* If so, just return. The spec. doesn't mention what to do in this case, so
* for now we go to the overhead of the work regardless.
*/
public void resume(Control which) throws InvalidControl, SystemException {
if (jtsLogger.logger.isTraceEnabled()) {
jtsLogger.logger.trace("CurrentImple::resume ( " + which + " )");
}
/*
* We must now "forget" any current transaction information. This is
* because when we end this transaction we must be associated with no
* transaction.
*/
_theManager.purgeActions();
if (// if null then return
which == null) {
ThreadAssociationControl.updateAssociation(null, TX_RESUMED);
return;
}
/*
* Must duplicate because it is an 'in' parameter which we want to keep.
*/
org.omg.CosTransactions.Control cont = which;
boolean invalidControl = false;
try {
Coordinator coord = cont.get_coordinator();
if (!coord.is_top_level_transaction()) {
/*
* Is the Control an ActionControl? If so then it has methods to
* allow us to get the parent directly. Otherwise, rely on the
* PropagationContext.
*/
ActionControl actControl = null;
try {
actControl = com.arjuna.ArjunaOTS.ActionControlHelper.narrow(cont);
if (actControl == null)
throw new BAD_PARAM();
} catch (Exception e) {
/*
* Not an ActionControl.
*/
actControl = null;
}
if (actControl != null) {
invalidControl = _theManager.addActionControlHierarchy(actControl);
} else {
invalidControl = _theManager.addRemoteHierarchy(cont);
}
}
coord = null;
} catch (OBJECT_NOT_EXIST one) {
// throw new InvalidControl();
} catch (// JacORB 1.4.5 bug
UNKNOWN ue) {
} catch (// JacORB 2.0 beta 2 bug
org.omg.CORBA.OBJ_ADAPTER oae) {
} catch (SystemException sysEx) {
throw new InvalidControl();
} catch (UserException usrEx) {
throw new InvalidControl();
} catch (NullPointerException npx) {
throw new InvalidControl();
} catch (Exception ex) {
throw new BAD_OPERATION("CurrentImple.resume: " + ex.toString());
}
try {
if (!invalidControl) {
ControlWrapper wrap = new ControlWrapper(cont);
ThreadAssociationControl.updateAssociation(wrap, TX_RESUMED);
_theManager.pushAction(wrap);
}
} catch (NullPointerException npx) {
invalidControl = true;
}
cont = null;
if (invalidControl)
throw new InvalidControl();
}
Aggregations