001    /*
002     * $RCSfile: AssignmentStrategy.java,v $
003     *
004     * Created on April 3, 2006, 9:29 AM
005     *
006     * This file is part of the STAR Scheduler.
007     * Copyright (c) 2002-2003 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.policy;
024    
025    import gov.bnl.star.offline.scheduler.*;
026    import gov.bnl.star.offline.scheduler.request.Request;
027    import gov.bnl.star.offline.scheduler.catalog.QueryResult;
028    import java.util.*;
029    
030    
031    /** Given the query result and the filelist, the AssignmentStrategy assign the
032     * copies of the files to the different targets (single nodes, or groups).
033     * <p>
034     * This is no easy problem, and is in the end a good part of the Policy. That
035     * is why we decided to create directly an interface for this part of the policy:
036     * to be able to play with different alternatives.
037     * <p>
038     * Also, in different cases it might be easier to find an optimal solution. In
039     * that case, different implementation might be used.
040     *
041     * @author Gabriele Carcassi
042     * @version $Revision: 1.9 $ $Date: 2006/11/21 00:41:31 $
043     */
044    public interface AssignmentStrategy {
045        /** Executes the strategy, by assigning all the copies of the files and
046         * creating a FileAssignment.
047         * <p>
048         * @param job the job request
049         * @param results the results of all the queries
050         * @param queries all the queries
051         * @param fileList the files gathered directly from the description
052         * @return the file assignment
053         */
054        public FileAssignment assignFiles(Request job, QueryResult[] results,
055            CatalogQuery[] queries, List fileList);
056    }