public abstract class DbService extends AppHolderBase<DbService>
Destroyable.Util
Modifier and Type | Field and Description |
---|---|
protected static org.osgl.logging.Logger |
_logger
Deprecated.
|
protected org.osgl.logging.Logger |
logger |
Constructor and Description |
---|
DbService(java.lang.String id,
App app)
Construct a
DbService with service ID and the current application |
Modifier and Type | Method and Description |
---|---|
abstract <DAO extends Dao> |
defaultDao(java.lang.Class<?> modelType) |
abstract java.lang.Class<? extends java.lang.annotation.Annotation> |
entityAnnotationType() |
protected static java.lang.Class<?> |
findModelIdTypeByAnnotation(java.lang.Class<?> modelType,
java.lang.Class<? extends java.lang.annotation.Annotation> idAnnotation)
Utility method to find the ID type from Model type.
|
java.lang.String |
id()
Returns the DB ID of the service
|
boolean |
initAsynchronously()
Tells the framework whether this service init asynchronously or synchronously
|
abstract boolean |
initialized()
Report if the db service has been initialized
|
java.util.Set<java.lang.Class> |
modelClasses()
Returns all model classes registered on this datasource
|
abstract <DAO extends Dao> |
newDaoInstance(java.lang.Class<DAO> daoType) |
protected abstract void |
releaseResources() |
app, app, me
addSubResource, destroy, isDestroyed, reload, scope
debug, debug, error, error, fatal, fatal, info, info, isDebugEnabled, isTraceEnabled, trace, trace, warn, warn
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
destroy, isDestroyed, scope
@Deprecated protected static final org.osgl.logging.Logger _logger
This is deprecated, please use logger
instead
protected final org.osgl.logging.Logger logger
public DbService(java.lang.String id, App app)
Construct a DbService
with service ID and the current application
id
- the service IDapp
- the current applicationpublic java.lang.String id()
Returns the DB ID of the service
public java.util.Set<java.lang.Class> modelClasses()
Returns all model classes registered on this datasource
protected abstract void releaseResources()
releaseResources
in class AppHolderBase<DbService>
public boolean initAsynchronously()
Tells the framework whether this service init asynchronously or synchronously
By default a db service is init synchronously
IMPORTANT if the implementation of the db service overwrite this method and return true
, the implementation must raise a DbServiceInitialized
event once the async initialization process is finished
true
if this db service initialization asynchronously or false
otherwisepublic abstract boolean initialized()
Report if the db service has been initialized
true
if the db service is initializedpublic abstract <DAO extends Dao> DAO defaultDao(java.lang.Class<?> modelType)
public abstract <DAO extends Dao> DAO newDaoInstance(java.lang.Class<DAO> daoType)
public abstract java.lang.Class<? extends java.lang.annotation.Annotation> entityAnnotationType()
protected static java.lang.Class<?> findModelIdTypeByAnnotation(java.lang.Class<?> modelType, java.lang.Class<? extends java.lang.annotation.Annotation> idAnnotation)
Utility method to find the ID type from Model type. Could be used by sub class on defaultDao(Class)
method implementation
modelType
- the model typeidAnnotation
- the ID annotationCopyright © 2014–2017 ActFramework. All rights reserved.