jPOS 1.6.1 API Documentation

org.jpos.tpl
Class PersistentEngine

java.lang.Object
  extended by org.jpos.tpl.PersistentEngine
All Implemented Interfaces:
Configurable, LogSource

public class PersistentEngine
extends java.lang.Object
implements LogSource, Configurable

DataSource implementation used by PersistentPeer implementations

Version:
$Id: PersistentEngine.java 2594 2008-01-22 16:41:31Z apr $
Author:
Alejandro P. Revilla

Constructor Summary
PersistentEngine()
          no args constructor
PersistentEngine(Configuration cfg, Logger logger, java.lang.String realm)
           
 
Method Summary
 void create(java.lang.Object o)
          creates a new persistent object
 java.sql.ResultSet executeQuery(java.lang.String sql, java.sql.Connection conn)
          Execute SQL Query.
 void executeUpdate(java.lang.String sql)
          Execute SQL Update
 void executeUpdate(java.lang.String sql, java.sql.Connection conn)
          Execute SQL Update
 java.sql.Connection getConnection()
           
 Logger getLogger()
           
 long getOID(java.sql.Connection conn)
           
 PersistentPeer getPeer(java.lang.Object obj)
          finds a peer for this object
 java.lang.String getRealm()
           
 void load(java.lang.Object o)
          load object from persistent storage
 void releaseConnection(java.sql.Connection conn)
           
 void remove(java.lang.Object o)
          remove object from persistent storage
 void setConfiguration(Configuration cfg)
          Implements Configurable
 void setLogger(Logger logger, java.lang.String realm)
           
 void update(java.lang.Object o)
          update object to persistent storage
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PersistentEngine

public PersistentEngine(Configuration cfg,
                        Logger logger,
                        java.lang.String realm)
                 throws ConfigurationException
Parameters:
cfg - Configuration
logger - logger
realm - logger's realm
Throws:
ConfigurationException

PersistentEngine

public PersistentEngine()
no args constructor

Method Detail

setConfiguration

public void setConfiguration(Configuration cfg)
                      throws ConfigurationException
Implements Configurable

Specified by:
setConfiguration in interface Configurable
Parameters:
cfg - Configuration
Throws:
ConfigurationException

getConnection

public java.sql.Connection getConnection()

releaseConnection

public void releaseConnection(java.sql.Connection conn)

setLogger

public void setLogger(Logger logger,
                      java.lang.String realm)
Specified by:
setLogger in interface LogSource

getRealm

public java.lang.String getRealm()
Specified by:
getRealm in interface LogSource

getLogger

public Logger getLogger()
Specified by:
getLogger in interface LogSource

getPeer

public PersistentPeer getPeer(java.lang.Object obj)
                       throws NoPeerException
finds a peer for this object

Parameters:
obj - Main object
Throws:
NoPeerException

executeUpdate

public void executeUpdate(java.lang.String sql)
                   throws java.sql.SQLException
Execute SQL Update

Parameters:
sql - sql command
Throws:
java.sql.SQLException

executeUpdate

public void executeUpdate(java.lang.String sql,
                          java.sql.Connection conn)
                   throws java.sql.SQLException
Execute SQL Update

Parameters:
sql - sql command
conn - sql connection
Throws:
java.sql.SQLException

executeQuery

public java.sql.ResultSet executeQuery(java.lang.String sql,
                                       java.sql.Connection conn)
                                throws java.sql.SQLException
Execute SQL Query.

Parameters:
sql - sql command
conn - sql connection
Returns:
ResultSet (please close() it after using - thanks)
Throws:
java.sql.SQLException

create

public void create(java.lang.Object o)
            throws NoPeerException,
                   java.sql.SQLException
creates a new persistent object

Parameters:
o - object to create
Throws:
NoPeerException
java.sql.SQLException

load

public void load(java.lang.Object o)
          throws NoPeerException,
                 java.sql.SQLException,
                 NotFoundException
load object from persistent storage

Parameters:
o - object to load
Throws:
NoPeerException
java.sql.SQLException
NotFoundException

remove

public void remove(java.lang.Object o)
            throws NoPeerException,
                   java.sql.SQLException,
                   NotFoundException
remove object from persistent storage

Parameters:
o - object to load
Throws:
NoPeerException
java.sql.SQLException
NotFoundException

update

public void update(java.lang.Object o)
            throws NoPeerException,
                   java.sql.SQLException,
                   NotFoundException
update object to persistent storage

Parameters:
o - object to load
Throws:
NoPeerException
java.sql.SQLException
NotFoundException

getOID

public long getOID(java.sql.Connection conn)
            throws java.sql.SQLException
Throws:
java.sql.SQLException

jPOS.org