001 /* 002 * OutputLinkAction.java 003 * 004 * Created on June 3, 2005, 2:02 PM 005 * 006 * STAR Scheduler is free software; you can redistribute it and/or modify 007 * it under the terms of the GNU General Public License as published by 008 * the Free Software Foundation; either version 2 of the License, or 009 * (at your option) any later version. 010 * 011 * STAR Scheduler is distributed in the hope that it will be useful, 012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 014 * GNU General Public License for more details. 015 * 016 * You should have received a copy of the GNU General Public License 017 * along with STAR Scheduler; if not, write to the Free Software 018 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 019 */ 020 021 package gov.bnl.star.offline.scheduler; 022 import java.net.URI; 023 import java.util.List; 024 025 /** Description of how to link output files. 026 * @author Levente Hajdu 027 */ 028 public class OutputLinkAction extends OutputAction implements java.io.Serializable { 029 030 /** Creates a new instance of OutputLinkAction */ 031 032 public OutputLinkAction(List actionList, String id, String referto, String to, int retries, int sleep, String kind) { 033 this.SetActionList(actionList); 034 this.setID(id); 035 this.setReferTo(referto); 036 this.setTo(to); 037 this.setRetries(retries); 038 this.setSleep(sleep); 039 this.kind = kind; 040 } 041 042 /** Creates a new instance of OutputCopyAction. Note: This constructor is only for use by the XML serializer. */ 043 public OutputLinkAction(){} 044 045 //String to; 046 /// public String getTo() { return to; } 047 /// public void setTo(String to){this.to = to;} 048 049 String kind; 050 public String getKind() { return kind; } 051 public void setKind(String kind){this.kind = kind;} 052 053 054 055 //public String getFileRef() { return ""; } 056 057 //public String getName() { return "link"; } 058 059 //public boolean isReferenceGenerator() { return true; } 060 061 public String getScriptName() { return "SUMSlink.pl"; } 062 063 /* 064 String kind; 065 public void setType(String kind) {this.kind = kind;} 066 public String getType(){return kind;} 067 */ 068 public String makeScriptString(String outputFile, String gateway) { 069 //return getScriptName() + " " + getKind() + " " + gateway + " " + outputFile + " " + getTo() + " " + this.getRetries() + this.getSleep(); 070 setOutputFile(outputFile); 071 072 if(this.getReferTo() != null){ //resolve the referTo 073 outputFile = this.findReferTo(this.GetActionList(), getReferTo() ); 074 } 075 076 String command = getScriptName() + " "; 077 if( getKind()!= null ) command = command.concat("\"" + getKind() + "\" "); 078 command = command.concat("\"" + gateway +"\" \""+ outputFile +"\" \""+ getTo() +"\" " ); 079 080 if(getRetries() > 0){ 081 command = command.concat(String.valueOf(getRetries()) +" "); 082 if(getSleep() > 0) command = command.concat(String.valueOf(getSleep())); 083 } 084 085 return command + "\n"; 086 087 } 088 089 }