use of alma.objexpErrType.wrappers.AcsJObjectExplorerInterfaceRepositoryAccessEx 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