net.sf.nxqd
Class NxqdManager

java.lang.Object
  extended by net.sf.nxqd.NxqdManager

public class NxqdManager
extends Object

The class NxqdManager is the main class for communicating with the Nxqd Apache module.

Version:
1.0
Author:
webhiker

Field Summary
static String NXQD_PORT
          The constant NXQD_PORT specifies the default port in case it is not specified in the URI.
 
Constructor Summary
NxqdManager(String host)
          Creates a new NxqdManager instance which will connect to the specified host on the default port.
NxqdManager(String host, String port)
          The a new NxqdManager constructor creates a new instance of this driver.
 
Method Summary
 void addNxqdContainerEventListener(NxqdContainerEventListener cl)
           
 void addNxqdManagerEventListener(NxqdManagerEventListener ml)
           
 void connect()
           
 boolean containerExists(String containerName)
          The containerExists method checks if the specified container exists.
 NxqdContainer createContainer(String containerName)
          The createContainer method creates the specified container A NxqdException is thrown if the container already exists.
 NxqdModify createModify()
          The createModify method will create an XmlModify object.
 void deleteContainer(NxqdContainer container)
          The deleteContainer method deletes the specifed container.
 void deleteContainer(String containerName)
          The deleteContainer method deletes the specifed container.
 void disconnect()
           
 NxqdContainer getContainer(String containerName)
          The getContainer method returns a handle to the specified container.
 String getHostName()
          The getHostName method returns the host name of the machine running the Nxqd server.
 String getHostPort()
          The getHostPort method returns the host port of the remote Nxqd server.
 List getResults(int numResults, String sessionID, int queryID)
          The getResults method will retrieve the results after a lazyQuery has been executed.
 String getSessionId()
          The getSessionId method returns the session id which identifies the client for this session.
 boolean isConnected()
           
 int lazyQuery(String queryExpression, Map nameSpaces, String sessionID)
          The lazyQuery method executes the specified queryExpression on this database.
 List listContainers()
          The listContainers method returns a List containing the container names managed by the server.
 NxqdQueryExpression prepare(String query)
          Describe prepare method here.
 List query(String queryExpression)
          The query method executes the specified queryExpression on this database.
 List query(String queryExpression, Map nameSpaces)
          The query method executes the specified queryExpression on this database.
 void removeNxqdContainerEventListener(NxqdContainerEventListener cl)
           
 void removeNxqdManagerEventListener(NxqdManagerEventListener ml)
           
 void renameContainer(String oldName, String newName)
          The renameContainer method creates the specified container A NxqdException is thrown if the container already exists.
 void setContainerEventPeriod(long ms)
          The setContainerEventPeriod method sets the polling period for retrieving the container event queue from the server.
 void setManagerEventPeriod(long ms)
          The setManagerEventPeriod method sets the polling period for retrieving the manager event queue from the server.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NXQD_PORT

public static final String NXQD_PORT
The constant NXQD_PORT specifies the default port in case it is not specified in the URI.

See Also:
Constant Field Values
Constructor Detail

NxqdManager

public NxqdManager(String host)
Creates a new NxqdManager instance which will connect to the specified host on the default port.

Parameters:
host - a String value indicating the hostname of the machine running the Nxqd server.

NxqdManager

public NxqdManager(String host,
                   String port)
The a new NxqdManager constructor creates a new instance of this driver.

Parameters:
host - a String value indicating the hostname of the machine running the Nxqd server.
port - an int value specifying the port of the Nxqd server.
Method Detail

getHostName

public final String getHostName()
The getHostName method returns the host name of the machine running the Nxqd server.

Returns:
a String value

getHostPort

public final String getHostPort()
The getHostPort method returns the host port of the remote Nxqd server.

Returns:
an String value

connect

public void connect()
             throws NxqdException
Throws:
NxqdException

disconnect

public void disconnect()
                throws NxqdException
Throws:
NxqdException

isConnected

public boolean isConnected()

getSessionId

public String getSessionId()
The getSessionId method returns the session id which identifies the client for this session.

Returns:
a String value

createContainer

public NxqdContainer createContainer(String containerName)
                              throws NxqdException
The createContainer method creates the specified container A NxqdException is thrown if the container already exists.

Parameters:
containerName - a String value
Returns:
a NxqdContainer value
Throws:
NxqdException - if an error occurs

renameContainer

public void renameContainer(String oldName,
                            String newName)
                     throws NxqdException
The renameContainer method creates the specified container A NxqdException is thrown if the container already exists.

Parameters:
oldName - a String indicating the container you want to rename
newName - a String indicating the new name for the container
Throws:
NxqdException - if an error occurs

deleteContainer

public void deleteContainer(String containerName)
                     throws NxqdException
The deleteContainer method deletes the specifed container. A NxqdException is thrown if the container does not exist.

Parameters:
containerName - a String value
Throws:
NxqdException - if an error occurs

deleteContainer

public void deleteContainer(NxqdContainer container)
                     throws NxqdException
The deleteContainer method deletes the specifed container. A NxqdException is thrown if the container does not exist.

Parameters:
container - a NxqdContainer value
Throws:
NxqdException - if an error occurs

getContainer

public NxqdContainer getContainer(String containerName)
                           throws NxqdException
The getContainer method returns a handle to the specified container. A NxqdException is thrown if the container does not exist.

Parameters:
containerName - a String value
Returns:
a NxqdContainer value
Throws:
NxqdException - if an error occurs

containerExists

public boolean containerExists(String containerName)
                        throws NxqdException
The containerExists method checks if the specified container exists. It will return true if the container exists, false otherwise. A NxqdException is thrown if other errors occur.

Parameters:
containerName - a String value
Returns:
a boolean value
Throws:
NxqdException - if an error occurs

listContainers

public List listContainers()
                    throws NxqdException
The listContainers method returns a List containing the container names managed by the server. This list may be empty, but it will never be null.

Returns:
a List value
Throws:
NxqdException - if an error occurs

query

public List query(String queryExpression)
           throws NxqdException
The query method executes the specified queryExpression on this database. No preprocessing of the query is performed.

Parameters:
queryExpression - a String value
Returns:
a List value which will contain XML fragments as String objects.
Throws:
NxqdException - if an error occurs

query

public List query(String queryExpression,
                  Map nameSpaces)
           throws NxqdException
The query method executes the specified queryExpression on this database. No preprocessing of the query is performed.

Parameters:
queryExpression - a String value
nameSpaces - a Map value
Returns:
a List value which will contain XML fragments as String objects.
Throws:
NxqdException - if an error occurs

lazyQuery

public int lazyQuery(String queryExpression,
                     Map nameSpaces,
                     String sessionID)
              throws NxqdException
The lazyQuery method executes the specified queryExpression on this database. No preprocessing of the query is performed. This querying is different from query in the way that no result is returned. Results can be retrieved by calling getResults

Parameters:
queryExpression - a String value
nameSpaces - a Map value
sessionID - a String value representing the client's session; retrieved using getSessionId()
Returns:
a int value which will retrieve the query id if the query was successful The query id retrieved has to be submitted to get_results to get the results associated with the lazy query. If query is unsuccessful, return 0.
Throws:
NxqdException - if an error occurs

getResults

public List getResults(int numResults,
                       String sessionID,
                       int queryID)
                throws NxqdException
The getResults method will retrieve the results after a lazyQuery has been executed.

Parameters:
numResults - a int value to specify how many results to retrieve
sessionID - a String value to specify which client's session
queryID - a int value retrieved from lazyQuery
Throws:
NxqdException

createModify

public NxqdModify createModify()
                        throws NxqdException
The createModify method will create an XmlModify object.

Returns:
a NxqdModify value
Throws:
NxqdException - if an error occurs

prepare

public NxqdQueryExpression prepare(String query)
                            throws NxqdException
Describe prepare method here.

Parameters:
query - a String The XQuery query string to compile.
Returns:
a NxqdQueryExpression value
Throws:
NxqdException - if an error occurs

addNxqdContainerEventListener

public void addNxqdContainerEventListener(NxqdContainerEventListener cl)

removeNxqdContainerEventListener

public void removeNxqdContainerEventListener(NxqdContainerEventListener cl)

setContainerEventPeriod

public void setContainerEventPeriod(long ms)
The setContainerEventPeriod method sets the polling period for retrieving the container event queue from the server.

Parameters:
ms - an long value represeting the pollingperiod in milliseconds. Defaults to 5000.

addNxqdManagerEventListener

public void addNxqdManagerEventListener(NxqdManagerEventListener ml)

removeNxqdManagerEventListener

public void removeNxqdManagerEventListener(NxqdManagerEventListener ml)

setManagerEventPeriod

public void setManagerEventPeriod(long ms)
The setManagerEventPeriod method sets the polling period for retrieving the manager event queue from the server.

Parameters:
ms - an long value represeting the pollingperiod in milliseconds. Defaults to 5000.


Copyright © 2005-2006 nxqd. All Rights Reserved.