Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Frost2011-05-05 12:11:36 -0400
committerChristopher Frost2011-05-05 12:11:36 -0400
commit9d9f0a38e18382a0a8b85df86558006e45a1f14d (patch)
tree601d98df772ea06fceb57d959fccc6868abd20d8 /org.eclipse.virgo.kernel.model
parent77bce71b09632e9d38ca605f77230593129deff9 (diff)
downloadorg.eclipse.virgo.kernel-9d9f0a38e18382a0a8b85df86558006e45a1f14d.tar.gz
org.eclipse.virgo.kernel-9d9f0a38e18382a0a8b85df86558006e45a1f14d.tar.xz
org.eclipse.virgo.kernel-9d9f0a38e18382a0a8b85df86558006e45a1f14d.zip
Review comments changes and bug fix in the Models Bundle dependancy determiner
Diffstat (limited to 'org.eclipse.virgo.kernel.model')
-rw-r--r--org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/RuntimeArtifactRepository.java5
-rw-r--r--org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/bundle/BundleDependencyDeterminer.java20
-rw-r--r--org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/configurationadmin/ModelConfigurationListener.java4
-rw-r--r--org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/deployer/DeployerCompositeArtifactDependencyDeterminer.java5
4 files changed, 15 insertions, 19 deletions
diff --git a/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/RuntimeArtifactRepository.java b/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/RuntimeArtifactRepository.java
index fc74ea46..9ac61295 100644
--- a/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/RuntimeArtifactRepository.java
+++ b/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/RuntimeArtifactRepository.java
@@ -58,13 +58,12 @@ public interface RuntimeArtifactRepository {
Set<Artifact> getArtifacts();
/**
- * Gets a specific {@link Artifact} from this repository. If the artifact is a bundle, it is only returned if the
- * bundle is in the user region.
+ * Gets a specific {@link Artifact} from this repository.
*
* @param type The type of the {@link Artifact} to get
* @param name The name of the {@link Artifact} to get
* @param version The {@link Version} of the {@link Artifact} to get
- * @param region The {@link Region} to get the {@link Artifact} from
+ * @param region The {@link Region} to get the {@link Artifact} from or null if the artifact has no region or the region isn't known
* @return The {@link Artifact} represented by this type, name, and version if it is in the repository, otherwise
* <code>null</code>
*/
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 8a3c7a89..d5e6d95c 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
@@ -54,27 +54,21 @@ public final class BundleDependencyDeterminer implements DependencyDeterminer {
* {@inheritDoc}
*/
public Set<Artifact> getDependents(Artifact rootArtifact) {
- Set<Artifact> artifacts = new HashSet<Artifact>();
+ if(!rootArtifact.getType().equalsIgnoreCase("bundle")){
+ return Collections.<Artifact> emptySet();
+ }
+
QuasiBundle rootBundle = getBundle(rootArtifact);
-
if (rootBundle == null) {
return Collections.<Artifact> emptySet();
}
+ Set<Artifact> artifacts = new HashSet<Artifact>();
for (QuasiImportPackage importPackage : rootBundle.getImportPackages()) {
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()));
-// if (artifact == null) {
-// // If there is no matching artifact in the user region, try the kernel region.
-// for (Artifact a : this.artifactRepository.getArtifacts()) {
-// if (BundleArtifact.TYPE.equals(a.getType()) && bundle.getSymbolicName().equals(a.getName()) && bundle.getVersion().equals(a.getVersion())) {
-// artifact = a;
-// break;
-// }
-// }
-// }
artifacts.add(artifact);
}
}
@@ -85,7 +79,9 @@ public final class BundleDependencyDeterminer implements DependencyDeterminer {
private QuasiBundle getBundle(Artifact artifact) {
QuasiFramework framework = quasiFrameworkFactory.create();
for (QuasiBundle bundle : framework.getBundles()) {
- if (artifact.getName().equals(bundle.getSymbolicName()) && artifact.getVersion().equals(bundle.getVersion())) {
+ if (artifact.getName().equals(bundle.getSymbolicName()) &&
+ artifact.getVersion().equals(bundle.getVersion()) &&
+ artifact.getRegion().equals(this.regionDigraph.getRegion(bundle.getBundleId()))) {
return bundle;
}
}
diff --git a/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/configurationadmin/ModelConfigurationListener.java b/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/configurationadmin/ModelConfigurationListener.java
index 34612f34..4798de6f 100644
--- a/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/configurationadmin/ModelConfigurationListener.java
+++ b/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/configurationadmin/ModelConfigurationListener.java
@@ -70,9 +70,9 @@ final class ModelConfigurationListener implements ConfigurationListener {
private void processDelete(ConfigurationEvent event) {
logger.info("Processing delete event for '{}'", event.getPid());
- Artifact artifact = this.artifactRepository.getArtifact(ConfigurationArtifact.TYPE, event.getPid(), Version.emptyVersion, null);
+ Artifact artifact = this.artifactRepository.getArtifact(ConfigurationArtifact.TYPE, event.getPid(), Version.emptyVersion, null);//Config will never be in a region
if (artifact instanceof ConfigurationArtifact) {
- this.artifactRepository.remove(ConfigurationArtifact.TYPE, event.getPid(), Version.emptyVersion, null);
+ this.artifactRepository.remove(ConfigurationArtifact.TYPE, event.getPid(), Version.emptyVersion, null);//Config will never be in a region
}
}
diff --git a/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/deployer/DeployerCompositeArtifactDependencyDeterminer.java b/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/deployer/DeployerCompositeArtifactDependencyDeterminer.java
index c4bd7ece..40e0beed 100644
--- a/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/deployer/DeployerCompositeArtifactDependencyDeterminer.java
+++ b/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/deployer/DeployerCompositeArtifactDependencyDeterminer.java
@@ -25,9 +25,10 @@ import org.eclipse.virgo.kernel.serviceability.NonNull;
import org.eclipse.virgo.util.common.Tree;
/**
- * Implementation of {@link DependencyDeterminer} that reutns the dependent of a <code>Plan</code>. The dependents
+ * Implementation of {@link DependencyDeterminer} that returns the dependent of a <code>Plan</code>. The dependents
* consist of the artifacts specified in the plan.
* <p />
+ * This class makes the assumption that the children of a composite artifact will always be in the same region as the parent.
*
* <strong>Concurrent Semantics</strong><br />
*
@@ -54,7 +55,7 @@ public final class DeployerCompositeArtifactDependencyDeterminer implements Depe
List<Tree<InstallArtifact>> children = ((DeployerCompositeArtifact) rootArtifact).getInstallArtifact().getTree().getChildren();
for (Tree<InstallArtifact> child : children) {
InstallArtifact artifact = child.getValue();
- dependents.add(artifactRepository.getArtifact(artifact.getType(), artifact.getName(), artifact.getVersion(), rootArtifact.getRegion()));
+ dependents.add(artifactRepository.getArtifact(artifact.getType(), artifact.getName(), artifact.getVersion(), rootArtifact.getRegion()));//Plans don't have a region so this only works as null will also return artifacts in regions
}
return dependents;

Back to the top