You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stanbol.apache.org by sf...@apache.org on 2010/12/12 16:02:37 UTC
svn commit: r1044829 [12/12] - in /incubator/stanbol/trunk/rick/generic:
core/src/main/java/eu/iksproject/rick/core/impl/
core/src/main/java/eu/iksproject/rick/core/mapping/
core/src/main/java/eu/iksproject/rick/core/model/
core/src/main/java/eu/ikspro...
Modified: incubator/stanbol/trunk/rick/generic/servicesapi/src/main/java/eu/iksproject/rick/servicesapi/yard/Cache.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/rick/generic/servicesapi/src/main/java/eu/iksproject/rick/servicesapi/yard/Cache.java?rev=1044829&r1=1044828&r2=1044829&view=diff
==============================================================================
--- incubator/stanbol/trunk/rick/generic/servicesapi/src/main/java/eu/iksproject/rick/servicesapi/yard/Cache.java (original)
+++ incubator/stanbol/trunk/rick/generic/servicesapi/src/main/java/eu/iksproject/rick/servicesapi/yard/Cache.java Sun Dec 12 15:02:34 2010
@@ -6,10 +6,10 @@ import eu.iksproject.rick.servicesapi.si
/**
* The Cache is a mediator between a {@link Yard} storing the cached information
- * and the {@link ReferencedSite} acting as access point to a referenced
+ * and the {@link ReferencedSite} acting as access point to a referenced
* information source.<p>
* This interface provides also access to the configuration of the cache.
- * This includes meta data needed to decide if requested information can be
+ * This includes meta data needed to decide if requested information can be
* retrieved by using the cache or if data need to be requested directly by the
* referenced site. This includes mainly cached fields used {@link CacheStrategy}
* for fields as well as cached languages. This may be extended in future
@@ -25,172 +25,172 @@ import eu.iksproject.rick.servicesapi.si
* note that the Cache is not responsible to create, configure nor activate the
* {@link Yard}. If the {@link Yard} for an cache is not active the cache
* returns <code>false</code> on calls to {@link #isAvailable()}.
- *
+ *
* @author Rupert Westenthaler
*
*/
public interface Cache extends Yard {
-
- /**
- * Key used to store the id of the Yard used as cache
- */
- String CACHE_YARD = "eu.iksproject.rick.yard.cacheYardId";
- /**
- * The ID used to store the configuration used for the creation of the cache.
- * This configuration can only be changed by updating all the cached items.
- */
- String BASE_CONFIGURATION_URI = "urn:eu.iksproject:rick.yard:cache:config.base";
- /**
- * The ID used to store the configuration used for the creation of
- * new items in the cache. This configuration is called additional, because
- * it can only define additional information to be cached. This restriction
- * is important because the base base configuration is used to determine
- * if queries can be answered by the cache. So it MUST BE ensured that also
- * documents updated in the cache confirm to the base configuration.
- */
- String ADDITIONAL_CONFIGURATION_URI = "urn:eu.iksproject:rick.yard:cache:config.additional";
- /**
- * The field used to store the fieldMappings of a CacheConfiguration
- */
- String FIELD_MAPPING_CONFIG_FIELD = "urn:eu.iksproject:rick.yard:cache:fieldMappings";
- /**
- * Returns the cache strategy for the given Field.<p>
- * <ul>
- * <li>{@link CacheStrategy#all} indicates that this field is cached for all
- * Representations within the cache.
- * <li>{@link CacheStrategy#used} indicates that this field is only present
- * for some Representations within the cache.
- * <li>{@link CacheStrategy#none} indicates that this field is ignored by
- * the cache.
- * </ul>
- * @param field the field
- * @return the cache strategy for this field
- */
- CacheStrategy isField(String field);
- /**
- * Returns the cache strategy for the given Language<p>
- * <ul>
- * <li>{@link CacheStrategy#all} indicates that this language is cached for all
- * Representations within the cache.
- * <li>{@link CacheStrategy#used} indicates that this language is only present
- * for some Representations within the cache.
- * <li>{@link CacheStrategy#none} indicates that this language is ignored by
- * the cache.
- * </ul>
- * @param lang the language
- * @return the cache strategy for this language
- */
- CacheStrategy isLanguage(String lang);
- /**
- * They key used to configure the cache strategy
- */
- String CACHE_STRATEGY = "eu.iksproject.rick.yard.cache.strategy";
- /**
- * The strategy used by this Cache.<p>
- * <li>{@link CacheStrategy#all} indicates that one can assume that this cache
- * holds at least some data for all Representations of the cached referenced
- * site.
- * <li>{@link CacheStrategy#used} indicates that this cache holds only
- * previously used entities of the referenced site.
- * <li>{@link CacheStrategy#none} indicates that this cache holds no data
- * of the ReferencedSite. This value is normally not used by a real cache
- * implementation.
- * </ul>
- * One needs to use {@link #isField(String)} and {@link #isLanguage(String)}
- * to check how specific fields are treated by the cahce.<p>
- * e.g. a cache may store dc:titel and dc:author for all documents, but all
- * other fields only for previously used items. In such cases this method
- * would return {@link CacheStrategy#all} but a call to
- * <code>isField("dc:description")</code> would return
- * {@link CacheStrategy#used}.<p>
- * This would indicate, that queries for titles and authors could be
- * executed by using the cache. Queries that also searches for
- * dc:descriptions would need to be performed directly on the referenced
- * site.
- * @return the strategy
- */
- CacheStrategy strategy();
- /**
- * Getter for the state of the Yard configured to store cached information
- * @return <code>true</code> if the yard used by this cache is available
- * (active).
- */
- boolean isAvailable();
- /**
- * Key used to configure additional mappings for a cache
- */
- String ADDITIONAL_MAPPINGS = "eu.iksproject.rick.yard.cache.additionalMappings";
+ /**
+ * Key used to store the id of the Yard used as cache
+ */
+ String CACHE_YARD = "eu.iksproject.rick.yard.cacheYardId";
+ /**
+ * The ID used to store the configuration used for the creation of the cache.
+ * This configuration can only be changed by updating all the cached items.
+ */
+ String BASE_CONFIGURATION_URI = "urn:eu.iksproject:rick.yard:cache:config.base";
+ /**
+ * The ID used to store the configuration used for the creation of
+ * new items in the cache. This configuration is called additional, because
+ * it can only define additional information to be cached. This restriction
+ * is important because the base base configuration is used to determine
+ * if queries can be answered by the cache. So it MUST BE ensured that also
+ * documents updated in the cache confirm to the base configuration.
+ */
+ String ADDITIONAL_CONFIGURATION_URI = "urn:eu.iksproject:rick.yard:cache:config.additional";
+ /**
+ * The field used to store the fieldMappings of a CacheConfiguration
+ */
+ String FIELD_MAPPING_CONFIG_FIELD = "urn:eu.iksproject:rick.yard:cache:fieldMappings";
+ /**
+ * Returns the cache strategy for the given Field.<p>
+ * <ul>
+ * <li>{@link CacheStrategy#all} indicates that this field is cached for all
+ * Representations within the cache.
+ * <li>{@link CacheStrategy#used} indicates that this field is only present
+ * for some Representations within the cache.
+ * <li>{@link CacheStrategy#none} indicates that this field is ignored by
+ * the cache.
+ * </ul>
+ * @param field the field
+ * @return the cache strategy for this field
+ */
+ CacheStrategy isField(String field);
+ /**
+ * Returns the cache strategy for the given Language<p>
+ * <ul>
+ * <li>{@link CacheStrategy#all} indicates that this language is cached for all
+ * Representations within the cache.
+ * <li>{@link CacheStrategy#used} indicates that this language is only present
+ * for some Representations within the cache.
+ * <li>{@link CacheStrategy#none} indicates that this language is ignored by
+ * the cache.
+ * </ul>
+ * @param lang the language
+ * @return the cache strategy for this language
+ */
+ CacheStrategy isLanguage(String lang);
+ /**
+ * They key used to configure the cache strategy
+ */
+ String CACHE_STRATEGY = "eu.iksproject.rick.yard.cache.strategy";
+ /**
+ * The strategy used by this Cache.<p>
+ * <li>{@link CacheStrategy#all} indicates that one can assume that this cache
+ * holds at least some data for all Representations of the cached referenced
+ * site.
+ * <li>{@link CacheStrategy#used} indicates that this cache holds only
+ * previously used entities of the referenced site.
+ * <li>{@link CacheStrategy#none} indicates that this cache holds no data
+ * of the ReferencedSite. This value is normally not used by a real cache
+ * implementation.
+ * </ul>
+ * One needs to use {@link #isField(String)} and {@link #isLanguage(String)}
+ * to check how specific fields are treated by the cahce.<p>
+ * e.g. a cache may store dc:titel and dc:author for all documents, but all
+ * other fields only for previously used items. In such cases this method
+ * would return {@link CacheStrategy#all} but a call to
+ * <code>isField("dc:description")</code> would return
+ * {@link CacheStrategy#used}.<p>
+ * This would indicate, that queries for titles and authors could be
+ * executed by using the cache. Queries that also searches for
+ * dc:descriptions would need to be performed directly on the referenced
+ * site.
+ * @return the strategy
+ */
+ CacheStrategy strategy();
+
+ /**
+ * Getter for the state of the Yard configured to store cached information
+ * @return <code>true</code> if the yard used by this cache is available
+ * (active).
+ */
+ boolean isAvailable();
+ /**
+ * Key used to configure additional mappings for a cache
+ */
+ String ADDITIONAL_MAPPINGS = "eu.iksproject.rick.yard.cache.additionalMappings";
// Design decision: Base Mappings MUST NOT be configurable via OSGI Properties
-// /**
-// * Key used to configure the base mappings for a cache
-// */
-// String BASE_MAPPINGS = "eu.iksproject.rick.yard.cache.baseMappings";
- /**
- * Sets the base mappings to the parsed field mapper and stores the new
- * configuration to the yard. If the {@link #baseMapper} is <code>null</code> this
- * method removes any existing configuration from the yard.<p>
- * <b>NOTE: (Expert Usage only)</b>Take care if using this method! The base
- * configuration MUST BE in correspondence with the cached data! Typically
- * this configuration is set by the code that creates a Full-Cache
- * ({@link CacheStrategy#all}) for an entity source (referenced site) and is
- * not modified later on. Changes to the base configuration usually requires
- * all entities in the cache to be updated!<p>
- * @param fieldMapper the fieldMapper holding the new base field mapping
- * configuration
- * @throws YardException on any error while storing the new configuration.
- * The new configuration is not set if storage is not successful to prevent
- * an configuration that do not correspond with the cached information in the
- * yard.
- */
- void setBaseMappings(FieldMapper fieldMapper) throws YardException;
- /**
- * Sets the additional field mappings for a cache. This mapping defines
- * fields that are cached in addition to that defined by the base mapping when
- * {@link Representation} of entities are stored/updated in the cache.<p>
- * Changing the additional mappings will only influence documents stored/
- * updated in the cache after the change. Already cached documents are not
- * affected changed. This means, that by changing this configuration a
- * cache will contain documents written by using different configurations.
- * To avoid that one needs to delete all documents in the cache.<p>
- * However changes to this configuration can not affect the base configuration
- * of the cache, because base mappings cannot be undone by this configuration.
- * <p>
- * Note that typically Caches used for {@link ReferencedSite}s using the
- * {@link CacheStrategy#used} do not define any base configuration. Also note
- * that setting the additional mappings to <code>null</code> means:<ul>
- * <li> using the base configuration if one is present or
- * <li> storing all data of the parsed Representations if no base configuration
- * is present.
- * </ul>
- * @param fieldMapper the fieldMapper holding the new additional field mapping
- * configuration
- * @throws YardException on any error while storing the new configuration.
- * The new configuration is not set if storage is not successful to prevent
- * an configuration that do not correspond with the cached information in the
- * yard.
- */
- void setAdditionalMappings(FieldMapper fieldMapper) throws YardException;
- /**
- * Getter for the additional mappings used by this Cache. Modifications on the
- * returned object do not have any influence on the mappings, because this
- * method returns a clone. Use {@link #setAdditionalMappings(FieldMapper)} to
- * change the used additional mappings. However make sure you understand the
- * implications of changing the base mappings as described in the
- * documentation of the setter method
- * @return A clone of the additional mappings or <code>null</code> if no
- * additional mappings are defined
- */
- FieldMapper getAdditionalMappings();
- /**
- * Getter for the base mappings used by this Cache. Modifications on the
- * returned object do not have any influence on the mappings, because this
- * method returns a clone. Use {@link #setBaseMappings(FieldMapper)} to
- * change the used base mappings. However make sure you understand the
- * implications of changing the base mappings as described in the
- * documentation of the setter method
- * @return A clone of the base mappings or <code>null</code> if no base
- * mappings are defined
- */
- FieldMapper getBaseMappings();
+// /**
+// * Key used to configure the base mappings for a cache
+// */
+// String BASE_MAPPINGS = "eu.iksproject.rick.yard.cache.baseMappings";
+ /**
+ * Sets the base mappings to the parsed field mapper and stores the new
+ * configuration to the yard. If the {@link #baseMapper} is <code>null</code> this
+ * method removes any existing configuration from the yard.<p>
+ * <b>NOTE: (Expert Usage only)</b>Take care if using this method! The base
+ * configuration MUST BE in correspondence with the cached data! Typically
+ * this configuration is set by the code that creates a Full-Cache
+ * ({@link CacheStrategy#all}) for an entity source (referenced site) and is
+ * not modified later on. Changes to the base configuration usually requires
+ * all entities in the cache to be updated!<p>
+ * @param fieldMapper the fieldMapper holding the new base field mapping
+ * configuration
+ * @throws YardException on any error while storing the new configuration.
+ * The new configuration is not set if storage is not successful to prevent
+ * an configuration that do not correspond with the cached information in the
+ * yard.
+ */
+ void setBaseMappings(FieldMapper fieldMapper) throws YardException;
+ /**
+ * Sets the additional field mappings for a cache. This mapping defines
+ * fields that are cached in addition to that defined by the base mapping when
+ * {@link Representation} of entities are stored/updated in the cache.<p>
+ * Changing the additional mappings will only influence documents stored/
+ * updated in the cache after the change. Already cached documents are not
+ * affected changed. This means, that by changing this configuration a
+ * cache will contain documents written by using different configurations.
+ * To avoid that one needs to delete all documents in the cache.<p>
+ * However changes to this configuration can not affect the base configuration
+ * of the cache, because base mappings cannot be undone by this configuration.
+ * <p>
+ * Note that typically Caches used for {@link ReferencedSite}s using the
+ * {@link CacheStrategy#used} do not define any base configuration. Also note
+ * that setting the additional mappings to <code>null</code> means:<ul>
+ * <li> using the base configuration if one is present or
+ * <li> storing all data of the parsed Representations if no base configuration
+ * is present.
+ * </ul>
+ * @param fieldMapper the fieldMapper holding the new additional field mapping
+ * configuration
+ * @throws YardException on any error while storing the new configuration.
+ * The new configuration is not set if storage is not successful to prevent
+ * an configuration that do not correspond with the cached information in the
+ * yard.
+ */
+ void setAdditionalMappings(FieldMapper fieldMapper) throws YardException;
+ /**
+ * Getter for the additional mappings used by this Cache. Modifications on the
+ * returned object do not have any influence on the mappings, because this
+ * method returns a clone. Use {@link #setAdditionalMappings(FieldMapper)} to
+ * change the used additional mappings. However make sure you understand the
+ * implications of changing the base mappings as described in the
+ * documentation of the setter method
+ * @return A clone of the additional mappings or <code>null</code> if no
+ * additional mappings are defined
+ */
+ FieldMapper getAdditionalMappings();
+ /**
+ * Getter for the base mappings used by this Cache. Modifications on the
+ * returned object do not have any influence on the mappings, because this
+ * method returns a clone. Use {@link #setBaseMappings(FieldMapper)} to
+ * change the used base mappings. However make sure you understand the
+ * implications of changing the base mappings as described in the
+ * documentation of the setter method
+ * @return A clone of the base mappings or <code>null</code> if no base
+ * mappings are defined
+ */
+ FieldMapper getBaseMappings();
}
Modified: incubator/stanbol/trunk/rick/generic/servicesapi/src/main/java/eu/iksproject/rick/servicesapi/yard/CacheInitialisationException.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/rick/generic/servicesapi/src/main/java/eu/iksproject/rick/servicesapi/yard/CacheInitialisationException.java?rev=1044829&r1=1044828&r2=1044829&view=diff
==============================================================================
--- incubator/stanbol/trunk/rick/generic/servicesapi/src/main/java/eu/iksproject/rick/servicesapi/yard/CacheInitialisationException.java (original)
+++ incubator/stanbol/trunk/rick/generic/servicesapi/src/main/java/eu/iksproject/rick/servicesapi/yard/CacheInitialisationException.java Sun Dec 12 15:02:34 2010
@@ -7,23 +7,23 @@ package eu.iksproject.rick.servicesapi.y
* required configuration meta data needed to correctly configure the cache.<p>
* For errors while performing CRUD operations on the Cache {@link YardException}s
* are used.
- *
+ *
* @author Rupert Westenthaler
*
*/
public class CacheInitialisationException extends RuntimeException {
- public CacheInitialisationException(String reason) {
- super(reason);
- }
+ public CacheInitialisationException(String reason) {
+ super(reason);
+ }
- public CacheInitialisationException(String reason, Throwable cause) {
- super(reason, cause);
- }
+ public CacheInitialisationException(String reason, Throwable cause) {
+ super(reason, cause);
+ }
- /**
- *
- */
- private static final long serialVersionUID = 1L;
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
}
Modified: incubator/stanbol/trunk/rick/generic/servicesapi/src/main/java/eu/iksproject/rick/servicesapi/yard/CacheStrategy.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/rick/generic/servicesapi/src/main/java/eu/iksproject/rick/servicesapi/yard/CacheStrategy.java?rev=1044829&r1=1044828&r2=1044829&view=diff
==============================================================================
--- incubator/stanbol/trunk/rick/generic/servicesapi/src/main/java/eu/iksproject/rick/servicesapi/yard/CacheStrategy.java (original)
+++ incubator/stanbol/trunk/rick/generic/servicesapi/src/main/java/eu/iksproject/rick/servicesapi/yard/CacheStrategy.java Sun Dec 12 15:02:34 2010
@@ -1,19 +1,19 @@
/**
- *
+ *
*/
package eu.iksproject.rick.servicesapi.yard;
public enum CacheStrategy{
- /**
- * All entities of this site should be cached
- */
- all,
- /**
- * Only entities are cached that where retrieved by some past request
- */
- used,
- /**
- * Entities of this site are not cached
- */
- none
-}
\ No newline at end of file
+ /**
+ * All entities of this site should be cached
+ */
+ all,
+ /**
+ * Only entities are cached that where retrieved by some past request
+ */
+ used,
+ /**
+ * Entities of this site are not cached
+ */
+ none
+}
Modified: incubator/stanbol/trunk/rick/generic/servicesapi/src/main/java/eu/iksproject/rick/servicesapi/yard/CacheingLevel.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/rick/generic/servicesapi/src/main/java/eu/iksproject/rick/servicesapi/yard/CacheingLevel.java?rev=1044829&r1=1044828&r2=1044829&view=diff
==============================================================================
--- incubator/stanbol/trunk/rick/generic/servicesapi/src/main/java/eu/iksproject/rick/servicesapi/yard/CacheingLevel.java (original)
+++ incubator/stanbol/trunk/rick/generic/servicesapi/src/main/java/eu/iksproject/rick/servicesapi/yard/CacheingLevel.java Sun Dec 12 15:02:34 2010
@@ -1,17 +1,17 @@
package eu.iksproject.rick.servicesapi.yard;
public enum CacheingLevel {
- /**
- * This indicated that a document in the cache confirms to the specification
- * as stored within the cache. This configuration is stored within the cache
- * and only be changed for an empty cache.<p>
- */
- base,
- /**
- * If a Document is updated in the cache, than there may be more information
- * be stored as defined by the initial creation of a cache. <p> This level indicates
- * that a document includes all the field defined for {@link #base} but
- * also some additional information.
- */
- special
+ /**
+ * This indicated that a document in the cache confirms to the specification
+ * as stored within the cache. This configuration is stored within the cache
+ * and only be changed for an empty cache.<p>
+ */
+ base,
+ /**
+ * If a Document is updated in the cache, than there may be more information
+ * be stored as defined by the initial creation of a cache. <p> This level indicates
+ * that a document includes all the field defined for {@link #base} but
+ * also some additional information.
+ */
+ special
}
Modified: incubator/stanbol/trunk/rick/generic/servicesapi/src/main/java/eu/iksproject/rick/servicesapi/yard/Yard.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/rick/generic/servicesapi/src/main/java/eu/iksproject/rick/servicesapi/yard/Yard.java?rev=1044829&r1=1044828&r2=1044829&view=diff
==============================================================================
--- incubator/stanbol/trunk/rick/generic/servicesapi/src/main/java/eu/iksproject/rick/servicesapi/yard/Yard.java (original)
+++ incubator/stanbol/trunk/rick/generic/servicesapi/src/main/java/eu/iksproject/rick/servicesapi/yard/Yard.java Sun Dec 12 15:02:34 2010
@@ -14,14 +14,13 @@ import eu.iksproject.rick.servicesapi.si
import eu.iksproject.rick.servicesapi.site.ReferencedSiteManager;
-
/**
* <p>The Yard represents a local cache for {@link Representation}s of the Entities
* and Symbols managed by a referenced site.<p>
- * </p>
+ *
* <p> Referenced Sites need to provide the configuration if there representations
* should be cached locally. This is done by using one of the defined {@link CacheStrategy}.
- * </p>
+ *
* <p>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
* {@link ReferencedSite} can have its own Yard instance. However
@@ -29,189 +28,223 @@ import eu.iksproject.rick.servicesapi.si
* <p>The {@link YardManager} is an singleton services that manages the different
* Yard instances and provides an central point of access for the {@link Rick}
* and the {@link ReferencedSiteManager}.</p>
+ *
* <p> This should also allow for implementing Yards that are based on
* <ul>
* <li> Indexes generated by dumps of the referred Site</li>
* <li> local installations of the software used by the referred site</li>
* <li> and so on ... </li>
* </ul>
- *
- * TODO: The framework need to provide a special Yard for storing {@link Symbol}
+ *
+ * TODO: The framework need to provide a special Yard for storing {@link Symbol}
* and {@link EntityMapping} information. This Yard is currently referenced as
* Rick-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 {@link Yard} service.
- *
+ * <p/>
* <p>Side note: The name yard was chosen because in farming the word "rick"
- * was used to describe small bales of Hay or Corn that are stacked in a
- * criss-crossed fashion. The word "rick yard" describes a farm-yard containing
+ * was used to describe small bales of Hay or Corn that are stacked in a
+ * criss-crossed fashion. The word "rick yard" describes a farm-yard containing
* ricks of hay or corn.</p>
- * @author Rupert Westenthaler
- *
- * TODO: Need to decide how Yards are linked to the Site for which they
- * cache entities.
*
+ * @author Rupert Westenthaler
+ * <p/>
+ * TODO: Need to decide how Yards are linked to the Site for which they
+ * cache entities.
*/
public interface Yard {
-
- String ID = "eu.iksproject.rick.yard.id";
- String NAME = "eu.iksproject.rick.yard.name";
- String DESCRIPTION = "eu.iksproject.rick.yard.description";
- /**
- * Getter for the unique ID of the Yard (within the local rick node)
- * @return the id
- */
- String getId();
- String getName();
- String getDescription();
- /**
- * Creates a new representation. The Yard is responsible to assign a valid
- * ID.
- * @return the created Representation initialised with a valid ID
- */
- Representation create();
- /**
- * Creates a new representation for the given id
- * @param id the id for the new representation or <code>null</code> to
- * indicate that the Yard should assign an id.
- * @return the created Representation
- * @throws IllegalArgumentException if the parsed id is not valid or there
- * exists already a representation with the parsed id.
- */
- Representation create(String id) throws IllegalArgumentException;
- /**
- * Stores the representation in the Yard. if the parsed representation is
- * not present in the Yard it will add it to the Yard.
- * @param representation the representation
- * @return the representation as stored
- * @throws IllegalArgumentException if <code>null</code> is parsed as argument or
- * the representation is not managed (e.g was not created by using this yard).
- * @throws YardException On any error related to the Yard
- */
- Representation store(Representation representation) throws IllegalArgumentException, YardException;
- /**
- * Stores all the parsed representation in a single chunk in the Yard. This
- * can improve performance, because it does not require multiple commits.<br>
- * <code>null</code> values are ignored and added as <code>null</code> in
- * the returned Iterable.
- * Otherwise same as {@link #store(Representation)}.
- * @param representations all the representations to store
- * @return the stored representations in the same iteration order
- * @throws IllegalArgumentException if <code>null</code> is parsed as Iterable
- * @throws YardException On any error related to the Yard
- */
- Iterable<Representation> store(Iterable<Representation> representations)throws IllegalArgumentException, YardException;
- /**
- * Removes the {@link Representation} with the given id
- * @param id the id
- * @throws IllegalArgumentException if the parsed ID is null or not valid
- * formatted
- * @throws YardException On any error related to the Yard
- */
- void remove(String id) throws IllegalArgumentException,YardException;
- /**
- * Removes all the {@link Representation} of the parsed ids. <code>null</code>
- * values are ignored.
- * @param ids the iterable over the ids to remove
- * @throws IllegalArgumentException if <code>null</code> is parsed as iterable
- * @throws YardException On any error related to the Yard
- */
- void remove(Iterable<String> ids) throws IllegalArgumentException,YardException;
- /**
- * checks if a representation with the given id is present in the Yard
- * @param id the id. Calls with <code>null</code> are ignored
- * @return <code>true</code> if a representation with the id is present in
- * the Yard. Otherwise <code>false</code>.
- * @throws IllegalArgumentException if the parsed ID is not valid
- * formatted
- * @throws YardException On any error related to the Yard
- */
- boolean isRepresentation(String id) throws YardException, IllegalArgumentException;
- /**
- * Getter for the representation based on the id. Calls with
- * <code>id = null</code> should return null.
- * @param id the id.
- * @return The representation with the parsed id or <code>null</code> if
- * no representation with this id is present in the Yard
- * @throws IllegalArgumentException if the parsed ID is not valid
- * formatted
- * @throws YardException On any error related to the Yard
- */
- Representation getRepresentation(String id) throws YardException,IllegalArgumentException;
- /**
- * Updates the store with the new state of the parsed representation
- * @param represnetation the representation
- * @return the representation as stored
- * @throws IllegalArgumentException if the parsed representation <code>null</code>
- * or not present in the Yard
- * @throws YardException On any error related to the Yard
- */
- Representation update(Representation represnetation) throws YardException,IllegalArgumentException;
- /**
- * Updates the store with the new state of the parsed representations. This
- * can improve performance, because it does not require multiple commits.<br>
- * <code>null</code> values are ignored and added as <code>null</code> in
- * the returned Iterable. Otherwise same as {@link #update(Representation)}.
- * @param representations the representations to update
- * @return the updated stored representations in the same iteration order
- * @throws YardException On any error related to the Yard
- * @throws IllegalArgumentException if <code>null</code> is parsed as Iterable
- */
- Iterable<Representation> update(Iterable<Representation> representations) throws YardException,IllegalArgumentException;
- /**
- * Finds all representations base on the parse query. Selected fields of the
- * query may be ignored, because only the ids of the found representations
- * are returned
- * @param query The query
- * @return A ResultList containing the IDs of the found representations
- * @throws IllegalArgumentException if <code>null</code> is parsed as Query
- * @throws YardException On any error related to the Yard
- */
- QueryResultList<String> findReferences(FieldQuery query) throws YardException,IllegalArgumentException;
- /**
- * Getter for a view onto the Representations selected by the Query. Note
- * that the returned Representations will only include fields that are
- * selected by the parsed query. And such fields will only contain values
- * that are not filtered by the query.
- * @param query the query
- * @return the view onto selected representations as defined by the query
- * @throws IllegalArgumentException if <code>null</code> is parsed as Query
- * @throws YardException On any error related to the Yard
- */
- QueryResultList<Representation> find(FieldQuery query) throws YardException, IllegalArgumentException;
- /**
- * Searches for all the Representation fulfilling the constraints of the
- * query and returns the (whole) representation as stored in the Yard.
- * Note that any as selected fields of the parsed query are ignored. Use
- * {@link #find(FieldQuery)} to retrieve representations that only contain
- * values for fields marked as selected by the parsed query.
- * @param query the Query used to select representations in the Yard
- * @return the selected representations as stored in this yard.
- * @throws IllegalArgumentException if <code>null</code> is parsed as Query
- * @throws YardException On any error related to the Yard
- */
- QueryResultList<Representation> findRepresentation(FieldQuery query) throws YardException,IllegalArgumentException;
- /**
- * Getter for the FieldQueryFactory used by this Yard
- * @return the FieldQueryFactory
- */
- FieldQueryFactory getQueryFactory();
- /**
- * Getter for the {@link ValueFactory} instance used by this Yard to create
- * {@link Representation}, {@link Reference} and {@link Text} instances.
- * @return the valueFactory used by the store
- */
- ValueFactory getValueFactory();
+
+ String ID = "eu.iksproject.rick.yard.id";
+ String NAME = "eu.iksproject.rick.yard.name";
+ String DESCRIPTION = "eu.iksproject.rick.yard.description";
+
+ /**
+ * Getter for the unique ID of the Yard (within the local rick node)
+ *
+ * @return the id
+ */
+ String getId();
+
+ String getName();
+
+ String getDescription();
+
+ /**
+ * Creates a new representation. The Yard is responsible to assign a valid
+ * ID.
+ *
+ * @return the created Representation initialised with a valid ID
+ */
+ Representation create();
+
+ /**
+ * Creates a new representation for the given id
+ *
+ * @param id the id for the new representation or <code>null</code> to
+ * indicate that the Yard should assign an id.
+ * @return the created Representation
+ * @throws IllegalArgumentException if the parsed id is not valid or there
+ * exists already a representation with the parsed id.
+ */
+ Representation create(String id) throws IllegalArgumentException;
+
+ /**
+ * Stores the representation in the Yard. if the parsed representation is
+ * not present in the Yard it will add it to the Yard.
+ *
+ * @param representation the representation
+ * @return the representation as stored
+ * @throws IllegalArgumentException if <code>null</code> is parsed as argument or
+ * the representation is not managed (e.g was not created by using this yard).
+ * @throws YardException On any error related to the Yard
+ */
+ Representation store(Representation representation) throws IllegalArgumentException, YardException;
+
+ /**
+ * Stores all the parsed representation in a single chunk in the Yard. This
+ * can improve performance, because it does not require multiple commits.<br>
+ * <code>null</code> values are ignored and added as <code>null</code> in
+ * the returned Iterable.
+ * Otherwise same as {@link #store(Representation)}.
+ *
+ * @param representations all the representations to store
+ * @return the stored representations in the same iteration order
+ * @throws IllegalArgumentException if <code>null</code> is parsed as Iterable
+ * @throws YardException On any error related to the Yard
+ */
+ Iterable<Representation> store(Iterable<Representation> representations) throws IllegalArgumentException, YardException;
+
+ /**
+ * Removes the {@link Representation} with the given id
+ *
+ * @param id the id
+ * @throws IllegalArgumentException if the parsed ID is null or not valid
+ * formatted
+ * @throws YardException On any error related to the Yard
+ */
+ void remove(String id) throws IllegalArgumentException, YardException;
+
+ /**
+ * Removes all the {@link Representation} of the parsed ids. <code>null</code>
+ * values are ignored.
+ *
+ * @param ids the iterable over the ids to remove
+ * @throws IllegalArgumentException if <code>null</code> is parsed as iterable
+ * @throws YardException On any error related to the Yard
+ */
+ void remove(Iterable<String> ids) throws IllegalArgumentException, YardException;
+
+ /**
+ * checks if a representation with the given id is present in the Yard
+ *
+ * @param id the id. Calls with <code>null</code> are ignored
+ * @return <code>true</code> if a representation with the id is present in
+ * the Yard. Otherwise <code>false</code>.
+ * @throws IllegalArgumentException if the parsed ID is not valid
+ * formatted
+ * @throws YardException On any error related to the Yard
+ */
+ boolean isRepresentation(String id) throws YardException, IllegalArgumentException;
+
+ /**
+ * Getter for the representation based on the id. Calls with
+ * <code>id = null</code> should return null.
+ *
+ * @param id the id.
+ * @return The representation with the parsed id or <code>null</code> if
+ * no representation with this id is present in the Yard
+ * @throws IllegalArgumentException if the parsed ID is not valid
+ * formatted
+ * @throws YardException On any error related to the Yard
+ */
+ Representation getRepresentation(String id) throws YardException, IllegalArgumentException;
+
+ /**
+ * Updates the store with the new state of the parsed representation
+ *
+ * @param represnetation the representation
+ * @return the representation as stored
+ * @throws IllegalArgumentException if the parsed representation <code>null</code>
+ * or not present in the Yard
+ * @throws YardException On any error related to the Yard
+ */
+ Representation update(Representation represnetation) throws YardException, IllegalArgumentException;
+
+ /**
+ * Updates the store with the new state of the parsed representations. This
+ * can improve performance, because it does not require multiple commits.<br>
+ * <code>null</code> values are ignored and added as <code>null</code> in
+ * the returned Iterable. Otherwise same as {@link #update(Representation)}.
+ *
+ * @param representations the representations to update
+ * @return the updated stored representations in the same iteration order
+ * @throws YardException On any error related to the Yard
+ * @throws IllegalArgumentException if <code>null</code> is parsed as Iterable
+ */
+ Iterable<Representation> update(Iterable<Representation> representations) throws YardException, IllegalArgumentException;
+
+ /**
+ * Finds all representations base on the parse query. Selected fields of the
+ * query may be ignored, because only the ids of the found representations
+ * are returned
+ *
+ * @param query The query
+ * @return A ResultList containing the IDs of the found representations
+ * @throws IllegalArgumentException if <code>null</code> is parsed as Query
+ * @throws YardException On any error related to the Yard
+ */
+ QueryResultList<String> findReferences(FieldQuery query) throws YardException, IllegalArgumentException;
+
+ /**
+ * Getter for a view onto the Representations selected by the Query. Note
+ * that the returned Representations will only include fields that are
+ * selected by the parsed query. And such fields will only contain values
+ * that are not filtered by the query.
+ *
+ * @param query the query
+ * @return the view onto selected representations as defined by the query
+ * @throws IllegalArgumentException if <code>null</code> is parsed as Query
+ * @throws YardException On any error related to the Yard
+ */
+ QueryResultList<Representation> find(FieldQuery query) throws YardException, IllegalArgumentException;
+
+ /**
+ * Searches for all the Representation fulfilling the constraints of the
+ * query and returns the (whole) representation as stored in the Yard.
+ * Note that any as selected fields of the parsed query are ignored. Use
+ * {@link #find(FieldQuery)} to retrieve representations that only contain
+ * values for fields marked as selected by the parsed query.
+ *
+ * @param query the Query used to select representations in the Yard
+ * @return the selected representations as stored in this yard.
+ * @throws IllegalArgumentException if <code>null</code> is parsed as Query
+ * @throws YardException On any error related to the Yard
+ */
+ QueryResultList<Representation> findRepresentation(FieldQuery query) throws YardException, IllegalArgumentException;
+
+ /**
+ * Getter for the FieldQueryFactory used by this Yard
+ *
+ * @return the FieldQueryFactory
+ */
+ FieldQueryFactory getQueryFactory();
+
+ /**
+ * Getter for the {@link ValueFactory} instance used by this Yard to create
+ * {@link Representation}, {@link Reference} and {@link Text} instances.
+ *
+ * @return the valueFactory used by the store
+ */
+ ValueFactory getValueFactory();
/*
- * TODO: Maybe one would like to add status Information about cached
+ * TODO: Maybe one would like to add status Information about cached
* Representations for registered Sites.
*/
// enum ProcessingStatus {
-// scheduled,
-// processing,
-// stored
-// };
-// ProcessingStatus getStatus(Site site);
-// ProcessingStatus getStatus(String entityId);
+// scheduled,
+// processing,
+// stored
+// };
+// ProcessingStatus getStatus(Site site);
+// ProcessingStatus getStatus(String entityId);
}
-
Modified: incubator/stanbol/trunk/rick/generic/servicesapi/src/main/java/eu/iksproject/rick/servicesapi/yard/YardException.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/rick/generic/servicesapi/src/main/java/eu/iksproject/rick/servicesapi/yard/YardException.java?rev=1044829&r1=1044828&r2=1044829&view=diff
==============================================================================
--- incubator/stanbol/trunk/rick/generic/servicesapi/src/main/java/eu/iksproject/rick/servicesapi/yard/YardException.java (original)
+++ incubator/stanbol/trunk/rick/generic/servicesapi/src/main/java/eu/iksproject/rick/servicesapi/yard/YardException.java Sun Dec 12 15:02:34 2010
@@ -9,26 +9,26 @@ import eu.iksproject.rick.servicesapi.Ri
*/
public class YardException extends RickException {
- /**
- * The default serial version UIR
- */
- private static final long serialVersionUID = 1L;
+ /**
+ * The default serial version UIR
+ */
+ private static final long serialVersionUID = 1L;
- /**
- * Creates an exception with a message and a cause
- * @param reason the message describing the reason for the error
- * @param cause the parent
- */
- public YardException(String reason, Throwable cause) {
- super(reason, cause);
- }
+ /**
+ * Creates an exception with a message and a cause
+ * @param reason the message describing the reason for the error
+ * @param cause the parent
+ */
+ public YardException(String reason, Throwable cause) {
+ super(reason, cause);
+ }
- /**
- * Creates an exception with a message and a cause
- * @param reason the message describing the reason for the error
- */
- public YardException(String reason) {
- super(reason);
- }
+ /**
+ * Creates an exception with a message and a cause
+ * @param reason the message describing the reason for the error
+ */
+ public YardException(String reason) {
+ super(reason);
+ }
}
Modified: incubator/stanbol/trunk/rick/generic/servicesapi/src/main/java/eu/iksproject/rick/servicesapi/yard/YardManager.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/rick/generic/servicesapi/src/main/java/eu/iksproject/rick/servicesapi/yard/YardManager.java?rev=1044829&r1=1044828&r2=1044829&view=diff
==============================================================================
--- incubator/stanbol/trunk/rick/generic/servicesapi/src/main/java/eu/iksproject/rick/servicesapi/yard/YardManager.java (original)
+++ incubator/stanbol/trunk/rick/generic/servicesapi/src/main/java/eu/iksproject/rick/servicesapi/yard/YardManager.java Sun Dec 12 15:02:34 2010
@@ -6,56 +6,56 @@ import java.util.Collection;
/**
* Manages the different active Yards and provides the possibility to lookup/
* create {@link Cache} instances based on already available Yards.
- *
+ *
* @author Rupert Westenthaler
*/
public interface YardManager {
- /**
- * Getter for the IDs of Yards currently managed by this Manager
- * @return the Ids of the currently active Yards
- */
- Collection<String> getYardIDs();
- /**
- * Returns if there is a Yard for the parsed ID
- * @param id the id
- * @return <code>true</code> if a {@link Yard} with the parsed ID is managed
- * by this YardManager.
- */
- boolean isYard(String id);
- /**
- * Getter for the Yard based on the parsed Id
- * @param id the ID
- * @return The Yard or <code>null</code> if no Yard with the parsed ID is
- * active.
- */
- Yard getYard(String id);
- /**
- * Getter for the Cache based on the yard id used to cache the data.<p>
- * If no cache is present for the parsed yard, than a new instance is
- * created by using the {@link ComponentFactory}.
- * @param id the ID of the Yard used to store the data of the cache
- * @return the cache or <code>null</code> if no Yard with the parsed ID
- * is active.
- * @throws YardException on any Error while creating a new Cache for the
- * Yard with the parsed id.
- * TODO: replace YardException by a better one. However I do not like to use
- * the ComponentException because it is a runtime exception and would
- * introduce a dependency to OSGI in the ServicesApi bundle
- */
- Cache getCache(String id);
- /**
- * Returns if a Cache with the requested ID is registered. NOTE that a Cache
- * always shares the same ID with the Yard used to store the cached data.
- * @param id the id of the cache (or the Yard used by the Cache)
- * @return <code>true</code> if a {@link Cache} with the parsed ID is managed
- * by this YardManager.
- */
- boolean isCache(String id);
- /**
- * Getter for the IDs of Caches currently managed by this Manager
- * @return the Ids of the currently active Caches
- */
- Collection<String> getCacheIDs();
+ /**
+ * Getter for the IDs of Yards currently managed by this Manager
+ * @return the Ids of the currently active Yards
+ */
+ Collection<String> getYardIDs();
+ /**
+ * Returns if there is a Yard for the parsed ID
+ * @param id the id
+ * @return <code>true</code> if a {@link Yard} with the parsed ID is managed
+ * by this YardManager.
+ */
+ boolean isYard(String id);
+ /**
+ * Getter for the Yard based on the parsed Id
+ * @param id the ID
+ * @return The Yard or <code>null</code> if no Yard with the parsed ID is
+ * active.
+ */
+ Yard getYard(String id);
+ /**
+ * Getter for the Cache based on the yard id used to cache the data.<p>
+ * If no cache is present for the parsed yard, than a new instance is
+ * created by using the {@link ComponentFactory}.
+ * @param id the ID of the Yard used to store the data of the cache
+ * @return the cache or <code>null</code> if no Yard with the parsed ID
+ * is active.
+ * @throws YardException on any Error while creating a new Cache for the
+ * Yard with the parsed id.
+ * TODO: replace YardException by a better one. However I do not like to use
+ * the ComponentException because it is a runtime exception and would
+ * introduce a dependency to OSGI in the ServicesApi bundle
+ */
+ Cache getCache(String id);
+ /**
+ * Returns if a Cache with the requested ID is registered. NOTE that a Cache
+ * always shares the same ID with the Yard used to store the cached data.
+ * @param id the id of the cache (or the Yard used by the Cache)
+ * @return <code>true</code> if a {@link Cache} with the parsed ID is managed
+ * by this YardManager.
+ */
+ boolean isCache(String id);
+ /**
+ * Getter for the IDs of Caches currently managed by this Manager
+ * @return the Ids of the currently active Caches
+ */
+ Collection<String> getCacheIDs();
}
Modified: incubator/stanbol/trunk/rick/generic/test/src/main/java/eu/iksproject/rick/test/model/RepresentationTest.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/rick/generic/test/src/main/java/eu/iksproject/rick/test/model/RepresentationTest.java?rev=1044829&r1=1044828&r2=1044829&view=diff
==============================================================================
--- incubator/stanbol/trunk/rick/generic/test/src/main/java/eu/iksproject/rick/test/model/RepresentationTest.java (original)
+++ incubator/stanbol/trunk/rick/generic/test/src/main/java/eu/iksproject/rick/test/model/RepresentationTest.java Sun Dec 12 15:02:34 2010
@@ -3,14 +3,14 @@ package eu.iksproject.rick.test.model;
import eu.iksproject.rick.servicesapi.model.Representation;
public abstract class RepresentationTest {
- /**
- * Subclasses implement this method to provide implementation instances of
- * {@link Representation}. This method may be called an arbitrary amount of time,
- * independently whether previously returned MGraph are still in use or not.
- *
- * @return an empty {@link Representation} of the implementation to be tested
- */
- protected abstract Representation getEmptyRepresentation();
-
- //TODO: Write the tests!
+ /**
+ * Subclasses implement this method to provide implementation instances of
+ * {@link Representation}. This method may be called an arbitrary amount of time,
+ * independently whether previously returned MGraph are still in use or not.
+ *
+ * @return an empty {@link Representation} of the implementation to be tested
+ */
+ protected abstract Representation getEmptyRepresentation();
+
+ //TODO: Write the tests!
}