org.basex.query
Class QueryResources

java.lang.Object
  extended by org.basex.query.QueryResources

public final class QueryResources
extends java.lang.Object

This class provides access to resources used by an XQuery expression.

Author:
BaseX Team 2005-12, BSD License, Christian Gruen

Field Summary
 java.util.HashMap<java.lang.String,java.lang.String[]> resources
          Resources.
 
Method Summary
 void addCollection(java.lang.String name, java.lang.String[] paths)
          Adds a collection with the specified paths.
 void addData(Data d)
          Adds a data reference.
 void addDoc(java.lang.String name, java.lang.String path)
          Adds a document with the specified path.
 void addResource(java.lang.String uri, java.lang.String... strings)
          Adds a resource with the specified path.
 Value collection(InputInfo info)
          Returns the default collection.
 Value collection(java.lang.String input, InputInfo info)
          Evaluates fn:collection(): opens an existing database collection, or creates a new data reference.
 Data data(java.lang.String name, InputInfo info)
          Opens a new database or returns a reference to an already opened database.
 DBNode doc(QueryInput qi, InputInfo info)
          Evaluates fn:doc(): opens an existing database document, or creates a new database and node.
 void removeData(java.lang.String name)
          Removes and closes a database if it has not been added by the global context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

resources

public final java.util.HashMap<java.lang.String,java.lang.String[]> resources
Resources.

Method Detail

data

public Data data(java.lang.String name,
                 InputInfo info)
          throws QueryException
Opens a new database or returns a reference to an already opened database.

Parameters:
name - name of database
info - input info
Returns:
database instance
Throws:
QueryException - query exception

doc

public DBNode doc(QueryInput qi,
                  InputInfo info)
           throws QueryException
Evaluates fn:doc(): opens an existing database document, or creates a new database and node.

Parameters:
qi - query input
info - input info
Returns:
document
Throws:
QueryException - query exception

collection

public Value collection(InputInfo info)
                 throws QueryException
Returns the default collection.

Parameters:
info - input info
Returns:
collection
Throws:
QueryException - query exception

collection

public Value collection(java.lang.String input,
                        InputInfo info)
                 throws QueryException
Evaluates fn:collection(): opens an existing database collection, or creates a new data reference.

Parameters:
input - collection path
info - input info
Returns:
collection
Throws:
QueryException - query exception

addDoc

public void addDoc(java.lang.String name,
                   java.lang.String path)
            throws QueryException
Adds a document with the specified path. Only called from the test APIs.

Parameters:
name - document identifier (may be null)
path - documents path
Throws:
QueryException - query exception

addResource

public void addResource(java.lang.String uri,
                        java.lang.String... strings)
Adds a resource with the specified path. Only called from the test APIs.

Parameters:
uri - resource uri
strings - resource strings (path, encoding)

addCollection

public void addCollection(java.lang.String name,
                          java.lang.String[] paths)
                   throws QueryException
Adds a collection with the specified paths. Only called from the test APIs.

Parameters:
name - name of collection
paths - documents paths
Throws:
QueryException - query exception

addData

public void addData(Data d)
Adds a data reference.

Parameters:
d - data reference to be added

removeData

public void removeData(java.lang.String name)
Removes and closes a database if it has not been added by the global context.

Parameters:
name - name of database to be removed