You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stanbol.apache.org by rw...@apache.org on 2011/04/12 19:09:31 UTC

svn commit: r1091500 [2/2] - in /incubator/stanbol/trunk/entityhub: generic/core/src/main/java/org/apache/stanbol/entityhub/core/impl/ generic/core/src/main/java/org/apache/stanbol/entityhub/core/site/ generic/servicesapi/src/main/java/org/apache/stanb...

Modified: incubator/stanbol/trunk/entityhub/generic/core/src/main/java/org/apache/stanbol/entityhub/core/site/AbstractEntitySearcher.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/generic/core/src/main/java/org/apache/stanbol/entityhub/core/site/AbstractEntitySearcher.java?rev=1091500&r1=1091499&r2=1091500&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/generic/core/src/main/java/org/apache/stanbol/entityhub/core/site/AbstractEntitySearcher.java (original)
+++ incubator/stanbol/trunk/entityhub/generic/core/src/main/java/org/apache/stanbol/entityhub/core/site/AbstractEntitySearcher.java Tue Apr 12 17:09:31 2011
@@ -21,12 +21,12 @@ import java.util.Dictionary;
 import org.apache.felix.scr.annotations.Activate;
 import org.apache.felix.scr.annotations.Deactivate;
 import org.apache.felix.scr.annotations.Property;
-import org.apache.stanbol.entityhub.servicesapi.site.ConfiguredSite;
+import org.apache.stanbol.entityhub.servicesapi.site.SiteConfiguration;
 import org.apache.stanbol.entityhub.servicesapi.site.EntitySearcher;
 import org.osgi.service.component.ComponentContext;
 import org.slf4j.Logger;
 
-@Property(name=ConfiguredSite.QUERY_URI)
+@Property(name=SiteConfiguration.QUERY_URI)
 public abstract class AbstractEntitySearcher implements EntitySearcher {
 
     protected final Logger log;
@@ -54,7 +54,7 @@ public abstract class AbstractEntitySear
             this.context = context;
             Dictionary<String,?> properties = context.getProperties();
             Object queryUriObject = properties.get(EntitySearcher.QUERY_URI);
-            Object accessUriObject = properties.get(ConfiguredSite.ACCESS_URI); //use as an fallback
+            Object accessUriObject = properties.get(SiteConfiguration.ACCESS_URI); //use as an fallback
             if(queryUriObject != null){
                 this.queryUri = queryUriObject.toString();
                 //now set the new config

Modified: incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/mapping/FieldMapperConfig.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/mapping/FieldMapperConfig.java?rev=1091500&r1=1091499&r2=1091500&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/mapping/FieldMapperConfig.java (original)
+++ incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/mapping/FieldMapperConfig.java Tue Apr 12 17:09:31 2011
@@ -18,14 +18,14 @@ package org.apache.stanbol.entityhub.ser
 
 import org.apache.stanbol.entityhub.servicesapi.Entityhub;
 import org.apache.stanbol.entityhub.servicesapi.EntityhubConfiguration;
-import org.apache.stanbol.entityhub.servicesapi.site.ConfiguredSite;
+import org.apache.stanbol.entityhub.servicesapi.site.SiteConfiguration;
 import org.apache.stanbol.entityhub.servicesapi.site.ReferencedSite;
 /**
  * Intended to define the configuration of the fieldMapper.
  *
  * @author Rupert Westenthaler
  * @deprecated unsure - Currently the functionality of this service is part of
- * the {@link EntityhubConfiguration} and the {@link ConfiguredSite} interfaces. 
+ * the {@link EntityhubConfiguration} and the {@link SiteConfiguration} interfaces. 
  * Access Methods for the {@link FieldMapper} are defined by the 
  * {@link Entityhub} and the {@link ReferencedSite} interfaces
  */

Modified: incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/site/EntityDereferencer.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/site/EntityDereferencer.java?rev=1091500&r1=1091499&r2=1091500&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/site/EntityDereferencer.java (original)
+++ incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/site/EntityDereferencer.java Tue Apr 12 17:09:31 2011
@@ -32,9 +32,9 @@ public interface EntityDereferencer {
     /**
      * The key used to define the baseUri of the service used for the
      * implementation of this interface.<br>
-     * This constants actually uses the value of {@link ConfiguredSite#ACCESS_URI}
+     * This constants actually uses the value of {@link SiteConfiguration#ACCESS_URI}
      */
-    String ACCESS_URI = ConfiguredSite.ACCESS_URI;
+    String ACCESS_URI = SiteConfiguration.ACCESS_URI;
 
     /**
      * The base uri used to access this site

Modified: incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/site/EntitySearcher.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/site/EntitySearcher.java?rev=1091500&r1=1091499&r2=1091500&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/site/EntitySearcher.java (original)
+++ incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/site/EntitySearcher.java Tue Apr 12 17:09:31 2011
@@ -33,9 +33,9 @@ public interface EntitySearcher {
     /**
      * The key used to define the baseUri of the query service used for the
      * implementation of this interface.<br>
-     * This constants actually uses the value of {@link ConfiguredSite#QUERY_URI}
+     * This constants actually uses the value of {@link SiteConfiguration#QUERY_URI}
      */
-    String QUERY_URI = ConfiguredSite.QUERY_URI;
+    String QUERY_URI = SiteConfiguration.QUERY_URI;
     /**
      * Searches for Entities based on the parsed {@link FieldQuery}
      * @param query the query

Modified: incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/site/ReferencedSite.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/site/ReferencedSite.java?rev=1091500&r1=1091499&r2=1091500&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/site/ReferencedSite.java (original)
+++ incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/site/ReferencedSite.java Tue Apr 12 17:09:31 2011
@@ -26,9 +26,16 @@ import org.apache.stanbol.entityhub.serv
 import org.apache.stanbol.entityhub.servicesapi.query.FieldQueryFactory;
 import org.apache.stanbol.entityhub.servicesapi.query.QueryResultList;
 
-public interface ReferencedSite extends ConfiguredSite {
+public interface ReferencedSite {
 
     /**
+     * The Id of this site. This Method MUST return the same value as
+     * <code>{@link #getConfiguration()}.getId()</code>. It is only there to
+     * make it more easy to access the Id of the site
+     * @return the ID of this site
+     */
+    String getId();
+    /**
      * Searches for entities based on the parsed {@link FieldQuery} and returns
      * the references (ids). Note that selected fields of the query are ignored.
      * @param query the query
@@ -111,4 +118,9 @@ public interface ReferencedSite extends 
      */
     FieldQueryFactory getQueryFactory();
 
+    /**
+     * Getter for the configuration of this referenced site
+     * @return the configuration 
+     */
+    SiteConfiguration getConfiguration();
 }

Copied: incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/site/SiteConfiguration.java (from r1089869, incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/site/ConfiguredSite.java)
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/site/SiteConfiguration.java?p2=incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/site/SiteConfiguration.java&p1=incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/site/ConfiguredSite.java&r1=1089869&r2=1091500&rev=1091500&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/site/ConfiguredSite.java (original)
+++ incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/site/SiteConfiguration.java Tue Apr 12 17:09:31 2011
@@ -17,7 +17,7 @@
 package org.apache.stanbol.entityhub.servicesapi.site;
 
 
-import org.apache.stanbol.entityhub.servicesapi.mapping.FieldMapper;
+import org.apache.stanbol.entityhub.servicesapi.EntityhubConfiguration;
 import org.apache.stanbol.entityhub.servicesapi.mapping.FieldMapping;
 import org.apache.stanbol.entityhub.servicesapi.model.EntityMapping;
 import org.apache.stanbol.entityhub.servicesapi.model.Symbol;
@@ -26,22 +26,21 @@ import org.apache.stanbol.entityhub.serv
 import org.apache.stanbol.entityhub.servicesapi.yard.Yard;
 
 /**
- * This interface defines the getter as well as the property keys for the
- * configuration of a {@link ReferencedSite}.<p>
+ * This interface defines the getter as well as the keys used to configure
+ * such properties when parsing an configuration for a {@link ReferencedSite}.<p>
  *
- * TODO: No Idea how to handle that in an OSGI context.
  * @author Rupert Westenthaler
  *
  */
-public interface ConfiguredSite {
+public interface SiteConfiguration {
 
     /**
      * The key to be used for the site id
      */
     String ID = "org.apache.stanbol.entityhub.site.id";
     /**
-     * Getter for the id of this site
-     * @return
+     * Getter for the id of this site.
+     * @return The id of the Site
      */
     String getId();
     /**
@@ -88,34 +87,33 @@ public interface ConfiguredSite {
      * Key used for the configuration of the name of the dereferencer type to be
      * used for this site
      */
-    String DEREFERENCER_TYPE = "org.apache.stanbol.entityhub.site.dereferencerType";
+    String ENTITY_DEREFERENCER_TYPE = "org.apache.stanbol.entityhub.site.dereferencerType";
     /**
      * The name of the {@link EntityDereferencer} to be used for accessing
      * representations of entities managed by this Site
      * @return the id of the entity dereferencer implementation
      */
-    String getDereferencerType();
+    String getEntityDereferencerType();
     /**
      * Key used for the configuration of the uri to access the query service of
      * the site
      */
     String QUERY_URI = "org.apache.stanbol.entityhub.site.queryUri";
     /**
-     * Getter for the queryUri of the site. IF not defined the {@link #ACCESS_URI}
-     * is used.
+     * Getter for the queryUri of the site.
      * @return the uri to access the query service of this site
      */
     String getQueryUri();
     /**
      * Key used for the configuration of the type of the query
      */
-    String SEARCHER_TYPE = "org.apache.stanbol.entityhub.site.searcherType";
+    String ENTITY_SEARCHER_TYPE = "org.apache.stanbol.entityhub.site.searcherType";
     /**
-     * The name of the {@link EntitySearcher} to be used to query for
+     * The type of the {@link EntitySearcher} to be used to query for
      * representations of entities managed by this Site.
      * @return the id of the entity searcher implementation.
      */
-    String getQueryType();
+    String getEntitySearcherType();
     /**
      * Key used for the configuration of the default {@link SymbolState} for a site
      */
@@ -188,8 +186,50 @@ public interface ConfiguredSite {
      */
     String SITE_FIELD_MAPPINGS = "org.apache.stanbol.entityhub.site.fieldMappings";
     /**
-     * The {@link FieldMapper} as configured for this Site.
-     * @return the FieldMappings
+     * Getter for the field mappings used for this site when importing entities
+     * to the Entityhub.<p>
+     * Note that this field mappings are used in addition to the field mappings
+     * defined by the {@link EntityhubConfiguration}.
+     * @return the FieldMappings or <code>null</code> if none.
      */
-    FieldMapper getFieldMapper();
+    String[] getFieldMappings();
+    /**
+     * The key used to configure the name of License used by a referenced Site
+     */
+    String SITE_LICENCE_NAME = "org.apache.stanbol.entityhub.site.licenseName";
+    
+    /**
+     * Getter for the Name of the License used for the data provided by this site. 
+     * @return The name of the license
+     */
+    String getLicenseName();
+    /**
+     * The key used to configure the License of a referenced Site
+     */
+    String SITE_LICENCE_TEXT = "org.apache.stanbol.entityhub.site.licenseText";
+    /**
+     * Getter for the full text of the License used for the data provided by
+     * this site
+     * @return the license
+     */
+    String getLicenseText();
+    /**
+     * The key used to configure the link to the License used by a referenced Site
+     */
+    String SITE_LICENCE_URL = "org.apache.stanbol.entityhub.site.licenseUrl";
+    /**
+     * The URL pointing to a site that provides additional information of the
+     * License
+     * @return the licenseUrl
+     */
+    String getLicenseUrl();
+    /**
+     * The attribution for the data provided by this referenced site
+     */
+    String SITE_ATTRIBUTION = "org.apache.stanbol.entityhub.site.attribution";
+    /**
+     * The Attribution for all data provided by this site
+     * @return the attribution
+     */
+    String getAttribution();
 }

Propchange: incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/site/SiteConfiguration.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/site/SiteConfiguration.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Modified: incubator/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/resource/ReferencedSiteRootResource.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/resource/ReferencedSiteRootResource.java?rev=1091500&r1=1091499&r2=1091500&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/resource/ReferencedSiteRootResource.java (original)
+++ incubator/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/resource/ReferencedSiteRootResource.java Tue Apr 12 17:09:31 2011
@@ -110,7 +110,8 @@ public class ReferencedSiteRootResource 
     @Path(value = "/")
     @Produces(MediaType.TEXT_HTML)
     public String getInfo() {
-        return "<html><head>" + site.getName() + "</head><body>" + "<h1>Referenced Site " + site.getName()
+        return "<html><head>" + site.getConfiguration().getName() + "</head><body>" + 
+                 "<h1>Referenced Site " + site.getConfiguration().getName()
                + ":</h1></body></html>";
     }
     
@@ -130,7 +131,7 @@ public class ReferencedSiteRootResource 
     @GET
     @Path("/entity")
     public Response getSignById(@QueryParam(value = "id") String id, @Context HttpHeaders headers) {
-        log.info("site/" + site.getId() + "/entity Request");
+        log.info("site/{}/entity Request",site.getId());
         log.info("  > id       : " + id);
         log.info("  > accept   : " + headers.getAcceptableMediaTypes());
         log.info("  > mediaType: " + headers.getMediaType());
@@ -143,8 +144,8 @@ public class ReferencedSiteRootResource 
         try {
             sign = site.getSign(id);
         } catch (ReferencedSiteException e) {
-            log.error("ReferencedSiteException while accessing Site " + site.getName() + " (id="
-                      + site.getId() + ")", e);
+            log.error("ReferencedSiteException while accessing Site " + site.getConfiguration().getName() + 
+                " (id=" + site.getId() + ")", e);
             throw new WebApplicationException(e, Response.Status.INTERNAL_SERVER_ERROR);
         }
         final MediaType acceptedMediaType = JerseyUtils.getAcceptableMediaType(headers,
@@ -154,7 +155,8 @@ public class ReferencedSiteRootResource 
         } else {
             // TODO: How to parse an ErrorMessage?
             // create an Response with the the Error?
-            log.info(" ... Entity {} not found on referenced site {}", id, site.getId());
+            log.info(" ... Entity {} not found on referenced site {}", 
+                id, site.getId());
             throw new WebApplicationException(Response.Status.NOT_FOUND);
         }
     }
@@ -180,7 +182,7 @@ public class ReferencedSiteRootResource 
                                @FormParam(value = "limit") Integer limit,
                                @FormParam(value = "offset") Integer offset,
                                @Context HttpHeaders headers) {
-        log.debug("site/" + site.getId() + "/find Request");
+        log.debug("site/{}/find Request",site.getId());
         // process the optional search field parameter
         if (field == null) {
             field = DEFAULT_FIND_FIELD;
@@ -238,7 +240,8 @@ public class ReferencedSiteRootResource 
         try {
             return Response.ok(site.find(query), acceptedMediaType).build();
         } catch (ReferencedSiteException e) {
-            log.error("ReferencedSiteException while accessing Site " + site.getName() + " (id="
+            log.error("ReferencedSiteException while accessing Site " +
+                site.getConfiguration().getName() + " (id="
                       + site.getId() + ")", e);
             throw new WebApplicationException(e, Response.Status.INTERNAL_SERVER_ERROR);
         }