use of org.talend.components.api.service.common.DefinitionRegistry in project components by Talend.
the class ServiceSpiFactory method getDefinitionRegistry.
/**
* return a singleton registry of all the definition red from the java ServiceLoader
*/
public static synchronized DefinitionRegistry getDefinitionRegistry() {
if (defReg == null) {
// Create a new instance of the definition registry.
DefinitionRegistry reg = new DefinitionRegistry();
for (ComponentInstaller installer : ServiceLoader.load(ComponentInstaller.class)) {
installer.install(reg);
}
reg.lock();
// Only assign it to the singleton after being locked.
defReg = reg;
}
return defReg;
}
use of org.talend.components.api.service.common.DefinitionRegistry in project components by Talend.
the class ServiceSpiFactory method createInternalDefintionRegistry.
private static void createInternalDefintionRegistry(URL[] classpath) {
// add the classpath to the classloader.
if (classpath != null && classpath.length > 0) {
for (URL url : classpath) {
extensibleClassLoader.addURL(url);
}
}
// Create a new instance of the definition registry.
DefinitionRegistry reg = new DefinitionRegistry();
for (ComponentInstaller installer : ServiceLoader.load(ComponentInstaller.class, extensibleClassLoader)) {
installer.install(reg);
}
reg.lock();
// Only assign it to the singleton after being locked.
defReg = reg;
}
use of org.talend.components.api.service.common.DefinitionRegistry in project components by Talend.
the class ComponentsTestRegistrySetup method getComponentRegistry.
private DefinitionRegistry getComponentRegistry() {
if (registry == null) {
registry = new DefinitionRegistry();
Map<String, ComponentInstaller> installers = context.getBeansOfType(ComponentInstaller.class);
for (ComponentInstaller installer : installers.values()) {
installer.install(registry);
LOGGER.debug("{} installed in the registry", installer);
}
registry.lock();
}
// else registry already initialised
return registry;
}
use of org.talend.components.api.service.common.DefinitionRegistry in project components by Talend.
the class MultiRuntimeComponentTest method getComponentService.
// default implementation for pure java test.
public ComponentService getComponentService() {
if (componentService == null) {
DefinitionRegistry testComponentRegistry = new DefinitionRegistry();
testComponentRegistry.registerDefinition(Arrays.asList(new MultiRuntimeComponentDefinition()));
componentService = new ComponentServiceImpl(testComponentRegistry);
}
return componentService;
}
use of org.talend.components.api.service.common.DefinitionRegistry in project components by Talend.
the class AzureStorageGenericBase method getDefinitionRegistry.
@Override
public DefinitionRegistryService getDefinitionRegistry() {
if (testComponentRegistry == null) {
testComponentRegistry = new DefinitionRegistry();
testComponentRegistry.registerComponentFamilyDefinition(new AzureStorageFamilyDefinition());
}
return testComponentRegistry;
}
Aggregations