]> git.argeo.org Git - gpl/argeo-slc.git/blob - runtime/org.argeo.slc.support.osgi/src/main/java/org/argeo/slc/osgi/OsgiBundle.java
Provisioning
[gpl/argeo-slc.git] / runtime / org.argeo.slc.support.osgi / src / main / java / org / argeo / slc / osgi / OsgiBundle.java
1 package org.argeo.slc.osgi;
2
3 import org.argeo.slc.build.Distribution;
4 import org.argeo.slc.deploy.DeploymentData;
5 import org.argeo.slc.deploy.Module;
6 import org.argeo.slc.deploy.TargetData;
7 import org.argeo.slc.process.RealizedFlow;
8 import org.osgi.framework.Bundle;
9 import org.osgi.framework.Constants;
10
11 public class OsgiBundle implements Module {
12 private String name;
13 private String version;
14 private Distribution distribution;
15
16 private Long internalBundleId;
17
18 public OsgiBundle() {
19
20 }
21
22 public OsgiBundle(String name, String version) {
23 this.name = name;
24 this.version = version;
25 }
26
27 public OsgiBundle(Bundle bundle) {
28 name = bundle.getSymbolicName();
29 version = bundle.getHeaders().get(Constants.BUNDLE_VERSION).toString();
30 internalBundleId = bundle.getBundleId();
31 }
32
33 public OsgiBundle(RealizedFlow realizedFlow) {
34 name = realizedFlow.getModuleName();
35 version = realizedFlow.getModuleVersion();
36 }
37
38 public String getDeployedSystemId() {
39 return name + ":" + version;
40 }
41
42 public DeploymentData getDeploymentData() {
43 throw new UnsupportedOperationException();
44 }
45
46 public Distribution getDistribution() {
47 return distribution;
48 }
49
50 public TargetData getTargetData() {
51 throw new UnsupportedOperationException();
52 }
53
54 public String getName() {
55 return name;
56 }
57
58 public String getVersion() {
59 return version;
60 }
61
62 public void setName(String name) {
63 this.name = name;
64 }
65
66 public void setVersion(String version) {
67 this.version = version;
68 }
69
70 public void setDistribution(Distribution distribution) {
71 this.distribution = distribution;
72 }
73
74 /**
75 * To be used for optimization when looking in the bundle context. Can
76 * therefore be null.
77 */
78 public Long getInternalBundleId() {
79 return internalBundleId;
80 }
81
82 /** Only package access for the time being. e.g. from {@link BundlesManager} */
83 void setInternalBundleId(Long internalBundleId) {
84 this.internalBundleId = internalBundleId;
85 }
86
87 }