|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object dk.netarkivet.common.distribute.HTTPRemoteFileRegistry
public class HTTPRemoteFileRegistry
This is a registry for HTTP remote file, meant for serving registered files to remote hosts. The embedded webserver handling remote files for HTTPRemoteFile point-to-point communication. Optimised to use direct transfer on local machine.
Nested Class Summary | |
---|---|
protected class |
HTTPRemoteFileRegistry.HTTPRemoteFileRegistryHandler
A handler for the registry. |
Field Summary | |
---|---|
protected static HTTPRemoteFileRegistry |
instance
The unique instance. |
protected int |
port
Port number for generating URLs. |
protected org.mortbay.jetty.Server |
server
The embedded webserver. |
Constructor Summary | |
---|---|
protected |
HTTPRemoteFileRegistry()
Initialise the registry. |
Method Summary | |
---|---|
void |
cleanup()
Stops the server and nulls the instance. |
(package private) java.net.URL |
getCleanupUrl(java.net.URL url)
Get the url for cleaning up after a remote file registered under some URL. |
static HTTPRemoteFileRegistry |
getInstance()
Get the unique instance. |
protected java.lang.String |
getProtocol()
Get the protocol part of URLs, that is HTTP. |
protected java.net.URLConnection |
openConnection(java.net.URL url)
Open a connection to an URL in a registry. |
java.net.URL |
registerFile(java.io.File file,
boolean deletable)
Register a file for serving to an endpoint. |
protected void |
startServer()
Start the server, including a handler that responds with registered files, removes registered files on request, and gives 404 otherwise. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static HTTPRemoteFileRegistry instance
protected final int port
protected org.mortbay.jetty.Server server
Constructor Detail |
---|
protected HTTPRemoteFileRegistry()
IOFailure
- if it cannot be initialised.Method Detail |
---|
protected void startServer()
IOFailure
- if it cannot be initialised.protected java.lang.String getProtocol()
public static HTTPRemoteFileRegistry getInstance()
public java.net.URL registerFile(java.io.File file, boolean deletable)
file
- The file to register.deletable
- Whether it should be deleted on cleanup.
ArgumentNotValid
- on null or unreadable file.
IOFailure
- on any trouble registerring the filejava.net.URL getCleanupUrl(java.net.URL url) throws java.net.MalformedURLException
url
- some URL
java.net.MalformedURLException
- If unable to construct the cleanup urlprotected java.net.URLConnection openConnection(java.net.URL url) throws java.io.IOException
url
- The URL to open connection to.
java.io.IOException
- If unable to open the connection.public void cleanup()
cleanup
in interface CleanupIF
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |