1 package com.atlassian.plugin.osgi.bridge;
2
3 import org.osgi.framework.Bundle;
4 import org.osgi.framework.Constants;
5
6
7
8
9
10
11 class PluginBundleUtils
12 {
13
14
15
16
17
18
19
20
21
22
23 static String getPluginKey(Bundle bundle)
24 {
25 return getPluginKey(
26 bundle.getSymbolicName(),
27 bundle.getHeaders().get("Atlassian-Plugin-Key"),
28 bundle.getHeaders().get(Constants.BUNDLE_VERSION)
29 );
30 }
31
32 private static String getPluginKey(Object bundleName, Object atlKey, Object version)
33 {
34 Object key = atlKey;
35 if (key == null)
36 {
37 key = bundleName + "-" + version;
38 }
39 return key.toString();
40
41 }
42 }