Search in sources :

Example 1 with IDynamicDistributionPreference

use of org.talend.hadoop.distribution.dynamic.pref.IDynamicDistributionPreference in project tbd-studio-se by Talend.

the class AbstractDependencyResolver method getLatestVersion.

@Override
public String getLatestVersion(String groupId, String artifactId, String baseVersion, String topVersion, IDynamicMonitor monitor) throws Exception {
    IDynamicDistributionPreference preference = configuration.getPreference();
    String remoteRepositoryUrl = preference.getRepository();
    String username = null;
    String password = null;
    if (!preference.isAnonymous()) {
        username = preference.getUsername();
        password = preference.getPassword();
    }
    String localRepositoryPath = getLocalRepositoryPath();
    return DynamicDistributionAetherUtils.getHighestVersion(remoteRepositoryUrl, username, password, localRepositoryPath, groupId, artifactId, null, null, monitor);
}
Also used : IDynamicDistributionPreference(org.talend.hadoop.distribution.dynamic.pref.IDynamicDistributionPreference)

Example 2 with IDynamicDistributionPreference

use of org.talend.hadoop.distribution.dynamic.pref.IDynamicDistributionPreference in project tbd-studio-se by Talend.

the class AbstractDependencyResolver method listHadoopVersions.

@Override
public List<String> listHadoopVersions(String baseVersion, String topVersion, IDynamicMonitor monitor) throws Exception {
    // $NON-NLS-1$
    String groupId = "org.apache.hadoop";
    // $NON-NLS-1$
    String artifactId = "hadoop-client";
    DynamicConfiguration configuration = getConfiguration();
    IDynamicDistributionPreference preference = configuration.getPreference();
    String remoteRepositoryUrl = preference.getRepository();
    String username = null;
    String password = null;
    if (!preference.isAnonymous()) {
        username = preference.getUsername();
        password = preference.getPassword();
    }
    String localRepositoryPath = getLocalRepositoryPath();
    List<String> versionRange = DynamicDistributionAetherUtils.versionRange(remoteRepositoryUrl, username, password, localRepositoryPath, groupId, artifactId, baseVersion, topVersion, monitor);
    return getCleanHadoopVersion(versionRange);
}
Also used : IDynamicDistributionPreference(org.talend.hadoop.distribution.dynamic.pref.IDynamicDistributionPreference) DynamicConfiguration(org.talend.hadoop.distribution.dynamic.DynamicConfiguration)

Example 3 with IDynamicDistributionPreference

use of org.talend.hadoop.distribution.dynamic.pref.IDynamicDistributionPreference in project tbd-studio-se by Talend.

the class AbstractDependencyResolver method getDependencyVersionByHadoopVersion.

@Override
public String getDependencyVersionByHadoopVersion(String groupId, String artifactId, IDynamicMonitor monitor) throws Exception {
    DynamicConfiguration configuration = getConfiguration();
    String distributionVersion = configuration.getVersion();
    IDynamicDistributionPreference preference = configuration.getPreference();
    String remoteRepositoryUrl = preference.getRepository();
    String username = null;
    String password = null;
    if (!preference.isAnonymous()) {
        username = preference.getUsername();
        password = preference.getPassword();
    }
    String localRepositoryPath = getLocalRepositoryPath();
    List<String> versionRange = DynamicDistributionAetherUtils.versionRange(remoteRepositoryUrl, username, password, localRepositoryPath, groupId, artifactId, null, null, monitor);
    String dependencyVersion = getVersionByHadoopVersion(versionRange, distributionVersion);
    return dependencyVersion;
}
Also used : IDynamicDistributionPreference(org.talend.hadoop.distribution.dynamic.pref.IDynamicDistributionPreference) DynamicConfiguration(org.talend.hadoop.distribution.dynamic.DynamicConfiguration)

Example 4 with IDynamicDistributionPreference

use of org.talend.hadoop.distribution.dynamic.pref.IDynamicDistributionPreference in project tbd-studio-se by Talend.

the class DynamicDistributionManager method getPreferencePaths.

@Override
public Collection<String> getPreferencePaths() {
    if (dynamicDistributionPreferencePaths.isEmpty()) {
        try {
            ProjectManager pm = ProjectManager.getInstance();
            List<Project> allProjects = new ArrayList<>();
            List<Project> allReferenceProjects = pm.getAllReferencedProjects();
            if (allReferenceProjects != null && !allReferenceProjects.isEmpty()) {
                allProjects.addAll(allReferenceProjects);
            }
            allProjects.add(pm.getCurrentProject());
            List<IDynamicDistributionsGroup> groups = getDynamicDistributionsGroups();
            for (Project project : allProjects) {
                for (IDynamicDistributionsGroup distributionGroup : groups) {
                    try {
                        IDynamicDistributionPreference preference = distributionGroup.getDynamicDistributionPreference(project);
                        String preferencePath = preference.getPreferencePath();
                        if (StringUtils.isNotEmpty(preferencePath)) {
                            dynamicDistributionPreferencePaths.add(preferencePath);
                        }
                    } catch (Exception e) {
                        ExceptionHandler.process(e);
                    }
                }
            }
        } catch (Exception e) {
            ExceptionHandler.process(e);
        }
    }
    return dynamicDistributionPreferencePaths;
}
Also used : IProject(org.eclipse.core.resources.IProject) Project(org.talend.core.model.general.Project) IDynamicDistributionPreference(org.talend.hadoop.distribution.dynamic.pref.IDynamicDistributionPreference) ArrayList(java.util.ArrayList) ProjectManager(org.talend.repository.ProjectManager)

Example 5 with IDynamicDistributionPreference

use of org.talend.hadoop.distribution.dynamic.pref.IDynamicDistributionPreference in project tbd-studio-se by Talend.

the class DynamicDistributionPreferenceForm method loadRepositorySetupGroup.

private void loadRepositorySetupGroup() throws Exception {
    IDynamicDistributionsGroup selectedSetupDistriGroup = getSelectedSetupDynamicDistriGroup();
    if (selectedSetupDistriGroup != null) {
        IDynamicDistributionPreference dynamicDistributionPreference = selectedSetupDistriGroup.getDynamicDistributionPreference(ProjectManager.getInstance().getCurrentProject());
        boolean overrideDefaultSetup = dynamicDistributionPreference.overrideDefaultSetup();
        String repositoryUrl = dynamicDistributionPreference.getRepository();
        boolean isAnonymous = dynamicDistributionPreference.isAnonymous();
        String username = dynamicDistributionPreference.getUsername();
        String password = dynamicDistributionPreference.getPassword();
        overrideDefaultSetupBtn.setSelection(overrideDefaultSetup);
        repositoryText.setText(repositoryUrl);
        anonymousBtn.setSelection(isAnonymous);
        userText.setText(username);
        passwordText.setText(password);
    } else {
        // exception case, disable all
        overrideDefaultSetupBtn.setEnabled(false);
        enableRepositoryText(false);
        anonymousBtn.setEnabled(false);
        enableUserPassword(false);
    }
}
Also used : IDynamicDistributionPreference(org.talend.hadoop.distribution.dynamic.pref.IDynamicDistributionPreference) IDynamicDistributionsGroup(org.talend.hadoop.distribution.dynamic.IDynamicDistributionsGroup)

Aggregations

IDynamicDistributionPreference (org.talend.hadoop.distribution.dynamic.pref.IDynamicDistributionPreference)12 IDynamicDistributionsGroup (org.talend.hadoop.distribution.dynamic.IDynamicDistributionsGroup)4 LoginException (org.talend.commons.exception.LoginException)2 PersistenceException (org.talend.commons.exception.PersistenceException)2 Project (org.talend.core.model.general.Project)2 IDynamicPlugin (org.talend.core.runtime.dynamic.IDynamicPlugin)2 IDynamicPluginConfiguration (org.talend.core.runtime.dynamic.IDynamicPluginConfiguration)2 DynamicConfiguration (org.talend.hadoop.distribution.dynamic.DynamicConfiguration)2 DynamicPluginAdapter (org.talend.hadoop.distribution.dynamic.adapter.DynamicPluginAdapter)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 ArrayList (java.util.ArrayList)1 IProject (org.eclipse.core.resources.IProject)1 Bundle (org.osgi.framework.Bundle)1 DependencyNode (org.talend.designer.maven.aether.node.DependencyNode)1 VersionNotFoundException (org.talend.hadoop.distribution.dynamic.VersionNotFoundException)1 IDynamicDistributionTemplate (org.talend.hadoop.distribution.dynamic.template.IDynamicDistributionTemplate)1 ProjectManager (org.talend.repository.ProjectManager)1