|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.salespointframework.core.data.database.PersistenceManager
public class PersistenceManager
The PersistenceManager is the core of SalesPoints Persistence layer Its job is to manage the database connections and persist and recover objects
Nested Class Summary | |
---|---|
(package private) static class |
PersistenceManager.CachedResultSet
this class cahches ResultSet s in performance mode to decrease query count |
private static class |
PersistenceManager.DelayedAssignmentInfo
|
static class |
PersistenceManager.LogonInformation
Logon information of users in local Salespoints should work with remote logons in future version |
private static class |
PersistenceManager.ModificationEntry
an entry which defines a modification event |
private class |
PersistenceManager.ModificationTriggerWorker
this worker constantly checks for table modifications on active connection |
(package private) static class |
PersistenceManager.MovingAverage
this class calculates the moving average of a given window size |
static class |
PersistenceManager.PerformanceTimer
Simple Performance timer with nano seconds precision |
(package private) static class |
PersistenceManager.ShopInstance
A shop instance that will be written to data source |
Field Summary | |
---|---|
private static PersistenceManager |
_instance
Singleton instance |
private java.sql.Statement |
_statement
The Statement to work with |
private boolean |
broadcastStateChanged
indicates whether a state changed should be broadcasted to PersistenceStateListener s |
private java.util.Map<java.lang.String,java.lang.Object> |
cache
Cache for all recovered and known objects |
private ClassFieldMapper |
cfMapper
current ClassFieldMapper |
private java.lang.Object |
changeLock
Locking object |
private java.lang.Object |
cncLock
Locking object |
private ClassNameEncoder |
cnEncoder
current ClassNameEncoder |
private java.sql.Connection |
connection
actual JDBC connection |
private java.util.List<DatabaseConnection> |
connections
list of connections |
private java.util.List<DatabaseConnectionListener> |
connectionsListener
list of database connection listeners |
private java.util.List<DatabaseConnectionTemplate> |
connectionTemplates
list of connection templates |
private DatabaseConnection |
dbConnection
the actual Database connection |
private boolean |
dbGeneratedKeys
flag for Driver capability to return generated keys |
private java.io.PrintWriter |
dmLog
Log output stream for DriverManager and debug messages, if #debug is false |
private java.util.List<DatasourceChangeListener> |
dsChangedListener
List of datasource changed listener |
private java.util.List<DatasourceOnChangeListener> |
dsOnChangeListener
List of datasource on change listener |
private java.util.Map<java.lang.String,java.util.List<ExternalModificationListener>> |
externalModificationListeners
listeners that listen for external modifications |
private boolean |
ignoreOpen
Ignores open() call |
private boolean |
initQueryInProgress
true, while checkForDataInit() is displayed |
private PersistenceStateListener.ConnectionState |
lastConnectionState
the last connection state |
private PersistenceStateListener.OperationalState |
lastOperation
the last operation |
private java.lang.Object |
lastOperationalObject
the last operational object |
private PersistenceManager.ShopInstance |
localShopInstance
the local shop instance |
private java.util.concurrent.locks.Lock |
lock
Main Lock |
static long |
lockTimeout
Main lock timeout in milliseconds |
java.util.logging.Logger |
logger
The logger |
private java.util.List<PersistenceManager.LogonInformation> |
logonInformations
Logon information list |
private PersistenceManager.MovingAverage |
ma
Moving average for latency |
static int |
MODIFICATION_TRIGGER_WORKER_ENTRY_REMOVE_MULTIPLIER
defines after how much cycles a PersistenceManager.ModificationEntry should be removed from modification table |
static long |
MODIFICATION_TRIGGER_WORKER_INTERVAL
interval in which PersistenceManager.ModificationTriggerWorker checks for changes in database |
static java.lang.String |
MODIFICATION_TRIGGER_WORKER_THREAD_NAME
name of the modification trigger worker thread |
private PersistenceManager.ModificationTriggerWorker |
modificationTriggerWorker
the modification checker |
private boolean |
performanceMode
flag for performance mode |
private java.util.List<PersistenceStateListener> |
psListener
Persistencestate listener |
private java.util.Map<java.lang.String,PersistenceManager.CachedResultSet> |
qCache
The query cache |
protected boolean |
stopModificationTriggerWorker
signal stop fpr MTW |
private java.util.Set<java.lang.String> |
tableCache
Table name cache |
Constructor Summary | |
---|---|
PersistenceManager()
Constructor |
Method Summary | ||
---|---|---|
boolean |
addDatasourceChangedListener(DatasourceChangeListener dscl)
Add a Datasource changed listener |
|
boolean |
addDatasourceOnChangeListener(DatasourceOnChangeListener docl)
Add a Datasource on change listener |
|
boolean |
addDBCListener(DatabaseConnectionListener dbcl)
Add as database connection listener |
|
boolean |
addPersistenceStateListener(PersistenceStateListener psl)
Add a Persistence state Listener |
|
java.lang.Object |
addToList(java.lang.Class c,
java.lang.String id,
java.lang.Class oc,
java.lang.Class kc,
java.lang.Object o,
java.lang.Object k,
boolean uniqueKey,
java.lang.Object host,
int index,
boolean newIndex)
Core function for persisting lists. this method persists items to the list. |
|
void |
aquireMainLock()
|
|
boolean |
attachExternalModificationListener(java.lang.String tableid,
ExternalModificationListener eml)
add an ExternalModificationListener |
|
void |
checkForDataInit()
|
|
private boolean |
checkTableAlternation(java.lang.String tname,
java.util.Map<java.lang.String,java.lang.String> scheme)
Checks for changes in the table scheme and tries to fix them |
|
void |
clearDatabase()
Clears the Database |
|
void |
close()
closes the JDBC connection |
|
int |
countListItems(java.lang.Class c,
java.lang.String id,
java.lang.Class oc,
java.lang.Class kc,
java.lang.Object k,
boolean uniqueKey,
java.lang.Object host,
java.lang.Object o)
Core function for persisting lists. this method counts the items of a list. |
|
void |
dettachExternalModificationListener(java.lang.String tableid,
ExternalModificationListener eml)
remove ExternalModificationListener |
|
protected java.lang.Object |
doTypeChecking(java.lang.Object odata,
java.lang.Class c)
|
|
private void |
fireCSChanged(PersistenceStateListener.ConnectionState state)
fire a Connection state changed event |
|
void |
fireDBCUpdate()
notifies connection listeners about an update |
|
private void |
fireDSChanged()
fire datasource changes event |
|
private void |
fireLatencyChanged(float latency)
fire a latency changed event |
|
private void |
fireOnDSChange()
fire datasource on change event |
|
private void |
fireOPSChanged(PersistenceStateListener.OperationalState op,
java.lang.Object o)
fire a operational state change event |
|
boolean |
forceOpen()
Enforces the connection opening |
|
private java.lang.String |
getCacheKey(java.lang.Class c,
java.lang.Object ident)
|
|
private java.lang.Object |
getChangeLock()
retrieve the change lock object |
|
java.util.List<DatabaseConnection> |
getConnections()
returns a read only list of regsitered database connections |
|
java.util.List<DatabaseConnectionTemplate> |
getConnectionTemplates()
returns the list of Database connection templates |
|
DatabaseConnection |
getDatabaseConnection()
returns the current database connection |
|
java.util.List<java.lang.Object> |
getEntireList(java.lang.Class c,
java.lang.String id,
java.lang.Class oc,
java.lang.Class kc,
boolean uniqueKey,
boolean returnKeys,
java.lang.Object RecoveryContext,
java.lang.Object host,
java.lang.Object k,
boolean isMap)
Core function for persisting lists. this method recovers the entire list. |
|
java.util.List<java.lang.Object> |
getFromList(java.lang.Class c,
java.lang.String id,
java.lang.Class oc,
java.lang.Class kc,
java.lang.Object k,
boolean uniqueKey,
java.lang.Object recoveryContext,
java.lang.Object host,
java.lang.Object ident)
Core function for persisting lists. this method recovers a set of entry objects from the list can be used for Maps as well as Lists |
|
static PersistenceManager |
getInstance()
get the singleton instance |
|
java.util.Map<java.lang.Object,java.lang.Object> |
getLargeList(java.lang.Class c,
java.lang.String id,
java.lang.Class oc,
java.lang.Class kc,
boolean uniqueKey,
java.lang.Object RecoveryContext,
java.lang.Object host,
java.lang.Object k,
boolean isMap)
Core function for persisting lists. this method recovers the entire list. |
|
java.lang.String |
getListId(java.lang.Class c,
java.lang.String id,
java.lang.Object host)
build table name for list |
|
java.lang.String |
getListId(java.lang.Class c,
java.lang.String id,
java.lang.Object host,
boolean raw)
|
|
java.util.Map<java.lang.String,java.lang.Object> |
getObjectCache()
get the object cache, which caches all recovered objects of current session |
|
java.sql.Statement |
getSimpleStatement()
Create a Statement |
|
java.sql.PreparedStatement |
getStatement(java.lang.String sql)
|
|
java.sql.PreparedStatement |
getStatement(java.lang.String sql,
int args)
Closes recent Statement if required and returns a new one |
|
java.util.Set<java.lang.String> |
getTableCache()
get the table cache, which contains all verified tables of current session |
|
java.util.List<PersistenceManager.LogonInformation> |
getUserSessions()
returns a list of all PersistenceManager.LogonInformation |
|
java.util.List<PersistenceManager.LogonInformation> |
getUserSessions(User user)
returns a list of all PersistenceManager.LogonInformation for given user |
|
void |
initalizeData()
fill database data |
|
boolean |
isOpen()
determines whether the JDBC connection is open |
|
boolean |
isPerformanceMode()
Sets Performance mode. |
|
void |
loadConnections()
Loads connections from PreferenceStorage |
|
void |
logoffUser(SalesPoint sp)
logoff user form given SalesPoint and remove PersistenceManager.LogonInformation record |
|
boolean |
logonUser(User user,
SalesPoint sp)
|
|
void |
markTableAsDirty(java.lang.String tname)
writes a PersistenceManager.ModificationEntry that marks given table as modified |
|
boolean |
open()
tries to open the JDBC connection, with help of the dbConnection |
|
java.lang.Object |
persist(java.lang.Object o)
Persist an object to DataSource |
|
private java.lang.Object |
persist(java.lang.Object o,
boolean commit,
java.util.Map<java.lang.Object,java.lang.Object> stack)
Persist an object to DataSource |
|
protected void |
prepareListTable(java.lang.String tname,
java.lang.Class o,
java.lang.Class k,
boolean uniqueKey)
Prepares a table for a list, if table does not exist |
|
protected void |
prepareTable(java.lang.Class c,
java.lang.Object o)
Create a table for a Class, if table doesn't exist |
|
private void |
printDbg(java.lang.String msg)
print a debug message. if debug is on: to error stream. if off: to log file |
|
private void |
printDbg(java.lang.String msg,
PersistenceManager.PerformanceTimer pt)
print a debug message with taken time. |
|
private void |
printWarn(java.lang.String msg)
print a warning message, if warn is on |
|
void |
propertyChange(java.beans.PropertyChangeEvent evt)
react on property change |
|
boolean |
realOpen()
this method really tries to open the connection |
|
|
recover(java.lang.Class<T> c,
java.lang.Object ident,
java.lang.Object recoveryContext)
Recovers an object identified by ident. |
|
private
|
recoverRow(java.lang.Class<T> c,
java.sql.ResultSet rs,
java.sql.PreparedStatement st,
boolean close,
java.lang.Object recoveryContext,
java.lang.Object ident,
boolean useCache,
PersistenceManager.CachedResultSet qrs,
java.util.Map<java.lang.String,java.lang.Object> stack,
java.util.List<PersistenceManager.DelayedAssignmentInfo> delayed)
Tries to recover a database. |
|
private
|
recoverSingleObject(java.lang.Class<T> c,
java.lang.Object ident,
java.lang.Object recoveryContext,
boolean useCache,
java.util.Map<java.lang.String,java.lang.Object> stack,
java.util.List<PersistenceManager.DelayedAssignmentInfo> delayed)
Recovers a single object, identified by ident |
|
void |
refireCSChanged()
fire the current connection state again |
|
boolean |
registerConnection(DatabaseConnection dbc)
registers an new Database connection |
|
void |
registerShop(Shop shop)
register shop instance |
|
void |
releaseMainLock()
|
|
void |
removeDatasourceChangedListener(DatasourceChangeListener dscl)
Remove a Datasource changed listener |
|
void |
removeDatasourceOnChangeListener(DatasourceOnChangeListener docl)
Remove a datasource on change listener |
|
void |
removeDBCListener(DatabaseConnectionListener dbcl)
Removes a database connection listener |
|
void |
removeListItems(java.lang.Class c,
java.lang.String id,
java.lang.Class oc,
java.lang.Class kc,
java.lang.Object k,
boolean uniqueKey,
java.lang.Object host,
java.lang.Object o,
java.lang.String ctr,
java.lang.Object ctro,
boolean removeItem,
int index)
Core function for persisting lists. this method removes items from a list can be used for Maps as well as Lists |
|
void |
removePersistenceStateListener(PersistenceStateListener psl)
Remove a persistence state listener |
|
private
|
respawn(java.lang.Class<T> c,
java.util.Map<java.lang.String,java.lang.Object> data,
boolean force0ctor,
java.util.List<java.lang.String> exclude)
core method for instantiate an object of specified Class |
|
void |
saveConnections()
Saves Connections to PrferenceStorage |
|
void |
setBroadcastStateChanged(boolean val)
set broadcastStateChanged |
|
void |
setClassFieldMapper(ClassFieldMapper cfm)
sets the current ClassFieldMapper |
|
void |
setClassNameEncoder(ClassNameEncoder cne)
Sets the current ClassNameEncoder |
|
void |
setConsoleLogLevel(java.util.logging.Level level)
Set the log level for Console output |
|
void |
setDatabaseConnection(DatabaseConnection dbc)
set the current database connection |
|
void |
setLogStream(java.io.PrintWriter log)
Set the LogStream for DriverManager |
|
void |
setPerformanceMode(boolean value)
Set performance mode |
|
void |
stopMTW()
Stop the Modification Trigger Worker |
|
private boolean |
testDbGeneratedKeys()
test if driver is able to fetch generated keys |
|
private void |
triggerModificationTableReset()
writes a reset ievent to modification tabel |
|
void |
unpersist(java.lang.Class c,
java.lang.Object ident)
Removes an Object from DataSource |
|
private void |
unpersist(java.lang.String cn,
java.lang.Object ident,
boolean deleteRecord)
Removes an Object from DataSource |
|
void |
unregisterConnection(DatabaseConnection dbc)
removes a database connection |
|
void |
unregisterShop()
unregister shop from datasource |
|
protected java.lang.Object |
upsert(java.lang.Object o,
java.lang.Class c,
java.util.Map<java.lang.Object,java.lang.Object> stack)
insert or update an object in persistent storage |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static long MODIFICATION_TRIGGER_WORKER_INTERVAL
PersistenceManager.ModificationTriggerWorker
checks for changes in database
public static int MODIFICATION_TRIGGER_WORKER_ENTRY_REMOVE_MULTIPLIER
PersistenceManager.ModificationEntry
should be removed from modification table
public static java.lang.String MODIFICATION_TRIGGER_WORKER_THREAD_NAME
private static PersistenceManager _instance
public final java.util.logging.Logger logger
private boolean broadcastStateChanged
PersistenceStateListener
s
private DatabaseConnection dbConnection
private java.util.List<DatabaseConnectionTemplate> connectionTemplates
private java.util.List<DatabaseConnection> connections
private java.util.List<DatabaseConnectionListener> connectionsListener
private final java.util.List<DatasourceChangeListener> dsChangedListener
private final java.util.List<DatasourceOnChangeListener> dsOnChangeListener
private final java.util.List<PersistenceStateListener> psListener
private PersistenceManager.MovingAverage ma
private PersistenceStateListener.ConnectionState lastConnectionState
private boolean initQueryInProgress
checkForDataInit()
is displayed
private PersistenceStateListener.OperationalState lastOperation
private java.lang.Object lastOperationalObject
private java.sql.Connection connection
private java.util.concurrent.locks.Lock lock
public static long lockTimeout
private java.lang.Object changeLock
private java.lang.Object cncLock
private java.sql.Statement _statement
private java.io.PrintWriter dmLog
#debug
is false
private java.util.Map<java.lang.String,java.lang.Object> cache
private java.util.Map<java.lang.String,PersistenceManager.CachedResultSet> qCache
private java.util.Set<java.lang.String> tableCache
private boolean performanceMode
private ClassNameEncoder cnEncoder
private ClassFieldMapper cfMapper
private boolean dbGeneratedKeys
private boolean ignoreOpen
open()
call
private PersistenceManager.ShopInstance localShopInstance
private java.util.Map<java.lang.String,java.util.List<ExternalModificationListener>> externalModificationListeners
private java.util.List<PersistenceManager.LogonInformation> logonInformations
private PersistenceManager.ModificationTriggerWorker modificationTriggerWorker
protected boolean stopModificationTriggerWorker
Constructor Detail |
---|
public PersistenceManager()
Method Detail |
---|
public void setConsoleLogLevel(java.util.logging.Level level)
public static PersistenceManager getInstance()
public void setClassFieldMapper(ClassFieldMapper cfm)
cfm
- public void setClassNameEncoder(ClassNameEncoder cne)
cne
- public void setLogStream(java.io.PrintWriter log)
log
- public boolean isPerformanceMode()
public void setPerformanceMode(boolean value)
value
- true to activatepublic boolean isOpen()
public void close()
private java.lang.Object getChangeLock()
public boolean addDatasourceOnChangeListener(DatasourceOnChangeListener docl)
public void removeDatasourceOnChangeListener(DatasourceOnChangeListener docl)
public boolean addDatasourceChangedListener(DatasourceChangeListener dscl)
public void removeDatasourceChangedListener(DatasourceChangeListener dscl)
public boolean addPersistenceStateListener(PersistenceStateListener psl)
psl
- the listenerpublic void removePersistenceStateListener(PersistenceStateListener psl)
the
- listenerprivate void fireOnDSChange()
public void setBroadcastStateChanged(boolean val)
broadcastStateChanged
val
- private void fireDSChanged()
private void fireLatencyChanged(float latency)
public void refireCSChanged()
private void fireCSChanged(PersistenceStateListener.ConnectionState state)
private void fireOPSChanged(PersistenceStateListener.OperationalState op, java.lang.Object o)
public void loadConnections()
public void aquireMainLock()
public void releaseMainLock()
public void saveConnections()
public java.sql.PreparedStatement getStatement(java.lang.String sql, int args) throws java.sql.SQLException
java.sql.SQLException
public java.sql.PreparedStatement getStatement(java.lang.String sql) throws java.sql.SQLException
java.sql.SQLException
public java.sql.Statement getSimpleStatement() throws java.sql.SQLException
java.sql.SQLException
public java.util.Set<java.lang.String> getTableCache()
public java.util.Map<java.lang.String,java.lang.Object> getObjectCache()
public java.util.List<DatabaseConnectionTemplate> getConnectionTemplates()
public java.util.List<DatabaseConnection> getConnections()
public boolean addDBCListener(DatabaseConnectionListener dbcl)
dbcl
-
public void removeDBCListener(DatabaseConnectionListener dbcl)
dbcl
- public void fireDBCUpdate()
public boolean registerConnection(DatabaseConnection dbc)
dbc
- the connection to be registered
public void unregisterConnection(DatabaseConnection dbc)
dbc
- connection to be removedpublic boolean forceOpen()
public boolean open()
dbConnection
public void checkForDataInit()
public boolean realOpen()
private boolean testDbGeneratedKeys()
public void clearDatabase()
public void initalizeData()
protected java.lang.Object doTypeChecking(java.lang.Object odata, java.lang.Class c)
private <T> T respawn(java.lang.Class<T> c, java.util.Map<java.lang.String,java.lang.Object> data, boolean force0ctor, java.util.List<java.lang.String> exclude)
T
- expected class typec
- Class to instantiatedata
- Object data. used for constructor callsforce0ctor
- force the use of constructor with no parametersexclude
- list will be filled with parameters used for constructor call, after execution
private <T> T recoverRow(java.lang.Class<T> c, java.sql.ResultSet rs, java.sql.PreparedStatement st, boolean close, java.lang.Object recoveryContext, java.lang.Object ident, boolean useCache, PersistenceManager.CachedResultSet qrs, java.util.Map<java.lang.String,java.lang.Object> stack, java.util.List<PersistenceManager.DelayedAssignmentInfo> delayed)
T
- expected class typec
- Class to recoverrs
- ResultSet with cursor set to target recordst
- Statement that belongs to ResultSetclose
- close re & st after callrecoveryContext
- RecoveryContext which will be passed to post-recovering operations
public <T> T recover(java.lang.Class<T> c, java.lang.Object ident, java.lang.Object recoveryContext)
T
- expected class typec
- Class of objectident
- Identification of the objectrecoveryContext
- parameter which will be passed to post-recovering operations
private <T> T recoverSingleObject(java.lang.Class<T> c, java.lang.Object ident, java.lang.Object recoveryContext, boolean useCache, java.util.Map<java.lang.String,java.lang.Object> stack, java.util.List<PersistenceManager.DelayedAssignmentInfo> delayed)
T
- expected class typec
- Class of objectident
- Identification of the objectrecoveryContext
- parameter which will be passed to post-recovering operationsuseCache
- indicates whether the cache should be used
public void stopMTW()
private java.lang.String getCacheKey(java.lang.Class c, java.lang.Object ident)
public java.lang.Object persist(java.lang.Object o)
o
- Object to persist
private java.lang.Object persist(java.lang.Object o, boolean commit, java.util.Map<java.lang.Object,java.lang.Object> stack)
o
- Object to persistcommit
- true if commit should be called on connection
public void unpersist(java.lang.Class c, java.lang.Object ident)
c
- Class of Object to removeident
- objects identificationprivate void unpersist(java.lang.String cn, java.lang.Object ident, boolean deleteRecord)
cn
- Classname as stringident
- objects identificationdeleteRecord
- protected java.lang.Object upsert(java.lang.Object o, java.lang.Class c, java.util.Map<java.lang.Object,java.lang.Object> stack)
o
- object to persistc
- class of object
private void triggerModificationTableReset()
public void markTableAsDirty(java.lang.String tname)
PersistenceManager.ModificationEntry
that marks given table as modified
tname
- affected tablepublic java.util.Map<java.lang.Object,java.lang.Object> getLargeList(java.lang.Class c, java.lang.String id, java.lang.Class oc, java.lang.Class kc, boolean uniqueKey, java.lang.Object RecoveryContext, java.lang.Object host, java.lang.Object k, boolean isMap)
c
- Class of calling Listid
- Lists unique idoc
- Class of entry objectkc
- class of key objectuniqueKey
- guaranty max. one occurrence of a keyRecoveryContext
- host
- host objectident
- isMap
-
public java.util.List<java.lang.Object> getEntireList(java.lang.Class c, java.lang.String id, java.lang.Class oc, java.lang.Class kc, boolean uniqueKey, boolean returnKeys, java.lang.Object RecoveryContext, java.lang.Object host, java.lang.Object k, boolean isMap)
c
- Class of calling Listid
- Lists unique idoc
- Class of entry objectkc
- class of key objectuniqueKey
- guaranty max. one occurrence of a keyreturnKeys
- true, if all keys should be returned. otherwise only entry objects will be returnedRecoveryContext
- host
- host objectident
- isMap
-
public void removeListItems(java.lang.Class c, java.lang.String id, java.lang.Class oc, java.lang.Class kc, java.lang.Object k, boolean uniqueKey, java.lang.Object host, java.lang.Object o, java.lang.String ctr, java.lang.Object ctro, boolean removeItem, int index)
c
- Class of calling listid
- unique id of calling listoc
- entry objects classkc
- key objects classk
- key to remove. if null: list will be cleareduniqueKey
- guaranty unique occurrence of keyhost
- host objectident
- public int countListItems(java.lang.Class c, java.lang.String id, java.lang.Class oc, java.lang.Class kc, java.lang.Object k, boolean uniqueKey, java.lang.Object host, java.lang.Object o)
c
- calling class's typeid
- id of calling classoc
- entry objects classkc
- key objects classk
- keys to count. if null: all keys will be counteduniqueKey
- guaranty single occurrence of keyhost
- host objectident
-
public java.util.List<java.lang.Object> getFromList(java.lang.Class c, java.lang.String id, java.lang.Class oc, java.lang.Class kc, java.lang.Object k, boolean uniqueKey, java.lang.Object recoveryContext, java.lang.Object host, java.lang.Object ident)
c
- lists classid
- lists unique idoc
- objects classkc
- keys classk
- keys to recoveruniqueKey
- recoveryContext
- host
- host objectident
-
public java.lang.Object addToList(java.lang.Class c, java.lang.String id, java.lang.Class oc, java.lang.Class kc, java.lang.Object o, java.lang.Object k, boolean uniqueKey, java.lang.Object host, int index, boolean newIndex)
c
- lists classid
- lists unique idoc
- objects classkc
- keys classo
- object to persistk
- objects key. can be null, is autoKeysuniqueKey
- guaranty single occurrence of keyhost
- host element
public java.lang.String getListId(java.lang.Class c, java.lang.String id, java.lang.Object host)
c
- class of listid
- unique id of list
public java.lang.String getListId(java.lang.Class c, java.lang.String id, java.lang.Object host, boolean raw)
protected void prepareListTable(java.lang.String tname, java.lang.Class o, java.lang.Class k, boolean uniqueKey)
tname
- desired table nameo
- class of entry objectk
- class of key objectuniqueKey
- protected void prepareTable(java.lang.Class c, java.lang.Object o)
c
- objects classo
- object to persistprivate boolean checkTableAlternation(java.lang.String tname, java.util.Map<java.lang.String,java.lang.String> scheme)
tname
- taget tablescheme
- new table scheme
public void setDatabaseConnection(DatabaseConnection dbc)
dbc
- public DatabaseConnection getDatabaseConnection()
public boolean logonUser(User user, SalesPoint sp)
public void logoffUser(SalesPoint sp)
SalesPoint
and remove PersistenceManager.LogonInformation
record
sp
- public java.util.List<PersistenceManager.LogonInformation> getUserSessions(User user)
PersistenceManager.LogonInformation
for given user
user
- user
public java.util.List<PersistenceManager.LogonInformation> getUserSessions()
PersistenceManager.LogonInformation
public void registerShop(Shop shop)
shop
- shop to registerpublic void unregisterShop()
public boolean attachExternalModificationListener(java.lang.String tableid, ExternalModificationListener eml)
ExternalModificationListener
tableid
- table it is interested ineml
- the listener
public void dettachExternalModificationListener(java.lang.String tableid, ExternalModificationListener eml)
ExternalModificationListener
tableid
- table nameeml
- the listenerprivate void printWarn(java.lang.String msg)
msg
- private void printDbg(java.lang.String msg)
msg
- private void printDbg(java.lang.String msg, PersistenceManager.PerformanceTimer pt)
msg
- pt
- timer to evaluatepublic void propertyChange(java.beans.PropertyChangeEvent evt)
propertyChange
in interface java.beans.PropertyChangeListener
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |