aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Ross2011-11-21 10:33:04 (EST)
committerJohn Ross2011-11-21 10:33:04 (EST)
commitef88d7cebbc412b73aeb83152f22b3f399b916fd (patch)
tree1af51e55f95a934f8cd9a8cac7bb6e57d4bb25e0
parenta15cf5afabb37e107d9ceaa8a18c3f10f4b44037 (diff)
downloadrt.equinox.bundles-ef88d7cebbc412b73aeb83152f22b3f399b916fd.zip
rt.equinox.bundles-ef88d7cebbc412b73aeb83152f22b3f399b916fd.tar.gz
rt.equinox.bundles-ef88d7cebbc412b73aeb83152f22b3f399b916fd.tar.bz2
Bug 363374: Replaced remaining references to BundleWiring.findEntries with Bundle.findEntries.
-rw-r--r--bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/impl/FragmentUtils.java11
-rw-r--r--bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/impl/MetaTypeProviderImpl.java11
2 files changed, 7 insertions, 15 deletions
diff --git a/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/impl/FragmentUtils.java b/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/impl/FragmentUtils.java
index e455ae6..c25b923 100644
--- a/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/impl/FragmentUtils.java
+++ b/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/impl/FragmentUtils.java
@@ -11,10 +11,9 @@
package org.eclipse.equinox.metatype.impl;
import java.net.URL;
-import java.util.List;
+import java.util.*;
import org.osgi.framework.Bundle;
import org.osgi.framework.wiring.BundleRevision;
-import org.osgi.framework.wiring.BundleWiring;
/*
* Fragment Utilities
@@ -32,9 +31,6 @@ public class FragmentUtils {
* Find all the URLs to entries for the bundle and its fragments.
*/
public static URL[] findEntries(Bundle bundle, String path) {
- BundleWiring wiring = bundle.adapt(BundleWiring.class);
- if (wiring == null)
- return null;
String directory = "/"; //$NON-NLS-1$
String file = "*"; //$NON-NLS-1$
int index = path.lastIndexOf(MetaTypeProviderImpl.DIRECTORY_SEP);
@@ -50,9 +46,10 @@ public class FragmentUtils {
directory = path.substring(0, index);
file = path.substring(index + 1);
}
- List<URL> entries = wiring.findEntries(directory, file, 0);
+ Enumeration<URL> entries = bundle.findEntries(directory, file, false);
if (entries == null)
return null;
- return entries.toArray(new URL[entries.size()]);
+ List<URL> list = Collections.list(entries);
+ return list.toArray(new URL[list.size()]);
}
}
diff --git a/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/impl/MetaTypeProviderImpl.java b/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/impl/MetaTypeProviderImpl.java
index 757b02e..c814c03 100644
--- a/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/impl/MetaTypeProviderImpl.java
+++ b/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/impl/MetaTypeProviderImpl.java
@@ -18,7 +18,6 @@ import org.eclipse.equinox.metatype.EquinoxObjectClassDefinition;
import org.eclipse.osgi.util.NLS;
import org.osgi.framework.Bundle;
import org.osgi.framework.Constants;
-import org.osgi.framework.wiring.BundleWiring;
import org.osgi.service.log.LogService;
import org.osgi.service.metatype.MetaTypeProvider;
import org.osgi.service.metatype.MetaTypeService;
@@ -165,12 +164,8 @@ public class MetaTypeProviderImpl implements MetaTypeProvider {
* @see org.osgi.service.metatype.MetaTypeProvider#getLocales()
*/
public synchronized String[] getLocales() {
-
if (_locales != null)
return checkForDefault(_locales);
- BundleWiring wiring = _bundle.adapt(BundleWiring.class);
- if (wiring == null)
- return null;
Vector<String> localizationFiles = new Vector<String>(7);
// get all the localization resources for PIDS
Enumeration<ObjectClassDefinitionImpl> ocds = _allPidOCDs.elements();
@@ -201,11 +196,11 @@ public class MetaTypeProviderImpl implements MetaTypeProvider {
baseDir = localizationFile.substring(0, iSlash);
}
baseFileName = '/' + localizationFile + RESOURCE_FILE_CONN;
- List<URL> entries = wiring.findEntries(baseDir, "*.properties", 0); //$NON-NLS-1$
+ Enumeration<URL> entries = _bundle.findEntries(baseDir, "*.properties", false); //$NON-NLS-1$
if (entries == null)
continue;
- for (URL entry : entries) {
- String resource = entry.getPath();
+ while (entries.hasMoreElements()) {
+ String resource = entries.nextElement().getPath();
if (resource.startsWith(baseFileName) && resource.toLowerCase().endsWith(RESOURCE_FILE_EXT))
locales.add(resource.substring(baseFileName.length(), resource.length() - RESOURCE_FILE_EXT.length()));
}