use of alma.maciErrType.CannotGetComponentEx in project ACS by ACS-Community.
the class ACSRemoteAccess method resolveNamingServiceContext.
private NamingContext resolveNamingServiceContext(si.ijs.maci.Manager manager) {
listenersDispatcher.publishReport("Resolving Naming Service...");
org.omg.CORBA.Object nameService = null;
try {
nameService = manager.get_service(0, NAME_SERVICE, false);
} catch (NoPermissionEx e) {
throw new IllegalStateException("Failed to obtaine NameService from the manager. No permission");
} catch (CannotGetComponentEx e) {
throw new IllegalStateException("Failed to obtain NameService from the manager.");
} catch (ComponentNotAlreadyActivatedEx e) {
throw new IllegalStateException("Failed to obtaine NameService from the manager.");
} catch (ComponentConfigurationNotFoundEx e) {
throw new IllegalStateException("Failed to obtaine NameService from the manager.");
}
NamingContext namingContext = null;
try {
namingContext = org.omg.CosNaming.NamingContextHelper.narrow(nameService);
} catch (Exception e) {
listenersDispatcher.publishReport("Exception occurred when narrowing Naming Service Context from the Naming Service.");
System.out.println("Exception in resloveNamingServiceContext(): " + e);
return null;
}
listenersDispatcher.publishReport("Naming Service resolved.");
return namingContext;
}
use of alma.maciErrType.CannotGetComponentEx in project ACS by ACS-Community.
the class BACIRemoteAccess method internalManagerConnect.
/**
* Insert the method's description here.
* Creation date: (2.11.2000 0:34:52)
* @param node si.ijs.acs.objectexplorer.engine.BACI.BACIRemoteNode
*/
private void internalManagerConnect(BACIRemoteNode baciNode) throws AcsJObjectExplorerConnectEx {
/* we are connecting directly to the Manager to obtain the object reference */
//System.out.println("DEBUG: imc "+baciNode);
String curl = (String) baciNode.getUserObject();
notifier.reportDebug("BACIRemoteAccess::internalManagerConnect", "Requesting component: '" + curl + "', activate = true");
notifier.reportMessage("Connecting to '" + curl + "'.");
baciNode.setNonSticky(connectNonSticky);
org.omg.CORBA.Object obj = null;
if (connectNonSticky) {
try {
obj = manager.get_component_non_sticky(handle, curl);
} catch (Throwable e) {
String message = "Connection to component '" + curl + "' failed. \n" + "'Connect as non-sticky' mode is enabled: in this mode component will not be activated by ObjectExplorer,\n" + "only already activated components can be accessed.";
int ans = choiceForNonStickyComponentConnection(message);
switch(ans) {
case 0:
baciNode.setNonSticky(false);
System.out.println("BACIRemoteAccess.internalManagerConnect setNonSticky to " + baciNode.isNonSticky() + " @ " + baciNode.hashCode());
break;
case 1:
baciEngineMenu.setNonSticky(false);
baciNode.setNonSticky(false);
break;
case 2:
{
AcsJObjectExplorerConnectEx acsjex = new AcsJObjectExplorerConnectEx(e);
acsjex.setCurl(curl);
throw acsjex;
}
default:
{
// should not happen.
notifier.reportError("Unexpected choice.");
AcsJObjectExplorerConnectEx acsjex = new AcsJObjectExplorerConnectEx(e);
acsjex.setCurl(curl);
throw acsjex;
}
}
}
}
try {
if (obj == null) {
obj = manager.get_component(handle, curl, true);
}
notifier.reportDebug("BACIRemoteAccess::internalManagerConnect", "Manager returns OK");
}/*
* We wrap into a specific exception and report up
*/
catch (CannotGetComponentEx e) {
notifier.reportError("Connection to component '" + curl + "' failed.");
AcsJObjectExplorerConnectEx acsjex = new AcsJObjectExplorerConnectEx(e);
acsjex.setCurl(curl);
throw acsjex;
} catch (org.omg.CORBA.TRANSIENT e) {
notifier.reportError("Connection to component '" + curl + "' failed.\nCouldn't connect to the manager.");
AcsJObjectExplorerConnectEx acsjex = new AcsJObjectExplorerConnectEx(e);
acsjex.setCurl(curl);
throw acsjex;
} catch (Throwable e) {
notifier.reportError("Connection to component '" + curl + "' failed.\nUnknown Reason.");
AcsJObjectExplorerConnectEx acsjex = new AcsJObjectExplorerConnectEx(e);
acsjex.setCurl(curl);
throw acsjex;
}
String irfid = null;
try {
notifier.reportDebug("BACIRemoteAccess::internalManagerConnect", "Querying component '" + curl + "' for CORBA type id.");
ComponentInfo[] cobInfos = manager.get_component_info(handle, new int[0], curl, "*", true);
if (cobInfos.length != 1) {
AcsJObjectExplorerConnectEx acsjex = new AcsJObjectExplorerConnectEx();
acsjex.setReason("Manager did not return valid ComponentInfo for '" + curl + "'.");
throw acsjex;
}
irfid = cobInfos[0].type;
notifier.reportDebug("BACIRemoteAccess::internalManagerConnect", "component '" + curl + "' has id: " + irfid);
} catch (Exception e) {
notifier.reportError("Cannot retrieve Interface Repository ID for component '" + curl + "'", e);
AcsJObjectExplorerConnectEx acsjex = new AcsJObjectExplorerConnectEx(e);
acsjex.setCurl(curl);
throw acsjex;
}
// baciNode.setNonSticky(connectNonSticky);
baciNode.setCORBARef(obj);
try {
baciNode.setIFDesc(getIFDesc(irfid));
if (baciNode.getIFDesc() != null)
notifier.reportDebug("BACIRemoteAccess::internalManagerConnect", "IR Query OK.");
else {
AcsJObjectExplorerConnectEx acsjex = new AcsJObjectExplorerConnectEx();
acsjex.setCurl(curl);
acsjex.setReason("Cannot retrieve Interface Repository description for component for '" + curl + "'.");
throw acsjex;
}
} catch (Exception e) {
baciNode.setCORBARef(null);
notifier.reportError("Failed to retrieve interface description from IR, releasing component on Manager, if needed.", e);
AcsJException releaseCompEx = null;
try {
if (manager != null && obj != null && !baciNode.isNonSticky()) {
manager.release_component(handle, curl);
}
} catch (NoPermissionEx npe) {
releaseCompEx = AcsJNoPermissionEx.fromNoPermissionEx(npe);
} catch (CannotDeactivateComponentEx ex) {
// @TODO remove this catch once we remove this ex from maci.idl
releaseCompEx = AcsJCannotDeactivateComponentEx.fromCannotDeactivateComponentEx(ex);
} catch (ComponentDeactivationUncleanEx ex) {
releaseCompEx = AcsJComponentDeactivationUncleanEx.fromComponentDeactivationUncleanEx(ex);
} catch (ComponentDeactivationFailedEx ex) {
releaseCompEx = AcsJComponentDeactivationFailedEx.fromComponentDeactivationFailedEx(ex);
}
if (releaseCompEx != null) {
notifier.reportError("Failed to release component", releaseCompEx);
logACSException(releaseCompEx);
}
AcsJObjectExplorerInterfaceRepositoryAccessEx acsjex = new AcsJObjectExplorerInterfaceRepositoryAccessEx(e);
acsjex.setCurl(curl);
acsjex.setIRid(irfid);
AcsJObjectExplorerConnectEx acsjex2 = new AcsJObjectExplorerConnectEx(acsjex);
acsjex2.setCurl(curl);
throw acsjex2;
}
notifier.reportMessage("Connected to '" + curl + "'.");
}
Aggregations