Package org.bedework.synch.db
Class SynchDb
- java.lang.Object
-
- org.bedework.synch.db.SynchDb
-
- All Implemented Interfaces:
Serializable,org.bedework.util.logging.Logged
public class SynchDb extends Object implements org.bedework.util.logging.Logged, Serializable
This class manages the Exchange synch database.- Author:
- Mike Douglass
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected TimestampobjTimestampWhen we were created for debuggingprotected booleanopenprotected org.bedework.util.hibernate.HibSessionsessCurrent hibernate session - exists only across one user interaction
-
Constructor Summary
Constructors Constructor Description SynchDb(SynchConfig config)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(Subscription sub)Add the subscription.protected voidbeginTransaction()protected voidcheckOpen()voidclose()protected voidcloseSession()voiddelete(Subscription sub)Delete the subscription.protected voidendTransaction()Subscriptionfind(Subscription sub)Find any subscription that matches this one.Subscriptionget(String id)The synch engine generates a unique subscription id for each subscription.List<Subscription>getAll()org.bedework.util.logging.BwLoggergetLogger()booleanisOpen()booleanopen()protected voidopenSession()protected voidrollbackTransaction()voidupdate(Subscription sub)Update the persisted state of the subscription.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.bedework.util.logging.Logged
audit, debug, debug, enableAuditLogger, enableErrorLogger, enableMetricsLogger, error, error, error, getLogLevel, info, isAuditLoggerEnabled, isErrorLoggerEnabled, isMetricsDebugEnabled, isMetricsLoggerEnabled, metrics, setLoggerClass, setLoggerClass, trace, trace, warn
-
-
-
-
Field Detail
-
open
protected boolean open
-
objTimestamp
protected Timestamp objTimestamp
When we were created for debugging
-
sess
protected org.bedework.util.hibernate.HibSession sess
Current hibernate session - exists only across one user interaction
-
-
Constructor Detail
-
SynchDb
public SynchDb(SynchConfig config)
- Parameters:
config- the configuration
-
-
Method Detail
-
open
public boolean open() throws SynchException- Returns:
- true if we had to open it. False if already open
- Throws:
SynchException
-
isOpen
public boolean isOpen()
- Returns:
- true for open
-
close
public void close() throws SynchException- Throws:
SynchException
-
getAll
public List<Subscription> getAll() throws SynchException
- Returns:
- list of subscriptions
- Throws:
SynchException
-
get
public Subscription get(String id) throws SynchException
The synch engine generates a unique subscription id for each subscription. This is used as a key for each subscription.- Parameters:
id- - unique id- Returns:
- a matching subscription or null
- Throws:
SynchException
-
find
public Subscription find(Subscription sub) throws SynchException
Find any subscription that matches this one. There can only be one with the same endpoints- Parameters:
sub- subscription- Returns:
- matching subscriptions
- Throws:
SynchException
-
add
public void add(Subscription sub) throws SynchException
Add the subscription.- Parameters:
sub- subscription- Throws:
SynchException
-
update
public void update(Subscription sub) throws SynchException
Update the persisted state of the subscription.- Parameters:
sub- subscription- Throws:
SynchException
-
delete
public void delete(Subscription sub) throws SynchException
Delete the subscription.- Parameters:
sub- subscription- Throws:
SynchException
-
checkOpen
protected void checkOpen() throws SynchException- Throws:
SynchException
-
openSession
protected void openSession() throws SynchException- Throws:
SynchException
-
closeSession
protected void closeSession() throws SynchException- Throws:
SynchException
-
beginTransaction
protected void beginTransaction() throws SynchException- Throws:
SynchException
-
endTransaction
protected void endTransaction() throws SynchException- Throws:
SynchException
-
rollbackTransaction
protected void rollbackTransaction() throws SynchException- Throws:
SynchException
-
getLogger
public org.bedework.util.logging.BwLogger getLogger()
- Specified by:
getLoggerin interfaceorg.bedework.util.logging.Logged
-
-