|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface Yard
The Yard represents a local cache for Representations of the Entities
and Symbols managed by a referenced site.
Referenced Sites need to provide the configuration if there representations
should be cached locally. This is done by using one of the defined CacheStrategy.
The Idea is not to have one big Yard that caches all the representations, but
to provide the possibility to use different caches. This means, that each
Site can have its own Yard instance. However
several Sites might also use the same Yard.
The YardManager is an singleton services that manages the different
Yard instances and provides an central point of access for the Entityhub
and the SiteManager.
This should also allow for implementing Yards that are based on
Symbol
and EntityMapping information. This Yard is currently referenced as
Entityhub-Yard. Do we need also a special API for this Yard?
One could still provide a "default" implementation that implements this
interface based on a Component that provides the normal Yard service.
Side note: The name yard was chosen as name because in farming "yard" refers to a piece of enclosed land for farm animals or other agricultural purpose and the storage component of the entityhub does the same thing for Entities.
| Field Summary | |
|---|---|
static String |
DESCRIPTION
|
static String |
ID
|
static String |
NAME
|
| Method Summary | |
|---|---|
Representation |
create()
Creates a new empty representation and stores it in the Yard. |
Representation |
create(String id)
Creates a new representation for the given id |
QueryResultList<Representation> |
find(FieldQuery query)
Getter for a view onto the Representations selected by the Query. |
QueryResultList<String> |
findReferences(FieldQuery query)
Finds all representations base on the parse query. |
QueryResultList<Representation> |
findRepresentation(FieldQuery query)
Searches for all the Representation fulfilling the constraints of the query and returns the (whole) representation as stored in the Yard. |
String |
getDescription()
|
String |
getId()
Getter for the unique ID of the Yard |
String |
getName()
|
FieldQueryFactory |
getQueryFactory()
Getter for the FieldQueryFactory used by this Yard |
Representation |
getRepresentation(String id)
Getter for the representation based on the id. |
ValueFactory |
getValueFactory()
Getter for the ValueFactory instance used by this Yard to create
Representation, Reference and Text instances. |
boolean |
isRepresentation(String id)
checks if a representation with the given id is present in the Yard |
void |
remove(Iterable<String> ids)
Removes all the Representation of the parsed ids. |
void |
remove(String id)
Removes the Representation with the given id |
void |
removeAll()
Removes all the Representation managed by this Yard |
Iterable<Representation> |
store(Iterable<Representation> representations)
Stores all the parsed representation in a single chunk in the Yard. |
Representation |
store(Representation representation)
Stores the representation in the Yard. |
Iterable<Representation> |
update(Iterable<Representation> representations)
Updates the store with the new state of the parsed representations. |
Representation |
update(Representation representation)
Updates the store with the new state of the parsed representation |
| Field Detail |
|---|
static final String ID
static final String NAME
static final String DESCRIPTION
| Method Detail |
|---|
String getId()
String getName()
String getDescription()
Representation create()
throws YardException
YardException - On any error while creating or storing the
representation
Representation create(String id)
throws IllegalArgumentException,
YardException
id - the id for the new representation or null to
indicate that the Yard should assign an id.
IllegalArgumentException - if the parsed id is not valid (especially
if an empty string is parsed as ID) or there
exists already a representation with the parsed id.
YardException - On any error while creating or storing the
representation
Representation store(Representation representation)
throws NullPointerException,
YardException
representation - the representation
NullPointerException - if null is parsed as argument.
YardException - On any error related to the Yard
Iterable<Representation> store(Iterable<Representation> representations)
throws NullPointerException,
YardException
null values are ignored and added as null in
the returned Iterable.
Otherwise same as store(Representation).
representations - all the representations to store. null
values are ignored and MUST NOT throw any exceptions. Parsing an Iterable
without any element will have none effect but also MUST NOT throw an exception.
NullPointerException - if null is parsed as Iterable,
but NOT if the parsed Iterable does not contain any Elements or the
null value.
YardException - On any error related to the Yard
void remove(String id)
throws IllegalArgumentException,
YardException
Representation with the given id
id - the id
IllegalArgumentException - if the parsed ID is null or not valid
formatted
YardException - On any error related to the Yard
void remove(Iterable<String> ids)
throws IllegalArgumentException,
YardException
Representation of the parsed ids. null
values are ignored.
ids - the iterable over the ids to remove
IllegalArgumentException - if null is parsed as iterable
YardException - On any error related to the Yard
void removeAll()
throws YardException
Representation managed by this Yard
YardException - On any error related to the Yard
boolean isRepresentation(String id)
throws YardException,
IllegalArgumentException
id - the id. Calls with null are ignored
true if a representation with the id is present in
the Yard. Otherwise false.
NullPointerException - if null is parsed as ID
IllegalArgumentException - if the parsed ID is not valid
formatted (especially if an empty String is parsed as ID
YardException - On any error related to the Yard
Representation getRepresentation(String id)
throws YardException,
IllegalArgumentException
id = null should return null.
id - the id.
null if
no representation with this id is present in the Yard
NullPointerException - if null is parsed as id
IllegalArgumentException - if the parsed ID is not valid formatted
YardException - On any error related to the Yard
Representation update(Representation representation)
throws YardException,
IllegalArgumentException
representation - the representation
NullPointerException - If null is parsed as representation
IllegalArgumentException - if the parsed representation is not present
in the Yard (and can not be updated therefore). TODO: evaluate if this should
really throw only a RuntimeException.
YardException - On any error related to the Yard
Iterable<Representation> update(Iterable<Representation> representations)
throws YardException,
IllegalArgumentException
null values are ignored and added as null in
the returned Iterable. Otherwise same as update(Representation).
representations - the representations to update
YardException - On any error related to the Yard
IllegalArgumentException - if null is parsed as Iterable
QueryResultList<String> findReferences(FieldQuery query)
throws YardException,
IllegalArgumentException
query - The query
IllegalArgumentException - if null is parsed as Query
YardException - On any error related to the Yard
QueryResultList<Representation> find(FieldQuery query)
throws YardException,
IllegalArgumentException
query - the query
IllegalArgumentException - if null is parsed as Query
YardException - On any error related to the Yard
QueryResultList<Representation> findRepresentation(FieldQuery query)
throws YardException,
IllegalArgumentException
find(FieldQuery) to retrieve representations that only contain
values for fields marked as selected by the parsed query.
query - the Query used to select representations in the Yard
IllegalArgumentException - if null is parsed as Query
YardException - On any error related to the YardFieldQueryFactory getQueryFactory()
ValueFactory getValueFactory()
ValueFactory instance used by this Yard to create
Representation, Reference and Text instances.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||