001 /* 002 * AccessMethod.java 003 * 004 * Created on October 4, 2006, 3:29 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 027 import java.util.List; 028 import java.util.ArrayList; 029 030 import gov.bnl.star.offline.scheduler.Dispatcher; 031 import gov.bnl.star.offline.scheduler.Queue; 032 033 import gov.bnl.star.offline.scheduler.LocalAccessPoint; 034 035 036 /** A configuration object used to combine (associate) the dispatcher with the queue under a gatekeeper. 037 * @author lbhajdu 038 */ 039 public class AccessMethod { 040 041 /** Creates a new instance of AccessMethod */ 042 public AccessMethod() {} 043 044 private String batchSystem = null; 045 /** Set the batch system that is to be used in the condor-g access string (Can also be used for reporting)**/ 046 public void setBatchSystem(String batchSystem){ this.batchSystem = batchSystem; } 047 /** Get the string that is to be used by condor-g (globusscheduler) **/ 048 public String getBatchSystem(){ return this.batchSystem; } 049 050 private Dispatcher dispatcher; 051 /**returns the dispatcher to use to access the queues in the queue list**/ 052 public Dispatcher getDispatcher(){ return this.dispatcher; } 053 /**Set the dispatcher to use to access the queues in the queue list. 054 *Note: This should be called from the config file.**/ 055 public void setDispatcher(Dispatcher dispatcher){this.dispatcher = dispatcher;} 056 057 058 List queues = new ArrayList(); 059 /**Used to add all queues that can be acessed by this method. 060 *Note: This method is called for the config file.**/ 061 public void addQueue(Queue queue){ 062 queue.addAccessMethod(this); 063 this.queues.add(queue); 064 } 065 /**Returns a list of queues (queue objects) that can be accessed by this method.*/ 066 public List getQueues(){return this.queues; } 067 /**It will set (reset) the list that has been configured by the config file at start up. 068 *Note: This function is only called by the framework. */ 069 public void setQueues(List Queues){this.queues = queues;} 070 071 072 List accessPoints = new ArrayList(); 073 public void addAccessPoint(LocalAccessPoint AccessPoint){ 074 this.accessPoints.add(AccessPoint); 075 } 076 077 /** The user need not configure this this member the access point will configure it when the object is added. */ 078 public void addAccessPoint(GateKeeperAccessPoint AccessPoint){ 079 this.accessPoints.add(AccessPoint); 080 } 081 082 083 084 public List getAccessPoints(){return accessPoints;} 085 /** The user need not configure this this member the access point will configure it when the object is added. */ 086 public void setAccessPoints(List accessPoints){this.accessPoints = accessPoints;} 087 /*Returns one access point for this AccessMethod. It will always return the same one.*/ 088 public LocalAccessPoint getAssociatedAccessPoint(){ 089 if(accessPoints.size() > 0) return (LocalAccessPoint) accessPoints.get(0); 090 else throw new RuntimeException("Error accessMethod has no access points."); 091 } 092 093 }