/** * Starts the service in the Notification Sender mode * * @throws NotificationServiceException Is thrown if failed to start the SenderTransport */ public void startSenderTransport() throws NotificationServiceException { GenericLogger logger = nativePlatform.getNativeLogger(); BusAttachment busAttachment = Transport.getInstance().getBusAttachment(); logger.debug(TAG, "Starting a sender transport"); // Creating transportChannel objects transportSenderChannels = new EnumMap<NotificationMessageType, TransportChannelObject>(NotificationMessageType.class); try { for (NotificationMessageType messageType : NotificationMessageType.values()) { transportSenderChannels.put( messageType, new TransportChannelObject(messageType, busAttachment, nativePlatform)); } } catch (NotificationServiceException nse) { logger.error(TAG, nse.getMessage()); throw nse; } // Initialize the NotificationProducer BusObject notifProducerBusObj = new NotificationProducerImpl(this, nativePlatform); notifProducerBusObj.init(); // Create session listener to be ready to handle incoming connections sessionListener = new SenderSessionListener(nativePlatform); sessionListener.init(); // //Send the Announce signal with all the NotificationService related // BusObjectDescription objects // if ( aboutObj != null ) { // aboutObj.announce(); // } } // startSenderTransport
/** SenderTransport cleanups */ public void stopSenderTransport() { GenericLogger logger = nativePlatform.getNativeLogger(); BusAttachment busAttachment = Transport.getInstance().getBusAttachment(); logger.debug(TAG, "Stopping SenderTransport"); if (transportSenderChannels != null) { for (NotificationMessageType pr : transportSenderChannels.keySet()) { transportSenderChannels.get(pr).clean(busAttachment); } transportSenderChannels = null; } if (sessionListener != null) { sessionListener.clean(); sessionListener = null; } if (notifProducerBusObj != null) { notifProducerBusObj.clean(); notifProducerBusObj = null; } // if ( aboutObj != null ) { // //Send the Announce signal after removing NotificationService related // BusObjectDescription objects // aboutObj.announce(); // } } // stopSenderTransport