List<ServiceController<?>> newControllers,
ServiceTarget target,
String repositoryName,
EditableDocument binaries,
ServiceName serviceName ) throws OperationFailedException {
CompositeBinaryStorageService service = new CompositeBinaryStorageService(repositoryName, binaries);
ServiceBuilder<BinaryStorage> builder = target.addService(serviceName, service);
List<ModelNode> nestedStores = ModelAttributes.NESTED_STORES.resolveModelAttribute(context, model).asList();
// parse the nested store names and add a dependency on each of those services
for (ModelNode nestedStore : nestedStores) {
String nestedStoreName = nestedStore.asString();
ServiceName nestedServiceName = ModeShapeServiceNames.binaryStorageNestedServiceName(repositoryName, nestedStoreName);
if (!StringUtil.isBlank(nestedStoreName)) {
builder.addDependency(nestedServiceName, BinaryStorage.class, service.nestedStoreConfiguration(nestedStoreName));
}
}
builder.setInitialMode(ServiceController.Mode.ACTIVE);
newControllers.add(builder.install());