1 package org
.argeo
.slc
.osgi
;
3 import org
.argeo
.slc
.build
.BasicNameVersion
;
4 import org
.argeo
.slc
.build
.Distribution
;
5 import org
.argeo
.slc
.core
.build
.ResourceDistribution
;
6 import org
.argeo
.slc
.deploy
.DeploymentData
;
7 import org
.argeo
.slc
.deploy
.Module
;
8 import org
.argeo
.slc
.deploy
.TargetData
;
9 import org
.argeo
.slc
.process
.RealizedFlow
;
10 import org
.osgi
.framework
.Bundle
;
11 import org
.osgi
.framework
.Constants
;
13 public class OsgiBundle
extends BasicNameVersion
implements Module
{
14 private ResourceDistribution distribution
;
16 private Long internalBundleId
;
22 public OsgiBundle(String name
, String version
) {
26 public OsgiBundle(Bundle bundle
) {
27 super(bundle
.getSymbolicName(), getVersionSafe(bundle
));
28 internalBundleId
= bundle
.getBundleId();
31 private static String
getVersionSafe(Bundle bundle
) {
32 Object versionObj
= bundle
.getHeaders().get(Constants
.BUNDLE_VERSION
);
33 if (versionObj
!= null)
34 return versionObj
.toString();
39 public OsgiBundle(RealizedFlow realizedFlow
) {
40 super(realizedFlow
.getModuleName(), realizedFlow
.getModuleVersion());
43 public String
getDeployedSystemId() {
44 return getName() + ":" + getVersion();
47 public DeploymentData
getDeploymentData() {
48 throw new UnsupportedOperationException();
51 public Distribution
getDistribution() {
55 public ResourceDistribution
getResourceDistribution() {
59 public TargetData
getTargetData() {
60 throw new UnsupportedOperationException();
63 public void setResourceDistribution(ResourceDistribution distribution
) {
64 this.distribution
= distribution
;
68 * To be used for optimization when looking in the bundle context. Can
71 public Long
getInternalBundleId() {
72 return internalBundleId
;
75 /** Only package access for the time being. e.g. from {@link BundlesManager} */
76 void setInternalBundleId(Long internalBundleId
) {
77 this.internalBundleId
= internalBundleId
;