Fix Bug USV-43 : NEW-7: Uniserv Metdata:ClassNotFoundExeption by creating the new Uniserv connection

https://jira.talendforge.org/browse/USV-43
fixed the bug by using Eclipse Extension point APIs

git-svn-id: http://talendforge.org/svn/tos/trunk@94808 f6f1c999-d317-4740-80b0-e6d1abc6f99e
This commit is contained in:
sgandon
2012-12-04 14:47:38 +00:00
parent f43ca54077
commit 7ec828c9aa

View File

@@ -20,9 +20,12 @@ import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.eclipse.core.runtime.ContributorFactoryOSGi;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IContributor;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.Platform;
import org.osgi.framework.Bundle;
import org.talend.commons.ui.runtime.exception.ExceptionHandler;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.database.EDatabaseTypeName;
@@ -63,18 +66,21 @@ public final class RepositoryComponentManager {
// sort by level
Collections.sort(repComponentDndFilterSettings, new Comparator<RepositoryComponentDndFilterSetting>() {
@Override
public int compare(RepositoryComponentDndFilterSetting o1, RepositoryComponentDndFilterSetting o2) {
return o1.getLevel() - o2.getLevel();
}
});
Collections.sort(sortedComponentSetting, new Comparator<SortedComponentSetting>() {
@Override
public int compare(SortedComponentSetting o1, SortedComponentSetting o2) {
return o1.getLevel() - o2.getLevel();
}
});
Collections.sort(specialSortedComponentSetting, new Comparator<SortedComponentSetting>() {
@Override
public int compare(SortedComponentSetting o1, SortedComponentSetting o2) {
return o1.getLevel() - o2.getLevel();
}
@@ -89,8 +95,7 @@ public final class RepositoryComponentManager {
List<String> dndFilterIds = new ArrayList<String>();
List<String> componentIds = new ArrayList<String>();
for (int i = 0; i < configurationElements.length; i++) {
IConfigurationElement element = configurationElements[i];
for (IConfigurationElement element : configurationElements) {
if (element.getName().equals("ExtensionFilter")) { //$NON-NLS-1$
//
List<String> filterAttrs = getFilterAttrs(element, "RepositoryComponentFilter", //$NON-NLS-1$
@@ -109,8 +114,7 @@ public final class RepositoryComponentManager {
}
}
for (int i = 0; i < configurationElements.length; i++) {
IConfigurationElement element = configurationElements[i];
for (IConfigurationElement element : configurationElements) {
if (element.getName().equals("RepositoryComponent")) { //$NON-NLS-1$
String name = element.getAttribute("name"); //$NON-NLS-1$
if (repositoryComponentNames.contains(name)) {
@@ -190,7 +194,9 @@ public final class RepositoryComponentManager {
for (IConfigurationElement ce : children) {
String className = ce.getAttribute("clazz"); //$NON-NLS-1$
try {
Class clazz = Class.forName(className);
IContributor contributor = ce.getContributor();
Bundle bundle = ContributorFactoryOSGi.resolve(contributor);
Class clazz = bundle.loadClass(className);
list.add(clazz);
} catch (ClassNotFoundException e) {
ExceptionHandler.process(e);