| author | Lazar Kirchev | 2011-07-20 06:53:53 (EDT) |
|---|---|---|
| committer | Hristo Iliev | 2011-07-20 07:05:48 (EDT) |
| commit | 73644c6f41c9bb6f4bf292df4c6de2fa98626127 (patch) (side-by-side diff) | |
| tree | 3047f3bf72dde1b76e8368bb7e89450aa5270381 | |
| parent | ece3f398078f59be234c1372f3389f49195309d1 (diff) | |
| download | org.eclipse.virgo.kernel-73644c6f41c9bb6f4bf292df4c6de2fa98626127.zip org.eclipse.virgo.kernel-73644c6f41c9bb6f4bf292df4c6de2fa98626127.tar.gz org.eclipse.virgo.kernel-73644c6f41c9bb6f4bf292df4c6de2fa98626127.tar.bz2 | |
Fixes the IDs of the listed with vsh bundles
2 files changed, 14 insertions, 5 deletions
diff --git a/org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/internal/commands/BundleCommands.java b/org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/internal/commands/BundleCommands.java index 503d2f8..b1b1e55 100644 --- a/org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/internal/commands/BundleCommands.java +++ b/org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/internal/commands/BundleCommands.java @@ -50,9 +50,9 @@ final class BundleCommands extends AbstractInstallArtifactBasedCommands<Manageab public BundleCommands(RuntimeArtifactModelObjectNameCreator objectNameCreator, StateService stateService, ModuleContextAccessor moduleContextAccessor, RegionDigraph regionDigraph) { - super(TYPE, objectNameCreator, new BundleInstallArtifactCommandFormatter(stateService, moduleContextAccessor), ManageableArtifact.class, regionDigraph); + super(TYPE, objectNameCreator, new BundleInstallArtifactCommandFormatter(regionDigraph, stateService, moduleContextAccessor), ManageableArtifact.class, regionDigraph); this.stateService = stateService; - this.formatter = new BundleInstallArtifactCommandFormatter(stateService, moduleContextAccessor); + this.formatter = new BundleInstallArtifactCommandFormatter(regionDigraph, stateService, moduleContextAccessor); } @Command("examine") diff --git a/org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/internal/formatting/BundleInstallArtifactCommandFormatter.java b/org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/internal/formatting/BundleInstallArtifactCommandFormatter.java index b05ad2d..b90b25f 100644 --- a/org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/internal/formatting/BundleInstallArtifactCommandFormatter.java +++ b/org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/internal/formatting/BundleInstallArtifactCommandFormatter.java @@ -20,11 +20,14 @@ import java.util.Collections; import java.util.Dictionary; import java.util.Enumeration; import java.util.List; +import java.util.Set; import org.osgi.framework.Bundle; import org.osgi.framework.Constants; import org.osgi.framework.Version; +import org.eclipse.equinox.region.Region; +import org.eclipse.equinox.region.RegionDigraph; import org.eclipse.virgo.kernel.model.BundleArtifact; import org.eclipse.virgo.kernel.model.management.ManageableArtifact; import org.eclipse.virgo.kernel.module.ModuleContext; @@ -59,6 +62,8 @@ public final class BundleInstallArtifactCommandFormatter implements InstallArtif private static final int VERSION_COLUMN_MIN_WIDTH = VERSION_COLUMN_NAME.length(); private static final String STATE_COLUMN_NAME = "State"; + + private static final String USER_REGION_NAME = "org.eclipse.virgo.region.user"; /** * longest state name from {@link BundleArtifact#mapBundleState()} @@ -68,10 +73,13 @@ public final class BundleInstallArtifactCommandFormatter implements InstallArtif private final StateService stateService; private final ModuleContextAccessor moduleContextAccessor; + + private final Region userRegion; - public BundleInstallArtifactCommandFormatter(StateService stateService, ModuleContextAccessor moduleContextAccessor) { + public BundleInstallArtifactCommandFormatter(RegionDigraph regionDigraph, StateService stateService, ModuleContextAccessor moduleContextAccessor) { this.stateService = stateService; this.moduleContextAccessor = moduleContextAccessor; + this.userRegion = regionDigraph.getRegion(USER_REGION_NAME); } public List<String> formatList(List<ManageableArtifact> artifacts) { @@ -309,7 +317,7 @@ public final class BundleInstallArtifactCommandFormatter implements InstallArtif List<ArtifactHolder> artifactHolders = new ArrayList<ArtifactHolder>(artifacts.size()); List<QuasiBundle> bundles = this.stateService.getAllBundles(null); - + for (ManageableArtifact artifact : artifacts) { ArtifactHolder artifactHolder = getArtifactHolder(artifact, bundles); if (artifactHolder != null) { @@ -322,8 +330,9 @@ public final class BundleInstallArtifactCommandFormatter implements InstallArtif private ArtifactHolder getArtifactHolder(ManageableArtifact artifact, List<QuasiBundle> bundles) { Version v = new Version(artifact.getVersion()); + Set<Long> bundleIds = userRegion.getBundleIds(); for (QuasiBundle bundle : bundles) { - if (bundle.getSymbolicName().equals(artifact.getName()) && bundle.getVersion().equals(v)) { + if (bundle.getSymbolicName().equals(artifact.getName()) && bundle.getVersion().equals(v) && bundleIds.contains(bundle.getBundleId())) { return new ArtifactHolder(artifact, bundle, moduleContextAccessor); } } |

