org.sixdml.excelon
Class xlnSixdmlIndex

java.lang.Object
  |
  +--org.sixdml.excelon.xlnSixdmlIndex
All Implemented Interfaces:
SixdmlConstants, SixdmlIndex

public class xlnSixdmlIndex
extends Object
implements SixdmlIndex, SixdmlConstants

  
 xlnSixdmlIndex.java

 A database index. 
 
 Created: Sun Jan 13 15:58:50 2002

 

Version:
1.0
Author:
Dare Obasanjo

Field Summary
private  HashMap indexFields
          The fields of this index.
(package private)  com.exln.dxe.filesystem.XlnIndex myIndex
          The underlying eXcelon index that this class acts as a wrapper for.
private  String name
          The name of the index.
 
Fields inherited from interface org.sixdml.dbmanagement.SixdmlIndex
STRUCTURE_INDEX, TEXT_INDEX, UNKNOWN, VALUE_INDEX
 
Fields inherited from interface org.sixdml.SixdmlConstants
SIXDML_NS, SIXDML_VERSION
 
Constructor Summary
private xlnSixdmlIndex()
          Default constructor private because one must always create an xlnSixdmlIndex with an underlying SixdmlIndex.
(package private) xlnSixdmlIndex(String name, HashMap indexFields)
          Creates an index with a name, an indexFields table and an underlying DXE database.
(package private) xlnSixdmlIndex(com.exln.dxe.filesystem.XlnIndex index, String name)
          Initializes the object with a eXcelon DXE index type.
 
Method Summary
(package private) static org.sixdml.excelon.xlnSixdmlIndex createIndex(Element xmlNode)
          Creates a xlnSixdmlIndex object from an XML serialization of the class.
 boolean equals(Object obj)
          Compares two objects of this class.
 com.exln.dxe.filesystem.XlnIndex getIndex()
          Returns this objects underlying eXcelon DXE XlnIndex object, if non-exists because this class instance was created in an ad-hoc manner then a new XlnIndex object will be created.
 HashMap getIndexFields()
          Returns a hash table containing various characteristics of the index depending on its type.
 String getName()
          Get the name of the index.
 org.sixdml.dbmanagement.SixdmlIndexType getType()
          Returns the type of the index.
 Node getXMLAsNode()
          Creates an XML representation of this object that conforms to the following DTD as a DOM node.
 String getXMLAsString()
          Creates an XML representation of this object that conforms to the following DTD as a string.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

myIndex

final com.exln.dxe.filesystem.XlnIndex myIndex
The underlying eXcelon index that this class acts as a wrapper for.


name

private String name
The name of the index.


indexFields

private HashMap indexFields
The fields of this index.

See Also:
getIndexFields()
Constructor Detail

xlnSixdmlIndex

private xlnSixdmlIndex()
Default constructor private because one must always create an xlnSixdmlIndex with an underlying SixdmlIndex.


xlnSixdmlIndex

xlnSixdmlIndex(String name,
               HashMap indexFields)
Creates an index with a name, an indexFields table and an underlying DXE database.
NOTE: Runtime error may occur if table not properly populated.

Parameters:
name - the name of the index.
indexFields - the index fields for the class.

xlnSixdmlIndex

xlnSixdmlIndex(com.exln.dxe.filesystem.XlnIndex index,
               String name)
Initializes the object with a eXcelon DXE index type.

Parameters:
index - the eXcelon DXE index type.
name - the name of the index.
Method Detail

createIndex

static org.sixdml.excelon.xlnSixdmlIndex createIndex(Element xmlNode)
Creates a xlnSixdmlIndex object from an XML serialization of the class.
NOTE: This code assumes that the XML node contains XML that conforms to the following DTD
 <!ELEMENT index(indexKey, indexElement, options, type, tokenizer?)> 
 <!ATTLIST index name CDATA #REQUIRED >
 <!ELEMENT indexKey (#PCDATA)> 
 <!ELEMENT indexElement (#PCDATA)> 
 <!ELEMENT options (#PCDATA)> 
 <!ELEMENT type (#PCDATA)> 
 

Parameters:
xmlNode - the XML representation of the object to create
Returns:
the newly created index sans an underlying XlnIndex object.

getIndex

public com.exln.dxe.filesystem.XlnIndex getIndex()
Returns this objects underlying eXcelon DXE XlnIndex object, if non-exists because this class instance was created in an ad-hoc manner then a new XlnIndex object will be created.


getName

public String getName()
Get the name of the index.

Specified by:
getName in interface SixdmlIndex
Returns:
Value of name.

getType

public org.sixdml.dbmanagement.SixdmlIndexType getType()
Returns the type of the index.

Specified by:
getType in interface SixdmlIndex
Returns:
type of the index.

getIndexFields

public HashMap getIndexFields()
Returns a hash table containing various characteristics of the index depending on its type. All eXcelon DXE indexes will have an entry for "indexKey", "indexElement", "options" and "type". Both the "options" and "type" fields will be integer values that will be one of a range of values defined as static ints in the XlnIndex, XlnTextIndex and XlnValueIndex classes.

Specified by:
getIndexFields in interface SixdmlIndex
Returns:
a hash table containing the relevant data about the index. The hashtable returned is a COPY of the one used by this class internally.

getXMLAsNode

public Node getXMLAsNode()
Creates an XML representation of this object that conforms to the following DTD as a DOM node.
 <!ELEMENT index(indexKey, indexElement, options, type, tokenizer?)> 
 <!ATTLIST index name CDATA #REQUIRED >
 <!ELEMENT indexKey (#PCDATA)> 
 <!ELEMENT indexElement (#PCDATA)> 
 <!ELEMENT options (#PCDATA)> 
 <!ELEMENT type (#PCDATA)> 
 

Returns:
a DOM Node containing the XML representation of this class.

getXMLAsString

public String getXMLAsString()
Creates an XML representation of this object that conforms to the following DTD as a string.
 <!ELEMENT index(indexKey, indexElement, options, type, tokenizer?)> 
 <!ATTLIST index name CDATA #REQUIRED >
 <!ELEMENT indexKey (#PCDATA)> 
 <!ELEMENT indexElement (#PCDATA)> 
 <!ELEMENT options (#PCDATA)> 
 <!ELEMENT type (#PCDATA)> 
 

Returns:
a string containing the XML representation of this class.

equals

public boolean equals(Object obj)
Compares two objects of this class. Returns true if they have the same name and same values in their index fields.

Overrides:
equals in class Object
Parameters:
obj - the object to compare.
Returns:
true if they have the same name and values in their index fields, false otherwise.