Object service = context.getService(event.getServiceReference());
if (service instanceof IAdaptable) {
service = ((IAdaptable) service).getAdapter(IPresenceService.class);
}
if (service instanceof IPresenceService) {
IPresenceService presenceService = (IPresenceService) service;
IChannelContainerAdapter channelAdapter = (IChannelContainerAdapter) presenceService.getAdapter(IChannelContainerAdapter.class);
if (channelAdapter != null) {
switch (event.getType()) {
case ServiceEvent.REGISTERED :
registerChannel(channelAdapter);
break;