001    /*
002     * BatchSystemt.java
003     *
004     * Created on July 18, 2005, 1:24 PM
005     *
006     * This file is part of the STAR Scheduler.
007     * Copyright (c) 2002-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;
025    
026    import java.util.List;
027    import java.util.ArrayList;
028    
029    
030    import gov.bnl.star.offline.scheduler.GateKeeperAccessPoint;
031    import gov.bnl.star.offline.scheduler.Queue;
032    import gov.bnl.star.offline.scheduler.Dispatcher;
033    import gov.bnl.star.offline.scheduler.Site;
034    
035    /**
036     * @deprecated This config object is no longer used
037     * @author  Levente Hajdu
038     */
039    public class BatchSystem {
040        
041        /** Creates a new instance of BatchSystemt */
042        public BatchSystem() {
043        }
044        
045        String name = "no name";
046        private List queues = new ArrayList();
047        private List gatekeepers = new ArrayList();
048        private Dispatcher gridDispatcher;
049        private Dispatcher localDispatcher;
050        
051        private Site site;
052        
053        public Site getSite(){return site;}
054        
055        public void setSite(Site site){this.site = site; }
056        
057        
058        /**Returns the name of the batch systemt.
059          *Examples: "sge", "LSF", "condor", "pbs" 
060          */
061        public String getName(){return name;}
062        
063        /**Sets the named of the batch systemt
064         *Examples: "sge", "LSF", "condor", "pbs" 
065         *This should be set in the config file.
066         */
067        public void setName(String name){this.name = name;}
068        
069        
070        
071        /** This function is used to configure the batch system, use it to add 
072         *Gatekeeper objects that are able to submit to the batch system. Note 
073         *that this function can be called multiple time for add multiple objects.
074         */
075        public void addGatekeeper(GateKeeperAccessPoint gateKeeper){gatekeepers.add(gateKeeper);}
076        
077        public GateKeeperAccessPoint getGatekeeper(){ 
078            if(gatekeepers.size() == 0){
079                String error = "There are no gatekeepers configured in the config file for the " + this.getName() + " Batch system.";
080                System.out.println(error);
081                throw new RuntimeException(error);
082            }
083            
084            
085            //Todo: this will be changed later for something a little smartter.
086            return (GateKeeperAccessPoint) gatekeepers.get(0); 
087        }
088        
089        
090        
091        
092        public List getGatekeepers(){return gatekeepers;}
093        public void setGatekeepers(List gatekeepers){this.gatekeepers = gatekeepers; }
094        
095        
096        public void addQueue(Queue queue){
097            queue.setBatchSystem( this ); //This gives the queue a pointer back to the batch system object it's in
098            queues.add(queue);
099        }
100        
101        public void setQueues(List queues){this.queues = queues; }
102        public List getQueues(){return queues;}
103        
104        
105        public void setLocalDispatcher(Dispatcher localDispatcher){this.localDispatcher = localDispatcher;}
106        public Dispatcher getLocalDispatcher(){return localDispatcher;}
107        
108        
109        public void setGridDispatcher(Dispatcher gridDispatcher){this.gridDispatcher = gridDispatcher;}
110        public Dispatcher getGridDispatcher(){return gridDispatcher;}
111            
112        
113    }