001    /*
002     * LocalAccess.java
003     *
004     * Created on October 4, 2006, 4:58 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.ArrayList;
027    import java.util.List;
028    
029    
030    /** A configuration object used to describe how to access a batch system locally  
031     *  @author lbhajdu
032     */
033    public class LocalAccessPoint implements java.io.Serializable{
034        
035        /** Creates a new instance of LocalAccess */
036        public LocalAccessPoint() {}
037        
038        private List accessMethods = new ArrayList();
039        /**Adds a new accessMethod to thsi gatekeeper **/
040        public void addAccessMethod(AccessMethod accessMethod){
041            accessMethod.addAccessPoint(this);
042            accessMethods.add(accessMethod); 
043        }
044        /** Set the list of access methods for this gatekeeper.
045         Note: by replacing this list you will overwrite the existing access method list. **/
046        public void setAccessMethods(List accessMethods){this.accessMethods = accessMethods; }
047        /** Returns a list of access method objects for this gatekeeper **/
048        public List getAccessMethods(){return this.accessMethods; }
049        
050        Site site = null;
051        public void setSite(Site site){
052            if(this.site != null) throw new RuntimeException("There was a configuration error. An access point was added to " + this.site.getSiteName() + " but its is also refranced to the site " + site.getSiteName() + "an access point can not exist at both sites."); //test that this point has not already been added to a site
053            this.site = site;
054        }
055        public Site getSite(){
056            
057            return this.site; 
058        }
059        
060        /**Returns true if access point is local, if it is a grid access point in return false**/
061        public boolean isLocal(){return true;}
062     
063    }