use of org.talend.repository.model.hadoopcluster.HadoopClusterConnectionItem in project tbd-studio-se by Talend.
the class CreateHCatalogAction method hideAction.
@Override
protected boolean hideAction(RepositoryNode node) {
HadoopClusterConnectionItem hcConnectionItem = HCRepositoryUtil.getHCConnectionItemFromRepositoryNode(node);
if (hcConnectionItem != null) {
HadoopClusterConnection hcConnection = (HadoopClusterConnection) hcConnectionItem.getConnection();
// First check if the Distribution is a HD Insight one.
DistributionBean hadoopDistribution = HadoopDistributionsHelper.HADOOP.getDistribution(hcConnection.getDistribution(), false);
if (hadoopDistribution != null) {
IHDistributionVersion hdVersion = hadoopDistribution.getHDVersion(hcConnection.getDfVersion(), false);
if (hdVersion != null && IMicrosoftHDInsightDistribution.DISTRIBUTION_NAME.equals(hdVersion.getDistribution().getName())) {
return false;
}
}
// If not, check if the Distribution implements HCatalogComponent
DistributionBean hcatalogDistribution = HadoopDistributionsHelper.HCATALOG.getDistribution(hcConnection.getDistribution(), false);
if (hcatalogDistribution != null) {
IHDistributionVersion hdVersion = hcatalogDistribution.getHDVersion(hcConnection.getDfVersion(), false);
if (hdVersion != null) {
// found, don't hide
return false;
}
}
}
return true;
}
use of org.talend.repository.model.hadoopcluster.HadoopClusterConnectionItem in project tbd-studio-se by Talend.
the class HadoopClusterService method getHadoopClusterItemById.
@Override
public Item getHadoopClusterItemById(String id) {
HadoopClusterConnectionItem connectionItem = HCRepositoryUtil.getRelativeHadoopClusterItem(id);
if (connectionItem == null) {
// In case it is a hadoopsubconnection.
connectionItem = HCRepositoryUtil.getHadoopClusterItemBySubitemId(id);
if (connectionItem == null) {
Item item = HCRepositoryUtil.getRelativeItem(id);
if (item != null) {
Project project = new Project(ProjectManager.getInstance().getProject(item.getProperty()));
connectionItem = HCRepositoryUtil.getHadoopClusterItemBySubitemId(project, id);
}
}
}
return connectionItem;
}
use of org.talend.repository.model.hadoopcluster.HadoopClusterConnectionItem 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.HadoopClusterConnectionItem 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.HadoopClusterConnectionItem 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;
}
Aggregations