001    /*
002     * JavaTask.java
003     *
004     * Created on January 19, 2005, 6:32 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    
024    package gov.bnl.star.offline.scheduler.request.rdl;
025    
026    /**
027     * An RDL java task object
028     * @author  Levente Hajdu
029     */
030    public class JavaTask extends Task {
031        
032        /** Creates a new instance of JavaTask */
033        public JavaTask() {}
034        
035        private String className;
036        private String mainJar;
037        private String classPath;
038        
039        public boolean isTaskClear() {return ((className == null) ^ (mainJar == null));}
040        
041        public void setClassName(String className) {
042            this.className = className;
043            if ( !isTaskClear() )  throw new RuntimeException("JavaTask cannot have both ClassName and MainJar");   
044        }
045        
046        /**Note: when this is set the setMainJar() may not be set.*/
047        public String getClassName() { return className; }
048    
049        /**This is used with the  -jar opton, Executes a program encapsulated in a  JAR  archive. The manifest of the JAR file must point to the main class in order for this option  to  work. The ClassName option must not be set.*/
050        public void setMainJar( String mainJar ) {
051            this.mainJar = mainJar;
052            if ( !isTaskClear() ) throw new RuntimeException("JavaTask cannot have both ClassName and MainJar");  
053        }
054        
055        /**This is used with the  -jar opton. The ClassName option must not be set. */
056        public String getMainJar() { return mainJar; }
057        /**This is used with the -cp option */
058        public void setClassPath(String path) { classPath = path; }
059        /**This is used with the -cp option */
060        public String getClassPath() { return classPath; }
061     
062    }