|
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.avalon.framework.logger.AbstractLogEnabled
org.ametys.plugins.datainclusion.data.jcr.JcrQueryDao
public class JcrQueryDao
JCR implementation of the Query DAO. This class manages DataSource and Query objects, storing them in the JCR repository.
| Field Summary | |
|---|---|
protected DataSourceFactoryExtensionPoint |
_dataSourceFactoryEP
The Data Source factory extension point. |
protected Repository |
_repository
The JCR repository. |
protected org.ametys.web.repository.site.SiteManager |
_siteManager
The Site manager. |
static String |
DATASOURCES_NODE
Data sources node name. |
static String |
PLUGIN_NODE
Plugin root node name. |
static String |
PLUGINS_NODE
Plugins root node name. |
static String |
PROPERTY_CONF_PREFIX
Configuration properties prefix. |
static String |
PROPERTY_DESCRIPTION
"Description" property name. |
static String |
PROPERTY_NAME
"Name" property name. |
static String |
PROPERTY_TYPE
"Type" property name. |
static String |
QUERIES_NODE
Queries node name. |
static String |
QUERY_PROPERTY_DATASOURCE
Query "dataSource" property name. |
static String |
QUERY_PROPERTY_PARAMETERS
Query "parameters" property name. |
static String |
QUERY_PROPERTY_QUERYSTRING
Query "query string" property name. |
static String |
QUERY_PROPERTY_RESULTTYPE
Query "resultType" property name. |
static String |
ROOT_REPO
JCR relative path to root node. |
| Fields inherited from interface org.ametys.plugins.datainclusion.data.QueryDao |
|---|
ROLE |
| Constructor Summary | |
|---|---|
JcrQueryDao()
|
|
| Method Summary | |
|---|---|
protected DataSource |
_extractDataSource(Node node)
Create a data source from a node. |
protected Query |
_extractQuery(Node node)
Create a data source from a node. |
protected void |
_fillDataSourceNode(DataSource dataSource,
Node node)
Store the data source properties into the JCR node. |
protected void |
_fillQueryNode(Query query,
Node node)
Store the query properties into the JCR node. |
protected void |
_fillQueryNode(Query query,
Node node,
Node dataSourceNode)
Store the query properties into the JCR node. |
protected void |
_fillQueryNode(Query query,
Node node,
String siteName,
String dataSourceId)
Store the query properties into the JCR node. |
protected Map<String,String> |
_getAdditionalConf(Node node)
Get additional configuration from properties. |
protected Node |
_getDataSourcesNode(String siteName)
Get the data sources root node. |
protected DataSource |
_getLinkedDataSource(Node queryNode)
Get a query's data source from its reference property. |
protected Collection<String> |
_getMultipleProperty(Node node,
String propertyName)
Get the values of a string array property. |
protected String |
_getNotExistingNodeName(Node container,
String baseName)
Get a name for a node which doesn't already exist in this node. |
protected Node |
_getPluginNode(String siteName)
Get the plugin root node in a site storage space. |
protected Node |
_getQueriesNode(String siteName)
Get the queries root node. |
protected Query.ResultType |
_getResultType(Node node,
Query.ResultType defaultValue)
Get a single property value. |
protected String |
_getSingleProperty(Node node,
String propertyName,
String defaultValue)
Get a single property value. |
String |
addDataSource(String siteName,
DataSource dataSource)
Add a data source and return its id. |
String |
addQuery(String siteName,
Query query,
String dataSourceId)
Add a query and set its id. |
DataSource |
getDataSource(String siteName,
String id)
Get a data source from its id. |
Map<String,Query> |
getDataSourceQueries(String siteName,
String dataSourceId)
Get all the queries of a site. |
Map<String,DataSource> |
getDataSources(String siteName)
Get all the data sources of a site. |
Map<String,DataSource> |
getDataSources(String siteName,
String type)
Get all the data sources of a site and of the specified type. |
Map<String,Query> |
getQueries(String siteName)
Get all the queries of a site. |
Map<String,Query> |
getQueries(String siteName,
String type)
Get all the queries of a site. |
Query |
getQuery(String siteName,
String id)
Get a query from its id. |
void |
removeDataSource(String siteName,
String id)
Remove a data source. |
void |
removeQuery(String siteName,
String id)
Remove a query. |
void |
service(org.apache.avalon.framework.service.ServiceManager serviceManager)
|
void |
updateDataSource(String siteName,
DataSource dataSource)
Update a data source. |
void |
updateQuery(String siteName,
Query query,
String dataSourceId)
Update a query. |
| Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled |
|---|
enableLogging, getLogger, setupLogger, setupLogger, setupLogger |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String ROOT_REPO
public static final String PLUGINS_NODE
public static final String PLUGIN_NODE
public static final String DATASOURCES_NODE
public static final String QUERIES_NODE
public static final String PROPERTY_NAME
public static final String PROPERTY_DESCRIPTION
public static final String PROPERTY_TYPE
public static final String PROPERTY_CONF_PREFIX
public static final String QUERY_PROPERTY_QUERYSTRING
public static final String QUERY_PROPERTY_PARAMETERS
public static final String QUERY_PROPERTY_RESULTTYPE
public static final String QUERY_PROPERTY_DATASOURCE
protected DataSourceFactoryExtensionPoint _dataSourceFactoryEP
protected Repository _repository
protected org.ametys.web.repository.site.SiteManager _siteManager
| Constructor Detail |
|---|
public JcrQueryDao()
| Method Detail |
|---|
public void service(org.apache.avalon.framework.service.ServiceManager serviceManager)
throws org.apache.avalon.framework.service.ServiceException
service in interface org.apache.avalon.framework.service.Serviceableorg.apache.avalon.framework.service.ServiceException
public Map<String,DataSource> getDataSources(String siteName)
throws DataInclusionException
QueryDao
getDataSources in interface QueryDaositeName - the site name.
DataInclusionException
public Map<String,DataSource> getDataSources(String siteName,
String type)
throws DataInclusionException
QueryDao
getDataSources in interface QueryDaositeName - the site name.type - the type id.
DataInclusionException
public DataSource getDataSource(String siteName,
String id)
throws DataInclusionException
QueryDao
getDataSource in interface QueryDaositeName - the site name.id - the data source id.
DataInclusionException
public String addDataSource(String siteName,
DataSource dataSource)
throws DataInclusionException
QueryDao
addDataSource in interface QueryDaositeName - the site namedataSource - the data source to add. The id member doesn't need to be specified.
DataInclusionException
public void updateDataSource(String siteName,
DataSource dataSource)
throws DataInclusionException
QueryDao
updateDataSource in interface QueryDaositeName - the site namedataSource - the data source to update.
DataInclusionException
public void removeDataSource(String siteName,
String id)
throws DataInclusionException
QueryDao
removeDataSource in interface QueryDaositeName - the site nameid - the data source id.
DataInclusionException
public Map<String,Query> getQueries(String siteName)
throws DataInclusionException
QueryDao
getQueries in interface QueryDaositeName - the site name.
DataInclusionException
public Map<String,Query> getQueries(String siteName,
String type)
throws DataInclusionException
QueryDao
getQueries in interface QueryDaositeName - the site name.
DataInclusionException
public Map<String,Query> getDataSourceQueries(String siteName,
String dataSourceId)
throws DataInclusionException
QueryDao
getDataSourceQueries in interface QueryDaositeName - the site name.
DataInclusionException
public Query getQuery(String siteName,
String id)
throws DataInclusionException
QueryDao
getQuery in interface QueryDaositeName - the site name.id - the query id.
DataInclusionException
public String addQuery(String siteName,
Query query,
String dataSourceId)
throws DataInclusionException
QueryDao
addQuery in interface QueryDaositeName - the site namequery - the query to add. The id member doesn't need to be specified.
DataInclusionException
public void updateQuery(String siteName,
Query query,
String dataSourceId)
throws DataInclusionException
QueryDao
updateQuery in interface QueryDaositeName - the site namequery - the query to update.
DataInclusionException
public void removeQuery(String siteName,
String id)
throws DataInclusionException
QueryDao
removeQuery in interface QueryDaositeName - the site nameid - the query id.
DataInclusionException
protected DataSource _extractDataSource(Node node)
throws RepositoryException,
DataInclusionException
node - the data source node.
RepositoryException
DataInclusionException
protected Query _extractQuery(Node node)
throws RepositoryException,
DataInclusionException
node - the data source node.
RepositoryException
DataInclusionException
protected String _getSingleProperty(Node node,
String propertyName,
String defaultValue)
throws RepositoryException
node - the JCR node.propertyName - the name of the property to get.defaultValue - the default value if the property does not exist.
RepositoryException - if a repository error occurs.
protected Query.ResultType _getResultType(Node node,
Query.ResultType defaultValue)
throws RepositoryException
node - defaultValue -
RepositoryException
protected Collection<String> _getMultipleProperty(Node node,
String propertyName)
throws RepositoryException
node - the node.propertyName - the name of the property to get.
RepositoryException - if a repository error occurs.
protected Map<String,String> _getAdditionalConf(Node node)
throws RepositoryException
node -
RepositoryException
protected DataSource _getLinkedDataSource(Node queryNode)
throws RepositoryException,
DataInclusionException
queryNode - the query Node.
RepositoryException
DataInclusionException
protected void _fillDataSourceNode(DataSource dataSource,
Node node)
throws RepositoryException
dataSource - node -
RepositoryException
protected void _fillQueryNode(Query query,
Node node)
throws RepositoryException,
DataInclusionException
query - node -
RepositoryException
DataInclusionException
protected void _fillQueryNode(Query query,
Node node,
String siteName,
String dataSourceId)
throws RepositoryException,
DataInclusionException
query - node - siteName - dataSourceId -
RepositoryException
DataInclusionException
protected void _fillQueryNode(Query query,
Node node,
Node dataSourceNode)
throws RepositoryException
query - node - dataSourceNode -
RepositoryException
protected String _getNotExistingNodeName(Node container,
String baseName)
throws RepositoryException
container - the container node.baseName - the base wanted node name.
RepositoryException
protected Node _getPluginNode(String siteName)
throws RepositoryException
siteName - the site name.
RepositoryException
protected Node _getDataSourcesNode(String siteName)
throws RepositoryException
siteName -
RepositoryException
protected Node _getQueriesNode(String siteName)
throws RepositoryException
siteName -
RepositoryException
|
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||