public static void fireEvent ( SbbEntity sbbEntity , EventTypeID eventTypeID , Object eventObject , ActivityContextInterface aci , Address address , ServiceID serviceID ) { if ( sleeContainer . getCongestionControl ( ) . refuseFireEvent ( ) ) { throw new SLEEException ( "congestion control refused event" ) ; } // JAIN SLEE (TM) specs - Section 8.4.1 // The SBB object must have an assigned SBB entity when it invokes this // method. // Otherwise, this method throws a java.lang.IllegalStateException. if ( sbbEntity == null || sbbEntity . getSbbObject ( ) == null || sbbEntity . getSbbObject ( ) . getState ( ) != SbbObjectState . READY ) throw new IllegalStateException ( "SbbObject not assigned!" ) ; // JAIN SLEE (TM) specs - Section 8.4.1 // The event ... cannot be null. If ... argument is null, the fire // event method throws a java.lang.NullPointerException. if ( eventObject == null ) throw new NullPointerException ( "JAIN SLEE (TM) specs - Section 8.4.1: The event ... cannot be null. If ... argument is null, the fire event method throws a java.lang.NullPointerException." ) ; // JAIN SLEE (TM) specs - Section 8.4.1 // The activity ... cannot be null. If ... argument is null, the fire // event method throws a java.lang.NullPointerException. if ( aci == null ) throw new NullPointerException ( "JAIN SLEE (TM) specs - Section 8.4.1: The activity ... cannot be null. If ... argument is null, the fire event method throws a java.lang.NullPointerException." ) ; // JAIN SLEE (TM) specs - Section 8.4.1 // It is a mandatory transactional method (see Section 9.6.1). final SleeTransactionManager txManager = sleeContainer . getTransactionManager ( ) ; txManager . mandateTransaction ( ) ; // rebuild the ac from the aci in the 2nd argument of the invoked // method, check it's state ActivityContext ac = ( ( org . mobicents . slee . container . activity . ActivityContextInterface ) aci ) . getActivityContext ( ) ; if ( logger . isTraceEnabled ( ) ) { logger . trace ( "invoke(): firing event on " + ac ) ; } // exception not in specs by mandated by // tests/activities/activitycontext/Test560Test.xml , it's preferable to // do double check on here than have the aci fire method throwing it and // the ra slee endpoint having to translate it to activity ending // exception, it is not common to have custom event firing in sbbs if ( ac . isEnding ( ) ) { throw new IllegalStateException ( "activity context " + ac . getActivityContextHandle ( ) + " is ending" ) ; } final EventRoutingTransactionData transactionData = txManager . getTransactionContext ( ) . getEventRoutingTransactionData ( ) ; if ( transactionData != null ) { final EventContext eventBeingDelivered = transactionData . getEventBeingDelivered ( ) ; if ( eventBeingDelivered != null && eventBeingDelivered . getEvent ( ) == eventObject ) { // there is an event being delivered by this tx and it matches the event being fired, lets copy the ref handler // fire the event ac . fireEvent ( eventTypeID , eventObject , ( Address ) address , serviceID , eventBeingDelivered ) ; return ; } } // seems it is not a refire ac . fireEvent ( eventTypeID , eventObject , ( Address ) address , serviceID , null , null , null ) ; }
The logic to fire an event from an SLEE 1 . 1 Sbb