001    /*
002     * $RCSfile: Application.java,v $ 
003     *
004     * Created on Jan 11 2005, 13:38 PM 
005     *
006     * This file is part of the STAR Scheduler.
007     * Copyright (c) 2006 STAR Collaboration - Brookhaven National Laboratory
008     *
009     * STAR Scheduler is free software; you can redistribute it and/or modify
010     * it under the terms of the GNU General Public License as published by
011     * the Free Software Foundation; either version 2 of the License, or
012     * (at your option) any later version.
013     *
014     * STAR Scheduler is distributed in the hope that it will be useful,
015     * but WITHOUT ANY WARRANTY; without even the implied warranty of
016     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
017     * GNU General Public License for more details.
018     *
019     * You should have received a copy of the GNU General Public License
020     * along with STAR Scheduler; if not, write to the Free Software
021     * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
022     */
023    package gov.bnl.star.offline.scheduler.request.rdl;
024    
025    import gov.bnl.star.offline.scheduler.request.rdl.Task;
026    /** Class representing the Application request element
027     *
028     * @author  paulh
029     * @version $Revision: 1.4 $ $Date: 2006/11/21 00:41:30 $
030     */
031    public class Application {
032    
033        private String name;
034        private String version;
035    
036        public Application() {}
037        public Application(String type, String name, String version) {
038            this.name = name;
039            this.version = version;
040        }
041    
042        /**Returns the name of the app (ie. java root4star root csh ect.)*/
043        public String getName() { return name; }
044        /**sets the version of the app (ie. 1.7.5)*/
045        public String getVersion() { return version; }
046        /** set the name of the app (ie. java root4star root csh ect.), Users must still be careful with the case as I can't make this all the same*/
047        public void setName(String name) { this.name = name.replaceAll("\n", "").trim(); }
048        /**So reformating will take place. If the version was set to " 1-5 /0 a " (worst possible formatting) this will the getVersion return "1.5.0A"   */
049        public void setVersion(String version) { this.version = version.replace('/', '.').replace('-', '.').toUpperCase().replaceAll(" ", "").replaceAll("\n", "");}
050        private boolean isDefault;
051        /**If this is set to true, the will be the default picked if no other app can be found*/
052        public void setIsDefault(boolean isDefault){this.isDefault = isDefault;}
053        /**Returns true is this is the default app*/
054        public boolean getIsDefault(){return isDefault;}
055        /**Calling this makes this app the defailt if no other matching apps can be found this is the one that will be used*/
056        public void makeDefault(){isDefault = true;}
057        
058        String path ="";
059        /**Sets the hard pther the the program*/
060        public void setPath(String path){this.path = path;}
061        /**Returns the path to the program*/
062        public String getPath(){return path;} 
063        
064        
065        Task type;
066        /**Set the type of the application by giving it TaskClass of the same type */
067        public void setType(Task type){this.type = type;}
068        /**Returns a class of the same type as the task (ie RootTask, JavaTask, ScriptTask)*/
069        public Task getType(){return type;}
070        
071    
072    }