001: /* ========================================================================
002: * JCommon : a free general purpose class library for the Java(tm) platform
003: * ========================================================================
004: *
005: * (C) Copyright 2000-2005, by Object Refinery Limited and Contributors.
006: *
007: * Project Info: http://www.jfree.org/jcommon/index.html
008: *
009: * This library is free software; you can redistribute it and/or modify it
010: * under the terms of the GNU Lesser General Public License as published by
011: * the Free Software Foundation; either version 2.1 of the License, or
012: * (at your option) any later version.
013: *
014: * This library is distributed in the hope that it will be useful, but
015: * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
016: * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
017: * License for more details.
018: *
019: * You should have received a copy of the GNU Lesser General Public
020: * License along with this library; if not, write to the Free Software
021: * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
022: * USA.
023: *
024: * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
025: * in the United States and other countries.]
026: *
027: * ------------------------
028: * BootableProjectInfo.java
029: * ------------------------
030: * (C)opyright 2004, by Thomas Morgner and Contributors.
031: *
032: * Original Author: Thomas Morgner;
033: * Contributor(s): David Gilbert (for Object Refinery Limited);
034: *
035: * $Id: BootableProjectInfo.java,v 1.4 2006/03/23 19:47:05 taqua Exp $
036: *
037: * Changes
038: * -------
039: * 07-Jun-2004 : Added source headers (DG);
040: *
041: */
042:
043: package org.jfree.base;
044:
045: import java.util.ArrayList;
046:
047: /**
048: * Project info for a bootable project. A bootable project provides a controlled
049: * way of initalizing all subsystems by providing a Boot loader implementation.
050: *
051: * @author Thomas Morgner
052: */
053: public class BootableProjectInfo extends BasicProjectInfo {
054:
055: /** The boot class. */
056: private String bootClass;
057:
058: /** The auto-boot flag. */
059: private boolean autoBoot;
060:
061: /**
062: * Creates a new instance.
063: */
064: public BootableProjectInfo() {
065: this .autoBoot = true;
066: }
067:
068: /**
069: * Creates a new library reference.
070: *
071: * @param name the name.
072: * @param version the version.
073: * @param licence the licence.
074: * @param info the web address or other info.
075: */
076: public BootableProjectInfo(final String name, final String version,
077: final String licence, final String info) {
078: this ();
079: setName(name);
080: setVersion(version);
081: setLicenceName(licence);
082: setInfo(info);
083: }
084:
085: /**
086: * Creates a new library reference.
087: *
088: * @param name the name.
089: * @param version the version.
090: * @param info the info (for example, the project URL).
091: * @param copyright the copyright statement.
092: * @param licenceName the license name.
093: */
094: public BootableProjectInfo(final String name, final String version,
095: final String info, final String copyright,
096: final String licenceName) {
097: this ();
098: setName(name);
099: setVersion(version);
100: setLicenceName(licenceName);
101: setInfo(info);
102: setCopyright(copyright);
103: }
104:
105: /**
106: * Returns the dependencies.
107: *
108: * @return The dependencies.
109: */
110: public BootableProjectInfo[] getDependencies() {
111: final ArrayList dependencies = new ArrayList();
112: final Library[] libraries = getLibraries();
113: for (int i = 0; i < libraries.length; i++) {
114: Library lib = libraries[i];
115: if (lib instanceof BootableProjectInfo) {
116: dependencies.add(lib);
117: }
118: }
119:
120: final Library[] optionalLibraries = getOptionalLibraries();
121: for (int i = 0; i < optionalLibraries.length; i++) {
122: Library lib = optionalLibraries[i];
123: if (lib instanceof BootableProjectInfo) {
124: dependencies.add(lib);
125: }
126: }
127: return (BootableProjectInfo[]) dependencies
128: .toArray(new BootableProjectInfo[dependencies.size()]);
129: }
130:
131: /**
132: * Adds a dependency.
133: *
134: * @param projectInfo the project.
135: * @deprecated use 'addLibrary' instead.
136: */
137: public void addDependency(final BootableProjectInfo projectInfo) {
138: if (projectInfo == null) {
139: throw new NullPointerException();
140: }
141: addLibrary(projectInfo);
142: }
143:
144: /**
145: * Returns the name of the boot class.
146: *
147: * @return The name of the boot class.
148: */
149: public String getBootClass() {
150: return this .bootClass;
151: }
152:
153: /**
154: * Sets the boot class name.
155: *
156: * @param bootClass the boot class name.
157: */
158: public void setBootClass(final String bootClass) {
159: this .bootClass = bootClass;
160: }
161:
162: /**
163: * Returns, whether the project should be booted automaticly.
164: *
165: * @return The auto-boot flag.
166: */
167: public boolean isAutoBoot() {
168: return this .autoBoot;
169: }
170:
171: /**
172: * Sets the auto boot flag.
173: *
174: * @param autoBoot true, if the project should be booted automaticly, false otherwise.
175: */
176: public void setAutoBoot(final boolean autoBoot) {
177: this.autoBoot = autoBoot;
178: }
179:
180: }
|