private static Set<String> traceSecurityDependencies(ClassLoader baseClassLoader) { try { // Trace dependencies for Authorizer class. This will make classes from cdap-security-spi as well as cdap-proto // and other dependencies of cdap-security-spi available to the authorizer extension. return ClassPathResources.getResourcesWithDependencies(baseClassLoader, Authorizer.class); } catch (IOException e) { LOG.error("Failed to determine resources for authorizer class loader while tracing dependencies of " + "Authorizer.", e); return ImmutableSet.of(); } }
/** * Returns a Set of resources name that are visible through the cdap-api module as well as Hadoop classes. * This includes all classes+resources in cdap-api plus all classes+resources that cdap-api * depends on (for example, sl4j, gson, etc). */ private static Set<String> createBaseResources() throws IOException { // Everything should be traceable in the same ClassLoader of this class, which is the CDAP system ClassLoader ClassLoader classLoader = ProgramResources.class.getClassLoader(); // Gather resources information for cdap-api classes // Add everything in cdap-api as visible resources // Trace dependencies for cdap-api classes Set<String> result = ClassPathResources.getResourcesWithDependencies(classLoader, Application.class); // Gather resources for javax.ws.rs classes. They are not traceable from the api classes. Iterables.addAll(result, Iterables.transform(ClassPathResources.getClassPathResources(classLoader, Path.class), ClassPathResources.RESOURCE_INFO_TO_RESOURCE_NAME)); // Gather Hadoop classes and resources getResources(ClassPath.from(classLoader, JAR_ONLY_URI), HADOOP_PACKAGES, EXCLUDE_PACKAGES, ClassPathResources.RESOURCE_INFO_TO_RESOURCE_NAME, result); return Collections.unmodifiableSet(result); }
/** * Returns a Set of resources name that are visible through the cdap-api module as well as Hadoop classes. * This includes all classes+resources in cdap-api plus all classes+resources that cdap-api * depends on (for example, sl4j, gson, etc). */ private static Set<String> createBaseResources() throws IOException { // Everything should be traceable in the same ClassLoader of this class, which is the CDAP system ClassLoader ClassLoader classLoader = ProgramResources.class.getClassLoader(); // Gather resources information for cdap-api classes // Add everything in cdap-api as visible resources // Trace dependencies for cdap-api classes Set<String> result = ClassPathResources.getResourcesWithDependencies(classLoader, Application.class); // Gather resources for javax.ws.rs classes. They are not traceable from the api classes. Iterables.addAll(result, Iterables.transform(ClassPathResources.getClassPathResources(classLoader, Path.class), ClassPathResources.RESOURCE_INFO_TO_RESOURCE_NAME)); // Gather Hadoop classes and resources getResources(ClassPath.from(classLoader, JAR_ONLY_URI), HADOOP_PACKAGES, EXCLUDE_PACKAGES, ClassPathResources.RESOURCE_INFO_TO_RESOURCE_NAME, result); return Collections.unmodifiableSet(result); }