1
/*___INFO__MARK_BEGIN__*/
2
/*************************************************************************
4
* The Contents of this file are made available subject to the terms of
5
* the Sun Industry Standards Source License Version 1.2
7
* Sun Microsystems Inc., March, 2001
10
* Sun Industry Standards Source License Version 1.2
11
* =================================================
12
* The contents of this file are subject to the Sun Industry Standards
13
* Source License Version 1.2 (the "License"); You may not use this file
14
* except in compliance with the License. You may obtain a copy of the
15
* License at http://gridengine.sunsource.net/Gridengine_SISSL_license.html
17
* Software provided under this License is provided on an "AS IS" basis,
18
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
19
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
20
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
21
* See the License for the specific provisions governing your rights and
22
* obligations concerning the Software.
24
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
26
* Copyright: 2001 by Sun Microsystems, Inc.
28
* All Rights Reserved.
30
************************************************************************/
31
/*___INFO__MARK_END__*/
33
* FileTransferMode.java
35
* Created on October 6, 2004, 6:05 PM
38
package org.ggf.drmaa;
40
import java.io.Serializable;
43
* This class represents the streams which should be used for file transfers.
44
* For each of the three properties which is set to true, the corresponding
45
* stream's path property in the job template will be treated as a source or
46
* destination (depending on the stream) for file tranfers. For example, if the
47
* inputStream property is set to true, the inputPath property of the
48
* JobTemplate will be interpreted as a source from which to transfer files.
49
* @author dan.templeton@sun.com
53
public class FileTransferMode implements Serializable, Cloneable {
54
/** Whether to transfer error stream files. */
55
private boolean errorStream = false;
56
/** Whether to transfer input stream files. */
57
private boolean inputStream = false;
58
/** Whether to transfer output stream files. */
59
private boolean outputStream = false;
62
* Creates a new instance of FileTransferMode
64
public FileTransferMode() {
68
* Create a new instance with the property values preset.
69
* @param inputStream whether to transfer input stream files
70
* @param outputStream whether to transfer output stream files
71
* @param errorStream whether to transfer error stream files
73
public FileTransferMode(boolean inputStream, boolean outputStream, boolean errorStream) {
74
this.errorStream = errorStream;
75
this.inputStream = inputStream;
76
this.outputStream = outputStream;
80
* Set whether to transfer error stream files.
81
* @param errorStream whether to transfer error stream files
83
public void setErrorStream(boolean errorStream) {
84
this.errorStream = errorStream;
88
* Whether to transfer error stream files.
89
* @return whether to transfer error stream files
91
public boolean getErrorStream() {
96
* Set whether to transfer error stream files.
97
* @param inputStream whether to transfer error stream files
99
public void setInputStream(boolean inputStream) {
100
this.inputStream = inputStream;
104
* Whether to transfer error stream files.
105
* @return whether to transfer error stream files
107
public boolean getInputStream() {
112
* Set whether to transfer error stream files.
113
* @param outputStream whether to transfer error stream files
115
public void setOutputStream(boolean outputStream) {
116
this.outputStream = outputStream;
120
* Whether to transfer error stream files.
121
* @return whether to transfer error stream files
123
public boolean getOutputStream() {
128
* Test whether two FileTransferMode objects have the same property
130
* @param obj the Object to test for equality
131
* @return whether the FileTransferMode object has the same property
132
* settings as this one
134
public boolean equals(Object obj) {
135
return ((obj instanceof FileTransferMode) &&
136
(((FileTransferMode)obj).errorStream == errorStream) &&
137
(((FileTransferMode)obj).inputStream == inputStream) &&
138
(((FileTransferMode)obj).outputStream == outputStream));
142
* Returns a hash code based on the file transfer properties.
143
* @return a hash code based on the file transfer properties
145
public int hashCode() {
148
ret += inputStream ? 1 : 0;
149
ret += outputStream ? 2 : 0;
150
ret += errorStream ? 4 : 0;
156
* Creates a copy of this FileTransferMode object.
157
* @return a copy of this FileTransferMode object
159
public Object clone() {
161
return super.clone();
162
} catch (CloneNotSupportedException e) {
163
// this shouldn't happen, since we are Cloneable
164
throw new InternalError();
169
* Returns a string containing the stream settings.
170
* @return a string containing the stream settings
172
public String toString() {
173
StringBuffer out = new StringBuffer();
174
boolean firstProperty = true;
178
firstProperty = false;
183
firstProperty = false;
188
out.append("output");
192
if (!firstProperty) {
199
return out.toString();