]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - runtime/org.argeo.slc.support.equinox/src/main/java/org/argeo/slc/osgi/OsgiBundle.java
Restructure OSGi launching
[gpl/argeo-slc.git] / runtime / org.argeo.slc.support.equinox / src / main / java / org / argeo / slc / osgi / OsgiBundle.java
index 47ca2ea72fba8649cd64109c1df54aa940b342c3..45cee40e2e98eab4f996c6c6a0dda1638e930ae2 100644 (file)
@@ -5,20 +5,30 @@ import org.argeo.slc.core.deploy.ResourceDistribution;
 import org.argeo.slc.deploy.DeploymentData;
 import org.argeo.slc.deploy.Module;
 import org.argeo.slc.deploy.TargetData;
+import org.argeo.slc.process.RealizedFlow;
 import org.osgi.framework.Bundle;
+import org.osgi.framework.Constants;
 
 public class OsgiBundle implements Module<ResourceDistribution> {
        private String name;
        private String version;
        private Distribution distribution;
 
+       private Long internalBundleId;
+
        public OsgiBundle() {
 
        }
 
        public OsgiBundle(Bundle bundle) {
                name = bundle.getSymbolicName();
-               version = bundle.getHeaders().get("Bundle-Version").toString();
+               version = bundle.getHeaders().get(Constants.BUNDLE_VERSION).toString();
+               internalBundleId = bundle.getBundleId();
+       }
+
+       public OsgiBundle(RealizedFlow realizedFlow) {
+               name = realizedFlow.getModuleName();
+               version = realizedFlow.getModuleVersion();
        }
 
        public String getDeployedSystemId() {
@@ -26,8 +36,7 @@ public class OsgiBundle implements Module<ResourceDistribution> {
        }
 
        public DeploymentData getDeploymentData() {
-               // TODO Auto-generated method stub
-               return null;
+               throw new UnsupportedOperationException();
        }
 
        public Distribution getDistribution() {
@@ -35,8 +44,7 @@ public class OsgiBundle implements Module<ResourceDistribution> {
        }
 
        public TargetData getTargetData() {
-               // TODO Auto-generated method stub
-               return null;
+               throw new UnsupportedOperationException();
        }
 
        public String getName() {
@@ -59,4 +67,17 @@ public class OsgiBundle implements Module<ResourceDistribution> {
                this.distribution = distribution;
        }
 
+       /**
+        * To be used for optimization when looking in the bundle context. Can
+        * therefore be null.
+        */
+       public Long getInternalBundleId() {
+               return internalBundleId;
+       }
+
+       /** Only package access for the time being. e.g. from {@link BundlesManager} */
+       void setInternalBundleId(Long internalBundleId) {
+               this.internalBundleId = internalBundleId;
+       }
+
 }