/** * Create a new VFSClassLoaderPolicy. * * @param name a name of the policy * @param roots the roots * @param excludedRoots the excluded roots * @return the classloader policy * @throws IllegalArgumentException for null roots */ public static VFSClassLoaderPolicy createVFSClassLoaderPolicy(String name, VirtualFile[] roots, VirtualFile[] excludedRoots) { return new VFSClassLoaderPolicy(name, roots, excludedRoots); }
@Override protected VFSClassLoaderPolicy determinePolicy() { VFSClassLoaderPolicy policy = VFSClassLoaderPolicy.createVFSClassLoaderPolicy(getContextName(), vfsRoots, excludedRoots); String[] packageNames = getPackageNames(); policy.setExportedPackages(packageNames); policy.setIncluded(getIncluded()); policy.setExcluded(getExcluded()); policy.setExcludedExport(getExcludedExport()); policy.setExportAll(getExportAll()); policy.setImportAll(isImportAll()); policy.setCacheable(isCacheable()); policy.setBlackListable(isBlackListable()); policy.setDelegates(getDelegates()); return policy; }
/** * Initialize the boot libraries using the new classloader * * @return the classloader * @throws Exception for any error */ private ClassLoader initBootLibraries() throws Exception { ClassLoaderSystem system = ClassLoaderSystem.getInstance(); mbeanServer.registerMBean(system, new ObjectName("jboss.classloader:service=ClassLoaderSystem")); List<URL> list = getBootURLs(); VirtualFile[] files = new VirtualFile[list.size()]; for (int i = 0; i < list.size(); ++i) { URL url = list.get(i); files[i] = VFS.getChild(url); } VFSClassLoaderPolicy policy = new VFSClassLoaderPolicy(files); policy.setExportAll(ExportAll.NON_EMPTY); policy.setImportAll(true); ClassLoader classLoader = system.registerClassLoaderPolicy(policy); if (classLoader instanceof RealClassLoader) bootstrapUCLName = ((RealClassLoader) classLoader).getObjectName(); return classLoader; }
@Override protected VFSClassLoaderPolicy determinePolicy() { VirtualFile[] roots = determineVFSRoots(); VFSClassLoaderPolicy policy = VFSClassLoaderPolicy.createVFSClassLoaderPolicy(getContextName(), roots); String[] packageNames = getPackageNames(); policy.setExportedPackages(packageNames); policy.setIncluded(getIncluded()); policy.setExcluded(getExcluded()); policy.setExcludedExport(getExcludedExport()); policy.setExportAll(getExportAll()); policy.setImportAll(isImportAll()); policy.setShutdownPolicy(getShutdownPolicy()); policy.setCacheable(isCacheable()); policy.setBlackListable(isBlackListable()); policy.setDelegates(getDelegates()); return policy; }
/** * Create a new VFSClassLoaderPolicy. * * @param roots the roots * @param excludedRoots the excluded roots * @return the classloader policy * @throws IllegalArgumentException for null roots */ public static VFSClassLoaderPolicy createVFSClassLoaderPolicy(VirtualFile[] roots, VirtualFile[] excludedRoots) { return new VFSClassLoaderPolicy(roots, excludedRoots); }
/** * Create a new VFSClassLoaderPolicy. * * @param roots the roots * @return the classloader policy * @throws IllegalArgumentException for null roots */ public static VFSClassLoaderPolicy createVFSClassLoaderPolicy(VirtualFile... roots) { return new VFSClassLoaderPolicy(roots); }
/** * Create a new VFSClassLoaderPolicy. * * @param name a name of the policy * @param roots the roots * @return the classloader policy * @throws IllegalArgumentException for null roots */ public static VFSClassLoaderPolicy createVFSClassLoaderPolicy(String name, VirtualFile... roots) { return new VFSClassLoaderPolicy(name, roots); }