Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Waibel2011-11-20 22:36:00 +0000
committerFlorian Waibel2011-11-20 22:36:00 +0000
commit41a65f5ef7dd9ae189e6ab45997c0b518d57341a (patch)
tree92d08feb8834d868de2c9f5df39b1a9bd3bf97a8 /org.eclipse.virgo.kernel.model/src
parent4048767a1ec815a33538fa5964fafa7acb6a6866 (diff)
downloadorg.eclipse.virgo.kernel-41a65f5ef7dd9ae189e6ab45997c0b518d57341a.tar.gz
org.eclipse.virgo.kernel-41a65f5ef7dd9ae189e6ab45997c0b518d57341a.tar.xz
org.eclipse.virgo.kernel-41a65f5ef7dd9ae189e6ab45997c0b518d57341a.zip
Bug 358442 Reworked deployer and pipeline to use the GraphNode instead of the Tree.
Diffstat (limited to 'org.eclipse.virgo.kernel.model/src')
-rw-r--r--org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/deployer/DeployerCompositeArtifactDependencyDeterminer.java12
-rw-r--r--org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/deployer/ModelInstallArtifactLifecycleListener.java5
-rw-r--r--org.eclipse.virgo.kernel.model/src/test/java/org/eclipse/virgo/kernel/model/internal/deployer/DeployerCompositeArtifactDependencyDeterminerTests.java18
3 files changed, 17 insertions, 18 deletions
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 deb8296c..55e38071 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
+ * Copyright (c) 2008, 2010 VMware Inc. and others
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* VMware Inc. - initial contribution
+ * EclipseSource - Bug 358442 Change InstallArtifact graph from a tree to a DAG
*******************************************************************************/
package org.eclipse.virgo.kernel.model.internal.deployer;
@@ -16,14 +17,13 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
+import org.eclipse.equinox.region.Region;
import org.eclipse.virgo.kernel.install.artifact.InstallArtifact;
import org.eclipse.virgo.kernel.model.Artifact;
import org.eclipse.virgo.kernel.model.RuntimeArtifactRepository;
import org.eclipse.virgo.kernel.model.internal.DependencyDeterminer;
-import org.eclipse.equinox.region.Region;
-
import org.eclipse.virgo.kernel.serviceability.NonNull;
-import org.eclipse.virgo.util.common.Tree;
+import org.eclipse.virgo.util.common.GraphNode;
/**
* Implementation of {@link DependencyDeterminer} that returns the dependent of a <code>Plan</code>. The dependents
@@ -59,8 +59,8 @@ public final class DeployerCompositeArtifactDependencyDeterminer implements Depe
}
final Set<Artifact> dependents = new HashSet<Artifact>();
- List<Tree<InstallArtifact>> children = ((DeployerCompositeArtifact) rootArtifact).getInstallArtifact().getTree().getChildren();
- for (Tree<InstallArtifact> child : children) {
+ List<GraphNode<InstallArtifact>> children = ((DeployerCompositeArtifact) rootArtifact).getInstallArtifact().getGraph().getChildren();
+ for (GraphNode<InstallArtifact> child : children) {
InstallArtifact artifact = child.getValue();
if(artifact.getType().equalsIgnoreCase("bundle")){
dependents.add(this.artifactRepository.getArtifact(artifact.getType(), artifact.getName(), artifact.getVersion(), this.userRegion));
diff --git a/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/deployer/ModelInstallArtifactLifecycleListener.java b/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/deployer/ModelInstallArtifactLifecycleListener.java
index 8661b6af..37c3b89f 100644
--- a/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/deployer/ModelInstallArtifactLifecycleListener.java
+++ b/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/deployer/ModelInstallArtifactLifecycleListener.java
@@ -1,11 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
+ * Copyright (c) 2008, 2010 VMware Inc. and others
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
+ * EclipseSource - Bug 358442 Change InstallArtifact graph from a tree to a DAG
* VMware Inc. - initial contribution
*******************************************************************************/
@@ -38,7 +39,7 @@ import org.slf4j.LoggerFactory;
* An existing artifact with the same type, name, and version as the incoming artifact is not replaced except in the
* case of a bundle. An existing {@link BundleArtifact} is replaced by an incoming {@link DeployerBundleArtifact}. This
* prevents the RAM being corrupted if an attempt it made to install an artifact which belongs to an existing install
- * tree. See {@link TreeRestrictingInstallArtifactLifecycleListener}.
+ * tree. See {@link GraphRestrictingInstallArtifactLifecycleListener}.
* <p />
*
* <strong>Concurrent Semantics</strong><br />
diff --git a/org.eclipse.virgo.kernel.model/src/test/java/org/eclipse/virgo/kernel/model/internal/deployer/DeployerCompositeArtifactDependencyDeterminerTests.java b/org.eclipse.virgo.kernel.model/src/test/java/org/eclipse/virgo/kernel/model/internal/deployer/DeployerCompositeArtifactDependencyDeterminerTests.java
index d22e321a..87fc4247 100644
--- a/org.eclipse.virgo.kernel.model/src/test/java/org/eclipse/virgo/kernel/model/internal/deployer/DeployerCompositeArtifactDependencyDeterminerTests.java
+++ b/org.eclipse.virgo.kernel.model/src/test/java/org/eclipse/virgo/kernel/model/internal/deployer/DeployerCompositeArtifactDependencyDeterminerTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
+ * Copyright (c) 2008, 2010 VMware Inc. and others
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,30 +7,27 @@
*
* Contributors:
* VMware Inc. - initial contribution
+ * EclipseSource - Bug 358442 Change InstallArtifact graph from a tree to a DAG
*******************************************************************************/
package org.eclipse.virgo.kernel.model.internal.deployer;
import static org.junit.Assert.assertEquals;
-import org.junit.Test;
-
import org.eclipse.virgo.kernel.install.artifact.InstallArtifact;
import org.eclipse.virgo.kernel.model.RuntimeArtifactRepository;
import org.eclipse.virgo.kernel.model.StubArtifactRepository;
import org.eclipse.virgo.kernel.model.StubCompositeArtifact;
import org.eclipse.virgo.kernel.model.StubRegion;
import org.eclipse.virgo.kernel.model.internal.DependencyDeterminer;
-import org.eclipse.virgo.kernel.model.internal.deployer.DeployerCompositeArtifact;
-import org.eclipse.virgo.kernel.model.internal.deployer.DeployerCompositeArtifactDependencyDeterminer;
-
-
import org.eclipse.virgo.kernel.serviceability.Assert.FatalAssertionException;
import org.eclipse.virgo.kernel.stubs.StubInstallArtifact;
import org.eclipse.virgo.kernel.stubs.StubPlanInstallArtifact;
import org.eclipse.virgo.teststubs.osgi.framework.StubBundleContext;
import org.eclipse.virgo.teststubs.osgi.support.TrueFilter;
-import org.eclipse.virgo.util.common.ThreadSafeArrayListTree;
+import org.eclipse.virgo.util.common.DirectedAcyclicGraph;
+import org.eclipse.virgo.util.common.ThreadSafeDirectedAcyclicGraph;
+import org.junit.Test;
public class DeployerCompositeArtifactDependencyDeterminerTests {
@@ -71,8 +68,9 @@ public class DeployerCompositeArtifactDependencyDeterminerTests {
@Test
public void success() {
- StubPlanInstallArtifact installArtifact = new StubPlanInstallArtifact();
- installArtifact.getTree().addChild(new ThreadSafeArrayListTree<InstallArtifact>(new StubInstallArtifact()));
+ DirectedAcyclicGraph<InstallArtifact> dag = new ThreadSafeDirectedAcyclicGraph<InstallArtifact>();
+ StubPlanInstallArtifact installArtifact = new StubPlanInstallArtifact(dag);
+ installArtifact.getGraph().addChild(dag.createRootNode(new StubInstallArtifact()));
DeployerCompositeArtifact artifact = new DeployerCompositeArtifact(bundleContext, installArtifact, region1);
assertEquals(1, this.determiner.getDependents(artifact).size());
}

Back to the top