001 /* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, 013 * software distributed under the License is distributed on an 014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 * KIND, either express or implied. See the License for the 016 * specific language governing permissions and limitations 017 * under the License. 018 */ 019 020 package org.apache.geronimo.genesis.dependency; 021 022 import java.util.Stack; 023 import java.util.Map; 024 import java.util.HashMap; 025 import java.util.Collection; 026 import java.util.List; 027 import java.util.ArrayList; 028 029 import org.apache.maven.artifact.Artifact; 030 031 /** 032 * ??? 033 * 034 * @version $Rev: 480396 $ $Date: 2006-11-28 20:32:42 -0800 (Tue, 28 Nov 2006) $ 035 */ 036 public class DependencyTree 037 { 038 Map artifacts = new HashMap(); 039 040 Node rootNode; 041 042 public Collection getArtifacts() { 043 return artifacts.values(); 044 } 045 046 public Node getRootNode() { 047 return rootNode; 048 } 049 050 public void setRootNode(Node rootNode) { 051 this.rootNode = rootNode; 052 } 053 054 // 055 // Node 056 // 057 058 public static class Node 059 { 060 Node parent; 061 062 List children = new ArrayList(); 063 064 Artifact artifact; 065 066 int depth; 067 068 public List getChildren() { 069 return children; 070 } 071 072 public Artifact getArtifact() { 073 return artifact; 074 } 075 076 public int getDepth() { 077 return depth; 078 } 079 080 public String toString() { 081 return "DependencyTree$Node: " + artifact + "(" + depth + ")"; 082 } 083 } 084 }