You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

Project.java 2.7 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. // ---------------------------------------------------------------------
  2. // (c)2000 Apache Software Foundation
  3. //
  4. // ---------------------------------------------------------------------
  5. package org.apache.ant;
  6. import java.io.*;
  7. import java.util.*;
  8. /**
  9. * In memory container for an Ant project.
  10. *
  11. * @author James Duncan Davidson (duncan@apache.org)
  12. */
  13. public class Project {
  14. // -----------------------------------------------------------------
  15. // PRIVATE DATA MEMBERS
  16. // -----------------------------------------------------------------
  17. /**
  18. *
  19. */
  20. private Ant ant;
  21. /**
  22. *
  23. */
  24. private PrintStream out;
  25. /**
  26. * Parent project to this project, if one exists.
  27. */
  28. private Project parentProject = null;
  29. /**
  30. *
  31. */
  32. private String name;
  33. /**
  34. * Hashtable containing all of the targets that are part of this
  35. * project. Targets are stored in this hashtable using the name
  36. * of the target as the key and the Target object for the target
  37. * as the value.
  38. */
  39. private Hashtable targets = new Hashtable();
  40. // -----------------------------------------------------------------
  41. // PUBLIC ACCESSOR METHODS
  42. // -----------------------------------------------------------------
  43. /**
  44. *
  45. */
  46. public void addTarget(Target target) {
  47. // XXX check out for name, if null, reject!
  48. targets.put(target.getName(), target);
  49. }
  50. /**
  51. *
  52. */
  53. public PrintStream getOutput() {
  54. // XXX check if null!!!!????
  55. return out;
  56. }
  57. /**
  58. * Returns the parent Project object to this Project if a parent
  59. * project exists. If there is not a parent Project object, null
  60. * is returned.
  61. */
  62. public Project getParent() {
  63. return parentProject;
  64. }
  65. /**
  66. * Returns the target identified with the given name. If no target
  67. * is known by the given name, then null is returned.
  68. */
  69. public Target getTarget(String name) {
  70. return (Target)targets.get(name);
  71. }
  72. /**
  73. *
  74. */
  75. public Enumeration getTargets() {
  76. return targets.elements();
  77. }
  78. /**
  79. *
  80. */
  81. public String getName() {
  82. return name;
  83. }
  84. /**
  85. *
  86. */
  87. public void setAnt(Ant ant) {
  88. this.ant = ant;
  89. }
  90. /**
  91. *
  92. */
  93. public void setOutput(PrintStream out) {
  94. this.out = out;
  95. }
  96. /**
  97. *
  98. */
  99. public void setName(String name) {
  100. this.name = name;
  101. }
  102. /**
  103. *
  104. */
  105. public String toString() {
  106. return "Project name=" + name;
  107. }
  108. }