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;
}
use of org.omg.CORBA.ORB in project ACS by ACS-Community.
the class JconttestUtil method getSystemLevelOrbTimeoutMillis.
/**
* We get the timeout property value from the ORB configuration.
* System-level timeout defaults are not standardized in Corba, thus we need jacorb-specific access.
* @throws IllegalArgumentException if the ORB timeout is configured as a negative value
* @throws AcsJCouldntPerformActionEx if the ORB-level timeout could not be read, e.g. because the ORB is not jacorb.
*/
public int getSystemLevelOrbTimeoutMillis() throws AcsJCouldntPerformActionEx {
int orbLevelTimeout = -1;
ORB orb = containerServices.getAdvancedContainerServices().getORB();
if (orb instanceof org.jacorb.orb.ORB) {
try {
orbLevelTimeout = ((org.jacorb.orb.ORB) orb).getConfiguration().getAttributeAsInteger(PROPERTYNAME_CLIENTORBTIMEOUT);
if (orbLevelTimeout < 0) {
throw new IllegalArgumentException("system-level roundtrip timeout must be non-negative!");
}
} catch (ConfigurationException e) {
logger.log(Level.SEVERE, "Failed to read the system-level ORB timeout setting.", e);
throw new AcsJCouldntPerformActionEx();
}
} else {
logger.log(Level.SEVERE, "Wrong ORB " + orb.getClass().getName());
throw new AcsJCouldntPerformActionEx();
}
return orbLevelTimeout;
}
use of org.omg.CORBA.ORB in project ACS by ACS-Community.
the class ServicesDaemonTest method getServicesDaemon.
private ServicesDaemon getServicesDaemon(String host) {
String daemonLoc = AcsLocations.convertToServicesDaemonLocation(host);
assertNotNull("corbaloc for service daemon must not be null", daemonLoc);
logger.fine("Using services daemon corbaloc " + daemonLoc);
ORB orb = acsCorba.getORB();
assertNotNull("ORB provided by inherited acsCorba must not be null", daemonLoc);
org.omg.CORBA.Object obj = orb.string_to_object(daemonLoc);
ServicesDaemon ret = null;
try {
ret = ServicesDaemonHelper.narrow(obj);
} catch (TRANSIENT ex) {
fail("Failed to get reference to services daemon '" + daemonLoc + "' because of TRANSIENT ex");
}
assertNotNull("Corba ref to services daemon must not be null", ret);
return ret;
}
use of org.omg.CORBA.ORB in project ACS by ACS-Community.
the class JNDIContextFactory method getInitialContext.
/**
* @see InitialContextFactory#getInitialContext(Hashtable)
*/
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));
JNDIContext.setOrb(orb);
JNDIContext.setDal(dal);
//System.out.println( "Returning CDBContext" );
Logger logger = ClientLogManager.getAcsLogManager().getLoggerForApplication(Server.CDB_LOGGER_NAME, true);
return new JNDIContext("", dal.list_nodes(""), logger);
}
use of org.omg.CORBA.ORB in project ACS by ACS-Community.
the class CharacteristicModelImpl method get_all_characteristics.
/**
* @see alma.ACS.CharacteristicModelOperations#get_all_characteristics()
*/
public PropertySet get_all_characteristics() {
String[] allSeq;
try {
if (prefix == "")
allSeq = dao.get_string_seq("");
else
allSeq = dao.get_string_seq(prefix);
Property[] p = new Property[allSeq.length];
for (int i = 0; i < allSeq.length; i++) {
Any a = get_characteristic_by_name(allSeq[i]);
p[i] = new Property(allSeq[i], a);
}
//dangerous methods!!
ORB orb = m_container.getAdvancedContainerServices().getORB();
POA rootpoa = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
rootpoa.the_POAManager().activate();
PropertySetImpl psetImpl = new PropertySetImpl(p);
PropertySetPOATie psetTie = new PropertySetPOATie(psetImpl, rootpoa);
return psetTie._this(orb);
} catch (CDBFieldDoesNotExistEx e) {
} catch (WrongCDBDataTypeEx e) {
} catch (NoSuchCharacteristic e) {
} catch (MultipleExceptions e) {
} catch (InvalidName e) {
} catch (AdapterInactive e) {
} catch (NullPointerException e) {
System.out.println(e);
}
throw new NO_IMPLEMENT();
}
Aggregations