Search in sources :

Example 11 with DiameterMessageFactoryImpl

use of org.mobicents.slee.resource.diameter.base.DiameterMessageFactoryImpl in project jain-slee.diameter by RestComm.

the class DiameterCxDxResourceAdaptor method sessionCreated.

// CxDx Session Creation Listener --------------------------------------
/*
   * (non-Javadoc)
   * @see org.mobicents.slee.resource.diameter.cxdx.handlers.CxDxSessionCreationListener#sessionCreated(org.jdiameter.api.cxdx.ServerCxDxSession)
   */
public void sessionCreated(ServerCxDxSession session) {
    DiameterMessageFactoryImpl baseMsgFactory = new DiameterMessageFactoryImpl(session.getSessions().get(0), stack);
    CxDxMessageFactoryImpl sessionMsgFactory = new CxDxMessageFactoryImpl(baseMsgFactory, session.getSessions().get(0), stack, new DiameterIdentity[] {});
    // Set the first configured Application-Id as default for message factory
    ApplicationId firstAppId = authApplicationIds.get(0);
    sessionMsgFactory.setApplicationId(firstAppId.getVendorId(), firstAppId.getAuthAppId());
    CxDxServerSessionImpl serverActivity = new CxDxServerSessionImpl(sessionMsgFactory, cxdxAvpFactory, session, this, null, null, stack);
    // session.addStateChangeNotification(serverActivity);
    // addActivity(serverActivity);
    serverActivity.setSessionListener(this);
}
Also used : DiameterMessageFactoryImpl(org.mobicents.slee.resource.diameter.base.DiameterMessageFactoryImpl) ApplicationId(org.jdiameter.api.ApplicationId)

Example 12 with DiameterMessageFactoryImpl

use of org.mobicents.slee.resource.diameter.base.DiameterMessageFactoryImpl in project jain-slee.diameter by RestComm.

the class DiameterCxDxResourceAdaptor method raActive.

public void raActive() {
    if (tracer.isFineEnabled()) {
        tracer.fine("Diameter Cx/Dx RA :: raActive.");
    }
    try {
        if (tracer.isInfoEnabled()) {
            tracer.info("Activating Diameter Cx/Dx RA Entity");
        }
        this.diameterMultiplexerObjectName = new ObjectName("diameter.mobicents:service=DiameterStackMultiplexer");
        Object object = null;
        if (ManagementFactory.getPlatformMBeanServer().isRegistered(this.diameterMultiplexerObjectName)) {
            // trying to get via MBeanServer
            object = ManagementFactory.getPlatformMBeanServer().invoke(this.diameterMultiplexerObjectName, "getMultiplexerMBean", new Object[] {}, new String[] {});
            if (tracer.isInfoEnabled()) {
                tracer.info("Trying to get via Platform MBeanServer: " + this.diameterMultiplexerObjectName + ", object: " + object);
            }
        } else {
            // trying to get via locateJBoss
            object = MBeanServerLocator.locateJBoss().invoke(this.diameterMultiplexerObjectName, "getMultiplexerMBean", new Object[] {}, new String[] {});
            if (tracer.isInfoEnabled()) {
                tracer.info("Trying to get via JBoss MBeanServer: " + this.diameterMultiplexerObjectName + ", object: " + object);
            }
        }
        if (object != null && object instanceof DiameterStackMultiplexerMBean) {
            this.diameterMux = (DiameterStackMultiplexerMBean) object;
        }
        // this.activities = new ConcurrentHashMap<ActivityHandle, DiameterActivity>();
        // Initialize the protocol stack
        initStack();
        // Initialize activities mgmt
        initActivitiesMgmt();
        // Initialize factories
        this.baseAvpFactory = new DiameterAvpFactoryImpl();
        this.baseMessageFactory = new DiameterMessageFactoryImpl(stack);
        this.cxdxAvpFactory = new CxDxAVPFactoryImpl(baseAvpFactory);
        this.cxdxMessageFactory = new CxDxMessageFactoryImpl(baseMessageFactory, stack);
        // Set the first configured Application-Id as default for message factory
        ApplicationId firstAppId = authApplicationIds.get(0);
        ((CxDxMessageFactoryImpl) this.cxdxMessageFactory).setApplicationId(firstAppId.getVendorId(), firstAppId.getAuthAppId());
        // Setup session factories
        this.sessionFactory = this.stack.getSessionFactory();
        this.cxdxSessionFactory = new CxDxSessionFactory(this, messageTimeout, sessionFactory);
        ((ISessionFactory) sessionFactory).registerAppFacory(ServerCxDxSession.class, cxdxSessionFactory);
        ((ISessionFactory) sessionFactory).registerAppFacory(ClientCxDxSession.class, cxdxSessionFactory);
    } catch (Exception e) {
        tracer.severe("Error Activating Diameter Cx/Dx RA Entity", e);
    }
}
Also used : DiameterStackMultiplexerMBean(org.mobicents.diameter.stack.DiameterStackMultiplexerMBean) DiameterMessageFactoryImpl(org.mobicents.slee.resource.diameter.base.DiameterMessageFactoryImpl) DiameterAvpFactoryImpl(org.mobicents.slee.resource.diameter.base.DiameterAvpFactoryImpl) CxDxSessionFactory(org.mobicents.slee.resource.diameter.cxdx.handlers.CxDxSessionFactory) ISessionFactory(org.jdiameter.client.api.ISessionFactory) ApplicationId(org.jdiameter.api.ApplicationId) 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) ObjectName(javax.management.ObjectName)

Example 13 with DiameterMessageFactoryImpl

use of org.mobicents.slee.resource.diameter.base.DiameterMessageFactoryImpl in project jain-slee.diameter by RestComm.

the class DiameterCCAResourceAdaptor method sessionCreated.

private void sessionCreated(ServerCCASession ccServerSession) {
    // Make sure it's a new session and there's no activity created yet.
    if (this.getActivity(getActivityHandle(ccServerSession.getSessions().get(0).getSessionId())) != null) {
        tracer.warning("Activity found for created Credit-Control Server Session. Shouldn't exist. Aborting.");
        return;
    }
    // Get Message Factories (for Base and CCA)
    DiameterMessageFactoryImpl baseMsgFactory = new DiameterMessageFactoryImpl(ccServerSession.getSessions().get(0), this.stack);
    CreditControlMessageFactory ccaMsgFactory = new CreditControlMessageFactoryImpl(baseMsgFactory, ccServerSession.getSessions().get(0), this.stack, this.ccaAvpFactory);
    // Create Server Activity
    CreditControlServerSessionImpl activity = new CreditControlServerSessionImpl(ccaMsgFactory, this.ccaAvpFactory, ccServerSession, null, null);
    activity.setSessionListener(this);
    activityCreated(activity, false);
}
Also used : DiameterMessageFactoryImpl(org.mobicents.slee.resource.diameter.base.DiameterMessageFactoryImpl) CreditControlMessageFactory(net.java.slee.resource.diameter.cca.CreditControlMessageFactory)

Example 14 with DiameterMessageFactoryImpl

use of org.mobicents.slee.resource.diameter.base.DiameterMessageFactoryImpl in project jain-slee.diameter by RestComm.

the class DiameterCCAResourceAdaptor method raActive.

// Lifecycle again
public void raActive() {
    if (tracer.isFineEnabled()) {
        tracer.fine("Diameter CCA RA :: raActive.");
    }
    try {
        if (tracer.isInfoEnabled()) {
            tracer.info("Activating Diameter CCA RA Entity");
        }
        this.diameterMultiplexerObjectName = new ObjectName("diameter.mobicents:service=DiameterStackMultiplexer");
        Object object = null;
        if (ManagementFactory.getPlatformMBeanServer().isRegistered(this.diameterMultiplexerObjectName)) {
            // trying to get via MBeanServer
            object = ManagementFactory.getPlatformMBeanServer().invoke(this.diameterMultiplexerObjectName, "getMultiplexerMBean", new Object[] {}, new String[] {});
            if (tracer.isInfoEnabled()) {
                tracer.info("Trying to get via Platform MBeanServer: " + this.diameterMultiplexerObjectName + ", object: " + object);
            }
        } else {
            // trying to get via locateJBoss
            object = MBeanServerLocator.locateJBoss().invoke(this.diameterMultiplexerObjectName, "getMultiplexerMBean", new Object[] {}, new String[] {});
            if (tracer.isInfoEnabled()) {
                tracer.info("Trying to get via JBoss MBeanServer: " + this.diameterMultiplexerObjectName + ", object: " + object);
            }
        }
        if (object != null && object instanceof DiameterStackMultiplexerMBean) {
            this.diameterMux = (DiameterStackMultiplexerMBean) object;
        }
        // Initialize stack
        initStack();
        // Initialize activities mgmt
        initActivitiesMgmt();
        // Initialize factories
        this.baseAvpFactory = new DiameterAvpFactoryImpl();
        this.ccaAvpFactory = new CreditControlAVPFactoryImpl(baseAvpFactory);
        this.baseMessageFactory = new DiameterMessageFactoryImpl(stack);
        this.ccaMessageFactory = new CreditControlMessageFactoryImpl(baseMessageFactory, null, stack, ccaAvpFactory);
        // Setup session factories
        this.sessionFactory = this.stack.getSessionFactory();
        this.ccaSessionFactory = new CreditControlSessionFactory(sessionFactory, this, defaultDirectDebitingFailureHandling, defaultCreditControlFailureHandling, defaultValidityTime, defaultTxTimerValue);
        // Register CCA App Session Factories
        ((ISessionFactory) sessionFactory).registerAppFacory(ServerCCASession.class, this.ccaSessionFactory);
        ((ISessionFactory) sessionFactory).registerAppFacory(ClientCCASession.class, this.ccaSessionFactory);
    } catch (Exception e) {
        tracer.severe("Error Activating Diameter CCA RA Entity", e);
        // ??
        throw new RuntimeException(e);
    }
}
Also used : DiameterStackMultiplexerMBean(org.mobicents.diameter.stack.DiameterStackMultiplexerMBean) DiameterMessageFactoryImpl(org.mobicents.slee.resource.diameter.base.DiameterMessageFactoryImpl) DiameterAvpFactoryImpl(org.mobicents.slee.resource.diameter.base.DiameterAvpFactoryImpl) ISessionFactory(org.jdiameter.client.api.ISessionFactory) CreditControlSessionFactory(org.mobicents.slee.resource.diameter.cca.handlers.CreditControlSessionFactory) InvalidTransactionException(javax.transaction.InvalidTransactionException) CreateActivityException(net.java.slee.resource.diameter.base.CreateActivityException) SystemException(javax.transaction.SystemException) InvalidConfigurationException(javax.slee.resource.InvalidConfigurationException) ObjectName(javax.management.ObjectName)

Example 15 with DiameterMessageFactoryImpl

use of org.mobicents.slee.resource.diameter.base.DiameterMessageFactoryImpl in project jain-slee.diameter by RestComm.

the class DiameterShServerResourceAdaptor method sessionCreated.

// Session Management --------------------------------------------------
public void sessionCreated(ServerShSession session, boolean isSubscription) {
    // Make sure it's a new session and there's no activity created yet.
    if (this.getActivity(getActivityHandle(session.getSessions().get(0).getSessionId())) != null) {
        tracer.warning("Activity found for created Credit-Control Server Session. Shouldn't exist. Aborting.");
        return;
    }
    // Get Message Factories (for Base and ShServer)
    DiameterMessageFactoryImpl baseMsgFactory = new DiameterMessageFactoryImpl(session.getSessions().get(0), this.stack);
    ShServerMessageFactoryImpl shServerMsgFactory = new ShServerMessageFactoryImpl(baseMsgFactory, session.getSessions().get(0), this.stack, this.shAvpFactory);
    // Create Server Activity
    DiameterActivity activity = null;
    if (isSubscription) {
        ShServerSubscriptionActivityImpl _activity = new ShServerSubscriptionActivityImpl(shServerMsgFactory, this.shAvpFactory, session, null, null);
        _activity.setSessionListener(this);
        activity = _activity;
        activityCreated(activity, false);
    } else {
        ShServerActivityImpl _activity = new ShServerActivityImpl(shServerMsgFactory, this.shAvpFactory, session, null, null);
        _activity.setSessionListener(this);
        activity = _activity;
        activityCreated(activity, false);
    }
}
Also used : DiameterMessageFactoryImpl(org.mobicents.slee.resource.diameter.base.DiameterMessageFactoryImpl) DiameterActivity(net.java.slee.resource.diameter.base.DiameterActivity)

Aggregations

DiameterMessageFactoryImpl (org.mobicents.slee.resource.diameter.base.DiameterMessageFactoryImpl)19 ApplicationId (org.jdiameter.api.ApplicationId)8 ObjectName (javax.management.ObjectName)7 InvalidConfigurationException (javax.slee.resource.InvalidConfigurationException)7 CreateActivityException (net.java.slee.resource.diameter.base.CreateActivityException)7 ISessionFactory (org.jdiameter.client.api.ISessionFactory)7 DiameterStackMultiplexerMBean (org.mobicents.diameter.stack.DiameterStackMultiplexerMBean)7 DiameterAvpFactoryImpl (org.mobicents.slee.resource.diameter.base.DiameterAvpFactoryImpl)7 AvpDataException (org.jdiameter.api.AvpDataException)6 OperationNotSupportedException (javax.naming.OperationNotSupportedException)5 IOException (java.io.IOException)4 DiameterActivityImpl (org.mobicents.slee.resource.diameter.base.DiameterActivityImpl)3 ArrayList (java.util.ArrayList)2 DiameterMessage (net.java.slee.resource.diameter.base.events.DiameterMessage)2 CreditControlMessageFactory (net.java.slee.resource.diameter.cca.CreditControlMessageFactory)2 UserDataRequest (net.java.slee.resource.diameter.sh.events.UserDataRequest)2 IllegalDiameterStateException (org.jdiameter.api.IllegalDiameterStateException)2 InternalException (org.jdiameter.api.InternalException)2 ServerShSession (org.jdiameter.api.sh.ServerShSession)2 ShServerSessionDataLocalImpl (org.jdiameter.server.impl.app.sh.ShServerSessionDataLocalImpl)2