use of org.talend.hadoop.distribution.model.DistributionBean in project tbd-studio-se by Talend.
the class DistributionsManager method getDistributionsDelegate.
Map<String, DistributionBean> getDistributionsDelegate() {
if (getServiceName() == null) {
return new HashMap<String, DistributionBean>();
}
final ComponentType type = getComponentType();
// We retrieve all the implementations of the HadoopComponent service.
BundleContext bc = getBundleContext();
Collection<ServiceReference<? extends HadoopComponent>> distributions = new LinkedList<>();
try {
Class<? extends HadoopComponent> clazz = (Class<? extends HadoopComponent>) Class.forName(getServiceName());
distributions.addAll(bc.getServiceReferences(clazz, null));
} catch (InvalidSyntaxException | ClassNotFoundException e) {
CommonExceptionHandler.process(e);
return new HashMap<String, DistributionBean>();
}
Map<String, DistributionBean> disctributionsMap = new HashMap<>();
for (ServiceReference<? extends HadoopComponent> sr : distributions) {
addDistribution(bc, disctributionsMap, type, sr);
}
return disctributionsMap;
}
use of org.talend.hadoop.distribution.model.DistributionBean in project tbd-studio-se by Talend.
the class CreateHDFSAction method hideAction.
@Override
protected boolean hideAction(RepositoryNode node) {
HadoopClusterConnectionItem hcConnectionItem = HCRepositoryUtil.getHCConnectionItemFromRepositoryNode(node);
if (hcConnectionItem != null) {
HadoopClusterConnection hcConnection = (HadoopClusterConnection) hcConnectionItem.getConnection();
DistributionBean hdfsDistribution = HadoopDistributionsHelper.HDFS.getDistribution(hcConnection.getDistribution(), false);
if (hdfsDistribution != null) {
if (hdfsDistribution.getDisplayName() == EHadoopDistributions.GOOGLE_CLOUD_DATAPROC.getDisplayName()) {
return true;
}
IHDistributionVersion hdVersion = hdfsDistribution.getHDVersion(hcConnection.getDfVersion(), false);
if (hdVersion != null) {
// found, don't hide
return false;
}
}
}
return true;
}
use of org.talend.hadoop.distribution.model.DistributionBean in project tbd-studio-se by Talend.
the class CreateMaprdbAction method hideAction.
@Override
protected boolean hideAction(RepositoryNode node) {
HadoopClusterConnectionItem hcConnectionItem = HCRepositoryUtil.getHCConnectionItemFromRepositoryNode(node);
if (hcConnectionItem != null) {
HadoopClusterConnection hcConnection = (HadoopClusterConnection) hcConnectionItem.getConnection();
DistributionBean maprdbDistribution = HadoopDistributionsHelper.MAPRDB.getDistribution(hcConnection.getDistribution(), false);
if (maprdbDistribution != null) {
IHDistributionVersion hdVersion = maprdbDistribution.getHDVersion(hcConnection.getDfVersion(), false);
if (hdVersion != null) {
// found, don't hide
if (GlobalServiceRegister.getDefault().isServiceRegistered(IHadoopDistributionService.class)) {
IHadoopDistributionService hadoopService = (IHadoopDistributionService) GlobalServiceRegister.getDefault().getService(IHadoopDistributionService.class);
if (hadoopService != null) {
return !hadoopService.doSupportMapRTicket(hdVersion);
}
}
}
}
}
return true;
}
use of org.talend.hadoop.distribution.model.DistributionBean in project tbd-studio-se by Talend.
the class HadoopSubMultiRepTypeProcessor method isValidAttributes.
private boolean isValidAttributes(RepositoryNode node) {
if (node == null) {
return true;
}
if (attributesMap != null && !attributesMap.isEmpty()) {
HadoopClusterConnection hcConnection = HCRepositoryUtil.getRelativeHadoopClusterConnection(node.getId());
if (hcConnection != null) {
IElement elem = (IElement) attributesMap.get(ELEMENT);
DistributionBean hadoopDistribution = HadoopDistributionsHelper.HADOOP.getDistribution(hcConnection.getDistribution(), false);
if (hadoopDistribution != null) {
DistributionVersion distributionVersion = hadoopDistribution.getVersion(hcConnection.getDfVersion(), false);
if (distributionVersion != null && distributionVersion.hadoopComponent != null) {
boolean validated = true;
Object isSpark = attributesMap.get(ISSPARK);
if (isSpark != null && Boolean.valueOf(isSpark.toString())) {
validated = (validated && distributionVersion.hadoopComponent instanceof SparkComponent);
if (!validated) {
return false;
}
}
Object useYarn = attributesMap.get(USEYARN);
if (useYarn != null && Boolean.valueOf(useYarn.toString())) {
// CustomDistribution.doSupportSparkYarnClusterMode = true
if (ICustomDistribution.DISTRIBUTION_NAME.equals(distributionVersion.hadoopComponent.getDistribution())) {
validated = true;
} else {
validated = (validated && (distributionVersion.hadoopComponent.isHadoop2() || distributionVersion.hadoopComponent.isHadoop3()));
}
if (!validated) {
return false;
}
}
}
}
}
}
return true;
}
use of org.talend.hadoop.distribution.model.DistributionBean in project tbd-studio-se by Talend.
the class CreateHiveAction method hideAction.
@Override
protected boolean hideAction(RepositoryNode node) {
HadoopClusterConnectionItem hcConnectionItem = HCRepositoryUtil.getHCConnectionItemFromRepositoryNode(node);
if (hcConnectionItem != null) {
HadoopClusterConnection hcConnection = (HadoopClusterConnection) hcConnectionItem.getConnection();
DistributionBean hiveDistribution = HadoopDistributionsHelper.HIVE.getDistribution(hcConnection.getDistribution(), false);
if (hiveDistribution != null) {
IHDistributionVersion hdVersion = hiveDistribution.getHDVersion(hcConnection.getDfVersion(), false);
if (hdVersion != null && !IMicrosoftHDInsightDistribution.DISTRIBUTION_NAME.equals(hdVersion.getDistribution().getName())) {
// found and not HD Insight, don't hide
return false;
}
}
}
return true;
}
Aggregations