container/remote/src/main/java/org/mobicents/slee/connector/local/SleeConnectionServiceImpl.java
public void fireEvent(Object event, EventTypeID eventType,
			ExternalActivityHandle activityHandle, Address address) throws NullPointerException,
			UnrecognizedActivityException, UnrecognizedEventException, ResourceException {
		if(sleeContainer == null)
		{
			throw new ResourceException("Connection is in closed state");
		}
		if(sleeContainer.getSleeState()!=SleeState.RUNNING)
		{
			throw new ResourceException("Container is not in running state.");
		}
		if (logger.isDebugEnabled()) {
			logger.debug("fireEvent(event=" + event + ",eventType=" + eventType
					+ ",activityHandle=" + activityHandle + ",address="
					+ address + ")");
		}

		if (event == null) {
			throw new NullPointerException("event is null");
		}
		if (eventType == null) {
			throw new NullPointerException("event type is null");
		}
		if (activityHandle == null) {
			throw new NullPointerException("activity handle is null");
		}

		EventTypeComponent eventTypeComponent = sleeContainer
				.getComponentRepository().getComponentByID(eventType);
		if (eventTypeComponent == null) {
			throw new UnrecognizedEventException("event type not installed");
		}

		if (!eventTypeComponent.getEventTypeClass().isAssignableFrom(event.getClass())) {
			logger.info(""+eventTypeComponent.getEventTypeClass().toString());
			logger.info(""+eventTypeComponent.getEventTypeClass().getCanonicalName());
			logger.info(""+Arrays.toString(eventTypeComponent.getEventTypeClass().getDeclaredMethods()));
			logger.info(""+eventTypeComponent.getEventTypeClass().getClass().toString());
			logger.info(""+eventTypeComponent.getEventTypeClass().getClass().getCanonicalName());
			logger.info(""+event.getClass().toString());
			logger.info(""+event.getClass().getCanonicalName());
			logger.info(""+Arrays.toString(event.getClass().getDeclaredMethods()));
			logger.info("*"+eventTypeComponent);
			logger.info("*"+eventTypeComponent.getEventTypeID());
			logger.info("*"+event);
			logger.info("&"+eventTypeComponent.getClassLoader());
			logger.info("&"+eventTypeComponent.getEventTypeClass().getClassLoader());
			logger.info("&"+event.getClass().getClassLoader());
			//throw new UnrecognizedEventException(
			//	"the class of the event object fired is not assignable to the event class of the event type.\n" +
			//	" EventClass: "+event.getClass()+", component class: "+eventTypeComponent.getEventTypeClass());

		}

		if (!(activityHandle instanceof NullActivityHandle)) {
			throw new UnrecognizedActivityException(activityHandle);
		}

		// check container state is running
		SleeContainer sleeContainer = SleeContainer.lookupFromJndi();
		if (sleeContainer.getSleeState() != SleeState.RUNNING) {
			throw new IllegalStateException("Container is not running");
		}

		SleeTransactionManager txMgr = sleeContainer.getTransactionManager();
		boolean newTx = txMgr.requireTransaction();
		boolean rollback = true;

		try {
			final NullActivityHandle nullActivityHandle = (NullActivityHandle) activityHandle;
			final ActivityContextHandle ach = nullActivityHandle.getActivityContextHandle();
			ActivityContext ac = sleeContainer.getActivityContextFactory()
					.getActivityContext(ach);
			if (ac == null) {
				sleeContainer.getNullActivityFactory().createNullActivity(
						nullActivityHandle, false);
				ac = sleeContainer.getActivityContextFactory()
						.getActivityContext(ach);
				if (ac == null) {
					throw new SLEEException(
							"unable to create null ac for external activity handle "
									+ activityHandle);
				}
			}
			ac.fireEvent(eventType, event, address, null, null,null,null);
			rollback = false;
		} catch (Throwable ex) {
			logger.error("Exception in fireEvent!", ex);
		} finally {
			if (newTx) {
				if (rollback) {
					try {
						txMgr.rollback();
					} catch (Throwable e) {
						logger.error("failed to rollback implicit tx", e);
					}
				} else {
					try {
						txMgr.commit();
					} catch (Throwable e) {
						logger.error("failed to commit implicit tx", e);
					}
				}
			}
			// else ignore, specs say there is no need to rollback a tx if event
			// queuing failed
		}
	}
public void fireEvent(Object event, EventTypeID eventType,
			ExternalActivityHandle activityHandle, Address address) throws NullPointerException,
			UnrecognizedActivityException, UnrecognizedEventException, ResourceException {
		if(sleeContainer == null)
		{
			throw new ResourceException("Connection is in closed state");
		}
		if(sleeContainer.getSleeState()!=SleeState.RUNNING)
		{
			throw new ResourceException("Container is not in running state.");
		}
		if (logger.isDebugEnabled()) {
			logger.debug("fireEvent(event=" + event + ",eventType=" + eventType
					+ ",activityHandle=" + activityHandle + ",address="
					+ address + ")");
		}

		if (event == null) {
			throw new NullPointerException("event is null");
		}
		if (eventType == null) {
			throw new NullPointerException("event type is null");
		}
		if (activityHandle == null) {
			throw new NullPointerException("activity handle is null");
		}

		EventTypeComponent eventTypeComponent = sleeContainer
				.getComponentRepository().getComponentByID(eventType);
		if (eventTypeComponent == null) {
			throw new UnrecognizedEventException("event type not installed");
		}

		if (!eventTypeComponent.getEventTypeClass().isAssignableFrom(event.getClass())) {
			logger.info(""+eventTypeComponent.getEventTypeClass().toString());
			logger.info(""+eventTypeComponent.getEventTypeClass().getCanonicalName());
			logger.info(""+Arrays.toString(eventTypeComponent.getEventTypeClass().getDeclaredMethods()));
			logger.info(""+eventTypeComponent.getEventTypeClass().getClass().toString());
			logger.info(""+eventTypeComponent.getEventTypeClass().getClass().getCanonicalName());
			logger.info(""+event.getClass().toString());
			logger.info(""+event.getClass().getCanonicalName());
			logger.info(""+Arrays.toString(event.getClass().getDeclaredMethods()));
			logger.info("*"+eventTypeComponent);
			logger.info("*"+eventTypeComponent.getEventTypeID());
			logger.info("*"+event);
			logger.info("&"+eventTypeComponent.getClassLoader());
			logger.info("&"+eventTypeComponent.getEventTypeClass().getClassLoader());
			logger.info("&"+event.getClass().getClassLoader());
			//throw new UnrecognizedEventException(
			//	"the class of the event object fired is not assignable to the event class of the event type.\n" +
			//	" EventClass: "+event.getClass()+", component class: "+eventTypeComponent.getEventTypeClass());

		}

		if (!(activityHandle instanceof NullActivityHandle)) {
			throw new UnrecognizedActivityException(activityHandle);
		}

		// check container state is running
		SleeContainer sleeContainer = SleeContainer.lookupFromJndi();
		if (sleeContainer.getSleeState() != SleeState.RUNNING) {
			throw new IllegalStateException("Container is not running");
		}

		SleeTransactionManager txMgr = sleeContainer.getTransactionManager();
		boolean newTx = txMgr.requireTransaction();
		boolean rollback = true;

		try {
			final NullActivityHandle nullActivityHandle = (NullActivityHandle) activityHandle;
			final ActivityContextHandle ach = nullActivityHandle.getActivityContextHandle();
			ActivityContext ac = sleeContainer.getActivityContextFactory()
					.getActivityContext(ach);
			if (ac == null) {
				sleeContainer.getNullActivityFactory().createNullActivity(
						nullActivityHandle, false);
				ac = sleeContainer.getActivityContextFactory()
						.getActivityContext(ach);
				if (ac == null) {
					throw new SLEEException(
							"unable to create null ac for external activity handle "
									+ activityHandle);
				}
			}
			ac.fireEvent(eventType, event, address, null, null,null,null);
			rollback = false;
		} catch (Throwable ex) {
			logger.error("Exception in fireEvent!", ex);
		} finally {
			if (newTx) {
				if (rollback) {
					try {
						txMgr.rollback();
					} catch (Throwable e) {
						logger.error("failed to rollback implicit tx", e);
					}
				} else {
					try {
						txMgr.commit();
					} catch (Throwable e) {
						logger.error("failed to commit implicit tx", e);
					}
				}
			}
			// else ignore, specs say there is no need to rollback a tx if event
			// queuing failed
		}
	}
public void fireEvent ( Object event , EventTypeID eventType , ExternalActivityHandle activityHandle , Address address ) throws NullPointerException , UnrecognizedActivityException , UnrecognizedEventException , ResourceException { if ( sleeContainer == null ) { throw new ResourceException ( "Connection is in closed state" ) ; } if ( sleeContainer . getSleeState ( ) != SleeState . RUNNING ) { throw new ResourceException ( "Container is not in running state." ) ; } if ( logger . isDebugEnabled ( ) ) { logger . debug ( "fireEvent(event=" + event + ",eventType=" + eventType + ",activityHandle=" + activityHandle + ",address=" + address + ")" ) ; } if ( event == null ) { throw new NullPointerException ( "event is null" ) ; } if ( eventType == null ) { throw new NullPointerException ( "event type is null" ) ; } if ( activityHandle == null ) { throw new NullPointerException ( "activity handle is null" ) ; } EventTypeComponent eventTypeComponent = sleeContainer . getComponentRepository ( ) . getComponentByID ( eventType ) ; if ( eventTypeComponent == null ) { throw new UnrecognizedEventException ( "event type not installed" ) ; } if ( ! eventTypeComponent . getEventTypeClass ( ) . isAssignableFrom ( event . getClass ( ) ) ) { logger . info ( "" + eventTypeComponent . getEventTypeClass ( ) . toString ( ) ) ; logger . info ( "" + eventTypeComponent . getEventTypeClass ( ) . getCanonicalName ( ) ) ; logger . info ( "" + Arrays . toString ( eventTypeComponent . getEventTypeClass ( ) . getDeclaredMethods ( ) ) ) ; logger . info ( "" + eventTypeComponent . getEventTypeClass ( ) . getClass ( ) . toString ( ) ) ; logger . info ( "" + eventTypeComponent . getEventTypeClass ( ) . getClass ( ) . getCanonicalName ( ) ) ; logger . info ( "" + event . getClass ( ) . toString ( ) ) ; logger . info ( "" + event . getClass ( ) . getCanonicalName ( ) ) ; logger . info ( "" + Arrays . toString ( event . getClass ( ) . getDeclaredMethods ( ) ) ) ; logger . info ( "*" + eventTypeComponent ) ; logger . info ( "*" + eventTypeComponent . getEventTypeID ( ) ) ; logger . info ( "*" + event ) ; logger . info ( "&" + eventTypeComponent . getClassLoader ( ) ) ; logger . info ( "&" + eventTypeComponent . getEventTypeClass ( ) . getClassLoader ( ) ) ; logger . info ( "&" + event . getClass ( ) . getClassLoader ( ) ) ; //throw new UnrecognizedEventException(
 //	"the class of the event object fired is not assignable to the event class of the event type.\n" +
 //	" EventClass: "+event.getClass()+", component class: "+eventTypeComponent.getEventTypeClass());
 } if ( ! ( activityHandle instanceof NullActivityHandle ) ) { throw new UnrecognizedActivityException ( activityHandle ) ; } // check container state is running
 SleeContainer sleeContainer = SleeContainer . lookupFromJndi ( ) ; if ( sleeContainer . getSleeState ( ) != SleeState . RUNNING ) { throw new IllegalStateException ( "Container is not running" ) ; } SleeTransactionManager txMgr = sleeContainer . getTransactionManager ( ) ; boolean newTx = txMgr . requireTransaction ( ) ; boolean rollback = true ; try { final NullActivityHandle nullActivityHandle = ( NullActivityHandle ) activityHandle ; final ActivityContextHandle ach = nullActivityHandle . getActivityContextHandle ( ) ; ActivityContext ac = sleeContainer . getActivityContextFactory ( ) . getActivityContext ( ach ) ; if ( ac == null ) { sleeContainer . getNullActivityFactory ( ) . createNullActivity ( nullActivityHandle , false ) ; ac = sleeContainer . getActivityContextFactory ( ) . getActivityContext ( ach ) ; if ( ac == null ) { throw new SLEEException ( "unable to create null ac for external activity handle " + activityHandle ) ; } } ac . fireEvent ( eventType , event , address , null , null , null , null ) ; rollback = false ; } catch ( Throwable ex ) { logger . error ( "Exception in fireEvent!" , ex ) ; } finally { if ( newTx ) { if ( rollback ) { try { txMgr . rollback ( ) ; } catch ( Throwable e ) { logger . error ( "failed to rollback implicit tx" , e ) ; } } else { try { txMgr . commit ( ) ; } catch ( Throwable e ) { logger . error ( "failed to commit implicit tx" , e ) ; } } } // else ignore, specs say there is no need to rollback a tx if event
 // queuing failed
 } }
/* (non-Javadoc)
@see javax.slee.connection.SleeConnection#fireEvent(java.lang.Object, javax.slee.EventTypeID, javax.slee.connection.ExternalActivityHandle, javax.slee.Address)
/ * ( non - Javadoc )