Пример #1
0
 private Category buildCategory(Element element, boolean flag) {
   if (!flag) {
     return Category.PRIVATE; // was UNDEFINED
   } else {
     final String value = ElementHelper.getAttribute(element, "tag", "private");
     return Category.valueOf(value.toUpperCase());
   }
 }
Пример #2
0
  /**
   * Construct an array of resources based on the RUNTIME scoped dependencies associated with the
   * supplied category. The implementation builds a list of all preceeding categories as a basis for
   * filtering the returned list ensuring no duplicate references are returned.
   *
   * @param category the runtime classloader category
   * @return the array of resources the define a classloader for the category
   */
  private DefaultResource[] getClasspathDefaultProviders(final Category category) {
    ArrayList<DefaultResource> list = new ArrayList<DefaultResource>();
    for (int i = 0; i < category.ordinal(); i++) {
      Category c = Category.valueOf(i);
      DefaultResource[] collection = getDefaultProviders(Scope.RUNTIME, true, c);
      for (int j = 0; j < collection.length; j++) {
        list.add(collection[j]);
      }
    }
    DefaultResource[] resources = getDefaultProviders(Scope.RUNTIME, true, category);
    ArrayList<DefaultResource> stack = new ArrayList<DefaultResource>();
    for (int i = 0; i < resources.length; i++) {
      DefaultResource resource = resources[i];
      if (resource.isa("jar") && !list.contains(resource)) {
        stack.add(resource);
      }
    }

    return stack.toArray(new DefaultResource[0]);
  }