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.3 2005/10/18 13:13:58 mungady 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 dependencies. */
056        private ArrayList dependencies;
057    
058        /** The boot class. */
059        private String bootClass;
060        
061        /** The auto-boot flag. */
062        private boolean autoBoot;
063    
064        /**
065         * Creates a new instance.
066         */
067        public BootableProjectInfo() {
068            this.dependencies = new ArrayList();
069            this.autoBoot = true;
070        }
071    
072        /**
073         * Creates a new library reference.
074         *
075         * @param name    the name.
076         * @param version the version.
077         * @param licence the licence.
078         * @param info    the web address or other info.
079         */
080        public BootableProjectInfo(final String name, final String version,
081                                   final String licence, final String info) {
082            this();
083            setName(name);
084            setVersion(version);
085            setLicenceName(licence);
086            setInfo(info);
087        }
088    
089        /**
090         * Creates a new library reference.
091         *
092         * @param name    the name.
093         * @param version the version.
094         * @param info  the info (for example, the project URL).
095         * @param copyright  the copyright statement.
096         * @param licenceName the license name.
097         */
098        public BootableProjectInfo(final String name, final String version, final String info,
099                                   final String copyright, final String licenceName) {
100            this();
101            setName(name);
102            setVersion(version);
103            setLicenceName(licenceName);
104            setInfo(info);
105            setCopyright(copyright);
106        }
107    
108        /**
109         * Returns the dependencies.
110         * 
111         * @return The dependencies.
112         */
113        public BootableProjectInfo[] getDependencies() {
114            return (BootableProjectInfo[]) this.dependencies.toArray
115                (new BootableProjectInfo[this.dependencies.size()]);
116        }
117    
118        /**
119         * Adds a dependency.
120         * 
121         * @param projectInfo  the project.
122         */
123        public void addDependency(final BootableProjectInfo projectInfo) {
124            if (projectInfo == null) {
125                throw new NullPointerException();
126            }
127            this.dependencies.add(projectInfo);
128        }
129    
130        /**
131         * Returns the name of the boot class.
132         * 
133         * @return The name of the boot class.
134         */
135        public String getBootClass() {
136            return this.bootClass;
137        }
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        /**
149         * Returns, whether the project should be booted automaticly.
150         * 
151         * @return The auto-boot flag.
152         */
153        public boolean isAutoBoot() {
154            return this.autoBoot;
155        }
156    
157        /**
158         * Sets the auto boot flag.
159         *
160         * @param autoBoot true, if the project should be booted automaticly, false otherwise.
161         */
162        public void setAutoBoot(final boolean autoBoot) {
163            this.autoBoot = autoBoot;
164        }
165        
166    }