All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class ninja.xset.SETserver

java.lang.Object
   |
   +----ninja.xset.SETserver

public class SETserver
extends Object
implements Serializable
Class that provides the main interface to the Search Engine on Treaps It provides the public methods register and deregister for the external applications.


Variable Index

 o globalHashSID
 o HASHSTORE
 o parser
 o refresh
 o rootTagList
 o runCleaner
 o storeDir
 o timeout
 o TREAPSTORE

Constructor Index

 o SETserver(long, String)
SETserver(long) ** Constructor method Initializes variables and prepares the search indices for data
 o SETserver(String)
SETserver() ** Constructor method Initializes variables and prepares the search indices for data This constructor is for SET instances with no timeouts

Method Index

 o clearAll()
clearAll() ** Method that resets the SETserver objects and deletes all XML files in the data directory
 o containsSEID(String)
boolean containsSEID(String) ** Method that tests if a given ServiceEntry ID is already registered in SETserver.
 o enumerateTag(String[])
Enumeration enumerateTag (Vector) ** Method to return an enumeration of values for a given tag.
 o printSET(String)
printSET(String) ** Debugging method used to print out the registration treap It uses the Treap.print()
 o querySET(Document)
Vector querySET(Document) ** Method called by the XSet service or independent application to query for a certain document, given an XML template
 o querySET(Document, Vector)
Method to query the XSet server, and return only those fields requested

This returned data structure is rather complicated.

 o SETderegister(Document)
SETderegister (Document) ** Method called by the SDS server or independent application to remove a document from the SET search engine indices.
 o SETderegister(ServiceEntry)
SETderegister (ServiceEntry) ** Method called by the XSet service to remove a document from the SET search engine indices.
 o SETregister(Document, long)
SETregister(Document, long) ** Method called by the SDS server or independent application to add a new document to the XSet search engine.
 o SETregister(String, long)
SETregister(String, long) ** Method called by application to add new document to XSet.
 o SETrenew(Document)
SETrenew (Document) ** Method called by he SDS server to update an existing XML document.
 o SETreplace(Document, Document)
SETreplace(Document, Document) ** Method called by the SDS server or independent application to replace an existing document with a new document.
 o testCheckAttributes()
testCheckAttributes() ** TESTER Method for checkAttributes
 o testIntersect()
testIntersect () ** TESTER Method for totalIntersect

Variables

 o HASHSTORE
 public static final short HASHSTORE
 o TREAPSTORE
 public static final short TREAPSTORE
 o rootTagList
 protected Hashtable rootTagList
 o refresh
 protected boolean refresh
 o timeout
 protected long timeout
 o globalHashSID
 protected Hashtable globalHashSID
 o storeDir
 protected String storeDir
 o runCleaner
 protected transient Thread runCleaner
 o parser
 protected transient DOMParser parser

Constructors

 o SETserver
 public SETserver(long refreshRate,
                  String sDir)
SETserver(long) ** Constructor method Initializes variables and prepares the search indices for data

Parameters:
refreshRate - The number of milliseconds taken for an entry to become outdated encoded as a long
sDir - The storage directory for all XML files
 o SETserver
 public SETserver(String sDir)
SETserver() ** Constructor method Initializes variables and prepares the search indices for data This constructor is for SET instances with no timeouts

Parameters:
sDir - The storage directory for all XML files

Methods

 o containsSEID
 public boolean containsSEID(String serviceID)
boolean containsSEID(String) ** Method that tests if a given ServiceEntry ID is already registered in SETserver.

Returns:
whether the hashtable contains the given ServiceEntry ID
 o querySET
 public Vector querySET(Document query)
Vector querySET(Document) ** Method called by the XSet service or independent application to query for a certain document, given an XML template

Parameters:
query - The XML document used as the template for the search
Returns:
The serviceEntry vector containing (if any) the matches that correspond to the query
 o querySET
 public Vector querySET(Document xmlQuery,
                        Vector tagVector) throws XSetException
Method to query the XSet server, and return only those fields requested

This returned data structure is rather complicated. It's a vector of hashtables, one hashtable for each matching XML document found. For each of these matches, the hashtable hashes each of the requested tag names to a vector. The vector contains all the string values which occur in that tagname in the currently matched XML document. So it's a Vector of Hashtables of Vectors.

Parameters:
xmlQuery, - the xml query in the form of a DOM tree object
tagVector, - a vector containing String names of requested tags
Returns:
Vector of hashtables that map each requested tagname to its value
Throws: XSetException
for normal XSet errors
 o enumerateTag
 public Enumeration enumerateTag(String pathArray[]) throws XSetException
Enumeration enumerateTag (Vector) ** Method to return an enumeration of values for a given tag. The method traverses the internal index for tags, and upon finding the desired tag (indicated through a series of string arguments, it calls the keys() method on the treap, and returns the enumeration.

Parameters:
pathArray - is an array of strings that denote the path from the root of the document to the desired tag
Returns:
an enumeration of the existing values for the specified given tag in the dataset tree
Throws: XSetException
for normal XSet errors
 o SETrenew
 public void SETrenew(Document d) throws XSetException
SETrenew (Document) ** Method called by he SDS server to update an existing XML document. It hashes the document to get the ID and retrieves the serviceEntry, then updates the heartbeat field.

Parameters:
renewDoc - XML document to be renewed
Throws: XSetException
for generalized errors
 o SETreplace
 public void SETreplace(Document olddoc,
                        Document newdoc) throws XSetException
SETreplace(Document, Document) ** Method called by the SDS server or independent application to replace an existing document with a new document. It deletes e old document first, the registers the new document.

Parameters:
olddoc - The XML document to be replaced in the SET
newdoc - The XML document to replace olddoc
Throws: XSetException
for generalized errors
 o SETregister
 public void SETregister(String xmltext,
                         long counter) throws XSetException
SETregister(String, long) ** Method called by application to add new document to XSet. This version is to provide a wrapper for parsing the XML string

Parameters:
xmltext - The XML document in string format
counter - The counter value assigned externally via a counter obj
Throws: XSetException
for generalized errors
 o SETregister
 public void SETregister(Document d,
                         long counter) throws XSetException
SETregister(Document, long) ** Method called by the SDS server or independent application to add a new document to the XSet search engine. Mainly a wrapper for generating the serviceID

Parameters:
d - The XML document to be added to the search engine
counter - The counter value assigned externally via a counter obj
Throws: XSetException
for generalized errors
 o SETderegister
 public void SETderegister(Document d) throws XSetException
SETderegister (Document) ** Method called by the SDS server or independent application to remove a document from the SET search engine indices.

Parameters:
d - The XML document to be removed from the search engine
Throws: XSetException
for generalized errors
 o SETderegister
 public void SETderegister(ServiceEntry se) throws XSetException
SETderegister (ServiceEntry) ** Method called by the XSet service to remove a document from the SET search engine indices.

Parameters:
se - The XML ServiceEntry to be removed from the search engine
Throws: XSetException
for generalized errors
 o clearAll
 public void clearAll()
clearAll() ** Method that resets the SETserver objects and deletes all XML files in the data directory

 o testCheckAttributes
 public void testCheckAttributes()
testCheckAttributes() ** TESTER Method for checkAttributes

 o testIntersect
 public void testIntersect()
testIntersect () ** TESTER Method for totalIntersect

 o printSET
 public void printSET(String roottagname)
printSET(String) ** Debugging method used to print out the registration treap It uses the Treap.print()


All Packages  Class Hierarchy  This Package  Previous  Next  Index