|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.datastore.core.AbstractDatastore
public abstract class AbstractDatastore
Abstract Datastore implementation that deals with binding the Session to thread locale upon creation.
Field Summary | |
---|---|
protected Map<String,String> |
connectionDetails
|
protected List<EntityInterceptor> |
interceptors
|
protected MappingContext |
mappingContext
|
Constructor Summary | |
---|---|
AbstractDatastore()
|
|
AbstractDatastore(MappingContext mappingContext)
|
|
AbstractDatastore(MappingContext mappingContext,
Map<String,String> connectionDetails)
|
Method Summary | |
---|---|
void |
addEntityInterceptor(EntityInterceptor interceptor)
Adds an EntityInterceptor |
static void |
bindSession(Session session)
Binds the session to the current thread local |
static void |
clearCurrentConnection()
Clears the thread bound session, should be called by the Session.disconnect() |
Session |
connect()
Connects to the datastore with the default connection details, normally provided via the datastore implementations constructor |
Session |
connect(Map<String,String> connectionDetails)
|
protected abstract Session |
createSession(Map<String,String> connectionDetails)
Creates the native session |
Session |
getCurrentSession()
Obtains the current session (if any) |
MappingContext |
getMappingContext()
Obtains the MappingContext object |
static Session |
retrieveSession()
Static way to retrieve the session |
void |
setConnectionDetails(Map<String,String> connectionDetails)
|
void |
setEntityInterceptors(List<EntityInterceptor> interceptors)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected MappingContext mappingContext
protected Map<String,String> connectionDetails
protected List<EntityInterceptor> interceptors
Constructor Detail |
---|
public AbstractDatastore(MappingContext mappingContext)
public AbstractDatastore(MappingContext mappingContext, Map<String,String> connectionDetails)
public AbstractDatastore()
Method Detail |
---|
public void setConnectionDetails(Map<String,String> connectionDetails)
public Session connect()
Datastore
connect
in interface Datastore
public void addEntityInterceptor(EntityInterceptor interceptor)
EntityInterceptorAware
EntityInterceptor
addEntityInterceptor
in interface EntityInterceptorAware
interceptor
- The interceptor to addpublic void setEntityInterceptors(List<EntityInterceptor> interceptors)
setEntityInterceptors
in interface EntityInterceptorAware
interceptors
- A list of entity interceptorspublic final Session connect(Map<String,String> connectionDetails)
protected abstract Session createSession(Map<String,String> connectionDetails)
connectionDetails
- The session details
public final Session getCurrentSession() throws ConnectionNotFoundException
Datastore
getCurrentSession
in interface Datastore
ConnectionNotFoundException
- Thrown if the Datastore.connect()
method has not yet been calledpublic static Session retrieveSession() throws ConnectionNotFoundException
ConnectionNotFoundException
- If no session has been createdpublic static void bindSession(Session session)
session
- The sessionpublic MappingContext getMappingContext()
Datastore
getMappingContext
in interface Datastore
public static void clearCurrentConnection()
Session.disconnect()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |