Search in sources :

Example 1 with BrokerConfig

use of com.sun.messaging.jmq.jmsserver.config.BrokerConfig in project openmq by eclipse-ee4j.

the class BrokerMonitor method init.

public static void init() {
    /*
         * The static listener 'cl' updates the static variables METRICS_TIME, PERSIST, and TTL when their corresponding
         * properties are updated.
         */
    BrokerConfig cfg = Globals.getConfig();
    cfg.addListener(METRICS_TIME_PROP, cl);
    cfg.addListener(PERSIST_PROP, cl);
    cfg.addListener(TTL_PROP, cl);
    cfg.addListener(ENABLED_PROP, cl);
}
Also used : BrokerConfig(com.sun.messaging.jmq.jmsserver.config.BrokerConfig)

Example 2 with BrokerConfig

use of com.sun.messaging.jmq.jmsserver.config.BrokerConfig in project openmq by eclipse-ee4j.

the class AccessController method loadProps.

private static void loadProps(AccessController ac) throws BrokerException {
    BrokerConfig config = Globals.getConfig();
    String serviceName = ac.getServiceName();
    ac.getAuthProperties().setProperty(PROP_SERVICE_NAME, ac.getServiceName());
    ac.getAuthProperties().setProperty(PROP_SERVICE_TYPE, ServiceType.getServiceTypeString(ac.getServiceType()));
    // first get system wide properties
    getProps(ac.getAuthProperties(), PROP_AUTHENTICATION_PREFIX, ac.getAuthType(), null, null);
    // get service instance properties - instance override system
    getProps(ac.getAuthProperties(), PROP_AUTHENTICATION_PREFIX, ac.getAuthType(), PROP_AUTHENTICATION_AREA, serviceName);
    String value = config.getProperty(PROP_SERVICE_PREFIX + serviceName + PROP_ACCESSCONTROL_TYPE_SUFFIX);
    if (value == null || value.trim().equals("")) {
        value = config.getProperty(PROP_ACCESSCONTROL_TYPE);
    }
    if (value == null || value.trim().equals("")) {
        if (ac.isAccessControlEnabled()) {
            throw new BrokerException(Globals.getBrokerResources().getKString(BrokerResources.X_ACCESSCONTROL_TYPE_NOT_DEFINED));
        }
    } else {
        ac.setAccessControlType(value);
        ac.getAuthProperties().setProperty(PROP_ACCESSCONTROL_TYPE, value);
        getProps(ac.getAuthProperties(), PROP_ACCESSCONTROL_PREFIX, value, null, null);
        getProps(ac.getAuthProperties(), PROP_ACCESSCONTROL_PREFIX, value, PROP_ACCESSCONTROL_AREA, serviceName);
    }
    value = ac.getAuthProperties().getProperty(PROP_AUTHENTICATION_PREFIX + ac.getAuthType() + PROP_USER_REPOSITORY_SUFFIX);
    if (value != null && !value.trim().equals("")) {
        ac.setUserRepository(value);
        getProps(ac.getAuthProperties(), PROP_USER_REPOSITORY_PREFIX, value, null, null);
        getProps(ac.getAuthProperties(), PROP_USER_REPOSITORY_PREFIX, value, PROP_USER_REPOSITORY_AREA, serviceName);
    }
    ac.init();
}
Also used : BrokerConfig(com.sun.messaging.jmq.jmsserver.config.BrokerConfig) BrokerException(com.sun.messaging.jmq.jmsserver.util.BrokerException)

Example 3 with BrokerConfig

use of com.sun.messaging.jmq.jmsserver.config.BrokerConfig in project openmq by eclipse-ee4j.

the class BridgeBaseContextAdapter method getBridgeConfig.

/**
 * @return the runtime configuration for Bridge Services Manager
 */
@Override
public Properties getBridgeConfig() {
    Properties props = new Properties();
    String prefix = Globals.IMQ + "." + BridgeBaseContext.PROP_BRIDGE;
    BrokerConfig bc = Globals.getConfig();
    List keys = Globals.getConfig().getPropertyNames(prefix);
    String key = null;
    Iterator itr = keys.iterator();
    while (itr.hasNext()) {
        key = (String) itr.next();
        props.put(key, bc.getProperty(key));
    }
    props.put(prefix + ".varhome", Globals.getInstanceDir() + File.separator + BridgeBaseContext.PROP_BRIDGE + "s");
    String lib = bc.getProperty(Globals.JMQ_LIB_HOME_PROPERTY);
    props.put(prefix + ".libhome", lib);
    props.put(prefix + ".stomp.type", "stomp");
    props.put(prefix + ".stomp.class", "com.sun.messaging.bridge.service.stomp.StompBridge");
    props.put(prefix + ".jms.class", "com.sun.messaging.bridge.service.jms.BridgeImpl");
    props.put(BridgeBaseContext.PROP_PREFIX, prefix);
    return props;
}
Also used : BrokerConfig(com.sun.messaging.jmq.jmsserver.config.BrokerConfig) Iterator(java.util.Iterator) List(java.util.List) Properties(java.util.Properties)

Example 4 with BrokerConfig

use of com.sun.messaging.jmq.jmsserver.config.BrokerConfig in project openmq by eclipse-ee4j.

the class KeystoreUtil method getKeystoreLocation.

public static String getKeystoreLocation() throws IOException {
    if (keystore_location == null) {
        BrokerConfig bcfg;
        bcfg = Globals.getConfig();
        // Get Keystore Location and Passphrase here .....
        String dir, value, file_sep;
        file_sep = System.getProperty("file.separator");
        if ((value = bcfg.getProperty(KEYSTORE_DIR_PROP)) != null) {
            value = StringUtil.expandVariables(value, bcfg);
            dir = value;
        } else {
            dir = bcfg.getProperty(Globals.IMQ + ".varhome") + file_sep + "security";
        }
        keystore_location = dir + file_sep + bcfg.getProperty(KEYSTORE_FILE_PROP);
    }
    return (keystore_location);
}
Also used : BrokerConfig(com.sun.messaging.jmq.jmsserver.config.BrokerConfig)

Example 5 with BrokerConfig

use of com.sun.messaging.jmq.jmsserver.config.BrokerConfig in project openmq by eclipse-ee4j.

the class TransactionLogManager method initTransactionLogOnStartUp.

private void initTransactionLogOnStartUp() throws BrokerException {
    if (Store.getDEBUG()) {
        String msg = getPrefix() + " initTransactionLogOnStartUp";
        logger.log(Logger.DEBUG, msg);
    }
    logger.log(Logger.INFO, "new transaction log enabled");
    logger.log(Logger.INFO, "sync writes to disk = " + Destination.PERSIST_SYNC);
    logger.log(Logger.INFO, "logNonTransactedMsgSend = " + logNonTransactedMsgSend);
    logger.log(Logger.INFO, "logNonTransactedMsgAck = " + logNonTransactedMsgAck);
    // create txn log writers
    String filename = null;
    try {
        BrokerConfig config = Globals.getConfig();
        SizeString filesize = config.getSizeProperty(TXNLOG_FILE_SIZE_PROP, DEFAULT_TXNLOG_FILE_SIZE_KB);
        filename = MSG_LOG_FILENAME;
        String mode = "rwd";
        boolean synch = true;
        if (!Destination.PERSIST_SYNC) {
            mode = "rw";
            synch = false;
        }
        logger.log(Logger.INFO, br.getKString(BrokerResources.I_OPEN_TXNLOG, mode, Long.valueOf(filesize.getBytes())));
        FileTransactionLogWriter ftlw = new FileTransactionLogWriter(rootDir, filename, filesize.getBytes(), mode, synch, isTxnLogGroupCommits, BaseTransaction.CURRENT_FORMAT_VERSION);
        long existingFormatVersion = ftlw.getExistingAppCookie();
        // so this is just a sanity check.
        if (existingFormatVersion != BaseTransaction.CURRENT_FORMAT_VERSION) {
            throw new BrokerException("Unexpected transaction log format. Format on file = " + existingFormatVersion + " Current software version = " + BaseTransaction.CURRENT_FORMAT_VERSION);
        }
        msgLogWriter = ftlw;
        msgLogWriter.setCheckPointListener(this);
        if (Store.getDEBUG()) {
            logger.log(Logger.DEBUG, "created txn log");
        }
    } catch (IOException ex) {
        logger.logStack(Logger.ERROR, BrokerResources.E_CREATE_TXNLOG_FILE_FAILED, filename, ex);
        throw new BrokerException(br.getString(BrokerResources.E_CREATE_TXNLOG_FILE_FAILED, filename), ex);
    }
}
Also used : SizeString(com.sun.messaging.jmq.util.SizeString) BrokerConfig(com.sun.messaging.jmq.jmsserver.config.BrokerConfig) BrokerException(com.sun.messaging.jmq.jmsserver.util.BrokerException) FileTransactionLogWriter(com.sun.messaging.jmq.io.txnlog.file.FileTransactionLogWriter) SizeString(com.sun.messaging.jmq.util.SizeString) IOException(java.io.IOException)

Aggregations

BrokerConfig (com.sun.messaging.jmq.jmsserver.config.BrokerConfig)13 BrokerException (com.sun.messaging.jmq.jmsserver.util.BrokerException)7 Logger (com.sun.messaging.jmq.util.log.Logger)2 IOException (java.io.IOException)2 MalformedURLException (java.net.MalformedURLException)2 List (java.util.List)2 Properties (java.util.Properties)2 FileTransactionLogWriter (com.sun.messaging.jmq.io.txnlog.file.FileTransactionLogWriter)1 BrokerShutdownRuntimeException (com.sun.messaging.jmq.jmsserver.util.BrokerShutdownRuntimeException)1 LoggerManager (com.sun.messaging.jmq.jmsserver.util.LoggerManager)1 MQRMIClientSocketFactory (com.sun.messaging.jmq.management.MQRMIClientSocketFactory)1 Password (com.sun.messaging.jmq.util.Password)1 SizeString (com.sun.messaging.jmq.util.SizeString)1 AccessControlException (java.security.AccessControlException)1 Enumeration (java.util.Enumeration)1 HashMap (java.util.HashMap)1 Iterator (java.util.Iterator)1 LoginException (javax.security.auth.login.LoginException)1