00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 package org.objectweb.proactive.core.filetransfer;
00032
00033 import java.io.File;
00034 import java.io.IOException;
00035
00036 import org.objectweb.proactive.core.ProActiveException;
00037
00038
00047 public class FileDispatcher {
00048 public FileDispatcher() {
00049 }
00050
00051 public OperationStatus sendBlock(FileTransferService remoteFTS,
00052 FileBlock fileBlock, File dstFile) {
00053 try {
00054 remoteFTS.saveFileBlockAndForward(dstFile, fileBlock);
00055 } catch (IOException e) {
00056 return new OperationStatus(new ProActiveException(
00057 "Can't forward block!", e));
00058 }
00059
00060 return new OperationStatus();
00061 }
00062
00063 public void sendBlockFileBlockWithoutThrowingException(
00064 FileTransferService remoteFTS, FileBlock fileBlock, File dstFile) {
00065 remoteFTS.saveFileBlockAndForwardWithoutThrowingException(dstFile,
00066 fileBlock);
00067 }
00068
00069 public OperationStatus closeForwardingService(FileTransferService fts,
00070 File srcFile, Exception e) {
00071 fts.closeForwardingService(srcFile, e);
00072 return new OperationStatus();
00073 }
00074
00075 public OperationStatus closeForwardingService(FileTransferService fts,
00076 File srcFile) {
00077 fts.closeForwardingService(srcFile);
00078 return new OperationStatus();
00079 }
00080 }