use of org.talend.sdk.component.server.dao.ComponentFamilyDao in project component-runtime by Talend.
the class ComponentManagerService method init.
@PostConstruct
private void init() {
ofNullable(configuration.mavenRepository()).ifPresent(repo -> System.setProperty("talend.component.manager.m2.repository", repo));
mvnCoordinateToFileConverter = new MvnCoordinateToFileConverter();
instance = ComponentManager.instance();
deploymentListener = new DeploymentListener(componentDao, componentFamilyDao, actionDao, configurationDao);
instance.getContainer().registerListener(deploymentListener);
// note: we don't want to download anything from the manager, if we need to download any artifact we need
// to ensure it is controlled (secured) and allowed so don't make it implicit but enforce a first phase
// where it is cached locally (provisioning solution)
ofNullable(configuration.componentCoordinates()).orElse(emptyList()).forEach(this::deploy);
ofNullable(configuration.componentRegistry()).map(File::new).filter(File::exists).ifPresent(registry -> {
final Properties properties = new Properties();
try (final InputStream is = new FileInputStream(registry)) {
properties.load(is);
} catch (final IOException e) {
throw new IllegalArgumentException(e);
}
properties.stringPropertyNames().stream().map(properties::getProperty).filter(gav -> !configuration.componentCoordinates().contains(gav)).forEach(this::deploy);
});
}
Aggregations