use of org.talend.repository.model.hadoopcluster.HadoopClusterConnection in project tbd-studio-se by Talend.
the class HadoopClusterService method updateConfJarsByContextGroup.
@Override
public boolean updateConfJarsByContextGroup(ContextItem contextItem, Map<String, String> contextGroupRanamedMap) {
boolean updated = false;
try {
List<IRepositoryViewObject> allHadoopClusterRepObjs = ProxyRepositoryFactory.getInstance().getAll(ProjectManager.getInstance().getCurrentProject(), getHadoopClusterType());
for (IRepositoryViewObject repObj : allHadoopClusterRepObjs) {
HadoopClusterConnectionItem hcItem = (HadoopClusterConnectionItem) repObj.getProperty().getItem();
HadoopClusterConnection hcConnection = (HadoopClusterConnection) hcItem.getConnection();
if (hcConnection.isUseCustomConfs()) {
String contextId = hcConnection.getContextId();
if (contextId != null && contextId.equals(contextItem.getProperty().getId())) {
boolean renamed = HadoopConfsUtils.renameContextGroups(hcConnection, contextGroupRanamedMap);
if (renamed) {
HadoopConfsUtils.getConfsJarDefaultNames(hcItem, true);
}
}
}
}
} catch (PersistenceException e) {
ExceptionHandler.process(e);
}
return updated;
}
use of org.talend.repository.model.hadoopcluster.HadoopClusterConnection in project tbd-studio-se by Talend.
the class HadoopClusterService method getCustomConfsJar.
@Override
public Optional<HadoopConfJarBean> getCustomConfsJar(ConnectionItem connectionItem, boolean createJarIfNotExist, boolean addExtraIds) {
if (connectionItem instanceof HadoopClusterConnectionItem) {
HadoopClusterConnectionItem item = (HadoopClusterConnectionItem) connectionItem;
HadoopClusterConnection connection = (HadoopClusterConnection) item.getConnection();
if (connection != null && connection.isUseCustomConfs()) {
String extraIds = null;
boolean isContextMode = connection.isContextMode();
if (addExtraIds && isContextMode) {
ContextType contextType = ConnectionContextHelper.getContextTypeForContextMode(connection, true);
extraIds = contextType.getName();
}
String defaultName = null;
if (extraIds == null) {
defaultName = HadoopConfsUtils.getConfsJarDefaultName(item, createJarIfNotExist);
} else {
defaultName = HadoopConfsUtils.getConfsJarDefaultName(item, createJarIfNotExist, extraIds);
}
return Optional.of(new HadoopConfJarBean(isContextMode, connection.isUseCustomConfs() && HCParameterUtil.isOverrideHadoopConfs(connection), HCParameterUtil.getHadoopConfSpecificJar(connection, false), HCParameterUtil.getHadoopConfSpecificJar(connection, true), defaultName));
}
}
return Optional.ofNullable(null);
}
use of org.talend.repository.model.hadoopcluster.HadoopClusterConnection in project tbd-studio-se by Talend.
the class HadoopClusterService method isUseDynamicConfJar.
@Override
public boolean isUseDynamicConfJar(String id) {
Item item = getHadoopClusterItemById(id);
if (item instanceof HadoopClusterConnectionItem) {
HadoopClusterConnectionItem hcItem = (HadoopClusterConnectionItem) item;
HadoopClusterConnection hcConnection = (HadoopClusterConnection) hcItem.getConnection();
return hcConnection.isUseCustomConfs() && !ProcessorUtilities.isExportAsOSGI();
}
return false;
}
use of org.talend.repository.model.hadoopcluster.HadoopClusterConnection in project tbd-studio-se by Talend.
the class HadoopClusterService method getSubitemIdsOfHadoopCluster.
@Override
public List<String> getSubitemIdsOfHadoopCluster(Item item) {
if (!isHadoopClusterItem(item)) {
return new ArrayList<>();
}
HadoopClusterConnectionItem clusterConnectionItem = (HadoopClusterConnectionItem) item;
HadoopClusterConnection clusterConnection = (HadoopClusterConnection) clusterConnectionItem.getConnection();
return clusterConnection.getConnectionList();
}
use of org.talend.repository.model.hadoopcluster.HadoopClusterConnection in project tbd-studio-se by Talend.
the class HadoopClusterService method useCustomConfsJarIfNeeded.
@Override
public void useCustomConfsJarIfNeeded(List<ModuleNeeded> modulesNeeded, String clusterId) {
Item item = getHadoopClusterItemById(clusterId);
if (item instanceof HadoopClusterConnectionItem) {
HadoopClusterConnectionItem connectionItem = (HadoopClusterConnectionItem) item;
HadoopClusterConnection connection = (HadoopClusterConnection) connectionItem.getConnection();
if (connection.isUseCustomConfs()) {
Set<String> confsJarNames = HadoopConfsUtils.getConfsJarDefaultNames(connectionItem, true);
Consumer<String> action = null;
if (HCParameterUtil.isOverrideHadoopConfs(connection)) {
action = (confsJarName) -> removeHadoopConfJar(modulesNeeded, confsJarName);
} else {
action = (confsJarName) -> addConfsModule(modulesNeeded, connection, confsJarName);
}
for (String confsJarName : confsJarNames) {
action.accept(confsJarName);
}
}
}
}
Aggregations