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, verifyStatus
public SessionToken checkForUpdate(String currVersion) throws IOException
Replicator
SessionToken
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 Replicator
IOException
public InputStream obtainFile(String sessionID, String source, String fileName) throws IOException
Replicator
InputStream
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 Replicator
SessionExpiredException
- if the specified session has already
expiredIOException
public void publish(Revision revision) throws IOException
Replicator
Revision
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 Replicator
IOException
public void release(String sessionID) throws IOException
Replicator
SessionToken
is no longer needed by the
caller.release
in interface Replicator
IOException
Copyright © 2000-2019 Apache Software Foundation. All Rights Reserved.