Search in sources :

Example 6 with DiameterMessageFactoryImpl

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

the class DiameterRxResourceAdaptor method raActive.

/**
 * {@inheritDoc}
 */
@Override
public void raActive() {
    if (tracer.isFineEnabled()) {
        tracer.fine("Diameter Rx RA :: raActive.");
    }
    try {
        if (tracer.isInfoEnabled()) {
            tracer.info("Activating Diameter Rx 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 the protocol stack
        initStack();
        // Initialize activities mgmt
        initActivitiesMgmt();
        // Initialize factories
        this.baseAvpFactory = new DiameterAvpFactoryImpl();
        this.baseMessageFactory = new DiameterMessageFactoryImpl(stack);
        this.rxAvpFactory = new RxAvpFactoryImpl(baseAvpFactory);
        this.rxMessageFactory = new RxMessageFactoryImpl(baseMessageFactory, null, stack);
        // Set the first configured Application-Id as default for message factory
        ApplicationId firstAppId = authApplicationIds.get(0);
        ((RxMessageFactoryImpl) this.rxMessageFactory).setApplicationId(firstAppId.getVendorId(), firstAppId.getAuthAppId());
        this.sessionFactory = this.stack.getSessionFactory();
        this.rxSessionFactory = new RxSessionFactory(this, sessionFactory);
        // Register Rx App Session Factories
        ((ISessionFactory) sessionFactory).registerAppFacory(ServerRxSession.class, this.rxSessionFactory);
        ((ISessionFactory) sessionFactory).registerAppFacory(ClientRxSession.class, this.rxSessionFactory);
    } catch (Exception e) {
        tracer.severe("Error Activating Diameter Rx 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) ISessionFactory(org.jdiameter.client.api.ISessionFactory) ApplicationId(org.jdiameter.api.ApplicationId) RxSessionFactory(org.mobicents.slee.resource.diameter.rx.handlers.RxSessionFactory) AvpDataException(org.jdiameter.api.AvpDataException) IOException(java.io.IOException) CreateActivityException(net.java.slee.resource.diameter.base.CreateActivityException) OperationNotSupportedException(javax.naming.OperationNotSupportedException) InvalidConfigurationException(javax.slee.resource.InvalidConfigurationException) ObjectName(javax.management.ObjectName)

Example 7 with DiameterMessageFactoryImpl

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

the class DiameterRfResourceAdaptor method raActive.

public void raActive() {
    if (tracer.isFineEnabled()) {
        tracer.fine("Diameter Rf RA :: raActive.");
    }
    try {
        if (tracer.isInfoEnabled()) {
            tracer.info("Activating Diameter Rf 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();
        // Init activities mgmt
        initActivitiesMgmt();
        // Initialize factories
        this.baseAvpFactory = new DiameterAvpFactoryImpl();
        this.baseMessageFactory = new DiameterMessageFactoryImpl(stack);
        this.rfAvpFactory = new RfAvpFactoryImpl();
        this.rfMessageFactory = new RfMessageFactoryImpl(baseMessageFactory, null, stack);
        // Set the first configured Application-Id as default for message factory
        ApplicationId firstAppId = acctApplicationIds.get(0);
        ((RfMessageFactoryImpl) this.rfMessageFactory).setApplicationId(firstAppId.getVendorId(), firstAppId.getAcctAppId());
        // Register Accounting App Session Factories
        this.sessionFactory = this.stack.getSessionFactory();
        this.rfSessionFactory = new RfSessionFactory(this, sessionFactory);
        ((ISessionFactory) sessionFactory).registerAppFacory(ServerRfSession.class, rfSessionFactory);
        ((ISessionFactory) sessionFactory).registerAppFacory(ClientRfSession.class, rfSessionFactory);
    } catch (Exception e) {
        tracer.severe("Error Activating Diameter Rf RA Entity", e);
    }
}
Also used : RfSessionFactory(org.mobicents.slee.resource.diameter.rf.handlers.RfSessionFactory) IRfSessionFactory(org.jdiameter.common.api.app.rf.IRfSessionFactory) 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) 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 8 with DiameterMessageFactoryImpl

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

the class DiameterS13ResourceAdaptor method sessionCreated.

public void sessionCreated(Session session) {
    DiameterMessageFactoryImpl sessionMsgFactory = new DiameterMessageFactoryImpl(session, stack, null, null);
    DiameterActivityImpl activity = new DiameterActivityImpl(sessionMsgFactory, baseAvpFactory, session, this, null, null);
    // TODO: Do we need to manage session?
    // session.addStateChangeNotification(activity);
    activity.setSessionListener(this);
    addActivity(activity, false);
}
Also used : DiameterMessageFactoryImpl(org.mobicents.slee.resource.diameter.base.DiameterMessageFactoryImpl) DiameterActivityImpl(org.mobicents.slee.resource.diameter.base.DiameterActivityImpl)

Example 9 with DiameterMessageFactoryImpl

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

the class ShServerActivityAnswerCreationTest method testShServerActivityAnswerCreation.

@Test
public void testShServerActivityAnswerCreation() throws Exception {
    ServerShSession session = new ShServerSessionImpl(new ShServerSessionDataLocalImpl(), new IShMessageFactoryImpl(), (ISessionFactory) stack.getSessionFactory(), new ServerShSessionListenerImpl());
    DiameterMessageFactoryImpl msgFactory = new DiameterMessageFactoryImpl(session.getSessions().get(0), stack, null, null);
    ShClientMessageFactoryImpl factory = new ShClientMessageFactoryImpl(session.getSessions().get(0), stack);
    UserDataRequest udr = factory.createUserDataRequest();
    net.java.slee.resource.diameter.sh.events.ProfileUpdateRequest pur = factory.createProfileUpdateRequest();
    net.java.slee.resource.diameter.sh.events.SubscribeNotificationsRequest snr = factory.createSubscribeNotificationsRequest();
    ArrayList<DiameterMessage> list = new ArrayList<DiameterMessage>();
    list.add(udr);
    list.add(pur);
    list.add(snr);
    ShServerActivityImpl activity = new ShServerActivityImpl(new ShServerMessageFactoryImpl(msgFactory, session.getSessions().get(0), stack, diameterShAvpFactory), diameterShAvpFactory, session, null, null);
    DiameterActivityAnswerCreationHelper.testAnswerCreation(activity, "stateMessages", list);
}
Also used : UserDataRequest(net.java.slee.resource.diameter.sh.events.UserDataRequest) ArrayList(java.util.ArrayList) DiameterMessage(net.java.slee.resource.diameter.base.events.DiameterMessage) ShServerActivityImpl(org.mobicents.slee.resource.diameter.sh.server.ShServerActivityImpl) ShClientMessageFactoryImpl(org.mobicents.slee.resource.diameter.sh.client.ShClientMessageFactoryImpl) ShServerSessionImpl(org.jdiameter.server.impl.app.sh.ShServerSessionImpl) DiameterMessageFactoryImpl(org.mobicents.slee.resource.diameter.base.DiameterMessageFactoryImpl) ShServerMessageFactoryImpl(org.mobicents.slee.resource.diameter.sh.server.ShServerMessageFactoryImpl) ServerShSession(org.jdiameter.api.sh.ServerShSession) ShServerSessionDataLocalImpl(org.jdiameter.server.impl.app.sh.ShServerSessionDataLocalImpl) Test(org.junit.Test) ShClientActivityAnswerCreationTest(org.mobicents.slee.resource.diameter.sh.client.tests.activities.ShClientActivityAnswerCreationTest)

Example 10 with DiameterMessageFactoryImpl

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

the class DiameterS6aResourceAdaptor method sessionCreated.

public void sessionCreated(Session session) {
    DiameterMessageFactoryImpl sessionMsgFactory = new DiameterMessageFactoryImpl(session, stack, null, null);
    DiameterActivityImpl activity = new DiameterActivityImpl(sessionMsgFactory, baseAvpFactory, session, this, null, null);
    // TODO: Do we need to manage session?
    // session.addStateChangeNotification(activity);
    activity.setSessionListener(this);
    addActivity(activity, false);
}
Also used : DiameterMessageFactoryImpl(org.mobicents.slee.resource.diameter.base.DiameterMessageFactoryImpl) DiameterActivityImpl(org.mobicents.slee.resource.diameter.base.DiameterActivityImpl)

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