/** * Finds a local resource by searching the ClasspathEntry objects of the classpath manager. * This method will first call all the configured class loading hooks * {@link ClassLoaderHook#preFindLocalResource(String, ClasspathManager)} methods. Then it * will search for the resource. Finally it will call all the configured class loading hooks * {@link ClassLoaderHook#postFindLocalResource(String, URL, ClasspathManager)} methods. * @param resource the requested resource name. * @return the requested resource URL or null if the resource does not exist */ public URL findLocalResource(String resource) { List<ClassLoaderHook> hooks = hookRegistry.getClassLoaderHooks(); for (ClassLoaderHook hook : hooks) { hook.preFindLocalResource(resource, this); } URL result = null; try { result = findLocalResourceImpl(resource, -1); return result; } finally { for (ClassLoaderHook hook : hooks) { hook.postFindLocalResource(resource, result, this); } } }
/** * Finds a local resource by searching the ClasspathEntry objects of the classpath manager. * This method will first call all the configured class loading hooks * {@link ClassLoaderHook#preFindLocalResource(String, ClasspathManager)} methods. Then it * will search for the resource. Finally it will call all the configured class loading hooks * {@link ClassLoaderHook#postFindLocalResource(String, URL, ClasspathManager)} methods. * @param resource the requested resource name. * @return the requested resource URL or null if the resource does not exist */ public URL findLocalResource(String resource) { List<ClassLoaderHook> hooks = hookRegistry.getClassLoaderHooks(); for (ClassLoaderHook hook : hooks) { hook.preFindLocalResource(resource, this); } URL result = null; try { result = findLocalResourceImpl(resource, -1); return result; } finally { for (ClassLoaderHook hook : hooks) { hook.postFindLocalResource(resource, result, this); } } }
/** * Finds a local resource by searching the ClasspathEntry objects of the classpath manager. * This method will first call all the configured class loading stats hooks * {@link ClassLoaderHook#preFindLocalResource(String, ClasspathManager)} methods. Then it * will search for the resource. Finally it will call all the configured class loading stats hooks * {@link ClassLoaderHook#postFindLocalResource(String, URL, ClasspathManager)} methods. * @param resource the requested resource name. * @return the requested resource URL or null if the resource does not exist */ public URL findLocalResource(String resource) { List<ClassLoaderHook> hooks = hookRegistry.getClassLoaderHooks(); for (ClassLoaderHook hook : hooks) { hook.preFindLocalResource(resource, this); } URL result = null; try { result = findLocalResourceImpl(resource, -1); return result; } finally { for (ClassLoaderHook hook : hooks) { hook.postFindLocalResource(resource, result, this); } } }
private Class<?> findLocalClassImpl(String classname, List<ClassLoaderHook> hooks) throws ClassNotFoundException { Class<?> result; // look in hook specific entries if any for (ClassLoaderHook hook : hookRegistry.getClassLoaderHooks()) { ClasspathEntry[] hookEntries = hook.getClassPathEntries(classname, this); if (hookEntries != null) { return findLocalClassImpl(classname, hookEntries, hooks); } } // look in classpath entries result = findLocalClassImpl(classname, entries, hooks); if (result != null) { return result; } // look in fragment entries for (FragmentClasspath fragCP : getFragmentClasspaths()) { result = findLocalClassImpl(classname, fragCP.getEntries(), hooks); if (result != null) { return result; } } throw new ClassNotFoundException(classname); }
private String findLibrary0(String libname) { String path = null; List<ClassLoaderHook> hooks = generation.getBundleInfo().getStorage().getConfiguration().getHookRegistry().getClassLoaderHooks(); for (ClassLoaderHook hook : hooks) { path = hook.findLocalLibrary(generation, libname); if (path != null) { return path; } } String mappedName = System.mapLibraryName(libname); String[] altMappedNames = mapLibraryNames(mappedName); // first check Bundle-NativeCode header path = findBundleNativeCode(libname, mappedName, altMappedNames); // next check eclipse specific support return path != null ? path : findEclipseNativeCode(libname, mappedName, altMappedNames); }
private String findLibrary0(String libname) { String path = null; List<ClassLoaderHook> hooks = generation.getBundleInfo().getStorage().getConfiguration().getHookRegistry().getClassLoaderHooks(); for (ClassLoaderHook hook : hooks) { path = hook.findLocalLibrary(generation, libname); if (path != null) { return path; } } String mappedName = System.mapLibraryName(libname); String[] altMappedNames = mapLibraryNames(mappedName); // first check Bundle-NativeCode header path = findBundleNativeCode(libname, mappedName, altMappedNames); // next check eclipse specific support return path != null ? path : findEclipseNativeCode(libname, mappedName, altMappedNames); }
private String findLibrary0(String libname) { String path = null; List<ClassLoaderHook> hooks = generation.getBundleInfo().getStorage().getConfiguration().getHookRegistry().getClassLoaderHooks(); for (ClassLoaderHook hook : hooks) { path = hook.findLocalLibrary(generation, libname); if (path != null) { return path; } } String mappedName = System.mapLibraryName(libname); String[] altMappedNames = mapLibraryNames(mappedName); // first check Bundle-NativeCode header path = findBundleNativeCode(libname, mappedName, altMappedNames); // next check eclipse specific support return path != null ? path : findEclipseNativeCode(libname, mappedName, altMappedNames); }
public ModuleClassLoader getModuleClassLoader() { synchronized (classLoaderMonitor) { if (classloader == null) { final List<ClassLoaderHook> hooks = container.getConfiguration().getHookRegistry().getClassLoaderHooks(); final Generation generation = (Generation) wiring.getRevision().getRevisionInfo(); if (System.getSecurityManager() == null) { classloader = createClassLoaderPrivledged(parent, generation.getBundleInfo().getStorage().getConfiguration(), this, generation, hooks); } else { final ClassLoader cl = parent; classloader = AccessController.doPrivileged(new PrivilegedAction<ModuleClassLoader>() { @Override public ModuleClassLoader run() { return createClassLoaderPrivledged(cl, generation.getBundleInfo().getStorage().getConfiguration(), BundleLoader.this, generation, hooks); } }); } for (ClassLoaderHook hook : hooks) { hook.classLoaderCreated(classloader); } } return classloader; } }
private String findLibrary0(String libname) { String path = null; List<ClassLoaderHook> hooks = generation.getBundleInfo().getStorage().getConfiguration().getHookRegistry().getClassLoaderHooks(); for (ClassLoaderHook hook : hooks) { path = hook.findLocalLibrary(generation, libname); if (path != null) { return path; } } String mappedName = System.mapLibraryName(libname); String[] altMappedNames = mapLibraryNames(mappedName); // first check Bundle-NativeCode header path = findBundleNativeCode(libname, mappedName, altMappedNames); // next check eclipse specific support return path != null ? path : findEclipseNativeCode(libname, mappedName, altMappedNames); }
public ModuleClassLoader getModuleClassLoader() { synchronized (classLoaderMonitor) { if (classloader == null) { final List<ClassLoaderHook> hooks = container.getConfiguration().getHookRegistry().getClassLoaderHooks(); final Generation generation = (Generation) wiring.getRevision().getRevisionInfo(); if (System.getSecurityManager() == null) { classloader = createClassLoaderPrivledged(parent, generation.getBundleInfo().getStorage().getConfiguration(), this, generation, hooks); } else { final ClassLoader cl = parent; classloader = AccessController.doPrivileged(new PrivilegedAction<ModuleClassLoader>() { @Override public ModuleClassLoader run() { return createClassLoaderPrivledged(cl, generation.getBundleInfo().getStorage().getConfiguration(), BundleLoader.this, generation, hooks); } }); } for (ClassLoaderHook hook : hooks) { hook.classLoaderCreated(classloader); } } return classloader; } }
private String findLibrary0(String libname) { String path = null; List<ClassLoaderHook> hooks = generation.getBundleInfo().getStorage().getConfiguration().getHookRegistry().getClassLoaderHooks(); for (ClassLoaderHook hook : hooks) { path = hook.findLocalLibrary(generation, libname); if (path != null) { return path; } } String mappedName = System.mapLibraryName(libname); String[] altMappedNames = mapLibraryNames(mappedName); // first check Bundle-NativeCode header path = findBundleNativeCode(libname, mappedName, altMappedNames); // next check eclipse specific support return path != null ? path : findEclipseNativeCode(libname, mappedName, altMappedNames); }
private String findLibrary0(String libname) { String path = null; List<ClassLoaderHook> hooks = generation.getBundleInfo().getStorage().getConfiguration().getHookRegistry().getClassLoaderHooks(); for (ClassLoaderHook hook : hooks) { path = hook.findLocalLibrary(generation, libname); if (path != null) { return path; } } String mappedName = System.mapLibraryName(libname); String[] altMappedNames = mapLibraryNames(mappedName); // first check Bundle-NativeCode header path = findBundleNativeCode(libname, mappedName, altMappedNames); // next check eclipse specific support return path != null ? path : findEclipseNativeCode(libname, mappedName, altMappedNames); }
public ModuleClassLoader getModuleClassLoader() { synchronized (classLoaderMonitor) { if (classloader == null) { final List<ClassLoaderHook> hooks = container.getConfiguration().getHookRegistry().getClassLoaderHooks(); final Generation generation = (Generation) wiring.getRevision().getRevisionInfo(); if (System.getSecurityManager() == null) { classloader = createClassLoaderPrivledged(parent, generation.getBundleInfo().getStorage().getConfiguration(), this, generation, hooks); } else { final ClassLoader cl = parent; classloader = AccessController.doPrivileged(new PrivilegedAction<ModuleClassLoader>() { @Override public ModuleClassLoader run() { return createClassLoaderPrivledged(cl, generation.getBundleInfo().getStorage().getConfiguration(), BundleLoader.this, generation, hooks); } }); } for (ClassLoaderHook hook : hooks) { hook.classLoaderCreated(classloader); } } return classloader; } }
public ModuleClassLoader getModuleClassLoader() { synchronized (classLoaderMonitor) { if (classloader == null) { final List<ClassLoaderHook> hooks = container.getConfiguration().getHookRegistry().getClassLoaderHooks(); final Generation generation = (Generation) wiring.getRevision().getRevisionInfo(); if (System.getSecurityManager() == null) { classloader = createClassLoaderPrivledged(parent, generation.getBundleInfo().getStorage().getConfiguration(), this, generation, hooks); } else { final ClassLoader cl = parent; classloader = AccessController.doPrivileged(new PrivilegedAction<ModuleClassLoader>() { @Override public ModuleClassLoader run() { return createClassLoaderPrivledged(cl, generation.getBundleInfo().getStorage().getConfiguration(), BundleLoader.this, generation, hooks); } }); } for (ClassLoaderHook hook : hooks) { hook.classLoaderCreated(classloader); } } return classloader; } }
/** * Finds all the ClasspathEntry objects for the requested classpath. This method will first call all * the configured class loading hooks {@link ClassLoaderHook#addClassPathEntry(ArrayList, String, ClasspathManager, Generation)} * methods. This allows class loading hooks to add additional ClasspathEntry objects to the result for the * requested classpath. Then the local host classpath entries and attached fragment classpath entries are * searched. * @param result a list of ClasspathEntry objects. This list is used to add new ClasspathEntry objects to. * @param cp the requested classpath. * @param hostloader the host classpath manager for the classpath * @param sourceGeneration the source generation to search for the classpath */ private void findClassPathEntry(ArrayList<ClasspathEntry> result, String cp, ClasspathManager hostloader, Generation sourceGeneration) { List<ClassLoaderHook> loaderHooks = hookRegistry.getClassLoaderHooks(); boolean hookAdded = false; for (ClassLoaderHook hook : loaderHooks) { hookAdded |= hook.addClassPathEntry(result, cp, hostloader, sourceGeneration); } if (!addClassPathEntry(result, cp, hostloader, sourceGeneration) && !hookAdded) { BundleException be = new BundleException(NLS.bind(Msg.BUNDLE_CLASSPATH_ENTRY_NOT_FOUND_EXCEPTION, cp, sourceGeneration.getRevision().toString()), BundleException.MANIFEST_ERROR); sourceGeneration.getBundleInfo().getStorage().getAdaptor().publishContainerEvent(ContainerEvent.INFO, sourceGeneration.getRevision().getRevisions().getModule(), be); } }
/** * Finds all the ClasspathEntry objects for the requested classpath. This method will first call all * the configured class loading hooks {@link ClassLoaderHook#addClassPathEntry(ArrayList, String, ClasspathManager, Generation)} * methods. This allows class loading hooks to add additional ClasspathEntry objects to the result for the * requested classpath. Then the local host classpath entries and attached fragment classpath entries are * searched. * @param result a list of ClasspathEntry objects. This list is used to add new ClasspathEntry objects to. * @param cp the requested classpath. * @param hostloader the host classpath manager for the classpath * @param sourceGeneration the source generation to search for the classpath */ private void findClassPathEntry(ArrayList<ClasspathEntry> result, String cp, ClasspathManager hostloader, Generation sourceGeneration) { List<ClassLoaderHook> loaderHooks = hookRegistry.getClassLoaderHooks(); boolean hookAdded = false; for (ClassLoaderHook hook : loaderHooks) { hookAdded |= hook.addClassPathEntry(result, cp, hostloader, sourceGeneration); } if (!addClassPathEntry(result, cp, hostloader, sourceGeneration) && !hookAdded) { BundleException be = new BundleException(NLS.bind(Msg.BUNDLE_CLASSPATH_ENTRY_NOT_FOUND_EXCEPTION, cp, sourceGeneration.getRevision().toString()), BundleException.MANIFEST_ERROR); sourceGeneration.getBundleInfo().getStorage().getAdaptor().publishContainerEvent(ContainerEvent.INFO, sourceGeneration.getRevision().getRevisions().getModule(), be); } }
/** * Finds all the ClasspathEntry objects for the requested classpath. This method will first call all * the configured class loading hooks {@link ClassLoaderHook#addClassPathEntry(ArrayList, String, ClasspathManager, Generation)} * methods. This allows class loading hooks to add additional ClasspathEntry objects to the result for the * requested classpath. Then the local host classpath entries and attached fragment classpath entries are * searched. * @param result a list of ClasspathEntry objects. This list is used to add new ClasspathEntry objects to. * @param cp the requested classpath. * @param hostloader the host classpath manager for the classpath * @param sourceGeneration the source generation to search for the classpath */ private void findClassPathEntry(ArrayList<ClasspathEntry> result, String cp, ClasspathManager hostloader, Generation sourceGeneration) { List<ClassLoaderHook> loaderHooks = hookRegistry.getClassLoaderHooks(); boolean hookAdded = false; for (ClassLoaderHook hook : loaderHooks) { hookAdded |= hook.addClassPathEntry(result, cp, hostloader, sourceGeneration); } if (!addClassPathEntry(result, cp, hostloader, sourceGeneration) && !hookAdded) { BundleException be = new BundleException(NLS.bind(Msg.BUNDLE_CLASSPATH_ENTRY_NOT_FOUND_EXCEPTION, cp, sourceGeneration.getRevision().toString()), BundleException.MANIFEST_ERROR); sourceGeneration.getBundleInfo().getStorage().getAdaptor().publishContainerEvent(ContainerEvent.INFO, sourceGeneration.getRevision().getRevisions().getModule(), be); } }
/** * Finds all the ClasspathEntry objects for the requested classpath. This method will first call all * the configured class loading hooks {@link ClassLoaderHook#addClassPathEntry(ArrayList, String, ClasspathManager, Generation)} * methods. This allows class loading hooks to add additional ClasspathEntry objects to the result for the * requested classpath. Then the local host classpath entries and attached fragment classpath entries are * searched. * @param result a list of ClasspathEntry objects. This list is used to add new ClasspathEntry objects to. * @param cp the requested classpath. * @param hostloader the host classpath manager for the classpath * @param sourceGeneration the source generation to search for the classpath */ private void findClassPathEntry(ArrayList<ClasspathEntry> result, String cp, ClasspathManager hostloader, Generation sourceGeneration) { List<ClassLoaderHook> loaderHooks = hookRegistry.getClassLoaderHooks(); boolean hookAdded = false; for (ClassLoaderHook hook : loaderHooks) { hookAdded |= hook.addClassPathEntry(result, cp, hostloader, sourceGeneration); } if (!addClassPathEntry(result, cp, hostloader, sourceGeneration) && !hookAdded) { BundleException be = new BundleException(NLS.bind(Msg.BUNDLE_CLASSPATH_ENTRY_NOT_FOUND_EXCEPTION, cp, sourceGeneration.getRevision().toString()), BundleException.MANIFEST_ERROR); sourceGeneration.getBundleInfo().getStorage().getAdaptor().publishContainerEvent(ContainerEvent.INFO, sourceGeneration.getRevision().getRevisions().getModule(), be); } }
/** * Finds all the ClasspathEntry objects for the requested classpath. This method will first call all * the configured class loading hooks {@link ClassLoaderHook#addClassPathEntry(ArrayList, String, ClasspathManager, Generation)} * methods. This allows class loading hooks to add additional ClasspathEntry objects to the result for the * requested classpath. Then the local host classpath entries and attached fragment classpath entries are * searched. * @param result a list of ClasspathEntry objects. This list is used to add new ClasspathEntry objects to. * @param cp the requested classpath. * @param hostloader the host classpath manager for the classpath * @param sourceGeneration the source generation to search for the classpath */ private void findClassPathEntry(ArrayList<ClasspathEntry> result, String cp, ClasspathManager hostloader, Generation sourceGeneration) { List<ClassLoaderHook> loaderHooks = hookRegistry.getClassLoaderHooks(); boolean hookAdded = false; for (ClassLoaderHook hook : loaderHooks) { hookAdded |= hook.addClassPathEntry(result, cp, hostloader, sourceGeneration); } if (!addClassPathEntry(result, cp, hostloader, sourceGeneration) && !hookAdded) { BundleException be = new BundleException(NLS.bind(Msg.BUNDLE_CLASSPATH_ENTRY_NOT_FOUND_EXCEPTION, cp, sourceGeneration.getRevision().toString()), BundleException.MANIFEST_ERROR); sourceGeneration.getBundleInfo().getStorage().getAdaptor().publishContainerEvent(ContainerEvent.INFO, sourceGeneration.getRevision().getRevisions().getModule(), be); } }
/** * Finds all the ClasspathEntry objects for the requested classpath. This method will first call all * the configured class loading hooks {@link ClassLoaderHook#addClassPathEntry(ArrayList, String, ClasspathManager, Generation)} * methods. This allows class loading hooks to add additional ClasspathEntry objects to the result for the * requested classpath. Then the local host classpath entries and attached fragment classpath entries are * searched. * @param result a list of ClasspathEntry objects. This list is used to add new ClasspathEntry objects to. * @param cp the requested classpath. * @param hostloader the host classpath manager for the classpath * @param sourceGeneration the source generation to search for the classpath */ private void findClassPathEntry(ArrayList<ClasspathEntry> result, String cp, ClasspathManager hostloader, Generation sourceGeneration) { List<ClassLoaderHook> loaderHooks = hookRegistry.getClassLoaderHooks(); boolean hookAdded = false; for (ClassLoaderHook hook : loaderHooks) { hookAdded |= hook.addClassPathEntry(result, cp, hostloader, sourceGeneration); } if (!addClassPathEntry(result, cp, hostloader, sourceGeneration) && !hookAdded) { BundleException be = new BundleException(NLS.bind(Msg.BUNDLE_CLASSPATH_ENTRY_NOT_FOUND_EXCEPTION, cp, sourceGeneration.getRevision().toString()), BundleException.MANIFEST_ERROR); sourceGeneration.getBundleInfo().getStorage().getAdaptor().publishContainerEvent(ContainerEvent.INFO, sourceGeneration.getRevision().getRevisions().getModule(), be); } }