Package: StandardPipeline

StandardPipeline

nameinstructionbranchcomplexitylinemethod
StandardPipeline()
M: 13 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
appendStage(PipelineStage)
M: 15 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
doProcessGraph(GraphNode, InstallEnvironment)
M: 27 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 5 C: 0
0%
M: 1 C: 0
0%
numStages()
M: 11 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2008, 2011 VMware Inc. and others
3: * All rights reserved. This program and the accompanying materials
4: * are made available under the terms of the Eclipse Public License v1.0
5: * which accompanies this distribution, and is available at
6: * http://www.eclipse.org/legal/epl-v10.html
7: *
8: * Contributors:
9: * VMware Inc. - initial contribution
10: * EclipseSource - Bug 358442 Change InstallArtifact graph from a tree to a DAG
11: *******************************************************************************/
12:
13: package org.eclipse.virgo.kernel.install.pipeline.internal;
14:
15: import java.util.ArrayList;
16: import java.util.List;
17:
18: import org.eclipse.virgo.nano.deployer.api.core.DeploymentException;
19: import org.eclipse.virgo.kernel.install.artifact.InstallArtifact;
20: import org.eclipse.virgo.kernel.install.environment.InstallEnvironment;
21: import org.eclipse.virgo.kernel.install.pipeline.Pipeline;
22: import org.eclipse.virgo.kernel.install.pipeline.stage.AbstractPipelineStage;
23: import org.eclipse.virgo.kernel.install.pipeline.stage.PipelineStage;
24: import org.eclipse.virgo.kernel.osgi.framework.UnableToSatisfyBundleDependenciesException;
25: import org.eclipse.virgo.util.common.GraphNode;
26:
27: /**
28: * {@link StandardPipeline} is the default implementation of {@link Pipeline}.
29: * <p />
30: *
31: * <strong>Concurrent Semantics</strong><br />
32: *
33: * This class is thread safe.
34: *
35: */
36: class StandardPipeline extends AbstractPipelineStage implements Pipeline {
37:
38: private final Object monitor = new Object();
39:
40: private final List<PipelineStage> stageList = new ArrayList<PipelineStage>();
41:
42: /**
43: * {@inheritDoc}
44: */
45: public Pipeline appendStage(PipelineStage stage) {
46: synchronized (this.monitor) {
47: this.stageList.add(stage);
48: }
49: return this;
50: }
51:
52: /**
53: * {@inheritDoc}
54: */
55: protected void doProcessGraph(GraphNode<InstallArtifact> installGraph, InstallEnvironment installEnvironment) throws DeploymentException,
56: UnableToSatisfyBundleDependenciesException {
57:• for (int i = 0; i < numStages(); i++) {
58: PipelineStage nextStage;
59: synchronized (this.monitor) {
60: nextStage = this.stageList.get(i);
61: }
62: nextStage.process(installGraph, installEnvironment);
63: }
64: }
65:
66: private int numStages() {
67: synchronized (this.monitor) {
68: return this.stageList.size();
69: }
70: }
71:
72: }