in commands/src/main/java/org/jclouds/karaf/commands/blobstore/BlobStoreServiceCreateCommand.java [130:183]
private void registerBlobStore(final ConfigurationAdmin configurationAdmin, final String id, final String provider, final String api,
final String identity, final String credential, final String endpoint, final Map<String, String> props)
throws Exception {
Runnable registrationTask = new Runnable() {
@Override
public void run() {
try {
Configuration configuration = findOrCreateFactoryConfiguration(configurationAdmin,
"org.jclouds.blobstore", id, provider, api);
if (configuration != null) {
@SuppressWarnings("unchecked")
Dictionary<String, Object> dictionary = configuration.getProperties();
if (dictionary == null) {
dictionary = new Hashtable<String, Object>();
}
String providerValue = EnvHelper.getBlobStoreProvider(provider);
String apiValue = EnvHelper.getBlobStoreApi(api);
String identityValue = EnvHelper.getBlobStoreIdentity(identity);
String credentialValue = EnvHelper.getBlobStoreCredential(providerValue, credential);
String endpointValue = EnvHelper.getBlobStoreEndpoint(endpoint);
if (id != null) {
dictionary.put(Constants.NAME, id);
}
if (providerValue != null) {
dictionary.put(Constants.PROVIDER, providerValue);
}
if (apiValue != null) {
dictionary.put(Constants.API, apiValue);
}
if (endpointValue != null) {
dictionary.put(Constants.ENDPOINT, endpointValue);
}
if (credentialValue != null) {
dictionary.put(Constants.CREDENTIAL, credentialValue);
}
if (identityValue != null) {
dictionary.put(Constants.IDENTITY, identityValue);
}
for (Map.Entry<String, String> entry : props.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
dictionary.put(key, value);
}
configuration.update(dictionary);
}
} catch (Exception ex) {
// noop
}
}
};
new Thread(registrationTask).start();
}