UtilityExtensionPoint utils = registry.getExtensionPoint(UtilityExtensionPoint.class);
InterfaceContractMapper mapper = utils.getUtility(InterfaceContractMapper.class);
// Get the provider factory service declarations
Collection<ServiceDeclaration> builderDeclarations;
ServiceDiscovery serviceDiscovery = registry.getServiceDiscovery();
try {
builderDeclarations = serviceDiscovery.getServiceDeclarations(CompositeBuilder.class.getName());
} catch (Exception e) {
throw new IllegalStateException(e);
}
for (ServiceDeclaration builderDeclaration : builderDeclarations) {
Map<String, String> attributes = builderDeclaration.getAttributes();
String id = attributes.get("id");
CompositeBuilder builder = new LazyCompositeBuilder(id, builderDeclaration, this, factories, mapper);
builders.put(id, builder);
}
try {
builderDeclarations = serviceDiscovery.getServiceDeclarations(BindingBuilder.class);
} catch (Exception e) {
throw new IllegalStateException(e);
}
for (ServiceDeclaration builderDeclaration : builderDeclarations) {
BindingBuilder<?> builder = new LazyBindingBuilder(builderDeclaration);
bindingBuilders.put(builder.getBindingType(), builder);
}
try {
builderDeclarations = serviceDiscovery.getServiceDeclarations(ImplementationBuilder.class);
} catch (Exception e) {
throw new IllegalStateException(e);
}
for (ServiceDeclaration builderDeclaration : builderDeclarations) {
ImplementationBuilder<?> builder = new LazyImplementationBuilder(builderDeclaration);
implementationBuilders.put(builder.getImplementationType(), builder);
}
try {
builderDeclarations = serviceDiscovery.getServiceDeclarations(PolicyBuilder.class);
} catch (Exception e) {
throw new IllegalStateException(e);
}
for (ServiceDeclaration builderDeclaration : builderDeclarations) {
PolicyBuilder<?> builder = new LazyPolicyBuilder(builderDeclaration);
policyBuilders.put(builder.getPolicyType(), builder);
}
try {
builderDeclarations = serviceDiscovery.getServiceDeclarations(ContractBuilder.class);
} catch (Exception e) {
throw new IllegalStateException(e);
}
for (ServiceDeclaration builderDeclaration : builderDeclarations) {