use of org.talend.hadoop.distribution.dynamic.template.IDynamicDistributionTemplate in project tbd-studio-se by Talend.
the class AbstractDynamicDistribution method unregister.
@Override
public void unregister(IDynamicPlugin dynamicPlugin, IDynamicMonitor monitor, boolean reloadLibCache) throws Exception {
IDynamicPluginConfiguration pluginConfiguration = dynamicPlugin.getPluginConfiguration();
String id = pluginConfiguration.getId();
IDynamicDistributionTemplate distribution = registedDistribution.remove(id);
if (distribution != null) {
unloadDistribution(distribution, reloadLibCache);
}
}
use of org.talend.hadoop.distribution.dynamic.template.IDynamicDistributionTemplate in project tbd-studio-se by Talend.
the class DynamicHDPDistribution method initTemplate.
@Override
protected IDynamicDistributionTemplate initTemplate(DynamicPluginAdapter pluginAdapter, IDynamicMonitor monitor) throws Exception {
IDynamicDistributionTemplate dynamicDistributionTemplate = null;
IDynamicPluginConfiguration pluginConfiguration = pluginAdapter.getPluginConfiguration();
String templateId = pluginConfiguration.getTemplateId();
switch(templateId) {
case HDP2xxDistributionTemplate.TEMPLATE_ID:
dynamicDistributionTemplate = new HDP2xxDistributionTemplate(pluginAdapter);
break;
case HDP3xxDistributionTemplate.TEMPLATE_ID:
dynamicDistributionTemplate = new HDP3xxDistributionTemplate(pluginAdapter);
break;
default:
throw new Exception("Unknown templateId: " + templateId);
}
return dynamicDistributionTemplate;
}
use of org.talend.hadoop.distribution.dynamic.template.IDynamicDistributionTemplate in project tbd-studio-se by Talend.
the class AbstractDynamicDistribution method register.
@Override
public void register(IDynamicPlugin dynamicPlugin, IDynamicMonitor monitor) throws Exception {
DynamicDistributionManager dynamicDistributionManager = DynamicDistributionManager.getInstance();
IDynamicPlugin copiedDynamicPlugin = DynamicFactory.getInstance().createPluginFromJson(dynamicPlugin.toXmlJson().toString());
Project project = ProjectManager.getInstance().getProjectFromProjectTechLabel((String) copiedDynamicPlugin.getPluginConfiguration().getAttribute(DynamicConstants.ATTR_PROJECT_TECHNICAL_NAME));
IDynamicDistributionPreference dynamicDistributionPreference = dynamicDistributionManager.getDynamicDistributionGroup(getDistributionName()).getDynamicDistributionPreference(project);
Bundle bundle = getBundle();
DynamicPluginAdapter pluginAdapter = new DynamicPluginAdapter(copiedDynamicPlugin, dynamicDistributionPreference, bundle);
pluginAdapter.adapt();
IDynamicPluginConfiguration pluginConfiguration = pluginAdapter.getPluginConfiguration();
String id = pluginConfiguration.getId();
try {
IDynamicDistributionTemplate existingTemplate = registedDistribution.get(id);
if (existingTemplate != null) {
unloadDistribution(existingTemplate, true);
DynamicPluginAdapter existingPluginAdapter = existingTemplate.getPluginAdapter();
IDynamicPluginConfiguration existingPluginConfig = existingPluginAdapter.getPluginConfiguration();
String existingProjectName = (String) existingPluginConfig.getAttribute(DynamicConstants.ATTR_PROJECT_TECHNICAL_NAME);
ExceptionHandler.log("Dynamic distribution: " + existingProjectName + "/" + id + " already exists, unloaded the old one and reload the new one");
}
} catch (Exception e) {
ExceptionHandler.process(e);
}
boolean isBuiltin = Boolean.parseBoolean((String) pluginConfiguration.getAttribute(DynamicConstants.ATTR_IS_BUILTIN));
if (isBuiltin) {
// $NON-NLS-1$
pluginConfiguration.setName(Messages.getString("DynamicDistribution.name.builtin", pluginConfiguration.getName()));
} else {
Project currentProject = ProjectManager.getInstance().getCurrentProject();
String curProjLabel = currentProject.getTechnicalLabel();
String projLabel = (String) pluginConfiguration.getAttribute(DynamicConstants.ATTR_PROJECT_TECHNICAL_NAME);
if (StringUtils.equals(curProjLabel, projLabel)) {
// $NON-NLS-1$
projLabel = Messages.getString("DynamicDistribution.name.current");
}
pluginConfiguration.setName(// $NON-NLS-1$
Messages.getString(// $NON-NLS-1$
"DynamicDistribution.name.project", // $NON-NLS-1$
pluginConfiguration.getName(), projLabel));
}
IDynamicDistributionTemplate distributionTemplate = initTemplate(pluginAdapter, monitor);
registedDistribution.put(pluginConfiguration.getId(), distributionTemplate);
distributionTemplate.registOsgiServices();
if (Boolean.getBoolean(PROP_LOAD_DYNAMIC_DISTRIBUTION_MODULE)) {
distributionTemplate.registPluginExtensions();
}
}
use of org.talend.hadoop.distribution.dynamic.template.IDynamicDistributionTemplate in project tbd-studio-se by Talend.
the class DynamicCDH6xDistribution method initTemplate.
@Override
protected IDynamicDistributionTemplate initTemplate(DynamicPluginAdapter pluginAdapter, IDynamicMonitor monitor) throws Exception {
IDynamicDistributionTemplate dynamicDistributionTemplate = null;
IDynamicPluginConfiguration pluginConfiguration = pluginAdapter.getPluginConfiguration();
String templateId = pluginConfiguration.getTemplateId();
switch(templateId) {
case CDH6xDistributionTemplate.TEMPLATE_ID:
dynamicDistributionTemplate = new CDH6xDistributionTemplate(pluginAdapter);
break;
default:
throw new Exception("Unknown templateId: " + templateId);
}
return dynamicDistributionTemplate;
}
Aggregations