com.languagecomputer.api
Class IndexServiceWebClient

java.lang.Object
  extended by com.languagecomputer.api.BaseWebClient<IndexWebService>
      extended by com.languagecomputer.api.IndexServiceWebClient
All Implemented Interfaces:
IndexService, Service

public class IndexServiceWebClient
extends BaseWebClient<IndexWebService>
implements IndexService

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

Since:
1.0
Author:
Kirk Roberts

Constructor Summary
IndexServiceWebClient(ServiceConfig serviceConfig)
          Creates a new IndexServiceWebClient with the given ServiceConfig.
 
Method Summary
 void finish()
          Indicates that the indexing process is finished or has reached some checkpoint stage.
 Document get(String docID)
          Loads the Document with the given docID from the index.
 String getName()
          Returns the name of the service to use for URL lookup.
protected  Class<IndexWebService> getWebServiceClass()
          Returns the BaseWebService class this BaseWebClient wraps.
 void index(Document document)
          Indexes the given Document.
 void remove(String docID)
          Removes the Document with the given docID from the index.
 void setPath(String path)
          Sets the location of the index.
 
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

IndexServiceWebClient

public IndexServiceWebClient(ServiceConfig serviceConfig)
Creates a new IndexServiceWebClient 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<IndexWebService>

getWebServiceClass

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

Specified by:
getWebServiceClass in class BaseWebClient<IndexWebService>

setPath

public void setPath(String path)
             throws IOException
Sets the location of the index. If no index exists at the location, one will be created upon a call to IndexService.index(Document). Calls to IndexService.remove(String) and IndexService.get(String), however, should throw an IOException. This is an optional operation.

Specified by:
setPath in interface IndexService
Parameters:
path - The path to the index.
Throws:
IOException - If there is an issue accessing any I/O component required by the IndexService. Implementors may or may not validate the path and throw an exception if it is inaccessible.

index

public void index(Document document)
           throws IOException
Indexes the given Document. This should now be retrievable using #getDocument(String). If no index currently exists at the location given to IndexService.setPath(String), a new index should be created.

Specified by:
index in interface IndexService
Parameters:
document - The Document to index.
Throws:
IOException - If there is an issue accessing any I/O component required by the IndexService.

finish

public void finish()
            throws IOException
Indicates that the indexing process is finished or has reached some checkpoint stage. This method should block until all index writing is complete and the index becomes usable. Any optimization or index-wide analysis should be done within this method as well. Whether more documents may be added after finish is called is left up to the implementation.

Specified by:
finish in interface IndexService
Throws:
IOException - If there is an issue accessing any I/O component required by the IndexService.

get

public Document get(String docID)
             throws IOException
Loads the Document with the given docID from the index.

Specified by:
get in interface IndexService
Parameters:
docID - Unique identifier for the Document.
Returns:
The Document with the given docID, or null if there is no such document in the index or if this operation is not supported.
Throws:
IOException - If there is an issue accessing any I/O component required by the IndexService.

remove

public void remove(String docID)
            throws IOException
Removes the Document with the given docID from the index.

Specified by:
remove in interface IndexService
Throws:
IOException - If there is an issue accessing any I/O component required by the IndexService.


Copyright © 2009. All Rights Reserved.