Class HttpPoster


  • public class HttpPoster
    extends java.lang.Object
    Posts an input stream to the GTS
    • Constructor Summary

      Constructors 
      Constructor Description
      HttpPoster​(org.apache.manifoldcf.core.interfaces.IThreadContext threadContext, java.lang.String realm, java.lang.String userID, java.lang.String password, java.lang.String postURI)
      Initialized the http poster.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      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.util.List<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.StringBuilder 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 StringBuilder
      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

      • 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
      • 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​(org.apache.manifoldcf.core.interfaces.IThreadContext threadContext,
                          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.util.List<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:
        org.apache.manifoldcf.core.interfaces.ManifoldCFException
        org.apache.manifoldcf.agents.interfaces.ServiceInterruption
      • writeACLs

        protected static void writeACLs​(java.lang.StringBuilder 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 StringBuilder
        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