use of org.apache.qpid.server.util.StringUtil in project qpid-broker-j by apache.
the class Main method execute.
protected void execute() throws Exception {
Map<String, Object> attributes = new HashMap<>();
String initialProperties = _commandLine.getOptionValue(OPTION_INITIAL_SYSTEM_PROPERTIES.getOpt());
SystemLauncher.populateSystemPropertiesFromDefaults(initialProperties);
String initialConfigLocation = _commandLine.getOptionValue(OPTION_INITIAL_CONFIGURATION_PATH.getOpt());
if (initialConfigLocation != null) {
attributes.put(SystemConfig.INITIAL_CONFIGURATION_LOCATION, initialConfigLocation);
}
// process the remaining options
if (_commandLine.hasOption(OPTION_HELP.getOpt())) {
final HelpFormatter formatter = new HelpFormatter();
formatter.printHelp("Qpid", OPTIONS, true);
} else if (_commandLine.hasOption(OPTION_CREATE_INITIAL_CONFIG.getOpt())) {
createInitialConfigCopy(initialConfigLocation);
} else if (_commandLine.hasOption(OPTION_VERSION.getOpt())) {
printVersion();
} else {
String[] configPropPairs = _commandLine.getOptionValues(OPTION_CONFIGURATION_PROPERTY.getOpt());
Map<String, String> context = calculateConfigContext(configPropPairs);
if (!context.isEmpty()) {
attributes.put(SystemConfig.CONTEXT, context);
}
String configurationStore = _commandLine.getOptionValue(OPTION_CONFIGURATION_STORE_PATH.getOpt());
if (configurationStore != null) {
attributes.put("storePath", configurationStore);
}
String configurationStoreType = _commandLine.getOptionValue(OPTION_CONFIGURATION_STORE_TYPE.getOpt());
attributes.put(SystemConfig.TYPE, configurationStoreType == null ? JsonSystemConfigImpl.SYSTEM_CONFIG_TYPE : configurationStoreType);
boolean managementMode = _commandLine.hasOption(OPTION_MANAGEMENT_MODE.getOpt());
if (managementMode) {
attributes.put(SystemConfig.MANAGEMENT_MODE, true);
String httpPort = _commandLine.getOptionValue(OPTION_MM_HTTP_PORT.getOpt());
if (httpPort != null) {
attributes.put(SystemConfig.MANAGEMENT_MODE_HTTP_PORT_OVERRIDE, httpPort);
}
boolean quiesceVhosts = _commandLine.hasOption(OPTION_MM_QUIESCE_VHOST.getOpt());
attributes.put(SystemConfig.MANAGEMENT_MODE_QUIESCE_VIRTUAL_HOSTS, quiesceVhosts);
String password = _commandLine.getOptionValue(OPTION_MM_PASSWORD.getOpt());
if (password == null) {
password = new StringUtil().randomAlphaNumericString(MANAGEMENT_MODE_PASSWORD_LENGTH);
}
attributes.put(SystemConfig.MANAGEMENT_MODE_PASSWORD, password);
}
setExceptionHandler();
startBroker(attributes);
}
}
use of org.apache.qpid.server.util.StringUtil in project qpid-broker-j by apache.
the class StringUtilTest method setUp.
@Override
public void setUp() throws Exception {
super.setUp();
_util = new StringUtil();
}
use of org.apache.qpid.server.util.StringUtil in project qpid-broker-j by apache.
the class SimpleLDAPAuthenticationManagerImpl method createSslSocketFactoryOverrideClass.
private Class<? extends SocketFactory> createSslSocketFactoryOverrideClass(final TrustStore trustStore) {
String managerName = String.format("%s_%s_%s", getName(), getId(), trustStore == null ? "none" : trustStore.getName());
String clazzName = new StringUtil().createUniqueJavaName(managerName);
SSLContext sslContext = null;
try {
sslContext = SSLUtil.tryGetSSLContext();
sslContext.init(null, trustStore == null ? null : trustStore.getTrustManagers(), null);
} catch (GeneralSecurityException e) {
LOGGER.error("Exception creating SSLContext", e);
if (trustStore != null) {
throw new IllegalConfigurationException("Error creating SSLContext with trust store : " + trustStore.getName(), e);
} else {
throw new IllegalConfigurationException("Error creating SSLContext (no trust store)", e);
}
}
SSLSocketFactory sslSocketFactory = new CipherSuiteAndProtocolRestrictingSSLSocketFactory(sslContext.getSocketFactory(), _tlsCipherSuiteWhiteList, _tlsCipherSuiteBlackList, _tlsProtocolWhiteList, _tlsProtocolBlackList);
Class<? extends AbstractLDAPSSLSocketFactory> clazz = LDAPSSLSocketFactoryGenerator.createSubClass(clazzName, sslSocketFactory);
LOGGER.debug("Connection to Directory will use custom SSL socket factory : {}", clazz);
return clazz;
}
Aggregations