Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Frost2012-09-28 12:15:41 -0400
committerChristopher Frost2012-09-28 12:15:41 -0400
commitaffdb22c104bf0af46f83ffe61969e4578757737 (patch)
treef3b740558bef720717033a4035f50c616ae1d3e6
parent13c245124e5a7e31cdd56c1b9a94c9647e43c240 (diff)
parent3bacb4a0114708e1e34c45279146d6d64b9d6ebc (diff)
downloadorg.eclipse.virgo.kernel-affdb22c104bf0af46f83ffe61969e4578757737.tar.gz
org.eclipse.virgo.kernel-affdb22c104bf0af46f83ffe61969e4578757737.tar.xz
org.eclipse.virgo.kernel-affdb22c104bf0af46f83ffe61969e4578757737.zip
Merge branch 'master' of ssh://git.eclipse.org/gitroot/virgo/org.eclipse.virgo.kernel
-rw-r--r--org.eclipse.virgo.kernel.artifact/src/main/java/org/eclipse/virgo/kernel/artifact/bundle/BundleBridge.java23
1 files changed, 20 insertions, 3 deletions
diff --git a/org.eclipse.virgo.kernel.artifact/src/main/java/org/eclipse/virgo/kernel/artifact/bundle/BundleBridge.java b/org.eclipse.virgo.kernel.artifact/src/main/java/org/eclipse/virgo/kernel/artifact/bundle/BundleBridge.java
index 9106e42d..a6c1c724 100644
--- a/org.eclipse.virgo.kernel.artifact/src/main/java/org/eclipse/virgo/kernel/artifact/bundle/BundleBridge.java
+++ b/org.eclipse.virgo.kernel.artifact/src/main/java/org/eclipse/virgo/kernel/artifact/bundle/BundleBridge.java
@@ -16,6 +16,7 @@ import java.util.Dictionary;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.List;
+import java.util.Map;
import org.osgi.framework.Constants;
import org.osgi.framework.Version;
@@ -28,6 +29,8 @@ import org.eclipse.virgo.repository.Attribute;
import org.eclipse.virgo.repository.HashGenerator;
import org.eclipse.virgo.repository.builder.ArtifactDescriptorBuilder;
import org.eclipse.virgo.repository.builder.AttributeBuilder;
+import org.eclipse.virgo.util.common.CaseInsensitiveMap;
+import org.eclipse.virgo.util.common.MapToDictionaryAdapter;
import org.eclipse.virgo.util.osgi.manifest.BundleManifest;
import org.eclipse.virgo.util.osgi.manifest.BundleSymbolicName;
import org.eclipse.virgo.util.osgi.manifest.ExportedPackage;
@@ -154,18 +157,32 @@ public final class BundleBridge implements ArtifactBridge {
* @return the new dictionary or null if the provided <code>artifactDescriptor</code> was not created by this bridge
*/
public static Dictionary<String, String> convertToDictionary(ArtifactDescriptor artifactDescriptor) {
+ Map<String, String> map = convertToMap(artifactDescriptor);
+
+ return map == null ? null : new MapToDictionaryAdapter(map);
+ }
+
+ /**
+ * Providing the <code>artifactDescriptor</code> was created by this bridge in the first place then all its
+ * attributes from the main section of the manifest are placed in to a case insensitive map and returned. If not then
+ * <code>null</code> is returned.
+ *
+ * @param artifactDescriptor to be converted
+ * @return the new map or null if the provided <code>artifactDescriptor</code> was not created by this bridge
+ */
+ public static Map<String, String> convertToMap(ArtifactDescriptor artifactDescriptor) {
if (!BRIDGE_TYPE.equals(artifactDescriptor.getType())) {
return null;
}
- Hashtable<String, String> dictionary = new Hashtable<String, String>();
+ CaseInsensitiveMap<String> map = new CaseInsensitiveMap<String>();
for (Attribute attribute : artifactDescriptor.getAttributes()) {
if (attribute.getKey().startsWith(RAW_HEADER_PREFIX)) {
- dictionary.put(attribute.getKey().substring(RAW_HEADER_PREFIX.length()), attribute.getValue());
+ map.put(attribute.getKey().substring(RAW_HEADER_PREFIX.length()), attribute.getValue());
}
}
- return dictionary;
+ return map;
}
private String applyBundleSymbolicName(ArtifactDescriptorBuilder artifactBuilder, BundleManifest bundleManifest) {

Back to the top