001 /* 002 * $RCSfile: CatalogTask.java,v $ 003 * 004 * Created on September 30, 2002, 10:41 AM 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.catalog; 025 026 import gov.bnl.star.offline.scheduler.CatalogQuery; 027 import gov.bnl.star.offline.scheduler.util.Task; 028 import java.net.URL; 029 import java.util.logging.Level; 030 import org.apache.log4j.Logger; 031 032 /** 033 * @deprecated please see gov.bnl.star.offline.scheduler.dataset.* for replacements. 034 * 035 * Task to solve a catalog query. These task don't have a timeout. 036 * 037 * @author Gabriele Carcassi 038 * @version $Revision: 1.10 $ $Date: 2006/11/21 00:41:31 $ 039 */ 040 public class CatalogTask extends Task { 041 static private Logger log = Logger.getLogger(CatalogTask.class.getName()); 042 043 private CatalogQuery query; 044 private QueryResult result; 045 private Class catalogClass; 046 047 /** Creates a new task to execute the query. The catalogClass is there for 048 * future expansions. 049 * @param catalogClass the class of the catalog 050 * @param query the query 051 */ 052 public CatalogTask(Class catalogClass, CatalogQuery query) { 053 this.catalogClass = catalogClass; 054 this.query = query; 055 } 056 057 public void run() { 058 try { 059 result = CatalogManager.executeQuery(query); 060 } catch (Exception e) { 061 log.error("Query execution failed", e); 062 exitStatus = -1; 063 } 064 } 065 066 /** Gets the result of the catalog query. 067 * @return null if no result is available 068 */ 069 public QueryResult getResult() { 070 return result; 071 } 072 073 }