use of alma.acs.nc.NCSubscriber in project ACS by ACS-Community.
the class AlarmSystemContainerServices method createNotificationChannelSubscriber.
@Override
public <T> AcsEventSubscriber<T> createNotificationChannelSubscriber(String channelName, String channelNotifyServiceDomainName, Class<T> eventType) throws AcsJContainerServicesEx {
if (eventType == null || !IDLEntity.class.isAssignableFrom(eventType)) {
throw new IllegalArgumentException("With Corba-NC based pub-sub, the event must be an instance of IDLEntity.");
}
AcsEventSubscriber<T> subscriber = null;
try {
// TODO: try to get the naming service ref in a nicer way (from ORB etc)
NamingContext namingService = Helper.getNamingServiceInitial(this);
// This is dirty omitting of <T> because NCSubscriber needs something like "<U extends T & IDLEntity>"
// Note that this problem does not exist in the ContainerServicesImpl because there we instantiate via reflection.
subscriber = new NCSubscriber(channelName, channelNotifyServiceDomainName, this, namingService, this.getName(), eventType);
} catch (Throwable e) {
logger.log(AcsLogLevel.ERROR, "Unexpected error while creating new AcsEventSubscriber object", e);
AcsJContainerServicesEx ex = new AcsJContainerServicesEx(e);
throw ex;
}
// m_subscribers.put( (channelNotifyServiceDomainName == null ? "" : channelNotifyServiceDomainName) + "/" + channelName, subscriber);
return subscriber;
}
Aggregations