1 package org
.argeo
.slc
.osgi
.deploy
;
3 import org
.apache
.commons
.logging
.Log
;
4 import org
.apache
.commons
.logging
.LogFactory
;
5 import org
.osgi
.framework
.Bundle
;
6 import org
.osgi
.framework
.BundleContext
;
7 import org
.osgi
.framework
.Constants
;
9 /** Logs the version of an OSGi bundle. */
10 public class OsgiModuleLabel
{
11 private final static Log log
= LogFactory
.getLog(OsgiModuleLabel
.class);
13 private Bundle bundle
;
15 public OsgiModuleLabel() {
18 /** Sets without logging. */
19 public OsgiModuleLabel(Bundle bundle
) {
24 * Retrieved bundle from a bundle context and logs it. Typically to be set
27 public void setBundleContext(BundleContext bundleContext
) {
28 this.bundle
= bundleContext
.getBundle();
33 String name
= bundle
.getHeaders().get(Constants
.BUNDLE_NAME
).toString();
34 String symbolicName
= bundle
.getSymbolicName();
35 String version
= bundle
.getVersion().toString();
36 return name
+ " v" + version
+ " (" + symbolicName
+ ")";