Search in sources :

Example 1 with ShServerSessionFactory

use of org.mobicents.slee.resource.diameter.sh.server.handlers.ShServerSessionFactory in project jain-slee.diameter by RestComm.

the class DiameterShServerResourceAdaptor method raActive.

// More life cycle methods ----------------------------------------------
public void raActive() {
    if (tracer.isFineEnabled()) {
        tracer.fine("Diameter ShServer RA :: raActive.");
    }
    try {
        if (tracer.isInfoEnabled()) {
            tracer.info("Activating Diameter ShServer 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 stack
        initStack();
        // Initialize activities mgmt
        initActivitiesMgmt();
        // Initialize factories
        this.baseAvpFactory = new DiameterAvpFactoryImpl();
        this.shAvpFactory = new DiameterShAvpFactoryImpl(baseAvpFactory);
        this.shServerMessageFactory = new ShServerMessageFactoryImpl(stack);
        // Set the first configured Application-Id as default for message factory
        ApplicationId firstAppId = authApplicationIds.get(0);
        ((ShServerMessageFactoryImpl) this.shServerMessageFactory).setApplicationId(firstAppId.getVendorId(), firstAppId.getAuthAppId());
        // Setup session factories
        this.sessionFactory = this.stack.getSessionFactory();
        ((ISessionFactory) sessionFactory).registerAppFacory(ServerShSession.class, new ShServerSessionFactory(sessionFactory, this));
    } catch (Exception e) {
        tracer.severe("Error Activating Diameter ShServer RA Entity", e);
    }
}
Also used : DiameterStackMultiplexerMBean(org.mobicents.diameter.stack.DiameterStackMultiplexerMBean) ShServerSessionFactory(org.mobicents.slee.resource.diameter.sh.server.handlers.ShServerSessionFactory) DiameterAvpFactoryImpl(org.mobicents.slee.resource.diameter.base.DiameterAvpFactoryImpl) ISessionFactory(org.jdiameter.client.api.ISessionFactory) ApplicationId(org.jdiameter.api.ApplicationId) AvpDataException(org.jdiameter.api.AvpDataException) AvpNotAllowedException(net.java.slee.resource.diameter.base.events.avp.AvpNotAllowedException) 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) DiameterShAvpFactoryImpl(org.mobicents.slee.resource.diameter.sh.DiameterShAvpFactoryImpl)

Aggregations

IOException (java.io.IOException)1 ObjectName (javax.management.ObjectName)1 OperationNotSupportedException (javax.naming.OperationNotSupportedException)1 InvalidConfigurationException (javax.slee.resource.InvalidConfigurationException)1 CreateActivityException (net.java.slee.resource.diameter.base.CreateActivityException)1 AvpNotAllowedException (net.java.slee.resource.diameter.base.events.avp.AvpNotAllowedException)1 ApplicationId (org.jdiameter.api.ApplicationId)1 AvpDataException (org.jdiameter.api.AvpDataException)1 ISessionFactory (org.jdiameter.client.api.ISessionFactory)1 DiameterStackMultiplexerMBean (org.mobicents.diameter.stack.DiameterStackMultiplexerMBean)1 DiameterAvpFactoryImpl (org.mobicents.slee.resource.diameter.base.DiameterAvpFactoryImpl)1 DiameterShAvpFactoryImpl (org.mobicents.slee.resource.diameter.sh.DiameterShAvpFactoryImpl)1 ShServerSessionFactory (org.mobicents.slee.resource.diameter.sh.server.handlers.ShServerSessionFactory)1