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
;
19 private String description
;
25 public OsgiBundle(String name
, String version
) {
29 public OsgiBundle(Bundle bundle
) {
30 super(bundle
.getSymbolicName(), getVersionSafe(bundle
));
31 internalBundleId
= bundle
.getBundleId();
34 private static String
getVersionSafe(Bundle bundle
) {
35 Object versionObj
= bundle
.getHeaders().get(Constants
.BUNDLE_VERSION
);
36 if (versionObj
!= null)
37 return versionObj
.toString();
42 public OsgiBundle(RealizedFlow realizedFlow
) {
43 super(realizedFlow
.getModuleName(), realizedFlow
.getModuleVersion());
46 public String
getDeployedSystemId() {
47 return getName() + ":" + getVersion();
50 public DeploymentData
getDeploymentData() {
51 throw new UnsupportedOperationException();
54 public Distribution
getDistribution() {
58 public ResourceDistribution
getResourceDistribution() {
62 public TargetData
getTargetData() {
63 throw new UnsupportedOperationException();
66 public void setResourceDistribution(ResourceDistribution distribution
) {
67 this.distribution
= distribution
;
71 * To be used for optimization when looking in the bundle context. Can
74 public Long
getInternalBundleId() {
75 return internalBundleId
;
78 /** Only package access for the time being. e.g. from {@link BundlesManager} */
79 void setInternalBundleId(Long internalBundleId
) {
80 this.internalBundleId
= internalBundleId
;
83 public String
getLabel() {
87 public void setLabel(String label
) {
91 public String
getDescription() {
95 public void setDescription(String description
) {
96 this.description
= description
;