public final synchronized ClassLoader getParentClassLoader() { if (parent != null) return parent; createClassLoader(); return parent; }
public final synchronized ClassLoader getParentClassLoader() { if (parent != null) return parent; createClassLoader(); return parent; }
/** * Returns an Enumeration of URLs representing all the resources with * the given name. Only the classloader for this bundle is searched. * * @param name the resource name * @return an Enumeration of URLs for the resources */ Enumeration<URL> findLocalResources(String name) { return createClassLoader().findLocalResources(name); }
/** * This method gets a resource from the bundle. The resource is searched * for in the same manner as it would if it was being loaded from a bundle * (i.e. all hosts, fragments, import, required bundles and * local resources are searched). * * @param name the name of the desired resource. * @return the resulting resource URL or null if it does not exist. */ final URL getResource(String name) { return createClassLoader().getResource(name); }
/** * Finds a resource local to this bundle. Only the classloader for this bundle is searched. * @param name The name of the resource to find. * @return The URL to the resource or null if the resource is not found. */ URL findLocalResource(final String name) { return createClassLoader().findLocalResource(name); }
protected static BaseClassLoader getBundleClassLoader(AbstractBundle bundle) { BundleLoader loader = bundle.getBundleLoader(); if (loader == null) return null; return (BaseClassLoader) loader.createClassLoader(); }
/** * This method gets a resource from the bundle. The resource is searched * for in the same manner as it would if it was being loaded from a bundle * (i.e. all hosts, fragments, import, required bundles and * local resources are searched). * * @param name the name of the desired resource. * @return the resulting resource URL or null if it does not exist. */ final URL getResource(String name) { return createClassLoader().getResource(name); }
/** * Returns an Enumeration of URLs representing all the resources with * the given name. Only the classloader for this bundle is searched. * * @param name the resource name * @return an Enumeration of URLs for the resources */ Enumeration<URL> findLocalResources(String name) { return createClassLoader().findLocalResources(name); }
protected static BaseClassLoader getBundleClassLoader(AbstractBundle bundle) { BundleLoader loader = bundle.getBundleLoader(); if (loader == null) return null; return (BaseClassLoader) loader.createClassLoader(); }
/** * Finds a resource local to this bundle. Only the classloader for this bundle is searched. * @param name The name of the resource to find. * @return The URL to the resource or null if the resource is not found. */ URL findLocalResource(final String name) { return createClassLoader().findLocalResource(name); }
@Override public Collection<String> listResources(String path, String filePattern) { BundleClassLoader bcl = supplier.getBundleLoader().createClassLoader(); return bcl.listLocalResources(path, filePattern, 0); } }
public ClassLoader getClassLoader(Bundle b) { BundleHost host = (BundleHost) b; BundleLoaderProxy lp = host.getLoaderProxy(); BundleLoader bl = (lp == null) ? null : lp.getBasicBundleLoader(); BundleClassLoader cl = (bl == null) ? null : bl.createClassLoader(); return ((cl instanceof ClassLoader) ? (ClassLoader) cl : null); } }
@Override public Collection<String> listResources(String path, String filePattern) { BundleClassLoader bcl = supplier.getBundleLoader().createClassLoader(); return bcl.listLocalResources(path, filePattern, 0); } }
/** * Gets the class loader for the host bundle. This may end up * creating the bundle class loader if it was not already created. * A null value may be returned if the bundle is not resolved. * @return the bundle class loader or null if the bundle is not resolved. */ public ClassLoader getClassLoader() { SecurityManager sm = System.getSecurityManager(); if (sm != null) sm.checkPermission(new RuntimePermission("getClassLoader")); //$NON-NLS-1$ BundleLoaderProxy curProxy = getLoaderProxy(); BundleLoader loader = curProxy == null ? null : curProxy.getBundleLoader(); BundleClassLoader bcl = loader == null ? null : loader.createClassLoader(); return (bcl instanceof ClassLoader) ? (ClassLoader) bcl : null; }
/** * Gets the class loader for the host bundle. This may end up * creating the bundle class loader if it was not already created. * A null value may be returned if the bundle is not resolved. * @return the bundle class loader or null if the bundle is not resolved. */ public ClassLoader getClassLoader() { SecurityManager sm = System.getSecurityManager(); if (sm != null) sm.checkPermission(new RuntimePermission("getClassLoader")); //$NON-NLS-1$ BundleLoaderProxy curProxy = getLoaderProxy(); BundleLoader loader = curProxy == null ? null : curProxy.getBundleLoader(); BundleClassLoader bcl = loader == null ? null : loader.createClassLoader(); return (bcl instanceof ClassLoader) ? (ClassLoader) bcl : null; }
Class<?> findClass(String name, boolean checkParent) throws ClassNotFoundException { ClassLoader parentCL = getParentClassLoader(); if (checkParent && parentCL != null && name.startsWith(JAVA_PACKAGE)) // 1) if startsWith "java." delegate to parent and terminate search // we want to throw ClassNotFoundExceptions if a java.* class cannot be loaded from the parent. return parentCL.loadClass(name); try { if (USE_GLOBAL_DEADLOCK_AVOIDANCE_LOCK) lock(createClassLoader()); return findClassInternal(name, checkParent, parentCL); } finally { if (USE_GLOBAL_DEADLOCK_AVOIDANCE_LOCK) unlock(); } }
private BundleClassLoader getBundleClassLoader() { Object o = BundleDescriptionImpl.this.getUserObject(); if (!(o instanceof BundleLoaderProxy)) { if (o instanceof BundleReference) o = ((BundleReference) o).getBundle(); if (o instanceof BundleHost) o = ((BundleHost) o).getLoaderProxy(); } if (o instanceof BundleLoaderProxy) return ((BundleLoaderProxy) o).getBundleLoader().createClassLoader(); return null; }
private BundleClassLoader getBundleClassLoader() { Object o = BundleDescriptionImpl.this.getUserObject(); if (!(o instanceof BundleLoaderProxy)) { if (o instanceof BundleReference) o = ((BundleReference) o).getBundle(); if (o instanceof BundleHost) o = ((BundleHost) o).getLoaderProxy(); } if (o instanceof BundleLoaderProxy) return ((BundleLoaderProxy) o).getBundleLoader().createClassLoader(); return null; }
private void checkClassLoader() { BundleLoaderProxy proxy = getLoaderProxy(); if (proxy != null && proxy.inUse() && proxy.getBundleLoader() != null) { BundleClassLoader loader = proxy.getBundleLoader().createClassLoader(); loader.getResource("dummy"); //$NON-NLS-1$ } }
private void checkClassLoader() { BundleLoaderProxy proxy = getLoaderProxy(); if (proxy != null && proxy.inUse() && proxy.getBundleLoader() != null) { BundleClassLoader loader = proxy.getBundleLoader().createClassLoader(); loader.getResource("dummy"); //$NON-NLS-1$ } }