Search in sources :

Example 16 with DefinitionRegistry

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;
}
Also used : ComponentInstaller(org.talend.components.api.ComponentInstaller) DefinitionRegistry(org.talend.components.api.service.common.DefinitionRegistry)

Example 17 with DefinitionRegistry

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;
}
Also used : ComponentInstaller(org.talend.components.api.ComponentInstaller) URL(java.net.URL) DefinitionRegistry(org.talend.components.api.service.common.DefinitionRegistry)

Example 18 with DefinitionRegistry

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;
}
Also used : ComponentInstaller(org.talend.components.api.ComponentInstaller) DefinitionRegistry(org.talend.components.api.service.common.DefinitionRegistry)

Example 19 with DefinitionRegistry

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;
}
Also used : ComponentServiceImpl(org.talend.components.api.service.common.ComponentServiceImpl) DefinitionRegistry(org.talend.components.api.service.common.DefinitionRegistry)

Example 20 with DefinitionRegistry

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;
}
Also used : DefinitionRegistry(org.talend.components.api.service.common.DefinitionRegistry)

Aggregations

DefinitionRegistry (org.talend.components.api.service.common.DefinitionRegistry)27 ComponentServiceImpl (org.talend.components.api.service.common.ComponentServiceImpl)12 Test (org.junit.Test)5 URL (java.net.URL)3 ComponentInstaller (org.talend.components.api.ComponentInstaller)3 SalesforceFamilyDefinition (org.talend.components.salesforce.SalesforceFamilyDefinition)3 BeforeClass (org.junit.BeforeClass)2 TJiraInputDefinition (org.talend.components.jira.tjirainput.TJiraInputDefinition)2 SnowflakeFamilyDefinition (org.talend.components.snowflake.SnowflakeFamilyDefinition)2 ComponentFamilyDefinition (org.talend.components.api.ComponentFamilyDefinition)1 ComponentService (org.talend.components.api.service.ComponentService)1 SimpleComponentDefinition (org.talend.components.api.test.SimpleComponentDefinition)1 AbstractTestFormatProperties (org.talend.components.common.format.instances.AbstractTestFormatProperties)1 TestFormatDefinition1Impl (org.talend.components.common.format.instances.TestFormatDefinition1Impl)1 TestFormatDefinition2Impl (org.talend.components.common.format.instances.TestFormatDefinition2Impl)1 LocalIOComponentFamilyDefinition (org.talend.components.localio.LocalIOComponentFamilyDefinition)1 FixedFlowInputDefinition (org.talend.components.localio.fixedflowinput.FixedFlowInputDefinition)1 SimpleFileIOComponentFamilyDefinition (org.talend.components.simplefileio.SimpleFileIOComponentFamilyDefinition)1 SimpleFileIODatasetDefinition (org.talend.components.simplefileio.SimpleFileIODatasetDefinition)1 SimpleFileIODatastoreDefinition (org.talend.components.simplefileio.SimpleFileIODatastoreDefinition)1