Search in sources :

Example 1 with CreditControlSessionFactory

use of org.mobicents.slee.resource.diameter.cca.handlers.CreditControlSessionFactory 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)

Aggregations

ObjectName (javax.management.ObjectName)1 InvalidConfigurationException (javax.slee.resource.InvalidConfigurationException)1 InvalidTransactionException (javax.transaction.InvalidTransactionException)1 SystemException (javax.transaction.SystemException)1 CreateActivityException (net.java.slee.resource.diameter.base.CreateActivityException)1 ISessionFactory (org.jdiameter.client.api.ISessionFactory)1 DiameterStackMultiplexerMBean (org.mobicents.diameter.stack.DiameterStackMultiplexerMBean)1 DiameterAvpFactoryImpl (org.mobicents.slee.resource.diameter.base.DiameterAvpFactoryImpl)1 DiameterMessageFactoryImpl (org.mobicents.slee.resource.diameter.base.DiameterMessageFactoryImpl)1 CreditControlSessionFactory (org.mobicents.slee.resource.diameter.cca.handlers.CreditControlSessionFactory)1