BootableProjectInfo.java 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. /* ========================================================================
  2. * JCommon : a free general purpose class library for the Java(tm) platform
  3. * ========================================================================
  4. *
  5. * (C) Copyright 2000-2005, by Object Refinery Limited and Contributors.
  6. *
  7. * Project Info: http://www.jfree.org/jcommon/index.html
  8. *
  9. * This library is free software; you can redistribute it and/or modify it
  10. * under the terms of the GNU Lesser General Public License as published by
  11. * the Free Software Foundation; either version 2.1 of the License, or
  12. * (at your option) any later version.
  13. *
  14. * This library is distributed in the hope that it will be useful, but
  15. * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  16. * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
  17. * License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public
  20. * License along with this library; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
  22. * USA.
  23. *
  24. * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
  25. * in the United States and other countries.]
  26. *
  27. * ------------------------
  28. * BootableProjectInfo.java
  29. * ------------------------
  30. * (C)opyright 2004, by Thomas Morgner and Contributors.
  31. *
  32. * Original Author: Thomas Morgner;
  33. * Contributor(s): David Gilbert (for Object Refinery Limited);
  34. *
  35. * $Id: BootableProjectInfo.java,v 1.4 2006/03/23 19:47:05 taqua Exp $
  36. *
  37. * Changes
  38. * -------
  39. * 07-Jun-2004 : Added source headers (DG);
  40. *
  41. */
  42. package org.jfree.base;
  43. import java.util.ArrayList;
  44. /**
  45. * Project info for a bootable project. A bootable project provides a controlled
  46. * way of initalizing all subsystems by providing a Boot loader implementation.
  47. *
  48. * @author Thomas Morgner
  49. */
  50. public class BootableProjectInfo extends BasicProjectInfo {
  51. /** The boot class. */
  52. private String bootClass;
  53. /** The auto-boot flag. */
  54. private boolean autoBoot;
  55. /**
  56. * Creates a new instance.
  57. */
  58. public BootableProjectInfo() {
  59. this.autoBoot = true;
  60. }
  61. /**
  62. * Creates a new library reference.
  63. *
  64. * @param name the name.
  65. * @param version the version.
  66. * @param licence the licence.
  67. * @param info the web address or other info.
  68. */
  69. public BootableProjectInfo(final String name, final String version,
  70. final String licence, final String info) {
  71. this();
  72. setName(name);
  73. setVersion(version);
  74. setLicenceName(licence);
  75. setInfo(info);
  76. }
  77. /**
  78. * Creates a new library reference.
  79. *
  80. * @param name the name.
  81. * @param version the version.
  82. * @param info the info (for example, the project URL).
  83. * @param copyright the copyright statement.
  84. * @param licenceName the license name.
  85. */
  86. public BootableProjectInfo(final String name, final String version, final String info,
  87. final String copyright, final String licenceName) {
  88. this();
  89. setName(name);
  90. setVersion(version);
  91. setLicenceName(licenceName);
  92. setInfo(info);
  93. setCopyright(copyright);
  94. }
  95. /**
  96. * Returns the dependencies.
  97. *
  98. * @return The dependencies.
  99. */
  100. public BootableProjectInfo[] getDependencies() {
  101. final ArrayList dependencies = new ArrayList();
  102. final Library[] libraries = getLibraries();
  103. for (int i = 0; i < libraries.length; i++) {
  104. Library lib = libraries[i];
  105. if (lib instanceof BootableProjectInfo) {
  106. dependencies.add(lib);
  107. }
  108. }
  109. final Library[] optionalLibraries = getOptionalLibraries();
  110. for (int i = 0; i < optionalLibraries.length; i++) {
  111. Library lib = optionalLibraries[i];
  112. if (lib instanceof BootableProjectInfo) {
  113. dependencies.add(lib);
  114. }
  115. }
  116. return (BootableProjectInfo[]) dependencies.toArray
  117. (new BootableProjectInfo[dependencies.size()]);
  118. }
  119. /**
  120. * Adds a dependency.
  121. *
  122. * @param projectInfo the project.
  123. * @deprecated use 'addLibrary' instead.
  124. */
  125. public void addDependency(final BootableProjectInfo projectInfo) {
  126. if (projectInfo == null) {
  127. throw new NullPointerException();
  128. }
  129. addLibrary(projectInfo);
  130. }
  131. /**
  132. * Returns the name of the boot class.
  133. *
  134. * @return The name of the boot class.
  135. */
  136. public String getBootClass() {
  137. return this.bootClass;
  138. }
  139. /**
  140. * Sets the boot class name.
  141. *
  142. * @param bootClass the boot class name.
  143. */
  144. public void setBootClass(final String bootClass) {
  145. this.bootClass = bootClass;
  146. }
  147. /**
  148. * Returns, whether the project should be booted automaticly.
  149. *
  150. * @return The auto-boot flag.
  151. */
  152. public boolean isAutoBoot() {
  153. return this.autoBoot;
  154. }
  155. /**
  156. * Sets the auto boot flag.
  157. *
  158. * @param autoBoot true, if the project should be booted automaticly, false otherwise.
  159. */
  160. public void setAutoBoot(final boolean autoBoot) {
  161. this.autoBoot = autoBoot;
  162. }
  163. }