Package org.ametys.core.datasource
Class AbstractMyBatisDAO
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.core.datasource.AbstractMyBatisDAO
-
- All Implemented Interfaces:
LogEnabled,PluginAware,Component,Configurable,Contextualizable,Serviceable
- Direct Known Subclasses:
ApogeeDAO,JdbcProfileAssignmentStorage,ResourceAccessComponent,ResourceAccessComponent,ResourceStatisticsComponent,RightProfilesDAO,SQLCollectionDAO,SQLUserSearchDAO,SubscribersDAO,SurveyAnswerDao,UserSignupManager
public abstract class AbstractMyBatisDAO extends AbstractLogEnabled implements Contextualizable, Serviceable, PluginAware, Configurable, Component
Interface to be implemented by any object that wishes to have access to one or multiple SqlMapClient.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) classAbstractMyBatisDAO.SqlMap
-
Field Summary
Fields Modifier and Type Field Description private String_contextPathprivate boolean_dataSourceConfigurationParameterprivate String_dataSourceIdprivate String_dataSourceParameterprotected ServiceManager_managerThe service managerprivate String_pluginNameprivate org.apache.ibatis.session.SqlSessionFactory_sessionFactoryprivate SQLDataSourceManager_sqlDataSourceManagerprivate Set<AbstractMyBatisDAO.SqlMap>_sqlMaps
-
Constructor Summary
Constructors Constructor Description AbstractMyBatisDAO()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void_configureDatasource(Configuration configuration)Configure datasourceprotected String_getDataSourceId()Get datasource idprotected org.apache.ibatis.session.Configuration_getMyBatisConfiguration(org.apache.ibatis.mapping.Environment env)Get the mybatis configurationprivate void_initializeXMLMapper(InputStream mapperStream, String mapperLocation, org.apache.ibatis.session.Configuration config)voidconfigure(Configuration configuration)voidcontextualize(Context context)protected org.apache.ibatis.session.SqlSessiongetSession()Returns the myBatisSqlSession.protected org.apache.ibatis.session.SqlSessiongetSession(boolean autoCommit)Returns the myBatisSqlSession.private SQLDataSourceManagergetSQLDataSourceManager()protected voidreload()Reload configuration and object for mybatisvoidservice(ServiceManager manager)voidsetPluginInfo(String pluginName, String featureName, String id)Sets the plugin info relative to the current component.
Note : The feature name may be null if the targeted component in declared at plugin level.-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
-
-
-
Field Detail
-
_manager
protected ServiceManager _manager
The service manager
-
_sessionFactory
private org.apache.ibatis.session.SqlSessionFactory _sessionFactory
-
_sqlDataSourceManager
private SQLDataSourceManager _sqlDataSourceManager
-
_contextPath
private String _contextPath
-
_pluginName
private String _pluginName
-
_dataSourceId
private String _dataSourceId
-
_dataSourceParameter
private String _dataSourceParameter
-
_dataSourceConfigurationParameter
private boolean _dataSourceConfigurationParameter
-
_sqlMaps
private Set<AbstractMyBatisDAO.SqlMap> _sqlMaps
-
-
Constructor Detail
-
AbstractMyBatisDAO
public AbstractMyBatisDAO()
-
-
Method Detail
-
contextualize
public void contextualize(Context context) throws ContextException
- Specified by:
contextualizein interfaceContextualizable- Throws:
ContextException
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
servicein interfaceServiceable- Throws:
ServiceException
-
getSQLDataSourceManager
private SQLDataSourceManager getSQLDataSourceManager()
-
setPluginInfo
public void setPluginInfo(String pluginName, String featureName, String id)
Description copied from interface:PluginAwareSets the plugin info relative to the current component.
Note : The feature name may be null if the targeted component in declared at plugin level.- Specified by:
setPluginInfoin interfacePluginAware- Parameters:
pluginName- Unique identifier for the plugin hosting the extensionfeatureName- Unique feature identifier (unique for a given pluginName)id- Unique identifier of this component
-
configure
public void configure(Configuration configuration) throws ConfigurationException
- Specified by:
configurein interfaceConfigurable- Throws:
ConfigurationException
-
_configureDatasource
protected void _configureDatasource(Configuration configuration) throws ConfigurationException
Configure datasource- Parameters:
configuration- the configuration- Throws:
ConfigurationException- if an error occurred
-
reload
protected void reload()
Reload configuration and object for mybatis
-
_initializeXMLMapper
private void _initializeXMLMapper(InputStream mapperStream, String mapperLocation, org.apache.ibatis.session.Configuration config)
-
_getMyBatisConfiguration
protected org.apache.ibatis.session.Configuration _getMyBatisConfiguration(org.apache.ibatis.mapping.Environment env)
Get the mybatis configuration- Parameters:
env- the mybatis environnement- Returns:
- the mybatis configuration
-
_getDataSourceId
protected String _getDataSourceId()
Get datasource id- Returns:
- the datasource id
-
getSession
protected org.apache.ibatis.session.SqlSession getSession()
Returns the myBatisSqlSession.- Returns:
- the myBatis
SqlSession.
-
getSession
protected org.apache.ibatis.session.SqlSession getSession(boolean autoCommit)
Returns the myBatisSqlSession.- Parameters:
autoCommit- if the underlying Connection should auto commit statements.- Returns:
- the myBatis
SqlSession.
-
-