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.
| Modifier and Type | Field and Description |
|---|---|
static String |
DESCRIPTION |
static String |
ID |
static String |
NAME |
| Modifier and Type | Method and Description |
|---|---|
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. if the parsed representation is
not present in the Yard it will add it to 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
|
static final String ID
static final String NAME
static final String DESCRIPTION
String getId()
String getName()
String getDescription()
Representation create() throws YardException
YardException - On any error while creating or storing the
representationRepresentation 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
representationRepresentation store(Representation representation) throws NullPointerException, YardException
representation - the representationNullPointerException - if null is parsed as argument.YardException - On any error related to the YardIterable<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 Yardvoid remove(String id) throws IllegalArgumentException, YardException
Representation with the given idid - the idIllegalArgumentException - if the parsed ID is null or not valid
formattedYardException - On any error related to the Yardvoid remove(Iterable<String> ids) throws IllegalArgumentException, YardException
Representation of the parsed ids. null
values are ignored.ids - the iterable over the ids to removeIllegalArgumentException - if null is parsed as iterableYardException - On any error related to the Yardvoid removeAll()
throws YardException
Representation managed by this YardYardException - On any error related to the Yardboolean isRepresentation(String id) throws YardException, IllegalArgumentException
id - the id. Calls with null are ignoredtrue if a representation with the id is present in
the Yard. Otherwise false.NullPointerException - if null is parsed as IDIllegalArgumentException - if the parsed ID is not valid
formatted (especially if an empty String is parsed as IDYardException - On any error related to the YardRepresentation 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 YardNullPointerException - if null is parsed as idIllegalArgumentException - if the parsed ID is not valid formattedYardException - On any error related to the YardRepresentation update(Representation representation) throws YardException, IllegalArgumentException
representation - the representationNullPointerException - If null is parsed as representationIllegalArgumentException - 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 YardIterable<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 updateYardException - On any error related to the YardIllegalArgumentException - if null is parsed as IterableQueryResultList<String> findReferences(FieldQuery query) throws YardException, IllegalArgumentException
query - The queryIllegalArgumentException - if null is parsed as QueryYardException - On any error related to the YardQueryResultList<Representation> find(FieldQuery query) throws YardException, IllegalArgumentException
query - the queryIllegalArgumentException - if null is parsed as QueryYardException - On any error related to the YardQueryResultList<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 YardIllegalArgumentException - if null is parsed as QueryYardException - On any error related to the YardFieldQueryFactory getQueryFactory()
ValueFactory getValueFactory()
ValueFactory instance used by this Yard to create
Representation, Reference and Text instances.Copyright © 2010-2014 The Apache Software Foundation. All Rights Reserved.