org.apache.manifoldcf.agents.output.gts
Class HttpPoster

java.lang.Object
  extended by org.apache.manifoldcf.agents.output.gts.HttpPoster

public class HttpPoster
extends java.lang.Object

Posts an input stream to the GTS


Nested Class Summary
protected static class HttpPoster.CodeDetails
          Code+details paper object
protected  class HttpPoster.DeleteThread
          Killable thread that does deletions.
protected  class HttpPoster.IngestThread
          Killable thread that does ingestions.
protected static class HttpPoster.LaxTrustManager
          Our own trust manager, which ignores certificate issues
protected  class HttpPoster.StatusThread
          Killable thread that does a status check.
 
Field Summary
static java.lang.String _rcsid
           
protected static int HEADER_CHUNK
           
static java.lang.String ingestBufferSizeProperty
          Ingestion buffer size property.
static java.lang.String ingestCredentialsRealm
           
static java.lang.String ingestMaxConnectionsProperty
           
static java.lang.String ingestPasswordProperty
           
static java.lang.String ingestRescheduleInterval
           
static java.lang.String ingestResponseRetryCount
           
static java.lang.String ingestResponseRetryInterval
           
static java.lang.String ingestURIProperty
           
static java.lang.String ingestUserProperty
           
protected static javax.net.ssl.SSLSocketFactory secureSocketFactory
          This is the secure socket factory we will use.
 
Constructor Summary
HttpPoster(java.lang.String realm, java.lang.String userID, java.lang.String password, java.lang.String postURI)
          Initialized the http poster.
 
Method Summary
 void checkPost()
          Post a check request.
protected  java.net.Socket createSocket(long responseRetryCount)
          Create a socket in a manner consistent with all of our specified parameters.
 void deletePost(java.lang.String documentURI, org.apache.manifoldcf.agents.interfaces.IOutputRemoveActivity activities)
          Post a delete request.
protected  java.lang.String getResponse(java.io.BufferedReader stream)
          Get the response code of the post
protected static javax.net.ssl.SSLSocketFactory getSecureSocketFactory()
          Build a secure socket factory based on no keystore and a lax trust manager.
 boolean indexPost(java.lang.String documentURI, java.lang.String[] collections, java.lang.String documentTemplate, java.lang.String authorityNameString, org.apache.manifoldcf.agents.interfaces.RepositoryDocument document, org.apache.manifoldcf.agents.interfaces.IOutputAddActivity activities)
          Post the input stream to ingest
protected static java.lang.String metadataEncode(java.lang.String inputString)
          Encode for metadata.
protected static void writeACLs(java.lang.StringBuffer aclXml, java.lang.String type, java.lang.String[] acl, java.lang.String[] denyAcl, java.lang.String authorityNameString, org.apache.manifoldcf.agents.interfaces.IOutputAddActivity activities)
          Write acls into a stringbuffer
protected  void writeCredentials(java.io.OutputStream out)
          Write credentials to output
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_rcsid

public static final java.lang.String _rcsid
See Also:
Constant Field Values

ingestBufferSizeProperty

public static java.lang.String ingestBufferSizeProperty
Ingestion buffer size property.


ingestCredentialsRealm

public static java.lang.String ingestCredentialsRealm

ingestResponseRetryCount

public static java.lang.String ingestResponseRetryCount

ingestResponseRetryInterval

public static java.lang.String ingestResponseRetryInterval

ingestRescheduleInterval

public static java.lang.String ingestRescheduleInterval

ingestURIProperty

public static java.lang.String ingestURIProperty

ingestUserProperty

public static java.lang.String ingestUserProperty

ingestPasswordProperty

public static java.lang.String ingestPasswordProperty

ingestMaxConnectionsProperty

public static java.lang.String ingestMaxConnectionsProperty

HEADER_CHUNK

protected static final int HEADER_CHUNK
See Also:
Constant Field Values

secureSocketFactory

protected static javax.net.ssl.SSLSocketFactory secureSocketFactory
This is the secure socket factory we will use. I'm presuming it's thread-safe, but if not, synchronization blocks are in order when it's used.

Constructor Detail

HttpPoster

public HttpPoster(java.lang.String realm,
                  java.lang.String userID,
                  java.lang.String password,
                  java.lang.String postURI)
           throws org.apache.manifoldcf.core.interfaces.ManifoldCFException
Initialized the http poster.

Parameters:
userID - is the unencoded user name, or null.
password - is the unencoded password, or null.
postURI - the uri to post the request to
Throws:
org.apache.manifoldcf.core.interfaces.ManifoldCFException
Method Detail

indexPost

public boolean indexPost(java.lang.String documentURI,
                         java.lang.String[] collections,
                         java.lang.String documentTemplate,
                         java.lang.String authorityNameString,
                         org.apache.manifoldcf.agents.interfaces.RepositoryDocument document,
                         org.apache.manifoldcf.agents.interfaces.IOutputAddActivity activities)
                  throws org.apache.manifoldcf.core.interfaces.ManifoldCFException,
                         org.apache.manifoldcf.agents.interfaces.ServiceInterruption
Post the input stream to ingest

Parameters:
documentURI - is the document's uri.
document - is the document structure to ingest.
Returns:
true if the ingestion was successful, or false if the ingestion is illegal.
Throws:
ManifoldCFException, - ServiceInterruption
org.apache.manifoldcf.core.interfaces.ManifoldCFException
org.apache.manifoldcf.agents.interfaces.ServiceInterruption

writeACLs

protected static void writeACLs(java.lang.StringBuffer aclXml,
                                java.lang.String type,
                                java.lang.String[] acl,
                                java.lang.String[] denyAcl,
                                java.lang.String authorityNameString,
                                org.apache.manifoldcf.agents.interfaces.IOutputAddActivity activities)
                         throws org.apache.manifoldcf.core.interfaces.ManifoldCFException
Write acls into a stringbuffer

Throws:
org.apache.manifoldcf.core.interfaces.ManifoldCFException

checkPost

public void checkPost()
               throws org.apache.manifoldcf.core.interfaces.ManifoldCFException,
                      org.apache.manifoldcf.agents.interfaces.ServiceInterruption
Post a check request.

Throws:
org.apache.manifoldcf.core.interfaces.ManifoldCFException
org.apache.manifoldcf.agents.interfaces.ServiceInterruption

deletePost

public void deletePost(java.lang.String documentURI,
                       org.apache.manifoldcf.agents.interfaces.IOutputRemoveActivity activities)
                throws org.apache.manifoldcf.core.interfaces.ManifoldCFException,
                       org.apache.manifoldcf.agents.interfaces.ServiceInterruption
Post a delete request.

Parameters:
documentURI - is the document's URI.
Throws:
org.apache.manifoldcf.core.interfaces.ManifoldCFException
org.apache.manifoldcf.agents.interfaces.ServiceInterruption

getResponse

protected java.lang.String getResponse(java.io.BufferedReader stream)
                                throws org.apache.manifoldcf.core.interfaces.ManifoldCFException,
                                       org.apache.manifoldcf.agents.interfaces.ServiceInterruption
Get the response code of the post

Parameters:
stream - the stream the response is going to come from
Returns:
the response string
Throws:
org.apache.manifoldcf.core.interfaces.ManifoldCFException
org.apache.manifoldcf.agents.interfaces.ServiceInterruption

writeCredentials

protected void writeCredentials(java.io.OutputStream out)
                         throws java.io.IOException
Write credentials to output

Throws:
java.io.IOException

metadataEncode

protected static java.lang.String metadataEncode(java.lang.String inputString)
Encode for metadata.

Parameters:
inputString - is the input string.
Returns:
output, encoded.

getSecureSocketFactory

protected static javax.net.ssl.SSLSocketFactory getSecureSocketFactory()
                                                                throws org.apache.manifoldcf.core.interfaces.ManifoldCFException
Build a secure socket factory based on no keystore and a lax trust manager. This allows use of SSL for privacy but not identification.

Throws:
org.apache.manifoldcf.core.interfaces.ManifoldCFException

createSocket

protected java.net.Socket createSocket(long responseRetryCount)
                                throws java.io.IOException,
                                       org.apache.manifoldcf.core.interfaces.ManifoldCFException
Create a socket in a manner consistent with all of our specified parameters.

Throws:
java.io.IOException
org.apache.manifoldcf.core.interfaces.ManifoldCFException