Berkeley DB XML
version 2.5.16

com.sleepycat.dbxml
Class XmlIndexLookup

java.lang.Object
  extended by com.sleepycat.dbxml.XmlIndexLookup

public class XmlIndexLookup
extends Object

The XmlIndexLookup class encapsulates the context within which an index lookup operation can be performed on an XmlContainer object. The lookup is performed using an XmlIndexLookup object, and a series of methods of that object that specify how the lookup is to be performed. Using these methods, it is possible to specify inequality lookups, range lookups, and simple value lookups, as well as the sort order of the results. By default, results are returned in the sort order of the index.

XmlIndexLookup objects are created using XmlManager.createIndexLookup(com.sleepycat.dbxml.XmlContainer, java.lang.String, java.lang.String, java.lang.String, com.sleepycat.dbxml.XmlValue, int).

XmlIndexLookup objects are not thread-safe, and may not be shared among threads while being configured. A constructed, read-only object may be shared among threads for multiple calls to execute(com.sleepycat.dbxml.XmlQueryContext).


Field Summary
static int EQ
          Operation equal (==)
static int GT
          Operation greater than (>)
static int GTE
          Operation greater than or equal (>=)
static int LT
          Operation less than (<)
static int LTE
          Operation less than or equal (<=)
static int NONE
          Empty/no operation
 
Constructor Summary
XmlIndexLookup(XmlIndexLookup o)
          Copy constructor
 
Method Summary
 void delete()
          Free the native resources associated with this object
 XmlResults execute(XmlQueryContext context)
          Executes the index lookup operation specified by the configuration of the XmlIndexLookup object.
 XmlResults execute(XmlQueryContext context, XmlDocumentConfig config)
          Executes the index lookup operation specified by the configuration of the XmlIndexLookup object.
 XmlResults execute(XmlTransaction txn, XmlQueryContext context)
          Executes the index lookup operation specified by the configuration of the XmlIndexLookup object.
 XmlResults execute(XmlTransaction txn, XmlQueryContext context, XmlDocumentConfig config)
          Executes the index lookup operation specified by the configuration of the XmlIndexLookup object.
 XmlContainer getContainer()
          Gets the container on which the index lookup operation is to be performed.
 int getHighBoundOperation()
          Gets the operation to be used for the upper bound for a range index lookup operation.
 XmlValue getHighBoundValue()
          Gets the value to be used for the upper bound for a range index lookup operation.
 String getIndex()
          Gets the indexing strategy to be used for the index lookup operation.
 int getLowBoundOperation()
          Gets the operation to be used for the lower bound for a range index lookup operation, or the single operation for a simple inequality lookup.
 XmlValue getLowBoundValue()
          Gets the value to be used for the lower bound for a range index lookup operation, or the single operation for a simple inequality lookup.
 String getNodeName()
          Gets the name of the node to be used along with the indexing strategy for the index lookup operation.
 String getNodeURI()
          Gets the uri of the node to be used along with the indexing strategy for the index lookup operation.
 String getParentName()
          Gets the name of the parent node to be used for an edge index lookup operation.
 String getParentURI()
          Gets the uri of the parent node to be used for an edge index lookup operation.
 void setContainer(XmlContainer container)
          Sets the container on which the index lookup operation is to be performed.
 void setHighBound(XmlValue value, int op)
          Sets the operation and value to be used for the upper bound for a range index lookup operation.
 void setIndex(String index)
          Sets the indexing strategy to be used for the index lookup operation.
 void setLowBound(XmlValue value, int op)
          Sets the operation and value to be used for the index lookup operation.
 void setNode(String uri, String name)
          Sets the name of the node to be used along with the indexing strategy for the index lookup operation.
 void setParent(String uri, String name)
          Sets the name of the parent node to be used for an edge index lookup operation.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NONE

public static final int NONE
Empty/no operation

See Also:
Constant Field Values

EQ

public static final int EQ
Operation equal (==)

See Also:
Constant Field Values

GT

public static final int GT
Operation greater than (>)

See Also:
Constant Field Values

GTE

public static final int GTE
Operation greater than or equal (>=)

See Also:
Constant Field Values

LT

public static final int LT
Operation less than (<)

See Also:
Constant Field Values

LTE

public static final int LTE
Operation less than or equal (<=)

See Also:
Constant Field Values
Constructor Detail

XmlIndexLookup

public XmlIndexLookup(XmlIndexLookup o)
               throws XmlException
Copy constructor

Throws:
XmlException
Method Detail

delete

public void delete()
Free the native resources associated with this object


getIndex

public String getIndex()
                throws XmlException
Gets the indexing strategy to be used for the index lookup operation. Only one index may be specified, and substring indexes are not supported.

Throws:
XmlException

setIndex

public void setIndex(String index)
              throws XmlException
Sets the indexing strategy to be used for the index lookup operation. Only one index may be specified, and substring indexes are not supported.

Parameters:
index - A string that represent the indexing strategy. See XmlIndexSpecification.addIndex(String, String, String) for a description of valid index specifications, with the exceptions that only one index can be specified, and substring indexes are not supported.
Throws:
XmlException

getNodeURI

public String getNodeURI()
                  throws XmlException
Gets the uri of the node to be used along with the indexing strategy for the index lookup operation.

Throws:
XmlException

getNodeName

public String getNodeName()
                   throws XmlException
Gets the name of the node to be used along with the indexing strategy for the index lookup operation.

Throws:
XmlException

setNode

public void setNode(String uri,
                    String name)
             throws XmlException
Sets the name of the node to be used along with the indexing strategy for the index lookup operation.

Parameters:
uri - The namespace of the node to be used. The default namespace is selected by passing an empty string for the namespace.
name - The name of the element or attribute node to be used.
Throws:
XmlException

getParentURI

public String getParentURI()
                    throws XmlException
Gets the uri of the parent node to be used for an edge index lookup operation.

Throws:
XmlException

getParentName

public String getParentName()
                     throws XmlException
Gets the name of the parent node to be used for an edge index lookup operation.

Throws:
XmlException

setParent

public void setParent(String uri,
                      String name)
               throws XmlException
Sets the name of the parent node to be used for an edge index lookup operation. If the index is not an edge index, this configuration is ignored.

Parameters:
uri - The namespace of the parent node to be used. The default namespace is selected by passing an empty string for the namespace.
name - The name of the parent element node to be used.
Throws:
XmlException

getLowBoundValue

public XmlValue getLowBoundValue()
                          throws XmlException
Gets the value to be used for the lower bound for a range index lookup operation, or the single operation for a simple inequality lookup.

Throws:
XmlException

getLowBoundOperation

public int getLowBoundOperation()
                         throws XmlException
Gets the operation to be used for the lower bound for a range index lookup operation, or the single operation for a simple inequality lookup.

Throws:
XmlException

setLowBound

public void setLowBound(XmlValue value,
                        int op)
                 throws XmlException
Sets the operation and value to be used for the index lookup operation. If the operation is a simple inequality lookup, the lower bound is used as the single value and operation for the lookup. If the operation is a range lookup, in which an upper bound is specified, the lower bound is used as the lower boundary value and operation for the lookup.

Parameters:
value - The value to be used for the lower bound. An empty value is specified using an uninitialized XmlValue object.
op - Selects the operation to be performed. Must be one of: NONE, EQ, GT, GTE, LT, LTE
Throws:
XmlException

getHighBoundValue

public XmlValue getHighBoundValue()
                           throws XmlException
Gets the value to be used for the upper bound for a range index lookup operation.

Throws:
XmlException

getHighBoundOperation

public int getHighBoundOperation()
                          throws XmlException
Gets the operation to be used for the upper bound for a range index lookup operation.

Throws:
XmlException

setHighBound

public void setHighBound(XmlValue value,
                         int op)
                  throws XmlException
Sets the operation and value to be used for the upper bound for a range index lookup operation. The high bound must be specified to indicate a range lookup.

Parameters:
value - The value to be used for the upper bound. Use of an empty value results in an inequality lookup, rather than a range lookup.
op - The operation to be used on the upper bound. Must be either XmlIndexLookup.LT or XmlIndexLookup.LTE
Throws:
XmlException

getContainer

public XmlContainer getContainer()
                          throws XmlException
Gets the container on which the index lookup operation is to be performed.

Throws:
XmlException

setContainer

public void setContainer(XmlContainer container)
                  throws XmlException
Sets the container on which the index lookup operation is to be performed.

Parameters:
container - The XmlContainer to use for the operation.
Throws:
XmlException

execute

public XmlResults execute(XmlQueryContext context)
                   throws XmlException
Executes the index lookup operation specified by the configuration of the XmlIndexLookup object.

Parameters:
context - The XmlQueryContext to use for the operation.
Throws:
XmlException

execute

public XmlResults execute(XmlTransaction txn,
                          XmlQueryContext context)
                   throws XmlException
Executes the index lookup operation specified by the configuration of the XmlIndexLookup object.

Parameters:
txn - If the operation is to be transaction-protected, the txn parameter is an XmlTransaction handle returned from XmlManager.createTransaction().
context - The XmlQueryContext to use for the operation.
Throws:
XmlException

execute

public XmlResults execute(XmlQueryContext context,
                          XmlDocumentConfig config)
                   throws XmlException
Executes the index lookup operation specified by the configuration of the XmlIndexLookup object.

Parameters:
context - The XmlQueryContext to use for the operation.
config - The XmlDocumentConfig object specifying configuration settings for this operation.
Throws:
XmlException

execute

public XmlResults execute(XmlTransaction txn,
                          XmlQueryContext context,
                          XmlDocumentConfig config)
                   throws XmlException
Executes the index lookup operation specified by the configuration of the XmlIndexLookup object.

Parameters:
txn - If the operation is to be transaction-protected, the txn parameter is an XmlTransaction handle returned from XmlManager.createTransaction().
context - The XmlQueryContext to use for the operation.
config - The XmlDocumentConfig object specifying configuration settings for this operation.
Throws:
XmlException

Berkeley DB XML
version 2.5.16

Copyright (c) 1996,2009 Oracle. All rights reserved.