Search in sources :

Example 1 with JmsRaUtil

use of com.sun.enterprise.connectors.jms.util.JmsRaUtil in project Payara by payara.

the class ActiveJmsResourceAdapter method postConstruct.

@Override
public void postConstruct() {
    // the RA.
    try {
        JMSConfigListener jmsConfigListener = jmsConfigListenerProvider.get();
        jmsConfigListener.setActiveResourceAdapter(this);
        JmsRaUtil raUtil = new JmsRaUtil();
        raUtil.upgradeIfNecessary();
    } catch (Throwable t) {
        // t.printStackTrace();
        if (_logger.isLoggable(Level.FINE)) {
            _logger.log(Level.FINE, "Cannot upgrade jmsra" + t.getMessage());
        }
    }
}
Also used : JmsRaUtil(com.sun.enterprise.connectors.jms.util.JmsRaUtil)

Example 2 with JmsRaUtil

use of com.sun.enterprise.connectors.jms.util.JmsRaUtil in project Payara by payara.

the class ActiveJmsResourceAdapter method setMdbContainerProperties.

private void setMdbContainerProperties() throws ConnectorRuntimeException {
    JmsRaUtil raUtil = new JmsRaUtil(null);
    ConnectorDescriptor cd = super.getDescriptor();
    raUtil.setMdbContainerProperties();
    String val = "" + MdbContainerProps.getReconnectEnabled();
    ConnectorConfigProperty envProp2 = new ConnectorConfigProperty(RECONNECTENABLED, val, val, "java.lang.Boolean");
    setProperty(cd, envProp2);
    val = "" + MdbContainerProps.getReconnectDelay();
    ConnectorConfigProperty envProp3 = new ConnectorConfigProperty(RECONNECTINTERVAL, val, val, "java.lang.Integer");
    setProperty(cd, envProp3);
    val = "" + MdbContainerProps.getReconnectMaxRetries();
    ConnectorConfigProperty envProp4 = new ConnectorConfigProperty(RECONNECTATTEMPTS, val, val, "java.lang.Integer");
    setProperty(cd, envProp4);
    String integrationMode = getJmsService().getType();
    boolean lazyInit = Boolean.valueOf(getJmsHost().getLazyInit());
    val = "true";
    if (EMBEDDED.equals(integrationMode) && lazyInit) {
        val = "false";
    }
    doBind = Boolean.valueOf(val);
    ConnectorConfigProperty envProp5 = new ConnectorConfigProperty(MQ_PORTMAPPER_BIND, val, val, "java.lang.Boolean");
    setProperty(cd, envProp5);
// The above properties will be set in ConnectorDescriptor and
// will be bound in JNDI. This will be available to appclient
// and standalone client.
}
Also used : JmsRaUtil(com.sun.enterprise.connectors.jms.util.JmsRaUtil) ConnectorDescriptor(com.sun.enterprise.deployment.ConnectorDescriptor) ConnectorConfigProperty(com.sun.enterprise.deployment.ConnectorConfigProperty)

Example 3 with JmsRaUtil

use of com.sun.enterprise.connectors.jms.util.JmsRaUtil in project Payara by payara.

the class ActiveJmsResourceAdapter method setJmsServiceProperties.

private void setJmsServiceProperties(JmsService service) throws ConnectorRuntimeException {
    JmsRaUtil jmsraUtil = new JmsRaUtil(service);
    jmsraUtil.setupAddressList();
    urlList = jmsraUtil.getUrlList();
    addressList = urlList.toString();
    if (_logger.isLoggable(Level.INFO)) {
        _logger.log(Level.INFO, JMSLoggerInfo.ADDRESSLIST_JMSPROVIDER, new Object[] { addressList });
    }
    ConnectorDescriptor cd = super.getDescriptor();
    setConnectionURL(service, urlList);
    String val = "" + jmsraUtil.getReconnectEnabled();
    ConnectorConfigProperty envProp2 = new ConnectorConfigProperty(RECONNECTENABLED, val, val, "java.lang.Boolean");
    setProperty(cd, envProp2);
    // convert to milliseconds
    int newval = Integer.parseInt(jmsraUtil.getReconnectInterval()) * 1000;
    val = "" + newval;
    ConnectorConfigProperty envProp3 = new ConnectorConfigProperty(RECONNECTINTERVAL, val, val, "java.lang.Integer");
    setProperty(cd, envProp3);
    val = "" + jmsraUtil.getReconnectAttempts();
    ConnectorConfigProperty envProp4 = new ConnectorConfigProperty(RECONNECTATTEMPTS, val, val, "java.lang.Integer");
    setProperty(cd, envProp4);
    val = "" + jmsraUtil.getAddressListBehaviour();
    ConnectorConfigProperty envProp5 = new ConnectorConfigProperty(ADRLIST_BEHAVIOUR, val, val, "java.lang.String");
    setProperty(cd, envProp5);
    val = "" + jmsraUtil.getAddressListIterations();
    ConnectorConfigProperty envProp6 = new ConnectorConfigProperty(ADRLIST_ITERATIONS, val, val, "java.lang.Integer");
    setProperty(cd, envProp6);
    boolean useExternal = shouldUseExternalRmiRegistry(jmsraUtil);
    val = Boolean.valueOf(useExternal).toString();
    ConnectorConfigProperty envProp7 = new ConnectorConfigProperty(USEEXTERNALRMIREGISTRY, val, val, "java.lang.Boolean");
    setProperty(cd, envProp7);
    _logger.log(Level.FINE, "Start RMI registry set as " + val);
    // If MQ RA needs to use AS RMI Registry Port, then set
    // the RMI registry port, else MQ RA uses its default RMI
    // Registry port  [as of now 1099]
    String configuredRmiRegistryPort = null;
    if (!useExternal) {
        configuredRmiRegistryPort = getRmiRegistryPort();
    } else {
        /* We will be here if we are LOCAL or REMOTE, standalone
           * or clustered. We could set the Rmi registry port.
           * The RA should ignore the port if REMOTE and use it only
           * for LOCAL cases.
           */
        configuredRmiRegistryPort = getUniqueRmiRegistryPort();
    }
    val = configuredRmiRegistryPort;
    if (val != null) {
        ConnectorConfigProperty envProp8 = new ConnectorConfigProperty(RMIREGISTRYPORT, val, val, "java.lang.Integer");
        setProperty(cd, envProp8);
        if (_logger.isLoggable(Level.FINE)) {
            _logger.log(Level.FINE, "RMI registry port set as " + val);
        }
    } else {
        if (_logger.isLoggable(Level.WARNING)) {
            _logger.log(Level.WARNING, JMSLoggerInfo.INVALID_RMI_PORT);
        }
    }
}
Also used : JmsRaUtil(com.sun.enterprise.connectors.jms.util.JmsRaUtil) ConnectorDescriptor(com.sun.enterprise.deployment.ConnectorDescriptor) ConnectorConfigProperty(com.sun.enterprise.deployment.ConnectorConfigProperty)

Aggregations

JmsRaUtil (com.sun.enterprise.connectors.jms.util.JmsRaUtil)3 ConnectorConfigProperty (com.sun.enterprise.deployment.ConnectorConfigProperty)2 ConnectorDescriptor (com.sun.enterprise.deployment.ConnectorDescriptor)2