View Javadoc

    1   /* RsyncURLConnection.java
    2    *
    3    * $Id: RsyncURLConnection.java 4510 2006-08-18 16:13:32Z stack-sf $
    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;
    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 =
    39      	System.getProperty(RsyncURLConnection.class.getName() + ".timeout",
    40      		"300");
    41
    42      protected RsyncURLConnection(URL u) {
    43          super(u);
    44      }
    45
    46      protected String getScript() {
    47      	return System.getProperty(this.getClass().getName() + ".path",
    48      		"rsync");
    49      }
    50
    51      @Override
    52      protected String[] getCommand(final URL thisUrl,
    53      		final File downloadFile) {
    54      	return new String[] {getScript(), "--timeout=" + RSYNC_TIMEOUT,
    55      		this.url.getPath(), downloadFile.getAbsolutePath()};
    56      }
    57  }