use of org.omg.CosNaming.NamingContext in project ACS by ACS-Community.
the class AlarmSystemCorbaServer method getNamingContext.
/**
* Get the {@link NamingContext}
*
* @return The {@link NamingContext}
*/
private NamingContext getNamingContext() throws InvalidName {
org.omg.CORBA.Object obj = null;
Properties props = System.getProperties();
String nameServiceCorbaLoc = props.getProperty("ORBInitRef.NameService");
if (nameServiceCorbaLoc != null) {
obj = orb.string_to_object(nameServiceCorbaLoc);
}
if (obj == null) {
obj = orb.resolve_initial_references("NameService");
}
if (obj == null) {
throw new NullPointerException("Error getting the reference to the NameService");
}
NamingContext context = NamingContextExtHelper.narrow(obj);
if (context == null) {
throw new NullPointerException("Got a null NamingContext while narrowing");
}
return context;
}
use of org.omg.CosNaming.NamingContext in project ACS by ACS-Community.
the class AlarmSystemCorbaServer method unregisterToNamingService.
/**
* Unregister the AlarmService name to the Naming Service.
* <P>
* The name to unregister is taken from the IDL interface.
*/
private void unregisterToNamingService() throws Exception {
String name = alma.alarmsystem.AlarmServiceName.value;
m_logger.log(AcsLogLevel.DEBUG, "Unregistering " + name + " from the naming service");
NamingContext context = getNamingContext();
NameComponent[] nameComponent = new NameComponent[1];
nameComponent[0] = new NameComponent(name, "");
context.unbind(nameComponent);
}
use of org.omg.CosNaming.NamingContext in project ACS by ACS-Community.
the class AlarmSystemCorbaServer method getCDB.
/**
* Get a reference to the DAL.
*
* @return The DAL
* @throws Exception In case of error getting the DAL
*/
private DAL getCDB() throws Exception {
NamingContext context = getNamingContext();
NameComponent[] nameCom = new NameComponent[1];
nameCom[0] = new NameComponent("CDB", "");
Object obj = context.resolve(nameCom);
return DALHelper.narrow(obj);
}
use of org.omg.CosNaming.NamingContext in project ACS by ACS-Community.
the class AlarmSystemCorbaServer method registerToNamingService.
/**
* Register the AlarmService name to the Naming Service.
* <P>
* The name to register is taken from the IDL interface.
*
* @param laserObject The CORBA object to bind to the name
*/
private void registerToNamingService(org.omg.CORBA.Object laserObject) throws Exception {
String name = alma.alarmsystem.AlarmServiceName.value;
m_logger.log(AcsLogLevel.DEBUG, "Registering into the naming service with name " + name);
NamingContext context = getNamingContext();
NameComponent[] nameComponent = new NameComponent[1];
nameComponent[0] = new NameComponent(name, "");
context.rebind(nameComponent, laserObject);
}
use of org.omg.CosNaming.NamingContext in project ACS by ACS-Community.
the class AlarmServiceUtils method getNamingContext.
/**
* Get the {@link NamingContext}
*
* @return The {@link NamingContext}
*/
private NamingContext getNamingContext() throws InvalidName {
org.omg.CORBA.Object obj = orb.resolve_initial_references("NameService");
NamingContext context = NamingContextExtHelper.narrow(obj);
if (context == null) {
throw new NullPointerException("Got a null NamingContext");
}
return context;
}
Aggregations