String id = (String) properties.get(Constants.NAME);
String identity = (String) properties.remove(Constants.IDENTITY);
String credential = (String) properties.remove(Constants.CREDENTIAL);
String endpoint = (String) properties.get(Constants.ENDPOINT);
BlobStoreContext context = null;
ContextBuilder builder = null;
if (providerMetadata != null) {
builder = ContextBuilder.newBuilder(providerMetadata);
} else if (apiMetadata != null) {
builder = ContextBuilder.newBuilder(apiMetadata);
} else {
return;
}
if (!Strings.isNullOrEmpty(endpoint)) {
builder = builder.endpoint(endpoint);
}
context = builder.name(id).credentials(identity, credential)
.modules(ImmutableSet.<Module>of(new Log4JLoggingModule(), new ManagementLifecycle(BaseManagementContext.INSTANCE)))
.overrides(props)
.build(BlobStoreContext.class);
BlobStore blobStore = context.getBlobStore();
newRegistration = bundleContext.registerService(
BlobStore.class.getName(), blobStore, properties);
//If all goes well move the pending pid to the active pids.
if (pendingPids.containsKey(pid)) {