public class HttpReplicator extends HttpClientBase implements Replicator
Replicator. Assumes the API supported by
ReplicationService.DEFAULT_CONNECTION_TIMEOUT, DEFAULT_SO_TIMEOUT, url| Constructor and Description |
|---|
HttpReplicator(String host,
int port,
String path,
org.apache.http.conn.HttpClientConnectionManager conMgr)
Construct with specified connection manager.
|
| Modifier and Type | Method and Description |
|---|---|
SessionToken |
checkForUpdate(String currVersion)
Check whether the given version is up-to-date and returns a
SessionToken which can be used for fetching the revision files,
otherwise returns null. |
InputStream |
obtainFile(String sessionID,
String source,
String fileName)
Returns an
InputStream for the requested file and source in the
context of the given session. |
void |
publish(Revision revision)
Publish a new
Revision for consumption by clients. |
void |
release(String sessionID)
Notify that the specified
SessionToken is no longer needed by the
caller. |
close, doAction, doAction, ensureOpen, executeGET, executePOST, isClosed, responseInputStream, responseInputStream, throwKnownError, verifyStatuspublic SessionToken checkForUpdate(String currVersion) throws IOException
ReplicatorSessionToken which can be used for fetching the revision files,
otherwise returns null.
NOTE: when the returned session token is no longer needed, you
should call Replicator.release(String) so that the session resources can be
reclaimed, including the revision files.
checkForUpdate in interface ReplicatorIOExceptionpublic InputStream obtainFile(String sessionID, String source, String fileName) throws IOException
ReplicatorInputStream for the requested file and source in the
context of the given session.
NOTE: it is the caller's responsibility to close the returned stream.
obtainFile in interface ReplicatorSessionExpiredException - if the specified session has already
expiredIOExceptionpublic void publish(Revision revision) throws IOException
ReplicatorRevision for consumption by clients. It is the
caller's responsibility to verify that the revision files exist and can be
read by clients. When the revision is no longer needed, it will be
released by the replicator.publish in interface ReplicatorIOExceptionpublic void release(String sessionID) throws IOException
ReplicatorSessionToken is no longer needed by the
caller.release in interface ReplicatorIOExceptionCopyright © 2000-2016 Apache Software Foundation. All Rights Reserved.