public void installService ( final ServiceComponent serviceComponent ) throws Exception { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Installing Service " + serviceComponent ) ; } // creates and registers the service usage mbean final ServiceUsageMBean serviceUsageMBean = sleeContainer . getUsageParametersManagement ( ) . newServiceUsageMBean ( serviceComponent ) ; // add rollback action to remove state created TransactionalAction action = new TransactionalAction ( ) { public void execute ( ) { try { serviceUsageMBean . remove ( ) ; } catch ( Throwable e ) { logger . error ( e . getMessage ( ) , e ) ; } } } ; final TransactionContext txContext = sleeContainer . getTransactionManager ( ) . getTransactionContext ( ) ; txContext . getAfterRollbackActions ( ) . add ( action ) ; // register notification sources for all sbbs // final TraceManagement traceMBeanImpl = sleeContainer . getTraceManagement ( ) ; for ( final SbbID sbbID : serviceComponent . getSbbIDs ( componentRepositoryImpl ) ) { // Tracer must be available for both 1.1 and 1.0 sbb components // SbbComponent sbbComponent = // componentRepositoryImpl.getComponentByID(sbbID); // if(sbbComponent.isSlee11()) { traceMBeanImpl . registerNotificationSource ( new SbbNotification ( serviceComponent . getServiceID ( ) , sbbID ) ) ; // add rollback action to remove state created action = new TransactionalAction ( ) { public void execute ( ) { // remove notification sources for all sbbs traceMBeanImpl . deregisterNotificationSource ( new SbbNotification ( serviceComponent . getServiceID ( ) , sbbID ) ) ; } } ; txContext . getAfterRollbackActions ( ) . add ( action ) ; } // this might be used not only by 1.1 sbbs... NotificationSourceWrapperImpl sbbMNotificationSource = new NotificationSourceWrapperImpl ( new SbbNotification ( serviceComponent . getServiceID ( ) , sbbID ) ) ; serviceComponent . getAlarmNotificationSources ( ) . putIfAbsent ( sbbID , sbbMNotificationSource ) ; } sleeContainer . getSbbManagement ( ) . serviceInstall ( serviceComponent ) ; }
Install a service into SLEE