Update of /cvsroot/mocklib/osgimgr/input/javasrc/osgi
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5023/input/javasrc/osgi
Added Files:
Activator.java BundleManager.java BundleManagerMBean.java
Lifecycle.java LifecycleMBean.java
Log Message:
add osgimgr to mocklib project for now.
--- NEW FILE: LifecycleMBean.java ---
package osgi;
import java.util.Dictionary;
import org.osgi.framework.BundleException;
import org.osgi.framework.ServiceReference;
import biz.xsoftware.api.mgmt.Documentation;
@Documentation("LifecycleMBean controls the lifecycle of a bundle as well as exposing it's manifest properties")
public interface LifecycleMBean {
@Documentation("Returns the unique bundle id of this bundle")
public abstract long getBundleId();
@Documentation("Starts the service this bundle represents")
public abstract void start() throws BundleException;
@Documentation("Stops the service this bean represents")
public abstract void stop() throws BundleException;
@Documentation("Upgrades the bundle from the location it was installed at")
public abstract void update() throws BundleException;
@Documentation("Uninstalls the bundle")
public abstract void uninstall() throws BundleException;
@Documentation("Gets the current state's name")
public abstract String getStateName();
@Documentation("Gets the current state")
public abstract int getState();
@Documentation("Gets the location the bundle was loaded from")
public abstract String getLocation();
@Documentation("Gets the registered Services")
public abstract ServiceReference[] getRegisteredServices();
@Documentation("The names of the registered services")
public String[] getRegisteredServiceNames();
@Documentation("The Services in use")
public abstract ServiceReference[] getServicesInUse();
@Documentation("The names of the services in use")
public String[] getServicesInUseNames();
@Documentation("The manifest")
public abstract Dictionary getManifest();
@Documentation("The class name of the BundleActivator")
public abstract String getBundleActivator();
@Documentation("The Bundle Category that was in the manifest")
public abstract String getBundleCategory();
@Documentation("The contact address that was in the manifest")
public abstract String getContactAddress();
@Documentation("The copyright from the manifest")
public abstract String getCopyright();
@Documentation("The description of this bundle")
public abstract String getDescription();
@Documentation("Link to the documentation on this bundle")
public abstract String getDocURL();
@Documentation("The name of this bundle")
public abstract String getName();
@Documentation("The native code property from the manifest")
public abstract String getNativeCode();
@Documentation("The native code language from the manifest")
public abstract String getNativeCodeLanguage();
@Documentation("The native code OS from the manifest")
public abstract String getNativeCodeOS();
public abstract String getNativeCodeOSVersion();
public abstract String getNativeCodeProcessor();
public abstract String getRequiredExecutionEnvironment();
@Documentation("The location which is used to update the bundle")
public abstract String getUpdateLocation();
@Documentation("The vendor of this bundle")
public abstract String getVendor();
@Documentation("The version of this bundle")
public abstract String getVersion();
@Documentation("The value of dynamice import in the manifest")
public abstract String getDynamicImport();
@Documentation("The packages that are exported by this bundle")
public abstract String getExportPackage();
public abstract String getExportService();
@Documentation("The packages that are imported by this bundle")
public abstract String getImportPackage();
public abstract String getImportService();
public abstract String getObjectClass();
public abstract String getPackageSpecificationVersion();
@Documentation("The manifest version")
String getManifestVersion();
}
--- NEW FILE: BundleManagerMBean.java ---
package osgi;
import java.util.Map;
import org.osgi.framework.BundleException;
import org.osgi.framework.InvalidSyntaxException;
public interface BundleManagerMBean {
public static final String NULL_STR = "@@NULL@@";
public String getUserDir();
public long installBundle(String location) throws BundleException;
public long getBundle();
public String getBundleContextProperty(String key);
// (bid)
public long[] getBundles();
// (sid, bid)
public long[] getServiceReferences(String filter) throws InvalidSyntaxException;
public long[] getServiceReferences2(String clazz, String filter) throws InvalidSyntaxException;
// // (bid, type)
// public long[] getBundleEvents();
//
// // (sid, type)
// public long[] getServiceEvents();
//
// // (bid, type)
// public long[] getFrameworkEvents();
// (key, value)
public Map getServiceProperties(long sid) throws InvalidSyntaxException;
// public int getStartLevel();
// public void setStartLevel(int level);
// public void setBundleStartLevel(long bid, int level);
// public int getBundleStartLevel(long bid);
// public void setInitialBundleStartLevel(int level);
// public int getInitialBundleStartLevel();
// public boolean isBundlePersistentlyStarted(long bid);
// public Map getExportedPackage(String name);
// public Map[] getExportedPackages(long bid);
// public void refreshPackages(long[] bids) ;
public Map getSystemProperties();
}
--- NEW FILE: Activator.java ---
package osgi;
import java.util.ArrayList;
import java.util.Dictionary;
import java.util.Hashtable;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.management.MalformedObjectNameException;
import javax.management.NotCompliantMBeanException;
import javax.management.ObjectName;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleEvent;
import org.osgi.framework.BundleListener;
import org.ungoverned.gravity.servicebinder.ConfigurationService;
import org.ungoverned.gravity.servicebinder.InstanceMetadata;
import org.ungoverned.gravity.servicebinder.SvcBinderActivator;
import biz.xsoftware.api.osgimgr.Bootstrap;
import biz.xsoftware.api.osgimgr.ConfigService;
import biz.xsoftware.api.osgimgr.GetComponent;
public class Activator extends SvcBinderActivator {
private static final Logger log = Logger.getLogger(Activator.class.getName());
public static final String PLATFORM_NAME = "Zeus";
private static final String LIFEBEAN_DOMAIN = PLATFORM_NAME+".Level2.Lifecycle";
public static final String SERVICES_DOMAIN = PLATFORM_NAME+".Level3.Service.";
private BundleContext ctx;
private GetComponent getter;
public Activator(GetComponent getter) throws Exception {
this();
this.getter = getter;
}
public Activator() throws Exception {
getter = Bootstrap.createGetComponent();
List<InstanceMetadata> list = new ArrayList<InstanceMetadata>();
InstanceMetadata data = new InstanceMetadata(Bootstrap.CONFIG_NAME, null);
data.addInterface(ConfigurationService.class.getName());
// DependencyMetadata depMeta = new DependencyMetadata(InstanceManager.ALL_SERVICES, "1..n", "dynamic", "", "addService", "removeService");
// data.addDependency(depMeta);
// DependencyMetadata depMeta2 = new DependencyMetadata()
// data.addDependency()
list.add(data);
setDescriptors(list);
}
@Override
public void start(BundleContext ctx) throws Exception {
this.ctx = ctx;
super.start(ctx);
MyBundleListener bundleList = new MyBundleListener();
long id = ctx.getBundle().getBundleId();
BundleManager mgr = new BundleManager(ctx);
ObjectName bundleName = new ObjectName(ConfigService.SERVER_LEVEL1+"BundleManager");
getter.getConfigService().registerBean(BundleManagerMBean.class, bundleName, mgr);
// Lifecycle lifeBean = new Lifecycle(id, ctx);
registerLifecycle(ctx.getBundle());
// ObjectName lifeName = new ObjectName(LIFEBEAN_PREFIX+"Lifecycle");
// getter.getConfigService().registerBean(LifecycleMBean.class, lifeName, lifeBean);
ctx.addBundleListener(bundleList);
Bundle[] bundles = ctx.getBundles();
for(Bundle b : bundles) {
if(b.getBundleId() == id)
continue;
registerLifecycle(b);
}
if(log.isLoggable(Level.FINER))
log.finer("Started");
}
@Override
public void stop(BundleContext ctx) throws Exception {
super.stop(ctx);
this.ctx = null;
}
private class MyBundleListener implements BundleListener {
/* (non-Javadoc)
* @see org.osgi.framework.BundleListener#bundleChanged(org.osgi.framework.BundleEvent)
*/
public void bundleChanged(BundleEvent evt) {
if(log.isLoggable(Level.FINER))
log.finer("evt Type"+evt.getType());
switch(evt.getType()) {
case BundleEvent.INSTALLED:
registerLifecycle(evt.getBundle());
break;
case BundleEvent.UNINSTALLED:
unregisterLifecycle(evt.getBundle());
break;
default:
break;
}
}
}
private String getLogId(Bundle b) {
String name = getName(b);
long id = b.getBundleId();
return "["+name+"]["+id+"]";
}
private String getName(Bundle bundle) {
Dictionary dic = bundle.getHeaders();
long id = bundle.getBundleId();
String name = dic.get("Bundle-Name")+"";
if(name == null)
name = ""+id;
return name;
}
private void registerLifecycle(Bundle bundle) {
long id = bundle.getBundleId();
String name = getName(bundle);
// ObjectName beanName;
try {
//beanName = new ObjectName(prefix+name);
Lifecycle lifeBean = new Lifecycle(id, ctx);
if(log.isLoggable(Level.FINE))
log.fine(getLogId(bundle)+"register Lifecycle MBean");
registerImpl(bundle, lifeBean, LifecycleMBean.class);
// OsgiStandardMBean osgiBean = new OsgiStandardMBean(lifeBean, LifecycleMBean.class);
// registrar.registerBean(beanName, osgiBean);
} catch (MalformedObjectNameException e) {
log.log(Level.WARNING, "Failed to register MBean="+name, e);
} catch (NotCompliantMBeanException e) {
log.log(Level.WARNING, "Failed to register MBean="+name, e);
}
}
private ObjectName registerImpl(Bundle b, Object bean, Class c) throws MalformedObjectNameException, NotCompliantMBeanException {
Hashtable<String, String> table = new Hashtable<String, String>();
table.put("name", getName(b));
table.put("BundleId", b.getBundleId()+"");
ObjectName beanName = new ObjectName(LIFEBEAN_DOMAIN, table);
if(log.isLoggable(Level.FINE))
log.fine(getLogId(b)+"registering MBean="+c.getName()+" name="+beanName);
getter.getConfigService().registerBean(c, beanName, bean);
if(log.isLoggable(Level.FINE))
log.fine(getLogId(b)+"registered MBean="+c.getName()+" name="+beanName);
return beanName;
}
private void unregisterLifecycle(Bundle bundle) {
String name = getName(bundle);
try {
Hashtable<String, String> table = new Hashtable<String, String>();
table.put("name", name);
table.put("BundleId", bundle.getBundleId()+"");
ObjectName beanName = new ObjectName(LIFEBEAN_DOMAIN, table);
getter.getConfigService().unregisterBean(beanName);
} catch (MalformedObjectNameException e) {
log.log(Level.WARNING, getLogId(bundle)+"Failed to unregister MBean", e);
}
}
}
--- NEW FILE: BundleManager.java ---
package osgi;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;
import org.osgi.framework.Constants;
import org.osgi.framework.InvalidSyntaxException;
import org.osgi.framework.ServiceReference;
public class BundleManager implements BundleManagerMBean {
private BundleContext bc;
public BundleManager(BundleContext bc) {
this.bc = bc;
}
public String getUserDir() {
return System.getProperty("user.dir");
}
public long installBundle(String location) throws BundleException {
Bundle b = bc.installBundle(location);
return b.getBundleId();
}
public long getBundle() {
return bc.getBundle().getBundleId();
}
public long[] getBundles() {
Bundle[] bl = bc.getBundles();
long[] bids = new long[bl.length];
for (int i = 0; i < bl.length; i++) {
bids[i] = bl[i].getBundleId();
}
return bids;
}
public String getBundleContextProperty(String key) {
String v = bc.getProperty(key);
if(v == null)
return NULL_STR;
else
return v;
}
public long[] getServiceReferences(String filter) throws InvalidSyntaxException {
return getServiceReferences2(null, filter);
}
public long[] getServiceReferences2(String clazz, String filter) throws InvalidSyntaxException {
if (NULL_STR.equals(clazz)) {
clazz = null;
}
if (NULL_STR.equals(filter)) {
filter = null;
}
ServiceReference[] srl = bc.getServiceReferences(clazz, filter);
/*
* System.out.println("server:getServiceReferences2 class=" + clazz + ",
* filter=" + filter + ", srl=" + (srl != null ? ("" + srl.length) :
* "null"));
*/
if (srl == null) {
return new long[0];
}
long[] r = new long[srl.length * 2];
int n = 0;
for (int i = 0; i < srl.length; i++) {
r[n * 2] = ((Long) srl[i].getProperty(Constants.SERVICE_ID))
.longValue();
r[n * 2 + 1] = srl[i].getBundle().getBundleId();
n++;
}
return r;
}
// public long[] getFrameworkEvents() {
// synchronized (frameworkEvents) {
// try {
//
// long[] r = new long[frameworkEvents.size() * 2];
// if (bDebug) {
// System.out.println("server: getFrameworkEvents size="
// + r.length / 2);
// }
// int i = 0;
//
// for (Iterator it = frameworkEvents.iterator(); it.hasNext();) {
// FrameworkEvent ev = (FrameworkEvent) it.next();
// Bundle b = ev.getBundle();
// long bid = -1;
// if (b == null) {
// if (bDebug) {
// System.out.println("fw event: " + ev
// + " - no bundle");
// }
// } else {
// bid = b.getBundleId();
// }
// r[i * 2] = bid;
// r[i * 2 + 1] = ev.getType();
// i++;
// }
//
// frameworkEvents.clear();
// if (bDebug) {
// System.out.println("server: getFrameworkEvents -> " + r);
// }
// return r;
// } catch (Exception e) {
// if (bDebug) {
// e.printStackTrace();
// }
// }
// }
// return null;
// }
// public long[] getBundleEvents() {
// synchronized (bundleEvents) {
// long[] r = new long[bundleEvents.size() * 2];
// int i = 0;
//
// for (Iterator it = bundleEvents.iterator(); it.hasNext();) {
// BundleEvent ev = (BundleEvent) it.next();
// r[i * 2] = ev.getBundle().getBundleId();
// r[i * 2 + 1] = ev.getType();
// i++;
// }
// bundleEvents.clear();
// return r;
// }
// }
// public long[] getServiceEvents() {
// synchronized (serviceEvents) {
// long[] r = new long[serviceEvents.size() * 2];
// int i = 0;
//
// for (Iterator it = serviceEvents.iterator(); it.hasNext();) {
// ServiceEvent ev = (ServiceEvent) it.next();
// r[i * 2] = ((Long) ev.getServiceReference().getProperty(
// Constants.SERVICE_ID)).longValue();
// r[i * 2 + 1] = ev.getType();
// i++;
// }
//
// serviceEvents.clear();
// return r;
// }
// }
public Map getServiceProperties(long sid) throws InvalidSyntaxException {
ServiceReference[] srl = bc.getServiceReferences(null,
"(service.id=" + sid + ")");
String[] keys = srl[0].getPropertyKeys();
Map<String, Object> result = new HashMap<String, Object>();
for (int i = 0; i < keys.length; i++) {
String key = keys[i];
Object val = srl[0].getProperty(keys[i]);
// Object strVal = Util.encodeAsString(val);
result.put(key, val);
}
return result;
}
// public int getStartLevel() {
// return ((StartLevel) slTracker.getService()).getStartLevel();
// }
//
// public void setStartLevel(int level) {
// ((StartLevel) slTracker.getService()).setStartLevel(level);
// }
//
// public void setBundleStartLevel(long bid, int level) {
// Bundle b = bc.getBundle(bid);
// ((StartLevel) slTracker.getService()).setBundleStartLevel(b, level);
// }
//
// public int getBundleStartLevel(long bid) {
// Bundle b = bc.getBundle(bid);
// return ((StartLevel) slTracker.getService()).getBundleStartLevel(b);
// }
//
// public void setInitialBundleStartLevel(int level) {
// ((StartLevel) slTracker.getService()).setInitialBundleStartLevel(level);
// }
//
// public int getInitialBundleStartLevel() {
// return ((StartLevel) slTracker.getService())
// .getInitialBundleStartLevel();
// }
//
// public boolean isBundlePersistentlyStarted(long bid) {
// Bundle b = bc.getBundle(bid);
// return ((StartLevel) slTracker.getService())
// .isBundlePersistentlyStarted(b);
// }
//
// public Map getExportedPackage(String name) {
// Map map = new HashMap();
// ExportedPackage pkg = ((PackageAdmin) pkgTracker.getService())
// .getExportedPackage(name);
//
// putExportPackage(map, pkg);
// return map;
// }
//
// public Map[] getExportedPackages(long bid) {
// Bundle b = bc.getBundle(bid);
// ExportedPackage[] pkgs = ((PackageAdmin) pkgTracker.getService())
// .getExportedPackages(b);
//
// if (pkgs == null) {
// return new Map[0];
// }
//
// Map[] maps = new Map[pkgs.length];
// for (int i = 0; i < pkgs.length; i++) {
// maps[i] = new HashMap();
// putExportPackage(maps[i], pkgs[i]);
// }
// return maps;
// }
//
// public void refreshPackages(long[] bids) {
// if (bids.length == 0) {
// ((PackageAdmin) pkgTracker.getService()).refreshPackages(null);
// bids = null;
// } else {
// Bundle[] bl = new Bundle[bids.length];
// for (int i = 0; i < bids.length; i++) {
// bl[i] = bc.getBundle(bids[i]);
// }
// ((PackageAdmin) pkgTracker.getService()).refreshPackages(bl);
// }
//
// }
// void putExportPackage(Map<String, Object> map, ExportedPackage pkg) {
// if (pkg != null) {
// Long[] bids;
// Bundle[] bl = pkg.getImportingBundles();
// if (bl == null) {
// bids = new Long[0];
// } else {
// bids = new Long[bl.length];
// for (int i = 0; i < bids.length; i++) {
// bids[i] = new Long(bl[i].getBundleId());
// }
// }
// map.put("getExportingBundle", new Long(pkg.getExportingBundle()
// .getBundleId()));
// map.put("getImportingBundles", bids);
// map.put("getName", pkg.getName());
// map.put("getSpecificationVersion", pkg.getSpecificationVersion());
// map.put("isRemovalPending", pkg.isRemovalPending() ? Boolean.TRUE
// : Boolean.FALSE);
// }
// }
public Map getSystemProperties() {
Map<String, String> map = new HashMap<String, String>();
Properties props = System.getProperties();
for (Enumeration e = props.keys(); e.hasMoreElements();) {
String key = (String) e.nextElement();
String val = (String) props.get(key);
map.put(key, val);
}
return map;
}
}
--- NEW FILE: Lifecycle.java ---
package osgi;
import java.util.Dictionary;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;
import org.osgi.framework.Constants;
import org.osgi.framework.ServiceReference;
public class Lifecycle implements LifecycleMBean {
private long id;
private BundleContext bc;
public Lifecycle(long id, BundleContext bc) {
this.id = id;
this.bc = bc;
}
/* (non-Javadoc)
* @see biz.xsoftware.osgi.mgr.Temp#getBundleId()
*/
public long getBundleId() {
return id;
}
/* (non-Javadoc)
* @see biz.xsoftware.osgi.mgr.Temp#start()
*/
public void start() throws BundleException {
bc.getBundle(id).start();
}
/* (non-Javadoc)
* @see biz.xsoftware.osgi.mgr.Temp#stop()
*/
public void stop() throws BundleException {
bc.getBundle(id).stop();
}
/* (non-Javadoc)
* @see biz.xsoftware.osgi.mgr.Temp#update()
*/
public void update() throws BundleException {
bc.getBundle(id).update();
}
/* (non-Javadoc)
* @see biz.xsoftware.osgi.mgr.Temp#uninstall()
*/
public void uninstall() throws BundleException {
bc.getBundle(id).uninstall();
}
/* (non-Javadoc)
* @see biz.xsoftware.osgi.mgr.Temp#getStateName()
*/
public String getStateName() {
switch(bc.getBundle(id).getState()) {
case Bundle.ACTIVE:
return "active";
case Bundle.INSTALLED:
return "installed";
case Bundle.RESOLVED:
return "resolved";
case Bundle.STARTING:
return "starting";
case Bundle.STOPPING:
return "stopping";
case Bundle.UNINSTALLED:
return "uninstalled";
default:
return "unknown state";
}
}
/* (non-Javadoc)
* @see biz.xsoftware.osgi.mgr.Temp#getState()
*/
public int getState() {
return bc.getBundle(id).getState();
}
/* (non-Javadoc)
* @see biz.xsoftware.osgi.mgr.Temp#getLocation()
*/
public String getLocation() {
return bc.getBundle(id).getLocation();
}
/* (non-Javadoc)
* @see biz.xsoftware.osgi.mgr.Temp#getRegisteredServices()
*/
public ServiceReference[] getRegisteredServices() {
return bc.getBundle(id).getRegisteredServices();
}
public String[] getRegisteredServiceNames() {
ServiceReference[] refs = getRegisteredServices();
if(refs == null)
return null;
String[] names = new String[refs.length];
for(int i = 0; i < refs.length; i++) {
Object o = bc.getService(refs[i]);
names[i] = o.getClass().getName();
}
return names;
}
/* (non-Javadoc)
* @see biz.xsoftware.osgi.mgr.Temp#getServicesInUse()
*/
public ServiceReference[] getServicesInUse() {
return bc.getBundle(id).getServicesInUse();
}
public String[] getServicesInUseNames() {
ServiceReference[] refs = getServicesInUse();
if(refs == null)
return null;
String[] names = new String[refs.length];
for(int i = 0; i < refs.length; i++) {
Object o = bc.getService(refs[i]);
names[i] = o.getClass().getName();
}
return names;
}
/* (non-Javadoc)
* @see biz.xsoftware.osgi.mgr.Temp#getManifest()
*/
public Dictionary getManifest() {
return bc.getBundle(id).getHeaders();
}
/* (non-Javadoc)
* @see biz.xsoftware.osgi.mgr.Temp#getBundleActivator()
*/
public String getBundleActivator() {
return (String)bc.getBundle(id).getHeaders().get(Constants.BUNDLE_ACTIVATOR);
}
/* (non-Javadoc)
* @see biz.xsoftware.osgi.mgr.Temp#getBundleCategory()
*/
public String getBundleCategory() {
return (String)bc.getBundle(id).getHeaders().get(Constants.BUNDLE_CATEGORY);
}
/* (non-Javadoc)
* @see biz.xsoftware.osgi.mgr.Temp#getContactAddress()
*/
public String getContactAddress() {
return (String)bc.getBundle(id).getHeaders().get(Constants.BUNDLE_CONTACTADDRESS);
}
/* (non-Javadoc)
* @see biz.xsoftware.osgi.mgr.Temp#getCopyright()
*/
public String getCopyright() {
return (String)bc.getBundle(id).getHeaders().get(Constants.BUNDLE_COPYRIGHT);
}
/* (non-Javadoc)
* @see biz.xsoftware.osgi.mgr.Temp#getDescription()
*/
public String getDescription() {
return (String)bc.getBundle(id).getHeaders().get(Constants.BUNDLE_DESCRIPTION);
}
/* (non-Javadoc)
* @see biz.xsoftware.osgi.mgr.Temp#getDocURL()
*/
public String getDocURL() {
return (String)bc.getBundle(id).getHeaders().get(Constants.BUNDLE_DOCURL);
}
/* (non-Javadoc)
* @see biz.xsoftware.osgi.mgr.Temp#getName()
*/
public String getName() {
return (String)bc.getBundle(id).getHeaders().get(Constants.BUNDLE_NAME);
}
/* (non-Javadoc)
* @see biz.xsoftware.osgi.mgr.Temp#getNativeCode()
*/
public String getNativeCode() {
return (String)bc.getBundle(id).getHeaders().get(Constants.BUNDLE_NATIVECODE);
}
/* (non-Javadoc)
* @see biz.xsoftware.osgi.mgr.Temp#getNativeCodeLanguage()
*/
public String getNativeCodeLanguage() {
return (String)bc.getBundle(id).getHeaders().get(Constants.BUNDLE_NATIVECODE_LANGUAGE);
}
/* (non-Javadoc)
* @see biz.xsoftware.osgi.mgr.Temp#getNativeCodeOS()
*/
public String getNativeCodeOS() {
return (String)bc.getBundle(id).getHeaders().get(Constants.BUNDLE_NATIVECODE_OSNAME);
}
/* (non-Javadoc)
* @see biz.xsoftware.osgi.mgr.Temp#getNativeCodeOSVersion()
*/
public String getNativeCodeOSVersion() {
return (String)bc.getBundle(id).getHeaders().get(Constants.BUNDLE_NATIVECODE_OSVERSION);
}
/* (non-Javadoc)
* @see biz.xsoftware.osgi.mgr.Temp#getNativeCodeProcessor()
*/
public String getNativeCodeProcessor() {
return (String)bc.getBundle(id).getHeaders().get(Constants.BUNDLE_NATIVECODE_PROCESSOR);
}
/* (non-Javadoc)
* @see biz.xsoftware.osgi.mgr.Temp#getRequiredExecutionEnvironment()
*/
public String getRequiredExecutionEnvironment() {
return (String)bc.getBundle(id).getHeaders().get(Constants.BUNDLE_REQUIREDEXECUTIONENVIRONMENT);
}
/* (non-Javadoc)
* @see biz.xsoftware.osgi.mgr.Temp#getUpdateLocation()
*/
public String getUpdateLocation() {
return (String)bc.getBundle(id).getHeaders().get(Constants.BUNDLE_UPDATELOCATION);
}
/* (non-Javadoc)
* @see biz.xsoftware.osgi.mgr.Temp#getVendor()
*/
public String getVendor() {
return (String)bc.getBundle(id).getHeaders().get(Constants.BUNDLE_VENDOR);
}
/* (non-Javadoc)
* @see biz.xsoftware.osgi.mgr.Temp#getVersion()
*/
public String getVersion() {
return (String)bc.getBundle(id).getHeaders().get(Constants.BUNDLE_VERSION);
}
/* (non-Javadoc)
* @see biz.xsoftware.osgi.mgr.Temp#getDynamicImport()
*/
public String getDynamicImport() {
return (String)bc.getBundle(id).getHeaders().get(Constants.DYNAMICIMPORT_PACKAGE);
}
/* (non-Javadoc)
* @see biz.xsoftware.osgi.mgr.Temp#getExportPackage()
*/
public String getExportPackage() {
String packs = (String)bc.getBundle(id).getHeaders().get(Constants.EXPORT_PACKAGE);
if(packs == null)
return null;
packs = packs.replace(',','\n');
return packs;
}
/* (non-Javadoc)
* @see biz.xsoftware.osgi.mgr.Temp#getExportService()
*/
public String getExportService() {
return (String)bc.getBundle(id).getHeaders().get(Constants.EXPORT_SERVICE);
}
/* (non-Javadoc)
* @see biz.xsoftware.osgi.mgr.Temp#getImportPackage()
*/
public String getImportPackage() {
String packs = (String)bc.getBundle(id).getHeaders().get(Constants.IMPORT_PACKAGE);
if(packs == null)
return null;
packs = packs.replace(',','\n');
return packs;
}
/* (non-Javadoc)
* @see biz.xsoftware.osgi.mgr.Temp#getImportService()
*/
public String getImportService() {
return (String)bc.getBundle(id).getHeaders().get(Constants.IMPORT_SERVICE);
}
/* (non-Javadoc)
* @see biz.xsoftware.osgi.mgr.Temp#getObjectClass()
*/
public String getObjectClass() {
return (String)bc.getBundle(id).getHeaders().get(Constants.OBJECTCLASS);
}
/* (non-Javadoc)
* @see biz.xsoftware.osgi.mgr.Temp#getPackageSpecificationVersion()
*/
public String getPackageSpecificationVersion() {
return (String)bc.getBundle(id).getHeaders().get(Constants.PACKAGE_SPECIFICATION_VERSION);
}
public String getManifestVersion() {
return (String)bc.getBundle(id).getHeaders().get("Manifest-Version");
}
}
|