use of org.osgi.service.cm.ConfigurationException in project felix by apache.
the class RoleRepositoryFileStoreTest method testUpdateConfigurationWithKeyWriteDisabledInvalidValueFail.
/**
* Tests that calling updated with the key "background.write.disabled" set to a numeric value fails.
*/
public void testUpdateConfigurationWithKeyWriteDisabledInvalidValueFail() throws Exception {
Properties properties = new Properties();
properties.put(RoleRepositoryFileStore.KEY_WRITE_DISABLED, Integer.valueOf(1));
try {
m_store.updated(properties);
fail("ConfigurationException expected!");
} catch (ConfigurationException e) {
// Ok; expected
}
}
use of org.osgi.service.cm.ConfigurationException in project cxf by apache.
the class HTTPJettyTransportActivator method updated.
public void updated(String pid, Dictionary<String, ?> properties) throws ConfigurationException {
if (pid == null) {
return;
}
int port = Integer.parseInt((String) properties.get("port"));
String host = (String) properties.get("host");
try {
TLSServerParameters tls = createTlsServerParameters(properties);
if (tls != null) {
factory.setTLSServerParametersForPort(host, port, tls);
} else {
factory.createJettyHTTPServerEngine(host, port, "http");
}
JettyHTTPServerEngine e = factory.retrieveJettyHTTPServerEngine(port);
configure(e, properties);
} catch (GeneralSecurityException e) {
throw new ConfigurationException(null, null, e);
} catch (IOException e) {
throw new ConfigurationException(null, null, e);
}
}
use of org.osgi.service.cm.ConfigurationException in project cxf by apache.
the class HTTPUndertowTransportActivator method updated.
public void updated(String pid, Dictionary<String, ?> properties) throws ConfigurationException {
if (pid == null) {
return;
}
int port = Integer.parseInt((String) properties.get("port"));
String host = (String) properties.get("host");
try {
TLSServerParameters tls = createTlsServerParameters(properties);
if (tls != null) {
factory.setTLSServerParametersForPort(host, port, tls);
} else {
factory.createUndertowHTTPServerEngine(host, port, "http");
}
UndertowHTTPServerEngine e = factory.retrieveUndertowHTTPServerEngine(port);
configure(e, properties);
} catch (GeneralSecurityException e) {
throw new ConfigurationException(null, null, e);
} catch (IOException e) {
throw new ConfigurationException(null, null, e);
}
}
use of org.osgi.service.cm.ConfigurationException in project smarthome by eclipse.
the class AcceptAllCertificatesSSLContext method getContext.
@Override
public SSLContext getContext() throws ConfigurationException {
try {
SSLContext sslContext = SSLContext.getInstance("TLSv1.2");
sslContext.init(null, new TrustManager[] { trustManager }, null);
return sslContext;
} catch (KeyManagementException | NoSuchAlgorithmException e) {
logger.warn("SSL configuration failed", e);
throw new ConfigurationException("ssl", e.getMessage());
}
}
use of org.osgi.service.cm.ConfigurationException in project adeptj-modules by AdeptJ.
the class DefaultJaxRSAuthenticationRealm method updated.
/**
* {@inheritDoc}
*/
@Override
public void updated(String pid, Dictionary<String, ?> properties) throws ConfigurationException {
String username = Objects.requireNonNull((String) properties.get(KEY_USERNAME), USERNAME_NULL_MSG);
String password = Objects.requireNonNull((String) properties.get(KEY_PWD), PWD_NULL_MSG);
LOGGER.info("Creating JaxRSAuthenticationInfo for User: [{}]", username);
if (this.pidVsUserMappings.containsKey(pid)) {
// This is an update
this.pidVsUserMappings.put(pid, username);
this.authInfoMap.put(username, new JaxRSAuthenticationInfo(username, password.toCharArray()));
} else if (!this.pidVsUserMappings.containsKey(pid) && this.pidVsUserMappings.containsValue(username)) {
LOGGER.warn("User: [{}] already present, ignoring this config!!");
throw new ConfigurationException(KEY_USERNAME, "User already present!!");
} else if (!this.pidVsUserMappings.containsKey(pid) && !this.pidVsUserMappings.containsValue(username)) {
this.pidVsUserMappings.put(pid, username);
this.authInfoMap.put(username, new JaxRSAuthenticationInfo(username, password.toCharArray()));
}
}
Aggregations