@SuppressWarnings("unchecked") @Override public Enumeration<URL> run() { return bundle.findEntries(path, fileNamePattern, recursive); } });
@SuppressWarnings("unchecked") @Override public Enumeration<URL> run() { return bundle.findEntries(path, fileNamePattern, recursive); } });
private List<Class> getCandidateGoExtensionClasses(Bundle bundle) throws ClassNotFoundException { List<Class> candidateClasses = new ArrayList<>(); Enumeration<URL> entries = bundle.findEntries("/", "*.class", true); while (entries.hasMoreElements()) { String entryPath = entries.nextElement().getFile(); if (isInvalidPath(entryPath)) { continue; } Class<?> candidateClass = loadClass(bundle, entryPath); if (candidateClass != null && isValidClass(candidateClass)) { candidateClasses.add(candidateClass); } } return candidateClasses; }
private void setupClassesInBundle(String... classes) throws MalformedURLException, ClassNotFoundException { Hashtable<URL, String> classFileEntries = new Hashtable<>(); for (String aClass : classes) { classFileEntries.put(new URL("file:///" + aClass), ""); } when(bundle.findEntries("/", "*.class", true)).thenReturn(classFileEntries.keys()); }
@Before public void setUp() { initMocks(this); when(context.getServiceReference(PluginHealthService.class)).thenReturn(pluginHealthServiceReference); when(context.getServiceReference(LoggingService.class)).thenReturn(loggingServiceReference); when(context.getService(pluginHealthServiceReference)).thenReturn(pluginHealthService); when(context.getService(loggingServiceReference)).thenReturn(loggingService); when(context.getBundle()).thenReturn(bundle); when(bundle.getSymbolicName()).thenReturn(PLUGIN_ID); when(bundle.findEntries("/", "*.class", true)).thenReturn(emptyListOfClassesInBundle); activator = new DefaultGoPluginActivator(); }
private List<String> determineResourceNames() { List<String> resourceNames = new ArrayList<String>(); Enumeration<URL> resourceFiles = this.bundle.findEntries(RESOURCE_DIRECTORY, RESOURCE_FILE_PATTERN, true); if (resourceFiles != null) { while (resourceFiles.hasMoreElements()) { URL resourceURL = resourceFiles.nextElement(); String resourcePath = resourceURL.getFile(); File resourceFile = new File(resourcePath); String resourceFileName = resourceFile.getName(); String baseName = resourceFileName.replaceFirst("[._]+.*", ""); if (!resourceNames.contains(baseName)) { resourceNames.add(baseName); } } } return resourceNames; }
public void execute(final Bundle bundle) { try { final Enumeration<URL> enumeration = bundle.findEntries(ROOT_PATH, "*", true); if (enumeration != null) { while (enumeration.hasMoreElements()) { final URL url = enumeration.nextElement(); if (PATH_MATCHER.match(antPathExpression, url.getPath())) { results.add(url); } } } } catch (final IllegalStateException e) { // The bundle has been uninstalled - ignore it } } }, context);
public void execute(final Bundle bundle) { try { final Enumeration<URL> enumeration = bundle.findEntries(ROOT_PATH, "*", true); if (enumeration != null) { while (enumeration.hasMoreElements()) { final URL url = enumeration.nextElement(); if (PATH_MATCHER.match(antPathExpression, url.getPath())) { try { final URI uri = url.toURI(); if (!uris.contains(uri)) { urls.add(url); uris.add(uri); } } catch (final URISyntaxException e) { // This URL can't be converted to a URI - // ignore it } } } } } catch (final IllegalStateException e) { // The bundle has been uninstalled - ignore it } } }, context);
@Override public URL getResource(String name) { Enumeration<URL> resourceFiles = this.bundle.findEntries(this.path, this.filePattern, true);
@SuppressWarnings("unchecked") @Override public Enumeration<URL> run() { return bundle.findEntries(path, fileNamePattern, recursive); } });
@SuppressWarnings("unchecked") @Override public Enumeration<URL> run() { return bundle.findEntries(path, fileNamePattern, recursive); } });
public static Enumeration<URL> findEntries(String path, String filePattern, boolean recurse) { if (instance != null && instance.context != null) return instance.context.getBundle().findEntries(path, filePattern, recurse); return null; }
@SuppressWarnings("unchecked") private List<URL> bundleUrlsForPattern() { Bundle pluginBundle = bundleSupplier.get(); @SuppressWarnings("rawtypes") Enumeration entries = pluginBundle.findEntries("", extractPattern, true); return (List<URL>) Collections.list(entries); }
protected static String findWidgetset(Bundle bundle) { Enumeration<URL> widgetEntries = bundle.findEntries("", "*.gwt.xml", true); // Enumeration widgetEntries = bundle.getEntryPaths(VAADIN_PATH); if (widgetEntries == null || !widgetEntries.hasMoreElements()) return null; URL widgetUrl = widgetEntries.nextElement(); String path = widgetUrl.getPath(); path = path.substring(1,path.length()-8); path = path.replace("/", "."); return path; }
protected String findWidgetset(Bundle bundle) { Enumeration<URL> widgetEntries = bundle.findEntries("", "*.gwt.xml", true); // Enumeration widgetEntries = bundle.getEntryPaths(VAADIN_PATH); if (widgetEntries == null || !widgetEntries.hasMoreElements()) return null; URL widgetUrl = widgetEntries.nextElement(); String path = widgetUrl.getPath(); path = path.substring(1,path.length()-8); path = path.replace("/", "."); return path; }
private void addEntries(Bundle bundle, String path, String filePattern, List<URL> pathList) { Enumeration<?> e = bundle.findEntries(path, filePattern, false); while (e != null && e.hasMoreElements()) { URL u = (URL) e.nextElement(); URL override = getOverrideURL(bundle, u, path); if (override == null) { pathList.add(u); } else { pathList.add(override); } } }
@Override public Resource[] getResources(String locationPattern) { Enumeration<URL> enumeration = _bundle.findEntries( locationPattern, "*.xml", false); List<Resource> resources = new ArrayList<>(); while (enumeration.hasMoreElements()) { resources.add(new UrlResource(enumeration.nextElement())); } return resources.toArray(new Resource[resources.size()]); }
protected void register(final Bundle bundle) { Enumeration<?> e = bundle.findEntries("META-INF/cxf/", "bus-extensions.txt", false); while (e != null && e.hasMoreElements()) { List<Extension> orig = new TextExtensionFragmentParser(null).getExtensions((URL)e.nextElement()); addExtensions(bundle, orig); } }
protected void register(final Bundle bundle) { Enumeration<?> e = bundle.findEntries("META-INF/cxf/", "bus-extensions.txt", false); while (e != null && e.hasMoreElements()) { List<Extension> orig = new TextExtensionFragmentParser(null).getExtensions((URL)e.nextElement()); addExtensions(bundle, orig); } }
protected void register(final Bundle bundle) { Enumeration<?> e = bundle.findEntries("META-INF/cxf/", "bus-extensions.txt", false); while (e != null && e.hasMoreElements()) { List<Extension> orig = new TextExtensionFragmentParser(null).getExtensions((URL)e.nextElement()); addExtensions(bundle, orig); } }