use of org.talend.hadoop.distribution.dynamic.resolver.IDependencyResolver in project tbd-studio-se by Talend.
the class DynamicDistributionManager method getDependencyResolver.
public IDependencyResolver getDependencyResolver(DynamicConfiguration config) throws Exception {
String distribution = config.getDistribution();
IDynamicDistributionsGroup dynamicDistributionGroup = getDynamicDistributionGroup(distribution);
IDependencyResolver resolver = null;
if (dynamicDistributionGroup != null) {
resolver = dynamicDistributionGroup.getDependencyResolver(config);
}
if (resolver == null) {
throw new Exception("Can't find DependencyResolver for " + distribution);
}
return resolver;
}
use of org.talend.hadoop.distribution.dynamic.resolver.IDependencyResolver in project tbd-studio-se by Talend.
the class AbstractDynamicDistributionsGroup method buildAllVersionList.
private List<String> buildAllVersionList(IDynamicMonitor monitor) throws Exception {
Set<String> allVersion = new HashSet<>();
DynamicDistributionManager dynamicDistributionManager = DynamicDistributionManager.getInstance();
DynamicConfiguration dynamicConfiguration = new DynamicConfiguration();
dynamicConfiguration.setDistribution(getDistribution());
IDependencyResolver dependencyResolver = dynamicDistributionManager.getDependencyResolver(dynamicConfiguration);
List<String> allHadoopVersions = dependencyResolver.listHadoopVersions(null, null, monitor);
if (allHadoopVersions != null) {
allVersion.addAll(allHadoopVersions);
}
List<String> versionList = new LinkedList<>(allVersion);
Collections.sort(versionList, Collections.reverseOrder(new VersionStringComparator()));
return new ArrayList<>(versionList);
}
use of org.talend.hadoop.distribution.dynamic.resolver.IDependencyResolver in project tbd-studio-se by Talend.
the class DynamicDistributionPreferenceForm method addListeners.
private void addListeners() {
if (ITalendCorePrefConstants.DYNAMIC_DISTRIBUTION_SETTING == showPart) {
distributionCombo.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
refreshVersionList(new DummyDynamicMonitor());
updateButtons();
}
});
versionCombo.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
updateButtons();
}
});
buildConfigBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
try {
IStructuredSelection selection = (IStructuredSelection) distributionCombo.getSelection();
if (selection == null) {
ExceptionHandler.process(new Exception(// $NON-NLS-1$
Messages.getString("DynamicDistributionPreferenceForm.exception.noDistributionSelected")));
return;
}
String distribution = (String) selection.getFirstElement();
if (distribution == null) {
ExceptionHandler.process(new Exception(// $NON-NLS-1$
Messages.getString("DynamicDistributionPreferenceForm.exception.noDistributionSelected")));
return;
}
IDynamicDistributionsGroup dynamicDistributionsGroup = DynamicDistributionManager.getInstance().getDynamicDistributionGroup(distribution);
DynamicDistributionSetupData configData = new DynamicDistributionSetupData();
configData.setDynamicDistributionsGroup(dynamicDistributionsGroup);
DynamicDistributionSetupWizard wizard = new DynamicDistributionSetupWizard(configData);
WizardDialog wizardDialog = new WizardDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), wizard);
wizardDialog.setMinimumPageSize(600, 400);
wizardDialog.create();
if (wizardDialog.open() == IDialogConstants.OK_ID) {
// nothing to do
}
IDynamicMonitor monitor = new DummyDynamicMonitor();
refreshVersionList(monitor);
} catch (Throwable ex) {
ExceptionHandler.process(ex);
}
updateButtons();
}
});
deleteBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
onDeleteBtnPressed();
updateButtons();
}
});
} else {
setupDistriCombo.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
try {
loadRepositorySetupGroup();
} catch (Exception e) {
ExceptionHandler.process(e);
}
updateButtons();
}
});
overrideDefaultSetupBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
updateButtons();
}
});
repositoryText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
String newRepositoryText = repositoryText.getText();
if (StringUtils.equals(newRepositoryText, repositoryUrlCache)) {
return;
}
repositoryUrlCache = newRepositoryText;
updateButtons();
}
});
anonymousBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
updateButtons();
}
});
userText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
String newUsername = userText.getText();
if (StringUtils.equals(newUsername, usernameCache)) {
return;
}
usernameCache = newUsername;
updateButtons();
}
});
passwordText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
String newPassword = passwordText.getText();
if (StringUtils.equals(newPassword, passwordCache)) {
return;
}
passwordCache = newPassword;
updateButtons();
}
});
checkConnectionBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (!isComplete()) {
return;
}
TypedReturnCode tc = new TypedReturnCode();
try {
IDynamicDistributionsGroup distriGroup = getSelectedSetupDynamicDistriGroup();
DynamicConfiguration dynamicConfiguration = new DynamicConfiguration();
dynamicConfiguration.setDistribution(distriGroup.getDistribution());
IDependencyResolver dependencyResolver = distriGroup.getDependencyResolver(dynamicConfiguration);
tc = dependencyResolver.checkConnection(repositoryText.getText(), userText.getText(), passwordText.getText());
} catch (Exception e1) {
ExceptionHandler.process(e1);
tc.setOk(false);
tc.setMessage(e1.getMessage());
}
showCheckConnectionInformation(true, tc);
}
});
}
}
use of org.talend.hadoop.distribution.dynamic.resolver.IDependencyResolver in project tbd-studio-se by Talend.
the class AbstractDynamicDistribution method getCompatibleVersions.
@Override
public List<String> getCompatibleVersions(IDynamicMonitor monitor) throws Exception {
Set<String> allCompatibleVersion = new HashSet<>();
List<TemplateBean> templates = getTemplates(monitor);
if (templates != null) {
DynamicDistributionUtils.checkCancelOrNot(monitor);
templateBeanCompatibleVersionMap = new HashMap<>();
DynamicDistributionManager dynamicDistributionManager = DynamicDistributionManager.getInstance();
DynamicConfiguration dynamicConfiguration = new DynamicConfiguration();
dynamicConfiguration.setDistribution(getDistributionName());
IDependencyResolver dependencyResolver = dynamicDistributionManager.getDependencyResolver(dynamicConfiguration);
List<String> allHadoopVersions = dependencyResolver.listHadoopVersions(null, null, monitor);
if (allHadoopVersions != null) {
for (TemplateBean templateBean : templates) {
DynamicDistributionUtils.checkCancelOrNot(monitor);
String baseVersion = templateBean.getBaseVersion();
String topVersion = templateBean.getTopVersion();
// $NON-NLS-1$
String versionRange = "[";
if (StringUtils.isEmpty(baseVersion)) {
// $NON-NLS-1$
versionRange = versionRange + "0";
} else {
versionRange = versionRange + baseVersion;
}
// $NON-NLS-1$
versionRange = versionRange + ",";
if (StringUtils.isNotEmpty(topVersion)) {
versionRange = versionRange + topVersion;
}
// $NON-NLS-1$
versionRange = versionRange + ")";
List<String> filteredVersions = DynamicDistributionAetherUtils.filterVersions(allHadoopVersions, versionRange);
if (filteredVersions != null && !filteredVersions.isEmpty()) {
allCompatibleVersion.addAll(filteredVersions);
templateBeanCompatibleVersionMap.put(templateBean, filteredVersions);
}
}
}
}
List<String> compatibleVersionList = new LinkedList<>(allCompatibleVersion);
Collections.sort(compatibleVersionList, Collections.reverseOrder(new VersionStringComparator()));
return compatibleVersionList;
}
use of org.talend.hadoop.distribution.dynamic.resolver.IDependencyResolver in project tbd-studio-se by Talend.
the class AbstractDynamicDistribution method getAllVersions.
@Override
public List<String> getAllVersions(IDynamicMonitor monitor) throws Exception {
Set<String> allVersion = new HashSet<>();
DynamicDistributionManager dynamicDistributionManager = DynamicDistributionManager.getInstance();
DynamicConfiguration dynamicConfiguration = new DynamicConfiguration();
dynamicConfiguration.setDistribution(getDistributionName());
IDependencyResolver dependencyResolver = dynamicDistributionManager.getDependencyResolver(dynamicConfiguration);
List<String> allHadoopVersions = dependencyResolver.listHadoopVersions(null, null, monitor);
if (allHadoopVersions != null) {
allVersion.addAll(allHadoopVersions);
}
List<String> versionList = new LinkedList<>(allVersion);
Collections.sort(versionList, Collections.reverseOrder(new VersionStringComparator()));
return versionList;
}
Aggregations