01: /* RsyncURLConnection.java
02: *
03: * $Id: RsyncURLConnection.java 4510 2006-08-18 16:13:32Z stack-sf $
04: *
05: * Created Jul 19, 2005
06: *
07: * Copyright (C) 2005 Internet Archive.
08: *
09: * 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;
28: import java.net.URL;
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 +0000 (Fri, 18 Aug 2006) $, $Revision: 4510 $
36: */
37: public class RsyncURLConnection extends DownloadURLConnection {
38: private final String RSYNC_TIMEOUT = System.getProperty(
39: RsyncURLConnection.class.getName() + ".timeout", "300");
40:
41: protected RsyncURLConnection(URL u) {
42: super (u);
43: }
44:
45: protected String getScript() {
46: return System.getProperty(this .getClass().getName() + ".path",
47: "rsync");
48: }
49:
50: @Override
51: protected String[] getCommand(final URL this Url,
52: final File downloadFile) {
53: return new String[] { getScript(),
54: "--timeout=" + RSYNC_TIMEOUT, this.url.getPath(),
55: downloadFile.getAbsolutePath() };
56: }
57: }
|