use of si.ijs.maci.Manager in project ACS by ACS-Community.
the class ACSRemoteAccess method initialize.
/**
* Initialize the connection.
*
* @param theORB The ORB.
* If it is null then a new CORBA connection is initialized.
* @param manager A reference to the Manager
* If it is null a reference is built by reading the properties.
*/
public void initialize(ORB theORB, Manager manager) {
isExternalORB = (theORB != null);
this.orb = theORB;
if (orb == null) {
listenersDispatcher.publishReport("Initializing CORBA...");
// ORB stanza
java.util.Properties orbprops = java.lang.System.getProperties();
orb = ORB.init(new String[0], orbprops);
// POA stanza -- use RootPOA
POA rootPOA = null;
try {
rootPOA = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
} catch (org.omg.CORBA.ORBPackage.InvalidName in) {
throw new IllegalStateException("Cannot resolve RootPOA: " + in);
}
POAManager poaManager = rootPOA.the_POAManager();
try {
poaManager.activate();
} catch (Exception e) {
throw new IllegalStateException("POAManager activation failed." + e);
}
// setup ORB profiling
try {
if (orb instanceof AcsProfilingORB) {
AcsORBProfiler profiler = new AcsORBProfilerImplBase(logger);
((AcsProfilingORB) orb).registerAcsORBProfiler(profiler);
logger.finer("Orb profiling set up, using class " + AcsORBProfilerImplBase.class.getName());
}
} catch (Throwable th) {
logger.log(Level.WARNING, "Failed to setup ORB profiling.", th);
}
// end of CORBA stanza
listenersDispatcher.publishReport("CORBA initialized.");
}
Manager maciManager = manager;
if (maciManager == null) {
maciManager = resolveManagerReference();
if (maciManager == null) {
// HSO: Ale, should this not throw an exception?
return;
}
}
NamingContext namingContext = resolveNamingServiceContext(maciManager);
if (namingContext == null) {
return;
}
if (!resolveNotifyChannel(LOGGING_XML_CHANNEL, namingContext)) {
return;
}
boolean isConsumerAdminCreated = createConsumerAdmin();
if (!isConsumerAdminCreated) {
return;
}
isInitialized = createStructuredPushConsumer();
}
use of si.ijs.maci.Manager in project ACS by ACS-Community.
the class ACSRemoteAccess method resolveManagerReference.
private si.ijs.maci.Manager resolveManagerReference() {
listenersDispatcher.publishReport("Resolving " + MANAGER_PROPERTY + " manager reference...");
org.omg.CORBA.Object obj = null;
si.ijs.maci.Manager manager;
try {
if (MANAGER_PROPERTY == null)
throw new IllegalStateException("Manager system property ACS.manager is null.");
obj = orb.string_to_object(MANAGER_PROPERTY);
//if (obj == null) throw new IllegalStateException("Could not resolve Manager reference from the ACS.manager system property (" + MANAGER_PROPERTY + ").");
manager = si.ijs.maci.ManagerHelper.narrow(obj);
} catch (Exception e) {
listenersDispatcher.publishReport("Exception occurred when resolving manager reference.");
System.out.println("Exception in ACSRemoteAccess::resolveManagerReference(): " + e);
return null;
}
listenersDispatcher.publishReport("Manager reference resolved.");
return manager;
}
use of si.ijs.maci.Manager in project ACS by ACS-Community.
the class BlockingPingClient method resolveManager.
/**
* Resolves manager reference.
* @return manager reference, <code>null</code> on failure.
*/
private Manager resolveManager() {
if (orb == null)
return null;
String managerReference = System.getProperty("ACS.manager");
if (managerReference == null)
managerReference = "corbaloc::localhost:3000/Manager";
System.out.println("Resolving manager reference '" + managerReference + "'.");
try {
org.omg.CORBA.Object obj = orb.string_to_object(managerReference);
if (obj == null)
throw new NullPointerException("'null' reference returned.");
Manager manager = ManagerHelper.narrow(obj);
if (manager == null)
throw new NullPointerException("'null' narrowed reference returned.");
System.out.println("Manager reference successfully resolved.");
return manager;
} catch (Exception ex) {
ex.printStackTrace();
System.out.println("Failed to resolve manager reference.");
return null;
}
}
use of si.ijs.maci.Manager in project ACS by ACS-Community.
the class BlockingPingClient method execute.
/**
* Main routine.
*/
public void execute(long sleepTimeMs) {
initializeCORBA();
Manager manager = resolveManager();
if (manager != null) {
ClientInfo clientInfo = login(manager, sleepTimeMs);
if (clientInfo != null) {
System.out.println("All initialization done.");
run();
logout(manager, clientInfo);
}
}
finalizeCORBA();
}
use of si.ijs.maci.Manager in project ACS by ACS-Community.
the class ManagerDynComponentTest method test.
/**
* Main test routine.
*/
public void test() {
initializeCORBA();
Manager manager = resolveManager();
if (manager != null) {
ClientInfo clientInfo = login(manager);
if (clientInfo != null) {
System.out.println("All initialization done.");
try {
/* ------------------------------------------------- */
manager.restart_component(clientInfo.h, "invalid");
manager.get_component(clientInfo.h, "MOUNT1", true);
manager.restart_component(clientInfo.h, "MOUNT1");
try {
manager.get_default_component(clientInfo.h, "invalid");
System.err.println("NoDefaultComponent exception expected.");
} catch (NoDefaultComponentEx nde) {
// this is OK
}
try {
manager.get_dynamic_component(clientInfo.h, new ComponentSpec("*", "invalidType", "*", "*"), true);
System.err.println("InvalidComponentSpec exception expected.");
} catch (InvalidComponentSpecEx ics) {
// this is OK
}
/* ------------------------------------------------- */
ComponentInfo componentInfo = manager.get_dynamic_component(clientInfo.h, new ComponentSpec("FULL_DYNAMIC", "IDL:alma/PS/PowerSupply:1.0", "acsexmplPS", "Container"), true);
System.out.println(componentInfo.h);
} catch (Exception ex) {
ex.printStackTrace();
}
logout(manager, clientInfo);
}
}
finalizeCORBA();
}
Aggregations