com.languagecomputer.api
Class DocumentServiceWebClient

java.lang.Object
  extended by com.languagecomputer.api.BaseWebClient<DocumentWebService>
      extended by com.languagecomputer.api.DocumentServiceWebClient
All Implemented Interfaces:
DocumentService, Service

public class DocumentServiceWebClient
extends BaseWebClient<DocumentWebService>
implements DocumentService

Web service client wrapper for the DocumentService. Handles all the web service interaction code. Combined with the DocumentService class, this provides a java-to-java interaction that masks the web service functionality.

For the methods process(URL), process(URI), and process(File), the file must be accessible from the server. If this is not possible, the method process(InputStream) should be used to send the content as part of the process message.

Since:
1.0
Author:
Kirk Roberts

Constructor Summary
DocumentServiceWebClient(ServiceConfig serviceConfig)
          Creates a new DocumentServiceWebClient with the given ServiceConfig.
 
Method Summary
 String getName()
          Returns the name of the service to use for URL lookup.
protected  Class<DocumentWebService> getWebServiceClass()
          Returns the BaseWebService class this BaseWebClient wraps.
 Document process(File file)
          Processes the given File, placing the processed contents into the returned Document.
 Document process(File file, String fileType)
          Processes the given File, placing the processed contents into the returned Document.
 Document process(InputStream stream)
          Processes the given InputStream, placing the processed contents into the returned Document.
 Document process(InputStream stream, String fileType)
          Processes the given InputStream, placing the processed contents into the returned Document.
 Document process(URI uri)
          Processes the given URI, placing the processed contents into the returned Document.
 Document process(URI uri, String fileType)
          Processes the given URI, placing the processed contents into the returned Document.
 Document process(URL url)
          Processes the given URL, placing the processed contents into the returned Document.
 Document process(URL url, String fileType)
          Processes the given URL, placing the processed contents into the returned Document.
 
Methods inherited from class com.languagecomputer.api.BaseWebClient
disconnect, getSessionID, getWebService, registerSession, sessionRegistered, setSession, setSessionID, unregisterSession
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.languagecomputer.api.Service
setSession
 

Constructor Detail

DocumentServiceWebClient

public DocumentServiceWebClient(ServiceConfig serviceConfig)
Creates a new DocumentServiceWebClient with the given ServiceConfig.

Method Detail

getName

public String getName()
Returns the name of the service to use for URL lookup.

Specified by:
getName in interface Service
Specified by:
getName in class BaseWebClient<DocumentWebService>

getWebServiceClass

protected Class<DocumentWebService> getWebServiceClass()
Returns the BaseWebService class this BaseWebClient wraps.

Specified by:
getWebServiceClass in class BaseWebClient<DocumentWebService>

process

public Document process(URL url)
                 throws IOException
Processes the given URL, placing the processed contents into the returned Document. Automatically detects the file type.

Specified by:
process in interface DocumentService
Parameters:
url - java.net.URL of the file to process.
Returns:
A processed Document corresponding to the given url.
Throws:
IOException - If there was a problem reading the URL.

process

public Document process(URL url,
                        String fileType)
                 throws IOException
Processes the given URL, placing the processed contents into the returned Document. Forces the document processor to use the given fileType.

Specified by:
process in interface DocumentService
Parameters:
url - java.net.URL of the file to process.
fileType - (Advanced Users) Optional file type to force.
Returns:
A processed Document corresponding to the given url.
Throws:
IOException - If there was a problem reading the URL.

process

public Document process(URI uri)
                 throws IOException
Processes the given URI, placing the processed contents into the returned Document. Automatically detects the file type.

Specified by:
process in interface DocumentService
Parameters:
uri - java.net.URI of the file to process.
Returns:
A processed Document corresponding to the given uri.
Throws:
IOException - If there was a problem reading the URI.

process

public Document process(URI uri,
                        String fileType)
                 throws IOException
Processes the given URI, placing the processed contents into the returned Document. Forces the document processor to use the given fileType.

Specified by:
process in interface DocumentService
Parameters:
uri - java.net.URI of the file to process.
fileType - (Advanced Users) Optional file type to force.
Returns:
A processed Document corresponding to the given uri.
Throws:
IOException - If there was a problem reading the URI.

process

public Document process(File file)
                 throws IOException
Processes the given File, placing the processed contents into the returned Document. Automatically detects the file type.

Specified by:
process in interface DocumentService
Parameters:
file - java.io.File of the file to process.
Returns:
A processed Document corresponding to the given file.
Throws:
IOException - If there was a problem reading the File.

process

public Document process(File file,
                        String fileType)
                 throws IOException
Processes the given File, placing the processed contents into the returned Document. Forces the document processor to use the given fileType.

Specified by:
process in interface DocumentService
Parameters:
file - java.io.File of the file to process.
fileType - (Advanced Users) Optional file type to force.
Returns:
A processed Document corresponding to the given file.
Throws:
IOException - If there was a problem reading the File.

process

public Document process(InputStream stream)
                 throws IOException
Processes the given InputStream, placing the processed contents into the returned Document. Automatically detects the file type.

Specified by:
process in interface DocumentService
Parameters:
stream - java.io.InputStream of the file to process.
Returns:
A processed Document corresponding to the given stream.
Throws:
IOException - If there was a problem reading the InputStream.

process

public Document process(InputStream stream,
                        String fileType)
                 throws IOException
Processes the given InputStream, placing the processed contents into the returned Document. Forces the document processor to use the given fileType.

Specified by:
process in interface DocumentService
Parameters:
stream - java.io.InputStream of the file to process.
fileType - (Advanced Users) Optional file type to force.
Returns:
A processed Document corresponding to the given stream.
Throws:
IOException - If there was a problem reading the InputStream.


Copyright © 2009. All Rights Reserved.