org/objectweb/proactive/core/process/filetransfer/RemoteFileCopy.java

00001 /* 
00002  * ################################################################
00003  * 
00004  * ProActive: The Java(TM) library for Parallel, Distributed, 
00005  *            Concurrent computing with Security and Mobility
00006  * 
00007  * Copyright (C) 1997-2007 INRIA/University of Nice-Sophia Antipolis
00008  * Contact: proactive@objectweb.org
00009  * 
00010  * This library is free software; you can redistribute it and/or
00011  * modify it under the terms of the GNU Lesser General Public
00012  * License as published by the Free Software Foundation; either
00013  * version 2.1 of the License, or any later version.
00014  *  
00015  * This library is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018  * Lesser General Public License for more details.
00019  * 
00020  * You should have received a copy of the GNU Lesser General Public
00021  * License along with this library; if not, write to the Free Software
00022  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
00023  * USA
00024  *  
00025  *  Initial developer(s):               The ProActive Team
00026  *                        http://www.inria.fr/oasis/ProActive/contacts.html
00027  *  Contributor(s): 
00028  * 
00029  * ################################################################
00030  */ 
00031 package org.objectweb.proactive.core.process.filetransfer;
00032 
00033 
00041 public class RemoteFileCopy extends SecureCopyProtocol {
00042     public RemoteFileCopy(String name) {
00043         super(name);
00044         super.COMMAND = "rcp";
00045     }
00046 
00047     public static void main(String[] args) {
00048         //Default is RCP_COMMAND
00049         FileTransferWorkShop fts = new FileTransferWorkShop("rcp");
00050 
00051         FileTransferDefinition ft1 = new FileTransferDefinition("1");
00052         FileTransferDefinition ft2 = new FileTransferDefinition("2");
00053 
00054         ft1.addFile("FileTransferTest.txt", "FileTransferTest-dest.txt");
00055         ft1.addFile("FileTransferTest.txt", "FileTransferTest.txt");
00056         ft1.addFile("heterofile1A", "heterofile1B");
00057         ft1.addDir("FileTransferTestDir", "FileTransferTestDir");
00058         ft1.addDir("heterodir1A", "heterodir1B");
00059 
00060         ft2.addFile("homofile2", "homofile2");
00061         ft2.addFile("heterofile2A", "heterofile2B");
00062         ft2.addDir("homodir2", "homodir2");
00063         ft2.addDir("heterodir2A", "heterodir2B");
00064 
00065         fts.addFileTransfer(ft1);
00066         fts.addFileTransfer(ft2);
00067         fts.setFileTransferCopyProtocol("processDefault");
00068         fts.dstInfoParams.setInfoParameter("username", "mleyton");
00069         fts.dstInfoParams.setInfoParameter("hostname", "plugrid1.inria.fr");
00070         fts.dstInfoParams.setInfoParameter("prefix", "/0/user/mleyton");
00071         fts.srcInfoParams.setInfoParameter("prefix", "/home/mleyton");
00072 
00073         CopyProtocol[] cp = fts.getCopyProtocols();
00074 
00075         System.out.println("Copying protocols:");
00076         for (int i = 0; i < cp.length; i++) {
00077             System.out.println(cp[i].getProtocolName());
00078             System.out.println(cp[i].getClass());
00079 
00080             cp[i].startFileTransfer();
00081         }
00082     }
00083 }

Generated on Mon Jan 22 15:16:08 2007 for ProActive by  doxygen 1.5.1