org.apache.ws.jaxme.pm.ino

Class InoManager

Implemented Interfaces:
PM

public class InoManager
extends PMIdImpl

An implementation of a JMManager for a Tamino database.
Author:
Jochen Wiedmanns

Nested Class Summary

Nested classes/interfaces inherited from class org.apache.ws.jaxme.pm.impl.PMImpl

PMImpl.ListObserver

Method Summary

void
delete(Element pElement)
Deletes the given document from the database.
protected String
getDeleteQuery(Element pElement)
Returns a query suited for deleting the element.
String
getElementTag()
Returns the qualified element name of the root element.
String
getIdTag()
Returns the qualified attribute name of the ID attribute.
protected String
getInsertQuery(Element pElement)
Returns a query suited for inserting the element.
protected String
getPassword()
protected java.net.HttpURLConnection
getResponse(String pQuery)
Performs a single database query.
protected String
getUpdateQuery(Element pElement)
Returns a query suited for updating the element.
protected String
getUser()
void
init(JMManager pManager)
Initializes the PM.
void
insert(Element pElement)
Inserts the given document into the database.
protected InoResponseHandler
performQuery(String pQuery, java.util.List pList)
Performs a single database query.
protected void
performQuery(String pQuery, InoResponseHandler pHandler)
Parses a single INO response document.
void
select(Observer pObserver, String pQuery, PMParams pPlaceHolderArgs)
Reads documents matching the given query.
void
setElementTag(String pElementTag)
Sets the qualified element name of the root element.
void
setIdTag(String pIdTag)
Returns the qualified attribute name of the ID attribute.
void
update(Element pElement)
Updates the given document in the database.

Methods inherited from class org.apache.ws.jaxme.pm.impl.PMIdImpl

getGetIdMethodName, getId, init, setGetIdMethodName

Methods inherited from class org.apache.ws.jaxme.pm.impl.PMImpl

create, getManager, init, parseQuery, select, select, select

Method Details

delete

public void delete(Element pElement)
            throws PMException
Deletes the given document from the database.
Specified by:
delete in interface PM

getDeleteQuery

protected String getDeleteQuery(Element pElement)
            throws JAXBException,
                   InvocationTargetException,
                   IllegalAccessException,
                   NoSuchMethodException,
                   UnsupportedEncodingException
Returns a query suited for deleting the element.

getElementTag

public String getElementTag()
Returns the qualified element name of the root element. This is used in delete or select queries for creation of an XPath query.

getIdTag

public String getIdTag()
Returns the qualified attribute name of the ID attribute. This is used in delete or update queries for creation of an XQL statement.

getInsertQuery

protected String getInsertQuery(Element pElement)
            throws JAXBException,
                   UnsupportedEncodingException
Returns a query suited for inserting the element.

getPassword

protected String getPassword()

getResponse

protected java.net.HttpURLConnection getResponse(String pQuery)
            throws SAXException
Performs a single database query.

getUpdateQuery

protected String getUpdateQuery(Element pElement)
            throws JAXBException,
                   UnsupportedEncodingException
Returns a query suited for updating the element.

getUser

protected String getUser()

init

public void init(JMManager pManager)
            throws JAXBException
Initializes the PM. Called from the JAXBContextImpl upon initialization.
Specified by:
init in interface PM
Overrides:
init in interface PMIdImpl
Parameters:
pManager - The manager being queried for configuration details.

insert

public void insert(Element pElement)
            throws PMException
Inserts the given document into the database.
Specified by:
insert in interface PM

performQuery

protected InoResponseHandler performQuery(String pQuery,
                                          java.util.List pList)
            throws SAXException
Performs a single database query.

performQuery

protected void performQuery(String pQuery,
                            InoResponseHandler pHandler)
            throws SAXException
Parses a single INO response document.

select

public void select(Observer pObserver,
                   String pQuery,
                   PMParams pPlaceHolderArgs)
            throws JAXBException
Reads documents matching the given query. For any document matching, the Observer's notify method is executed with the matching document as an argument.

The query may contain placeholders. If it does, you have to supply an instance of PMParams with the placeholder values. Example:

   manager.select("Name = ? and Id = ?",
                  new PMParams().addString("Someone").addInt(4));
 
Specified by:
select in interface PM
Parameters:
pObserver - This Observer is notified for any matching document. The document is added as an argument.
pQuery - The query to perform. May contain placeholders.
pPlaceHolderArgs - An array of objects or null, if the query doesn't contain any placeholders.

setElementTag

public void setElementTag(String pElementTag)
Sets the qualified element name of the root element. This is used in delete or select queries for creation of an XQL statement.

setIdTag

public void setIdTag(String pIdTag)
Returns the qualified attribute name of the ID attribute. This is used in delete or update queries for creation of an XQL statement.

update

public void update(Element pElement)
            throws PMException
Updates the given document in the database.
Specified by:
update in interface PM