X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;ds=sidebyside;f=runtime%2Forg.argeo.slc.support.osgi%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fslc%2Fosgi%2FOsgiBundle.java;h=50b76fa4764c06abeb2460a03a0b8b765d41818f;hb=c3079df154cefc630d0f4a398ab1ce97b61d3ba7;hp=745ba76a616218bb244074fb4fc17b4aadf97fde;hpb=b98bef7b2e743103c93e719ac5c18bf41858ec3a;p=gpl%2Fargeo-slc.git diff --git a/runtime/org.argeo.slc.support.osgi/src/main/java/org/argeo/slc/osgi/OsgiBundle.java b/runtime/org.argeo.slc.support.osgi/src/main/java/org/argeo/slc/osgi/OsgiBundle.java index 745ba76a6..50b76fa47 100644 --- a/runtime/org.argeo.slc.support.osgi/src/main/java/org/argeo/slc/osgi/OsgiBundle.java +++ b/runtime/org.argeo.slc.support.osgi/src/main/java/org/argeo/slc/osgi/OsgiBundle.java @@ -1,6 +1,8 @@ package org.argeo.slc.osgi; +import org.argeo.slc.build.BasicNameVersion; import org.argeo.slc.build.Distribution; +import org.argeo.slc.core.build.ResourceDistribution; import org.argeo.slc.deploy.DeploymentData; import org.argeo.slc.deploy.Module; import org.argeo.slc.deploy.TargetData; @@ -8,35 +10,41 @@ import org.argeo.slc.process.RealizedFlow; import org.osgi.framework.Bundle; import org.osgi.framework.Constants; -public class OsgiBundle implements Module { - private String name; - private String version; - private Distribution distribution; +public class OsgiBundle extends BasicNameVersion implements Module { + private ResourceDistribution distribution; private Long internalBundleId; + private String label; + private String description; + public OsgiBundle() { } public OsgiBundle(String name, String version) { - this.name = name; - this.version = version; + super(name, version); } public OsgiBundle(Bundle bundle) { - name = bundle.getSymbolicName(); - version = bundle.getHeaders().get(Constants.BUNDLE_VERSION).toString(); + super(bundle.getSymbolicName(), getVersionSafe(bundle)); internalBundleId = bundle.getBundleId(); } + private static String getVersionSafe(Bundle bundle) { + Object versionObj = bundle.getHeaders().get(Constants.BUNDLE_VERSION); + if (versionObj != null) + return versionObj.toString(); + else + return null; + } + public OsgiBundle(RealizedFlow realizedFlow) { - name = realizedFlow.getModuleName(); - version = realizedFlow.getModuleVersion(); + super(realizedFlow.getModuleName(), realizedFlow.getModuleVersion()); } public String getDeployedSystemId() { - return name + ":" + version; + return getName() + ":" + getVersion(); } public DeploymentData getDeploymentData() { @@ -47,27 +55,15 @@ public class OsgiBundle implements Module { return distribution; } - public TargetData getTargetData() { - throw new UnsupportedOperationException(); - } - - public String getName() { - return name; - } - - public String getVersion() { - return version; - } - - public void setName(String name) { - this.name = name; + public ResourceDistribution getResourceDistribution() { + return distribution; } - public void setVersion(String version) { - this.version = version; + public TargetData getTargetData() { + throw new UnsupportedOperationException(); } - public void setDistribution(Distribution distribution) { + public void setResourceDistribution(ResourceDistribution distribution) { this.distribution = distribution; } @@ -84,4 +80,20 @@ public class OsgiBundle implements Module { this.internalBundleId = internalBundleId; } + public String getLabel() { + return label; + } + + public void setLabel(String label) { + this.label = label; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + }