use of org.omg.CORBA.ORB in project ACS by ACS-Community.
the class BrowserJNDIContextFactory method getInitialContext.
/**
* An initial context factory (JNDI_ContextFactory) must implement the InitialContextFactory interface, which
* provides a method for creating instances of initial context that implement the Context interface
*/
public Context getInitialContext(Hashtable environment) throws NamingException {
String strIOR = (String) environment.get(Context.PROVIDER_URL);
if (strIOR == null)
throw new NamingException("There is no " + Context.PROVIDER_URL + " property set!");
// try to get the server
// create and initialize the ORB
String[] argv = {};
ORB orb = ORB.init(argv, null);
DAL dal = DALHelper.narrow(orb.string_to_object(strIOR));
BrowserJNDIContext.setOrb(orb);
BrowserJNDIContext.setDal(dal);
String rootElements = dal.list_nodes("");
//Returns the first level of the CDBTree (possible: "alma MACI schema CVS")
try {
//remove 'CVS' and 'schema' from Root
rootElements = rootElements.replaceAll("CVS", "");
rootElements = rootElements.replaceAll("schemas", "");
} catch (PatternSyntaxException e) {
} catch (NullPointerException e) {
}
Logger logger = ClientLogManager.getAcsLogManager().getLoggerForApplication("cdbBrowser", false);
//JNDI_Context implements Context
return new BrowserJNDIContext("", rootElements, logger);
}
use of org.omg.CORBA.ORB in project ACS by ACS-Community.
the class AlarmSystemCorbaServer method run.
/**
* Main thread to handle CORBA requests.
*
* @see java.lang.Runnable#run()
*/
public void run() {
ORB localORBRef = orb;
if (!destroyState && localORBRef != null) {
localORBRef.run();
}
m_logger.log(AcsLogLevel.DEBUG, "ORB thread terminated");
}
use of org.omg.CORBA.ORB in project ACS by ACS-Community.
the class AlarmServiceUtils method initORB.
/**
* Instantiate the ORB
*
* @return the ORB
*/
private ORB initORB() {
// ORB stanza
java.util.Properties orbprops = java.lang.System.getProperties();
ORB theORB = ORB.init(new String[0], orbprops);
// POA stanza -- use RootPOA
POA rootPOA = null;
try {
rootPOA = POAHelper.narrow(theORB.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);
}
return theORB;
}
use of org.omg.CORBA.ORB in project ACS by ACS-Community.
the class AdvancedContainerServicesImpl method corbaObjectFromString.
/* (non-Javadoc)
* @see alma.acs.container.ContainerServices#corbaObjectFromString(java.lang.String)
*/
public org.omg.CORBA.Object corbaObjectFromString(String strObjRef) {
ORB orb = getORB();
org.omg.CORBA.Object objRef = orb.string_to_object(strObjRef);
logger.finer("converted corba object reference string " + strObjRef + " back to a corba object reference.");
return objRef;
}
use of org.omg.CORBA.ORB in project ACS by ACS-Community.
the class AdvancedContainerServicesImpl method getAny.
/**
* Returns a reference to a new CORBA Any. In Java the only way to do
* this is through the ORB itself (i.e., the create_any method).
* @return org.omg.CORBA.Any
* @throws NullPointerException if the Any object could not be created.
*/
public org.omg.CORBA.Any getAny() {
ORB orb = getORB();
org.omg.CORBA.Any any = orb.create_any();
if (any == null) {
// should never happen, but we check just in case,
// since there is a difficult to verify NPE when Any is created by MC for sending alarms.
String msg = "Failed to create org.omg.CORBA.Any";
logger.warning(msg);
throw new NullPointerException(msg);
}
return any;
}
Aggregations