public static List<IComponent> filterNeededComponents(
      Item item, RepositoryNode seletetedNode, ERepositoryObjectType type) {
    if (!GlobalServiceRegister.getDefault().isServiceRegistered(IComponentsService.class)) {
      return Collections.emptyList();
    }
    IComponentsService service =
        (IComponentsService)
            GlobalServiceRegister.getDefault().getService(IComponentsService.class);

    Set<IComponent> components = service.getComponentsFactory().getComponents();
    List<IComponent> neededComponents = new ArrayList<IComponent>();
    List<IComponent> exceptedComponents = new ArrayList<IComponent>();

    for (IComponent component : components) {
      //
      for (RepositoryComponentDndFilterSetting dndFilter : getDndFilterSettings()) {
        IRepositoryComponentDndFilter filter = dndFilter.getFilter();
        if (filter == null) {
          continue;
        }
        String repositoryType = filter.getRepositoryType(item, type);
        if (repositoryType == null) {
          continue;
        }
        if (!exceptedComponents.contains(component)
            && filter.except(item, type, seletetedNode, component, repositoryType)) {
          exceptedComponents.add(component);
        }
        // if have been excepted, so no need add it to needed component
        if (!exceptedComponents.contains(component)
            && !neededComponents.contains(component)
            && filter.valid(item, type, seletetedNode, component, repositoryType)) {
          neededComponents.add(component);
        }
      }
    }
    // remove all excepted components
    neededComponents.removeAll(exceptedComponents);

    return sortFilteredComponnents(item, seletetedNode, type, neededComponents);
  }
  private static void init() {
    IExtensionRegistry registry = Platform.getExtensionRegistry();
    IConfigurationElement[] configurationElements =
        registry.getConfigurationElementsFor(
            "org.talend.core.runtime.repositoryComponent_provider"); //$NON-NLS-1$
    List<String> repositoryComponentNames = new ArrayList<String>();
    List<String> dndFilterIds = new ArrayList<String>();
    List<String> componentIds = new ArrayList<String>();

    for (int i = 0; i < configurationElements.length; i++) {
      IConfigurationElement element = configurationElements[i];
      if (element.getName().equals("ExtensionFilter")) { // $NON-NLS-1$
        //
        List<String> filterAttrs =
            getFilterAttrs(
                element,
                "RepositoryComponentFilter", //$NON-NLS-1$
                "repositoryComponentName"); //$NON-NLS-1$
        repositoryComponentNames.addAll(filterAttrs);

        //
        filterAttrs =
            getFilterAttrs(
                element,
                "DragAndDropFilterFilter", //$NON-NLS-1$
                "dndFilterId"); //$NON-NLS-1$
        dndFilterIds.addAll(filterAttrs);

        //
        filterAttrs =
            getFilterAttrs(
                element,
                "SortedComponentFilter", //$NON-NLS-1$
                "componentId"); //$NON-NLS-1$
        componentIds.addAll(filterAttrs);
      }
    }

    for (int i = 0; i < configurationElements.length; i++) {
      IConfigurationElement element = configurationElements[i];
      if (element.getName().equals("RepositoryComponent")) { // $NON-NLS-1$
        String name = element.getAttribute("name"); // $NON-NLS-1$
        if (repositoryComponentNames.contains(name)) {
          continue; // filter
        }
        String type = element.getAttribute("type"); // $NON-NLS-1$
        boolean withSchema =
            Boolean.parseBoolean(element.getAttribute("withSchema")); // $NON-NLS-1$
        String input = element.getAttribute("input"); // $NON-NLS-1$
        String output = element.getAttribute("output"); // $NON-NLS-1$
        String def = element.getAttribute("default"); // $NON-NLS-1$

        IRepositoryComponentAgent agent = null;
        if (element.getAttribute("agent") != null) { // $NON-NLS-1$
          try {
            Object object = element.createExecutableExtension("agent"); // $NON-NLS-1$
            if (object != null && (object instanceof IRepositoryComponentAgent)) {
              agent = (IRepositoryComponentAgent) object;
            }
          } catch (Exception e) {
            //
          }
        }

        RepositoryComponentSetting setting = new RepositoryComponentSetting();
        setting.setName(name);
        setting.setRepositoryType(type);
        setting.setWithSchema(withSchema);
        setting.setInputComponent(input);
        setting.setOutputComponent(output);
        setting.setDefaultComponent(def);
        setting.setClasses(retrieveClasses(element));
        setting.setDbTypes(retrieveDBTypes(element));
        setting.setAgent(agent);

        repComponentSettings.add(setting);
      } else if (element.getName().equals("DragAndDropFilter")) { // $NON-NLS-1$
        String id = element.getAttribute("id"); // $NON-NLS-1$
        if (dndFilterIds.contains(id)) {
          continue; // filter
        }
        String name = element.getAttribute("name"); // $NON-NLS-1$
        int level = parserLevel(element.getAttribute("level")); // $NON-NLS-1$
        IRepositoryComponentDndFilter filter = null;
        try {
          Object object = element.createExecutableExtension("clazz"); // $NON-NLS-1$
          if (object == null || !(object instanceof IRepositoryComponentDndFilter)) {
            throw new IllegalArgumentException("the argument of clazz is wrong"); // $NON-NLS-1$
          }
          filter = (IRepositoryComponentDndFilter) object;
        } catch (Exception e) {
          ExceptionHandler.process(e);
        }

        RepositoryComponentDndFilterSetting dndSetting = new RepositoryComponentDndFilterSetting();

        dndSetting.setId(id);
        dndSetting.setName(name);
        dndSetting.setLevel(level);
        dndSetting.setFilter(filter);

        repComponentDndFilterSettings.add(dndSetting);
      } else if (element.getName().equals("SortedComponents")) { // $NON-NLS-1$

        retrieveSortedComponent(
            componentIds, sortedComponentSetting, element, "Component"); // $NON-NLS-1$
        retrieveSortedComponent(
            componentIds,
            specialSortedComponentSetting,
            element,
            "SpecialComponent"); //$NON-NLS-1$
      }
    }
  }