Search in sources :

Example 1 with ComponentInfoImpl

use of org.apache.aries.samples.goat.info.ComponentInfoImpl in project aries by apache.

the class BundleContextInfoProvider method getComponentForId.

public ComponentInfo getComponentForId(String id) {
    if (biCache.containsKey(id)) {
        return biCache.get(id);
    }
    Bundle b = getBundleForIDKey(ctx, id);
    ComponentInfoImpl bii = new ComponentInfoImpl();
    bii.setId(getKeyForBundle(b));
    HashSet<Long> allDepSet = new HashSet<Long>();
    bii.setComponentProperties(new HashMap<String, String>());
    bii.getComponentProperties().put("BundleID", "" + b.getBundleId());
    bii.getComponentProperties().put("State", bundleStateToString(b.getState()));
    bii.getComponentProperties().put("SymbolicName", b.getSymbolicName());
    bii.getComponentProperties().put("Version", "" + b.getVersion());
    Enumeration<String> e = b.getHeaders().keys();
    while (e.hasMoreElements()) {
        String key = e.nextElement();
        if (!(key.equals("Import-Package") || key.equals("Export-Package"))) {
        //bii.getComponentProperties().put(key, String.valueOf(b.getHeaders().get(key)));
        }
    }
    bii.setChildren(new ArrayList<ComponentInfo>());
    biCache.put(id, bii);
    return bii;
}
Also used : ComponentInfoImpl(org.apache.aries.samples.goat.info.ComponentInfoImpl) Bundle(org.osgi.framework.Bundle) ComponentInfo(org.apache.aries.samples.goat.api.ComponentInfo) HashSet(java.util.HashSet)

Aggregations

HashSet (java.util.HashSet)1 ComponentInfo (org.apache.aries.samples.goat.api.ComponentInfo)1 ComponentInfoImpl (org.apache.aries.samples.goat.info.ComponentInfoImpl)1 Bundle (org.osgi.framework.Bundle)1