org.apache.ws.jaxme

Interface PM

Known Implementing Classes:
InoManager, PMIdImpl, PMImpl, PMJdbcImpl, TaminoAPI4JDbPm, TaminoAPI4JPm, TaminoAPI4JRaPm, XmlDbPM

public interface PM

The persistence manager (or PM for short) is responsible for reading objects from the database or storing them into the database.
Author:
Jochen Wiedmann

Method Summary

Object
create()
Creates a new, empty element.
void
delete(Element element)
Deletes the given document from the database.
JMManager
getManager()
Returns the manager being queried for configuration details.
void
init(JMManager pManager)
Initializes the PM.
void
insert(Element element)
Inserts the given document into the database.
java.util.Iterator
select(String pQuery)
Returns an iterator to all documents matching the given query.
java.util.Iterator
select(String pQuery, PMParams pPlaceHolderArgs)
Returns an iterator to all documents matching the given query.
void
select(Observer pObserver, String pQuery)
Reads documents matching the given query.
void
select(Observer pObserver, String pQuery, PMParams pPlaceHolderArgs)
Reads documents matching the given query.
void
update(Element element)
Updates the given document in the database.

Method Details

create

public Object create()
            throws JAXBException
Creates a new, empty element.

delete

public void delete(Element element)
            throws JAXBException
Deletes the given document from the database.

getManager

public JMManager getManager()
Returns the manager being queried for configuration details.

init

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

insert

public void insert(Element element)
            throws JAXBException
Inserts the given document into the database.

select

public java.util.Iterator select(String pQuery)
            throws JAXBException
Returns an iterator to all documents matching the given query.
Parameters:
pQuery - The query to perform.

select

public java.util.Iterator select(String pQuery,
                                 PMParams pPlaceHolderArgs)
            throws JAXBException
Returns an iterator to all documents matching the given query. 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));
 
Parameters:
pQuery - The query to perform. May contain placeholders.
pPlaceHolderArgs - An array of objects or null, if the query doesn't contain any placeholders.

select

public void select(Observer pObserver,
                   String pQuery)
            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.
Parameters:
pObserver - This Observer is notified for any matching document. The document is added as an argument.
pQuery - The query to perform.

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));
 
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.

update

public void update(Element element)
            throws JAXBException
Updates the given document in the database.