|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Datasource
Interface for Datasources. Datasources can be configured to
store/retrieve data in a generalized way.
Instances of this interface
represent connections to the underlying storage system and are therefore not
threadsafe.
This API might still change, and is intended and maintened for usage
only. Don't implement your own datasources for now.
When the time
comes, do not implement this interface directly, but extend the abstract
class AbstractDatasource
instead.
Nested Class Summary | |
---|---|
static class |
Datasource.Sorting
Inner class for definition of sorting |
Field Summary | |
---|---|
static int |
SORTORDER_ASC
Constant for the sortorder "ASCENDING" |
static int |
SORTORDER_DESC
Constant for the sortorder "DESCENDING" |
static int |
SORTORDER_NONE
Constant for the sortorder "NONE" (ie. |
Method Summary | |
---|---|
java.lang.Object |
clone()
Clone the datasource (that means to create a copy that would work excactly like this datasource) |
DatasourceFilter |
createDatasourceFilter(Expression expression)
Create a datasource filter for the given expression. |
int |
getCount()
Deprecated. use getCount(DatasourceFilter) instead. |
int |
getCount(DatasourceFilter filter)
Get the number of objects in the datasource that match the given filter |
int |
getCount(DatasourceFilter filter,
java.util.Map<java.lang.String,java.lang.Object> specificParameters)
Get the number of objects in the datasource that match the given filter |
int |
getCount2()
Deprecated. use getCount(DatasourceFilter) instead. |
HandlePool |
getHandlePool()
Get the handlepool used by this Datasource. |
java.lang.String |
getId()
Returns the unique identifier for this Datasource. |
java.util.Collection |
getResult()
Deprecated. Use getResult(DatasourceFilter, String[]) methods with DatasourceFilter instead. |
java.util.Collection<Resolvable> |
getResult(DatasourceFilter filter,
java.lang.String[] prefillAttributes)
Get the resolvables from the datasource that match the given datasource filter (unsorted). |
java.util.Collection<Resolvable> |
getResult(DatasourceFilter filter,
java.lang.String[] prefillAttributes,
int start,
int count,
Datasource.Sorting[] sortedColumns)
Get the resolvables from the datasource that match the given datasource filter. |
java.util.Collection<Resolvable> |
getResult(DatasourceFilter filter,
java.lang.String[] prefillAttributes,
int start,
int count,
Datasource.Sorting[] sortedColumns,
java.util.Map<java.lang.String,java.lang.Object> specificParameters)
Get the resolvables from the datasource that match the given datasource filter. |
java.util.Collection |
getResult(int start,
int count,
java.lang.String sortBy,
int sortOrder)
Deprecated. Use getResult(DatasourceFilter, String[]) methods with DatasourceFilter instead. |
java.util.Collection |
getResult(int start,
int count,
java.lang.String sortBy,
int sortOrder,
java.util.Map specificParameters)
Deprecated. use getResult(DatasourceFilter, String[]) methods with DatasourceFilter instead. |
java.util.Collection |
getResult(java.lang.String sortBy,
int sortOrder)
Deprecated. Use getResult(DatasourceFilter, String[]) methods with DatasourceFilter instead. |
boolean |
hasChanged()
Deprecated. deprecated since a datasource should be stateless, use hasChanged(long) instead. |
boolean |
hasChanged(long timestamp)
Returns true when the data in the underlying storage layer might have changed since the given timestamp. |
boolean |
isValidAttribute(java.lang.String attributeName)
Verifies that the given attribute name is valid and exists in the datasource. |
void |
setAttributeNames(java.lang.String[] names)
Deprecated. Prefill Attributes can be given in getResult(DatasourceFilter, String[]) methods. |
void |
setRuleTree(RuleTree ruleTree)
Deprecated. RuleTree is deprecated, use Expression and DatasourceFilter instead. |
Field Detail |
---|
static final int SORTORDER_NONE
static final int SORTORDER_ASC
static final int SORTORDER_DESC
Method Detail |
---|
void setRuleTree(RuleTree ruleTree)
Expression
and DatasourceFilter
instead.
ruleTree
- filter RuleTreegetResult(DatasourceFilter, String[])
,
createDatasourceFilter(Expression)
void setAttributeNames(java.lang.String[] names)
getResult(DatasourceFilter, String[])
methods.
names
- array of attribute namesjava.util.Collection getResult(int start, int count, java.lang.String sortBy, int sortOrder) throws DatasourceNotAvailableException
getResult(DatasourceFilter, String[])
methods with DatasourceFilter instead.
start
- index of the first object to get after the filter and sorting have been
applied (counting starts with 0)count
- maximum number of objects to return, -1 for no limitsortBy
- property to sortby, null for unsorted result. May also
contain a comma separated list of attribute namessortOrder
- sort order, use one of SORTORDER_ASC
,
SORTORDER_DESC
SORTORDER_NONE
DatasourceNotAvailableException
java.util.Collection getResult() throws DatasourceNotAvailableException
getResult(DatasourceFilter, String[])
methods with DatasourceFilter instead.
DatasourceNotAvailableException
java.util.Collection getResult(java.lang.String sortBy, int sortOrder) throws DatasourceNotAvailableException
getResult(DatasourceFilter, String[])
methods with DatasourceFilter instead.
sortBy
- property to sortby, null for unsorted result. May also
contain a comma separated list of attribute namessortOrder
- sort order, use one of SORTORDER_ASC
,
SORTORDER_DESC
SORTORDER_NONE
DatasourceNotAvailableException
java.util.Collection getResult(int start, int count, java.lang.String sortBy, int sortOrder, java.util.Map specificParameters) throws DatasourceNotAvailableException
getResult(DatasourceFilter, String[])
methods with DatasourceFilter instead.
start
- index of the first object to get after the filter and sorting have been
applied (counting starts with 0)count
- maximum number of objects to return, -1 for no limitsortBy
- property to sortby, null for unsorted result. May also
contain a comma separated list of attribute namessortOrder
- sort order, use one of SORTORDER_ASC
,
SORTORDER_DESC
SORTORDER_NONE
specificParameters
- map of specific parameters, which will be
interpreted by some specific Datasources, may be null or empty (no
specific parameters)
DatasourceNotAvailableException
int getCount()
getCount(DatasourceFilter)
instead.
int getCount2() throws DatasourceNotAvailableException
getCount(DatasourceFilter)
instead.
DatasourceNotAvailableException
HandlePool getHandlePool()
java.lang.Object clone() throws java.lang.CloneNotSupportedException
java.lang.CloneNotSupportedException
boolean hasChanged()
hasChanged(long)
instead.
getResult()
(or any of it's
variants). The specific implementations can simply return true when a
change cannot be determined other than refetching the data or can do any
specific checks for modified data.
boolean hasChanged(long timestamp)
timestamp
- timestamp to check if data has propably changed - timestamp is a java timestamp - ie. milliseconds since 1970 like System.currentTimeMillis()
DatasourceFilter createDatasourceFilter(Expression expression) throws ExpressionParserException
expression
- expression to transform into a datasource filter
ExpressionParserException
- When the DatasourceFilter can't be createdjava.util.Collection<Resolvable> getResult(DatasourceFilter filter, java.lang.String[] prefillAttributes) throws DatasourceException
filter
- datasource filterprefillAttributes
- array of attribute names to prefill (null or empty for no prefilling)
DatasourceException
createDatasourceFilter(Expression)
java.util.Collection<Resolvable> getResult(DatasourceFilter filter, java.lang.String[] prefillAttributes, int start, int count, Datasource.Sorting[] sortedColumns) throws DatasourceException
filter
- datasource filterprefillAttributes
- array of attribute names to prefill (null or empty for no prefilling)start
- index of the first object to returncount
- maximum number of objects to return (-1 for all objects).sortedColumns
- possible sorting (may be null for "no sorting")
DatasourceException
createDatasourceFilter(Expression)
java.util.Collection<Resolvable> getResult(DatasourceFilter filter, java.lang.String[] prefillAttributes, int start, int count, Datasource.Sorting[] sortedColumns, java.util.Map<java.lang.String,java.lang.Object> specificParameters) throws DatasourceException
filter
- datasource filterprefillAttributes
- array of attribute names to prefill (null or empty for no prefilling)start
- index of the first object to returncount
- maximum number of objects to return (-1 for all objects).sortedColumns
- possible sorting (may be null for "no sorting")specificParameters
- map of specific parameters, which will be
interpreted by some specific Datasources, may be null or empty (no
specific parameters)
DatasourceException
createDatasourceFilter(Expression)
int getCount(DatasourceFilter filter) throws DatasourceException
filter
- datasource filter
DatasourceException
createDatasourceFilter(Expression)
int getCount(DatasourceFilter filter, java.util.Map<java.lang.String,java.lang.Object> specificParameters) throws DatasourceException
filter
- datasource filterspecificParameters
- map of specific parameters, which will be
interpreted by some specific Datasources, may be null or empty (no
specific parameters)
DatasourceException
createDatasourceFilter(Expression)
java.lang.String getId()
boolean isValidAttribute(java.lang.String attributeName) throws DatasourceException
attributeName
- the attribute name to check
DatasourceException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |