Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.virgo.kernel.model')
-rw-r--r--org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/BundleArtifact.java6
-rw-r--r--org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/AbstractArtifact.java2
-rw-r--r--org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/bundle/BundleDependencyDeterminer.java2
-rw-r--r--org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/bundle/ModelBundleListener.java8
-rw-r--r--org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/bundle/ModelBundleListenerInitializer.java2
-rw-r--r--org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/bundle/NativeBundleArtifact.java (renamed from org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/bundle/BundleArtifact.java)21
-rw-r--r--org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/deployer/DeployerArtifact.java2
-rw-r--r--org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/deployer/DeployerBundleArtifact.java14
-rw-r--r--org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/management/ManageableBundleArtifact.java6
-rw-r--r--org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/management/internal/DelegatingManageableBundleArtifact.java7
-rw-r--r--org.eclipse.virgo.kernel.model/src/test/java/org/eclipse/virgo/kernel/model/internal/bundle/BundleArtifactTests.java8
11 files changed, 41 insertions, 37 deletions
diff --git a/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/BundleArtifact.java b/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/BundleArtifact.java
index 6c373cd2..3dac3538 100644
--- a/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/BundleArtifact.java
+++ b/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/BundleArtifact.java
@@ -40,11 +40,5 @@ public interface BundleArtifact extends Artifact {
*/
void deleteEntry(String targetPath);
- /**
- * Gets the id of this bundle
- *
- * @return long id of this bundle
- */
- long getBundleId();
}
diff --git a/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/AbstractArtifact.java b/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/AbstractArtifact.java
index c9be1c91..fc391d03 100644
--- a/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/AbstractArtifact.java
+++ b/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/AbstractArtifact.java
@@ -97,7 +97,7 @@ public abstract class AbstractArtifact implements Artifact {
* {@inheritDoc}
*/
@Override
- public Region getRegion() {
+ public final Region getRegion() {
return this.region;
}
diff --git a/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/bundle/BundleDependencyDeterminer.java b/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/bundle/BundleDependencyDeterminer.java
index de2a1526..98a618a5 100644
--- a/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/bundle/BundleDependencyDeterminer.java
+++ b/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/bundle/BundleDependencyDeterminer.java
@@ -68,7 +68,7 @@ public final class BundleDependencyDeterminer implements DependencyDeterminer {
QuasiExportPackage provider = importPackage.getProvider();
if (provider != null) {
QuasiBundle bundle = provider.getExportingBundle();
- Artifact artifact = artifactRepository.getArtifact(BundleArtifact.TYPE, bundle.getSymbolicName(), bundle.getVersion(), this.regionDigraph.getRegion(bundle.getBundleId()));
+ Artifact artifact = artifactRepository.getArtifact(NativeBundleArtifact.TYPE, bundle.getSymbolicName(), bundle.getVersion(), this.regionDigraph.getRegion(bundle.getBundleId()));
artifacts.add(artifact);
}
}
diff --git a/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/bundle/ModelBundleListener.java b/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/bundle/ModelBundleListener.java
index 0be0e3b0..8e3d1b8e 100644
--- a/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/bundle/ModelBundleListener.java
+++ b/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/bundle/ModelBundleListener.java
@@ -71,17 +71,17 @@ final class ModelBundleListener implements SynchronousBundleListener {
Bundle bundle = event.getBundle();
Region region = this.regionDigraph.getRegion(bundle);
logger.info("Processing installed event for bundle '{}:{}' in region '{}'", new Object[] {bundle.getSymbolicName(), bundle.getVersion().toString(), region.getName()});
- this.artifactRepository.add(new BundleArtifact(bundleContext, packageAdminUtil, bundle, region));
+ this.artifactRepository.add(new NativeBundleArtifact(bundleContext, packageAdminUtil, bundle, region));
}
private void processUninstalled(BundleEvent event) {
Bundle bundle = event.getBundle();
for (Artifact artifact : this.artifactRepository.getArtifacts()) {
- if (artifact.getType().equals(BundleArtifact.TYPE) &&
+ if (artifact.getType().equals(NativeBundleArtifact.TYPE) &&
artifact.getName().equals(bundle.getSymbolicName()) &&
artifact.getVersion().equals(bundle.getVersion()) ){
- if(artifact instanceof BundleArtifact){
- BundleArtifact bundleArtifact = (BundleArtifact) artifact;
+ if(artifact instanceof NativeBundleArtifact){
+ NativeBundleArtifact bundleArtifact = (NativeBundleArtifact) artifact;
if(ArtifactState.UNINSTALLED == bundleArtifact.getState()){
this.artifactRepository.remove(bundleArtifact);
logger.info("Processing uninstalled event for bundle '{}:{}' from region '{}'", new Object[] {bundleArtifact.getName(), bundleArtifact.getVersion().toString(), bundleArtifact.getRegion().getName()});
diff --git a/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/bundle/ModelBundleListenerInitializer.java b/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/bundle/ModelBundleListenerInitializer.java
index d40cda1a..012525a5 100644
--- a/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/bundle/ModelBundleListenerInitializer.java
+++ b/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/bundle/ModelBundleListenerInitializer.java
@@ -69,7 +69,7 @@ public final class ModelBundleListenerInitializer {
// Find bundles that the listener has almost certainly missed.
for (Bundle bundle : systemBundleContext.getBundles()) {
try {
- this.artifactRepository.add(new BundleArtifact(this.kernelBundleContext, this.packageAdminUtil, bundle, this.regionDigraph.getRegion(bundle)));
+ this.artifactRepository.add(new NativeBundleArtifact(this.kernelBundleContext, this.packageAdminUtil, bundle, this.regionDigraph.getRegion(bundle)));
} catch (Exception e) {
this.logger.error(String.format("Exception adding bundle '%s:%s' to the repository", bundle.getSymbolicName(),
bundle.getVersion().toString()), e);
diff --git a/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/bundle/BundleArtifact.java b/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/bundle/NativeBundleArtifact.java
index a5786f18..30f64f3f 100644
--- a/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/bundle/BundleArtifact.java
+++ b/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/bundle/NativeBundleArtifact.java
@@ -11,6 +11,10 @@
package org.eclipse.virgo.kernel.model.internal.bundle;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
import org.eclipse.equinox.region.Region;
import org.eclipse.virgo.kernel.model.Artifact;
import org.eclipse.virgo.kernel.model.ArtifactState;
@@ -24,7 +28,8 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
- * Implementation of {@link Artifact} that delegates to an OSGi native bundle
+ * Implementation of {@link Artifact} that delegates to an OSGi native bundle, this is in comparison
+ * to a {@link DeployerBundleArtifact} which delegates to a Kernel {@link InstallArtifact}.
* <p />
*
* <strong>Concurrent Semantics</strong><br />
@@ -32,7 +37,7 @@ import org.slf4j.LoggerFactory;
* Threadsafe
*
*/
-final class BundleArtifact extends AbstractArtifact {
+final class NativeBundleArtifact extends AbstractArtifact {
static final String TYPE = "bundle";
@@ -42,7 +47,7 @@ final class BundleArtifact extends AbstractArtifact {
private final Bundle bundle;
- public BundleArtifact(@NonNull BundleContext bundleContext, @NonNull PackageAdminUtil packageAdminUtil, @NonNull Bundle bundle, @NonNull Region region) {
+ public NativeBundleArtifact(@NonNull BundleContext bundleContext, @NonNull PackageAdminUtil packageAdminUtil, @NonNull Bundle bundle, @NonNull Region region) {
super(bundleContext, TYPE, bundle.getSymbolicName(), bundle.getVersion(), region);
this.packageAdminUtil = packageAdminUtil;
this.bundle = bundle;
@@ -58,6 +63,16 @@ final class BundleArtifact extends AbstractArtifact {
/**
* {@inheritDoc}
*/
+ public Map<String, String> getProperties() {
+ Map<String, String> properties = new HashMap<String, String>();
+ properties.put("BundleId", String.valueOf(this.bundle.getBundleId()));
+ properties.put("Location", this.bundle.getLocation());
+ return Collections.unmodifiableMap(properties);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
public boolean refresh() {
try {
this.bundle.update();
diff --git a/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/deployer/DeployerArtifact.java b/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/deployer/DeployerArtifact.java
index b2fcf8ff..1aecd733 100644
--- a/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/deployer/DeployerArtifact.java
+++ b/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/deployer/DeployerArtifact.java
@@ -113,7 +113,7 @@ class DeployerArtifact extends AbstractArtifact {
/**
* {@inheritDoc}
*/
- public final Map<String, String> getProperties() {
+ public Map<String, String> getProperties() {
Set<String> propertyNames = this.installArtifact.getPropertyNames();
Map<String, String> result = new HashMap<String, String>(propertyNames.size());
for (String propertyName : propertyNames) {
diff --git a/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/deployer/DeployerBundleArtifact.java b/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/deployer/DeployerBundleArtifact.java
index c200881c..9cd55072 100644
--- a/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/deployer/DeployerBundleArtifact.java
+++ b/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/deployer/DeployerBundleArtifact.java
@@ -12,6 +12,9 @@
package org.eclipse.virgo.kernel.model.internal.deployer;
import java.net.URI;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
import org.eclipse.equinox.region.Region;
import org.eclipse.virgo.kernel.install.artifact.BundleInstallArtifact;
@@ -45,8 +48,13 @@ final class DeployerBundleArtifact extends DeployerArtifact implements BundleArt
/**
* {@inheritDoc}
*/
- public long getBundleId() {
- return this.installArtifact.getBundle().getBundleId();
+ public final Map<String, String> getProperties() {
+ Map<String, String> parentProperties = super.getProperties();
+ Map<String, String> properties = new HashMap<String, String>();
+ properties.putAll(parentProperties);
+ properties.put("BundleId", String.valueOf(this.installArtifact.getBundle().getBundleId()));
+ properties.put("Location", this.installArtifact.getBundle().getLocation());
+ return Collections.unmodifiableMap(properties);
}
-
+
}
diff --git a/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/management/ManageableBundleArtifact.java b/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/management/ManageableBundleArtifact.java
index 68abe39e..5d96905f 100644
--- a/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/management/ManageableBundleArtifact.java
+++ b/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/management/ManageableBundleArtifact.java
@@ -43,10 +43,4 @@ public interface ManageableBundleArtifact extends ManageableArtifact {
*/
void deleteEntry(String targetPath);
- /**
- * Gets the id of this bundle
- *
- * @return long id of this bundle
- */
- long getBundleId();
}
diff --git a/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/management/internal/DelegatingManageableBundleArtifact.java b/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/management/internal/DelegatingManageableBundleArtifact.java
index fc49bf4a..f06e3652 100644
--- a/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/management/internal/DelegatingManageableBundleArtifact.java
+++ b/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/management/internal/DelegatingManageableBundleArtifact.java
@@ -51,11 +51,4 @@ final class DelegatingManageableBundleArtifact extends DelegatingManageableArtif
this.bundleArtifact.updateEntry(inputPath, targetPath);
}
- /**
- * {@inheritDoc}
- */
- public long getBundleId() {
- return this.bundleArtifact.getBundleId();
- }
-
}
diff --git a/org.eclipse.virgo.kernel.model/src/test/java/org/eclipse/virgo/kernel/model/internal/bundle/BundleArtifactTests.java b/org.eclipse.virgo.kernel.model/src/test/java/org/eclipse/virgo/kernel/model/internal/bundle/BundleArtifactTests.java
index 445893dc..189570c4 100644
--- a/org.eclipse.virgo.kernel.model/src/test/java/org/eclipse/virgo/kernel/model/internal/bundle/BundleArtifactTests.java
+++ b/org.eclipse.virgo.kernel.model/src/test/java/org/eclipse/virgo/kernel/model/internal/bundle/BundleArtifactTests.java
@@ -48,21 +48,21 @@ public class BundleArtifactTests {
expect(this.region.getName()).andReturn("test.region").anyTimes();
}
- private final AbstractArtifact artifact = new BundleArtifact(bundleContext, packageAdminUtil, bundle, this.region);
+ private final AbstractArtifact artifact = new NativeBundleArtifact(bundleContext, packageAdminUtil, bundle, this.region);
@Test(expected = FatalAssertionException.class)
public void nullBundleContext() {
- new BundleArtifact(null, packageAdminUtil, bundle, this.region);
+ new NativeBundleArtifact(null, packageAdminUtil, bundle, this.region);
}
@Test(expected = FatalAssertionException.class)
public void nullPackageAdminUtil() {
- new BundleArtifact(bundleContext, null, bundle, this.region);
+ new NativeBundleArtifact(bundleContext, null, bundle, this.region);
}
@Test(expected = FatalAssertionException.class)
public void nullBundle() {
- new BundleArtifact(bundleContext, packageAdminUtil, null, this.region);
+ new NativeBundleArtifact(bundleContext, packageAdminUtil, null, this.region);
}
@Test

Back to the top