View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *  http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  
20  package org.apache.geronimo.genesis.dependency;
21  
22  import java.util.Stack;
23  import java.util.Map;
24  import java.util.HashMap;
25  import java.util.Collection;
26  import java.util.List;
27  import java.util.ArrayList;
28  
29  import org.apache.maven.artifact.Artifact;
30  
31  /**
32   * ???
33   *
34   * @version $Rev: 480396 $ $Date: 2006-11-28 20:32:42 -0800 (Tue, 28 Nov 2006) $
35   */
36  public class DependencyTree
37  {
38      Map artifacts = new HashMap();
39  
40      Node rootNode;
41  
42      public Collection getArtifacts() {
43          return artifacts.values();
44      }
45  
46      public Node getRootNode() {
47          return rootNode;
48      }
49  
50      public void setRootNode(Node rootNode) {
51          this.rootNode = rootNode;
52      }
53  
54      //
55      // Node
56      //
57  
58      public static class Node
59      {
60          Node parent;
61  
62          List children = new ArrayList();
63  
64          Artifact artifact;
65  
66          int depth;
67  
68          public List getChildren() {
69              return children;
70          }
71  
72          public Artifact getArtifact() {
73              return artifact;
74          }
75  
76          public int getDepth() {
77              return depth;
78          }
79  
80          public String toString() {
81              return "DependencyTree$Node: " + artifact + "(" + depth + ")";
82          }
83      }
84  }