KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > archive > net > rsync > RsyncURLConnection


1 /* RsyncURLConnection.java
2  *
3  * $Id: RsyncURLConnection.java,v 1.4 2006/08/18 16:13:32 stack-sf Exp $
4  *
5  * Created Jul 19, 2005
6  *
7  * Copyright (C) 2005 Internet Archive.
8  *
9  * This file is part of the Heritrix web crawler (crawler.archive.org).
10  *
11  * Heritrix is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser Public License as published by
13  * the Free Software Foundation; either version 2.1 of the License, or
14  * any later version.
15  *
16  * Heritrix is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Lesser Public License for more details.
20  *
21  * You should have received a copy of the GNU Lesser Public License
22  * along with Heritrix; if not, write to the Free Software
23  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24  */

25 package org.archive.net.rsync;
26
27 import java.io.File JavaDoc;
28 import java.net.URL JavaDoc;
29
30 import org.archive.net.DownloadURLConnection;
31
32 /**
33  * Rsync URL connection.
34  * @author stack
35  * @version $Date: 2006/08/18 16:13:32 $, $Revision: 1.4 $
36  */

37 public class RsyncURLConnection extends DownloadURLConnection {
38     private final String JavaDoc RSYNC_TIMEOUT =
39         System.getProperty(RsyncURLConnection.class.getName() + ".timeout",
40             "300");
41
42     protected RsyncURLConnection(URL JavaDoc u) {
43         super(u);
44     }
45     
46     protected String JavaDoc getScript() {
47         return System.getProperty(this.getClass().getName() + ".path",
48             "rsync");
49     }
50     
51     @Override JavaDoc
52     protected String JavaDoc[] getCommand(final URL JavaDoc thisUrl,
53             final File JavaDoc downloadFile) {
54         return new String JavaDoc[] {getScript(), "--timeout=" + RSYNC_TIMEOUT,
55             this.url.getPath(), downloadFile.getAbsolutePath()};
56     }
57 }
58
Popular Tags