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
.build
.NameVersion
;
6 import org
.argeo
.slc
.core
.build
.ResourceDistribution
;
7 import org
.argeo
.slc
.deploy
.DeploymentData
;
8 import org
.argeo
.slc
.deploy
.Module
;
9 import org
.argeo
.slc
.deploy
.TargetData
;
10 import org
.argeo
.slc
.process
.RealizedFlow
;
11 import org
.osgi
.framework
.Bundle
;
12 import org
.osgi
.framework
.Constants
;
14 public class OsgiBundle
extends BasicNameVersion
implements Module
{
15 private ResourceDistribution distribution
;
17 private Long internalBundleId
;
20 private String description
;
26 public OsgiBundle(String name
, String version
) {
30 public OsgiBundle(NameVersion nameVersion
) {
34 public OsgiBundle(Bundle bundle
) {
35 super(bundle
.getSymbolicName(), getVersionSafe(bundle
));
36 internalBundleId
= bundle
.getBundleId();
39 private static String
getVersionSafe(Bundle bundle
) {
40 Object versionObj
= bundle
.getHeaders().get(Constants
.BUNDLE_VERSION
);
41 if (versionObj
!= null)
42 return versionObj
.toString();
47 public OsgiBundle(RealizedFlow realizedFlow
) {
48 super(realizedFlow
.getModuleName(), realizedFlow
.getModuleVersion());
51 public String
getDeployedSystemId() {
52 return getName() + ":" + getVersion();
55 public DeploymentData
getDeploymentData() {
56 throw new UnsupportedOperationException();
59 public Distribution
getDistribution() {
63 public ResourceDistribution
getResourceDistribution() {
67 public TargetData
getTargetData() {
68 throw new UnsupportedOperationException();
71 public void setResourceDistribution(ResourceDistribution distribution
) {
72 this.distribution
= distribution
;
76 * To be used for optimization when looking in the bundle context. Can
79 public Long
getInternalBundleId() {
80 return internalBundleId
;
83 /** Only package access for the time being. e.g. from {@link BundlesManager} */
84 void setInternalBundleId(Long internalBundleId
) {
85 this.internalBundleId
= internalBundleId
;
88 public String
getLabel() {
92 public void setLabel(String label
) {
96 public String
getDescription() {
100 public void setDescription(String description
) {
101 this.description
= description
;