Search in sources :

Example 11 with HadoopClusterConnectionItem

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;
}
Also used : IHDistributionVersion(org.talend.core.runtime.hd.IHDistributionVersion) HadoopClusterConnection(org.talend.repository.model.hadoopcluster.HadoopClusterConnection) HadoopClusterConnectionItem(org.talend.repository.model.hadoopcluster.HadoopClusterConnectionItem) DistributionBean(org.talend.hadoop.distribution.model.DistributionBean)

Example 12 with HadoopClusterConnectionItem

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;
}
Also used : ContextItem(org.talend.core.model.properties.ContextItem) HadoopClusterConnectionItem(org.talend.repository.model.hadoopcluster.HadoopClusterConnectionItem) Item(org.talend.core.model.properties.Item) DatabaseConnectionItem(org.talend.core.model.properties.DatabaseConnectionItem) HadoopSubConnectionItem(org.talend.repository.model.hadoopcluster.HadoopSubConnectionItem) ConnectionItem(org.talend.core.model.properties.ConnectionItem) Project(org.talend.core.model.general.Project) HadoopClusterConnectionItem(org.talend.repository.model.hadoopcluster.HadoopClusterConnectionItem)

Example 13 with HadoopClusterConnectionItem

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;
}
Also used : IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) PersistenceException(org.talend.commons.exception.PersistenceException) HadoopClusterConnection(org.talend.repository.model.hadoopcluster.HadoopClusterConnection) HadoopClusterConnectionItem(org.talend.repository.model.hadoopcluster.HadoopClusterConnectionItem)

Example 14 with HadoopClusterConnectionItem

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);
}
Also used : ContextType(org.talend.designer.core.model.utils.emf.talendfile.ContextType) HadoopClusterConnection(org.talend.repository.model.hadoopcluster.HadoopClusterConnection) HadoopClusterConnectionItem(org.talend.repository.model.hadoopcluster.HadoopClusterConnectionItem) HadoopConfJarBean(org.talend.core.hadoop.HadoopConfJarBean)

Example 15 with HadoopClusterConnectionItem

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;
}
Also used : ContextItem(org.talend.core.model.properties.ContextItem) HadoopClusterConnectionItem(org.talend.repository.model.hadoopcluster.HadoopClusterConnectionItem) Item(org.talend.core.model.properties.Item) DatabaseConnectionItem(org.talend.core.model.properties.DatabaseConnectionItem) HadoopSubConnectionItem(org.talend.repository.model.hadoopcluster.HadoopSubConnectionItem) ConnectionItem(org.talend.core.model.properties.ConnectionItem) HadoopClusterConnection(org.talend.repository.model.hadoopcluster.HadoopClusterConnection) HadoopClusterConnectionItem(org.talend.repository.model.hadoopcluster.HadoopClusterConnectionItem)

Aggregations

HadoopClusterConnectionItem (org.talend.repository.model.hadoopcluster.HadoopClusterConnectionItem)39 HadoopClusterConnection (org.talend.repository.model.hadoopcluster.HadoopClusterConnection)28 DatabaseConnectionItem (org.talend.core.model.properties.DatabaseConnectionItem)11 HadoopSubConnectionItem (org.talend.repository.model.hadoopcluster.HadoopSubConnectionItem)10 Item (org.talend.core.model.properties.Item)9 ConnectionItem (org.talend.core.model.properties.ConnectionItem)7 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)6 DistributionBean (org.talend.hadoop.distribution.model.DistributionBean)6 ContextItem (org.talend.core.model.properties.ContextItem)5 IHDistributionVersion (org.talend.core.runtime.hd.IHDistributionVersion)5 Test (org.junit.Test)4 PersistenceException (org.talend.commons.exception.PersistenceException)4 Project (org.talend.core.model.general.Project)4 IProxyRepositoryFactory (org.talend.repository.model.IProxyRepositoryFactory)4 ArrayList (java.util.ArrayList)3 DatabaseConnection (org.talend.core.model.metadata.builder.connection.DatabaseConnection)3 Property (org.talend.core.model.properties.Property)3 HashSet (java.util.HashSet)2 Path (org.eclipse.core.runtime.Path)2 Connection (org.talend.core.model.metadata.builder.connection.Connection)2