use of org.omg.CosNaming.NameComponent in project ACS by ACS-Community.
the class Helper method destroyNotificationChannel.
/**
* <b>Destroys the channel and unregisters it from the naming service. ONLY
* USE THIS METHOD IF YOU KNOW FOR CERTAIN THERE IS ONLY ONE SUPPLIER FOR THE
* CHANNEL!!! Use this method with extreme caution as it's likely to become
* deprecated in future versions of ACS!</b>
*
* @param channelName
* name of the channel as registered int the CORBA notification
* service
* @param channelKind
* Kind of the channel as registered with the CORBA naming service.
* @param channelRef
* reference to the channel being destroyed.
* Here we use the plain OMG type instead of the TAO extension subtype, because the extensions are
* not used for channel destruction.
* @throws AcsJException
* Thrown when the channel isn't registered with the Naming
* Service.
* @warning this method assumes
*/
protected void destroyNotificationChannel(String channelKind, org.omg.CosNotifyChannelAdmin.EventChannel channelRef) throws AcsJException {
try {
// destroy the remote CORBA object
channelRef.destroy();
// unregister our channel with the naming service
NameComponent[] t_NameChannel = { new NameComponent(combineChannelAndDomainName(channelName, domainName), channelKind) };
getNamingService().unbind(t_NameChannel);
} catch (org.omg.CosNaming.NamingContextPackage.NotFound e) {
// Think there is virtually no chance of this every happening but...
String msg = "Cannot unbind the '" + channelName + "' channel from the Naming Service!";
m_logger.severe(msg);
} catch (org.omg.CosNaming.NamingContextPackage.CannotProceed e) {
// Think there is virtually no chance of this every happening but...
Throwable cause = new Throwable(e.getMessage());
throw new alma.ACSErrTypeCommon.wrappers.AcsJCORBAProblemEx(cause);
} catch (org.omg.CosNaming.NamingContextPackage.InvalidName e) {
// Think there is virtually no chance of this every happening but...
Throwable cause = new Throwable(e.getMessage());
throw new alma.ACSErrTypeCommon.wrappers.AcsJCORBAProblemEx(cause);
}
// TODO use notif.service name
LOG_NC_ChannelDestroyed_OK.log(m_logger, channelName, "");
}
use of org.omg.CosNaming.NameComponent in project ACS by ACS-Community.
the class HelperTest method setUp.
protected void setUp() throws Exception {
System.out.println("------------------------- " + getName() + " -------------------------");
super.setUp();
nctx = NamingContextHelper.narrow(m_acsManagerProxy.get_service(NAMING_SERVICE_NAME.value, false));
String factoryMonitorRegName = "MC_NotifyEventChannelFactory";
try {
nsmc = NotificationServiceMonitorControlHelper.narrow(nctx.resolve(new NameComponent[] { new NameComponent("MC_NotifyEventChannelFactory", "") }));
} catch (NotFound ex) {
fail("Failed to resolve factory's MC extension object in the naming service: " + factoryMonitorRegName + ". This is a recurrent problem, probably linked to the missing line 'ReBound ID: MC_NotifyEventChannelFactory' in ./tmp/acsStart.log.");
}
assertNotNull(nsmc);
}
use of org.omg.CosNaming.NameComponent 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.NameComponent 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.NameComponent 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);
}
Aggregations