Search in sources :

Example 1 with AppSession

use of org.jdiameter.api.app.AppSession in project jain-slee.diameter by RestComm.

the class DiameterS6aResourceAdaptor method stateChanged.

/* (non-Javadoc)
   * @see org.mobicents.slee.resource.diameter.s6a.handlers.S6aSessionCreationListener#stateChanged(org.jdiameter.api.app.AppSession, java.lang.Enum, java.lang.Enum)
   */
public void stateChanged(AppSession source, Enum oldState, Enum newState) {
    DiameterActivityHandle dah = getActivityHandle(source.getSessionId());
    Object activity = getActivity(dah);
    if (activity != null) {
        if (source instanceof ServerShSession) {
            try {
                // damn, no common, do something unexpected
                StateChangeListener<AppSession> scl = (StateChangeListener<AppSession>) activity;
                scl.stateChanged(source, oldState, newState);
            } catch (Exception e) {
                tracer.warning("Failed to deliver state, for: " + dah + " on stateChanged( " + source + ", " + oldState + ", " + newState + " )", e);
            }
        }
    } else {
        tracer.warning("No activity for: " + dah + " on stateChanged( " + source + ", " + oldState + ", " + newState + " )");
    }
}
Also used : AppSession(org.jdiameter.api.app.AppSession) StateChangeListener(org.jdiameter.api.app.StateChangeListener) DiameterActivityHandle(org.mobicents.slee.resource.diameter.base.DiameterActivityHandle) AvpDataException(org.jdiameter.api.AvpDataException) InternalException(org.jdiameter.api.InternalException) IllegalDiameterStateException(org.jdiameter.api.IllegalDiameterStateException) CreateActivityException(net.java.slee.resource.diameter.base.CreateActivityException) OperationNotSupportedException(javax.naming.OperationNotSupportedException) InvalidConfigurationException(javax.slee.resource.InvalidConfigurationException) ServerShSession(org.jdiameter.api.sh.ServerShSession)

Example 2 with AppSession

use of org.jdiameter.api.app.AppSession in project jain-slee.diameter by RestComm.

the class S6aSessionFactory method getNewSession.

/* (non-Javadoc)
   * @see org.jdiameter.common.api.app.IAppSessionFactory#getNewSession(java.lang.String, java.lang.Class, org.jdiameter.api.ApplicationId, java.lang.Object[])
   */
@Override
public AppSession getNewSession(String sessionId, Class<? extends AppSession> appSessionClass, ApplicationId applicationId, Object[] args) {
    AppSession appSession = null;
    if (appSessionClass == ServerS6aSession.class) {
        S6aServerSessionImpl serverSession = null;
        serverSession = (S6aServerSessionImpl) super.getNewSession(sessionId, appSessionClass, applicationId, args);
        appSession = serverSession;
    } else if (appSessionClass == ClientS6aSession.class) {
        S6aClientSessionImpl clientSession = null;
        clientSession = (S6aClientSessionImpl) super.getNewSession(sessionId, appSessionClass, applicationId, args);
        appSession = clientSession;
    } else {
        throw new IllegalArgumentException("Wrong session class: [" + appSessionClass + "]. Supported[" + ServerS6aSession.class + "," + ClientS6aSession.class + "]");
    }
    return appSession;
}
Also used : ClientS6aSession(org.jdiameter.api.s6a.ClientS6aSession) AppSession(org.jdiameter.api.app.AppSession) ServerS6aSession(org.jdiameter.api.s6a.ServerS6aSession) S6aClientSessionImpl(org.jdiameter.client.impl.app.s6a.S6aClientSessionImpl) S6aServerSessionImpl(org.jdiameter.server.impl.app.s6a.S6aServerSessionImpl)

Example 3 with AppSession

use of org.jdiameter.api.app.AppSession in project jain-slee.diameter by RestComm.

the class DiameterS13ResourceAdaptor method stateChanged.

/* (non-Javadoc)
   * @see org.mobicents.slee.resource.diameter.s13.handlers.S13SessionCreationListener#stateChanged(org.jdiameter.api.app.AppSession, java.lang.Enum, java.lang.Enum)
   */
public void stateChanged(AppSession source, Enum oldState, Enum newState) {
    DiameterActivityHandle dah = getActivityHandle(source.getSessionId());
    Object activity = getActivity(dah);
    if (activity != null) {
        if (source instanceof ServerShSession) {
            try {
                // damn, no common, do something unexpected
                StateChangeListener<AppSession> scl = (StateChangeListener<AppSession>) activity;
                scl.stateChanged(source, oldState, newState);
            } catch (Exception e) {
                tracer.warning("Failed to deliver state, for: " + dah + " on stateChanged( " + source + ", " + oldState + ", " + newState + " )", e);
            }
        }
    } else {
        tracer.warning("No activity for: " + dah + " on stateChanged( " + source + ", " + oldState + ", " + newState + " )");
    }
}
Also used : AppSession(org.jdiameter.api.app.AppSession) StateChangeListener(org.jdiameter.api.app.StateChangeListener) DiameterActivityHandle(org.mobicents.slee.resource.diameter.base.DiameterActivityHandle) AvpDataException(org.jdiameter.api.AvpDataException) InternalException(org.jdiameter.api.InternalException) IllegalDiameterStateException(org.jdiameter.api.IllegalDiameterStateException) CreateActivityException(net.java.slee.resource.diameter.base.CreateActivityException) OperationNotSupportedException(javax.naming.OperationNotSupportedException) InvalidConfigurationException(javax.slee.resource.InvalidConfigurationException) ServerShSession(org.jdiameter.api.sh.ServerShSession)

Example 4 with AppSession

use of org.jdiameter.api.app.AppSession in project jain-slee.diameter by RestComm.

the class S13SessionFactory method getNewSession.

/* (non-Javadoc)
   * @see org.jdiameter.common.api.app.IAppSessionFactory#getNewSession(java.lang.String, java.lang.Class, org.jdiameter.api.ApplicationId, java.lang.Object[])
   */
@Override
public AppSession getNewSession(String sessionId, Class<? extends AppSession> appSessionClass, ApplicationId applicationId, Object[] args) {
    AppSession appSession = null;
    if (appSessionClass == ServerS13Session.class) {
        S13ServerSessionImpl serverSession = null;
        serverSession = (S13ServerSessionImpl) super.getNewSession(sessionId, appSessionClass, applicationId, args);
        appSession = serverSession;
    } else if (appSessionClass == ClientS13Session.class) {
        S13ClientSessionImpl clientSession = null;
        clientSession = (S13ClientSessionImpl) super.getNewSession(sessionId, appSessionClass, applicationId, args);
        appSession = clientSession;
    } else {
        throw new IllegalArgumentException("Wrong session class: [" + appSessionClass + "]. Supported[" + ServerS13Session.class + "," + ClientS13Session.class + "]");
    }
    return appSession;
}
Also used : ServerS13Session(org.jdiameter.api.s13.ServerS13Session) AppSession(org.jdiameter.api.app.AppSession) ClientS13Session(org.jdiameter.api.s13.ClientS13Session) S13ClientSessionImpl(org.jdiameter.client.impl.app.s13.S13ClientSessionImpl) S13ServerSessionImpl(org.jdiameter.server.impl.app.s13.S13ServerSessionImpl)

Example 5 with AppSession

use of org.jdiameter.api.app.AppSession in project jain-slee.diameter by RestComm.

the class DiameterCxDxResourceAdaptor method stateChanged.

/* (non-Javadoc)
   * @see org.mobicents.slee.resource.diameter.cxdx.handlers.CxDxSessionCreationListener#stateChanged(org.jdiameter.api.app.AppSession, java.lang.Enum, java.lang.Enum)
   */
public void stateChanged(AppSession source, Enum oldState, Enum newState) {
    DiameterActivityHandle dah = getActivityHandle(source.getSessionId());
    Object activity = getActivity(dah);
    if (activity != null) {
        if (source instanceof ServerShSession) {
            try {
                // damn, no common, do something unexpected
                StateChangeListener<AppSession> scl = (StateChangeListener<AppSession>) activity;
                scl.stateChanged(source, oldState, newState);
            } catch (Exception e) {
                tracer.warning("Failed to deliver state, for: " + dah + " on stateChanged( " + source + ", " + oldState + ", " + newState + " )", e);
            }
        }
    } else {
        tracer.warning("No activity for: " + dah + " on stateChanged( " + source + ", " + oldState + ", " + newState + " )");
    }
}
Also used : AppSession(org.jdiameter.api.app.AppSession) StateChangeListener(org.jdiameter.api.app.StateChangeListener) DiameterActivityHandle(org.mobicents.slee.resource.diameter.base.DiameterActivityHandle) AvpDataException(org.jdiameter.api.AvpDataException) InternalException(org.jdiameter.api.InternalException) IllegalDiameterStateException(org.jdiameter.api.IllegalDiameterStateException) CreateActivityException(net.java.slee.resource.diameter.base.CreateActivityException) OperationNotSupportedException(javax.naming.OperationNotSupportedException) InvalidConfigurationException(javax.slee.resource.InvalidConfigurationException) ServerShSession(org.jdiameter.api.sh.ServerShSession)

Aggregations

AppSession (org.jdiameter.api.app.AppSession)7 InvalidConfigurationException (javax.slee.resource.InvalidConfigurationException)4 CreateActivityException (net.java.slee.resource.diameter.base.CreateActivityException)4 AvpDataException (org.jdiameter.api.AvpDataException)4 IllegalDiameterStateException (org.jdiameter.api.IllegalDiameterStateException)4 InternalException (org.jdiameter.api.InternalException)4 OperationNotSupportedException (javax.naming.OperationNotSupportedException)3 StateChangeListener (org.jdiameter.api.app.StateChangeListener)3 ServerShSession (org.jdiameter.api.sh.ServerShSession)3 DiameterActivityHandle (org.mobicents.slee.resource.diameter.base.DiameterActivityHandle)3 IOException (java.io.IOException)1 ObjectName (javax.management.ObjectName)1 AvpNotAllowedException (net.java.slee.resource.diameter.base.events.avp.AvpNotAllowedException)1 ApplicationId (org.jdiameter.api.ApplicationId)1 RawSession (org.jdiameter.api.RawSession)1 Session (org.jdiameter.api.Session)1 SessionFactory (org.jdiameter.api.SessionFactory)1 ClientAccSession (org.jdiameter.api.acc.ClientAccSession)1 ServerAccSession (org.jdiameter.api.acc.ServerAccSession)1 ClientAuthSession (org.jdiameter.api.auth.ClientAuthSession)1