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);
}
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();
}
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;
}
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);
}
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);
}
}
Aggregations