View Javadoc

1   /*
2    * Copyright 2007-2008 the original author or authors.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.gwe.drivers.fileSystems;
18  
19  import org.apache.commons.logging.Log;
20  import org.apache.commons.logging.LogFactory;
21  import org.gwe.utils.security.KeyStore;
22  
23  /**
24   * @author Marco Ruiz
25   * @since Jul 3, 2007
26   */
27  public class GridFileSystem {
28  
29  	private static Log log = LogFactory.getLog(GridFileSystem.class);
30  
31  	private FileTransferer downloadfileTransferer;
32  	private FileTransferer uploadFileTransferer;
33  
34  	public GridFileSystem(int maxParallelFileTransfers) {
35  		this.downloadfileTransferer = new FileTransferer(maxParallelFileTransfers, "Download");
36  		this.uploadFileTransferer   = new FileTransferer(5, "Upload");
37  	}
38  
39  	public Long stageFile(String srcFile, String destFile, KeyStore keys) throws Exception {
40  		return downloadfileTransferer.transferFile(srcFile, destFile, keys);
41  	}
42  
43  	public Long transferFile(String srcFile, String destFile, KeyStore keys) throws Exception {
44  		return downloadfileTransferer.transferFile(srcFile, destFile, keys);
45  	}
46  
47  	public Long uploadFile(String srcFile, String destFile, KeyStore keys) throws Exception {
48  		return uploadFileTransferer.transferFile(srcFile, destFile, keys);
49  	}
50  }
51