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(java.lang.String host,
int port,
java.lang.String path,
org.apache.http.conn.HttpClientConnectionManager conMgr)
Construct with specified connection manager.
|
| Modifier and Type | Method and Description |
|---|---|
SessionToken |
checkForUpdate(java.lang.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. |
java.io.InputStream |
obtainFile(java.lang.String sessionID,
java.lang.String source,
java.lang.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(java.lang.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 HttpReplicator(java.lang.String host,
int port,
java.lang.String path,
org.apache.http.conn.HttpClientConnectionManager conMgr)
public SessionToken checkForUpdate(java.lang.String currVersion) throws java.io.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 Replicatorjava.io.IOExceptionpublic java.io.InputStream obtainFile(java.lang.String sessionID,
java.lang.String source,
java.lang.String fileName)
throws java.io.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
expiredjava.io.IOExceptionpublic void publish(Revision revision) throws java.io.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 Replicatorjava.io.IOExceptionpublic void release(java.lang.String sessionID)
throws java.io.IOException
ReplicatorSessionToken is no longer needed by the
caller.release in interface Replicatorjava.io.IOExceptionCopyright © 2000–2025 The Apache Software Foundation. All rights reserved.