org.archive.net.md5
Class Handler

java.lang.Object
  extended by java.net.URLStreamHandler
      extended by org.archive.net.md5.Handler

public class Handler
extends java.net.URLStreamHandler

A protocol handler for an 'md5' URI scheme. Md5 URLs look like this: md5:deadbeefdeadbeefdeadbeefdeadbeef When this handler is invoked against an md5 URL, it passes the raw md5 to the configured script as an argument. The configured script then does the work to bring the item pointed to by the md5 local so we can open a Stream on the local copy. Local file is deleted when we finish. Do DownloadURLConnection.getFile() to get name of temporary file.

You need to define the system property -Djava.protocol.handler.pkgs=org.archive.net to add this handler to the java.net.URL set. Also define system properties -Dorg.archive.net.md5.Md5URLConnection.path=PATH_TO_SCRIPT to pass path of script to run as well as -Dorg.archive.net.md5.Md5URLConnection.options=OPTIONS for any options you'd like to include. The pointed-to PATH_TO_SCRIPT will be invoked as follows: PATH_TO_SCRIPT OPTIONS MD5 LOCAL_TMP_FILE. The LOCAL_TMP_FILE file is made in java.io.tmpdir using java tmp name code.

Author:
stack

Constructor Summary
Handler()
           
 
Method Summary
static void main(java.lang.String[] args)
          Main dumps rsync file to STDOUT.
protected  java.net.URLConnection openConnection(java.net.URL u)
           
 
Methods inherited from class java.net.URLStreamHandler
equals, getDefaultPort, getHostAddress, hashCode, hostsEqual, openConnection, parseURL, sameFile, setURL, setURL, toExternalForm
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Handler

public Handler()
Method Detail

openConnection

protected java.net.URLConnection openConnection(java.net.URL u)
Specified by:
openConnection in class java.net.URLStreamHandler

main

public static void main(java.lang.String[] args)
                 throws java.io.IOException
Main dumps rsync file to STDOUT.

Parameters:
args -
Throws:
java.io.IOException


Copyright © 2003-2011 Internet Archive. All Rights Reserved.