Author: ogrisel
Date: Sun Apr  3 23:18:14 2011
New Revision: 1088437

URL: http://svn.apache.org/viewvc?rev=1088437&view=rev
Log:
STANBOL-120: more fixes for engines output views: all images are now delegated 
to the 'home' web fragment

Removed:
    
incubator/stanbol/branches/http-endpoint-refactoring/enhancer/jersey/src/main/resources/org/apache/stanbol/enhancer/jersey/static/images/
Modified:
    
incubator/stanbol/branches/http-endpoint-refactoring/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/resource/ContentItemResource.java
    
incubator/stanbol/branches/http-endpoint-refactoring/enhancer/jersey/src/main/resources/org/apache/stanbol/enhancer/jersey/templates/imports/contentitem.ftl
    
incubator/stanbol/branches/http-endpoint-refactoring/enhancer/jersey/src/main/resources/org/apache/stanbol/enhancer/jersey/templates/org/apache/stanbol/enhancer/jersey/resource/EnginesRootResource/index.ftl
    
incubator/stanbol/branches/http-endpoint-refactoring/enhancer/launchers/full/src/main/bundles/list.xml
    
incubator/stanbol/branches/http-endpoint-refactoring/enhancer/launchers/lite/src/main/bundles/list.xml
    
incubator/stanbol/branches/http-endpoint-refactoring/launchers/mini/src/main/bundles/list.xml

Modified: 
incubator/stanbol/branches/http-endpoint-refactoring/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/resource/ContentItemResource.java
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/branches/http-endpoint-refactoring/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/resource/ContentItemResource.java?rev=1088437&r1=1088436&r2=1088437&view=diff
==============================================================================
--- 
incubator/stanbol/branches/http-endpoint-refactoring/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/resource/ContentItemResource.java
 (original)
+++ 
incubator/stanbol/branches/http-endpoint-refactoring/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/resource/ContentItemResource.java
 Sun Apr  3 23:18:14 2011
@@ -68,12 +68,7 @@ public class ContentItemResource extends
     // TODO make this configurable trough a property
     public static final UriRef THUMBNAIL = new 
UriRef("http://dbpedia.org/ontology/thumbnail";);
 
-    public static final Map<UriRef,String> DEFAULT_THUMBNAILS = new 
HashMap<UriRef,String>();
-    static {
-        DEFAULT_THUMBNAILS.put(DBPEDIA_PERSON, "/static/images/user_48.png");
-        DEFAULT_THUMBNAILS.put(DBPEDIA_ORGANISATION, 
"/static/images/organization_48.png");
-        DEFAULT_THUMBNAILS.put(DBPEDIA_PLACE, "/static/images/compass_48.png");
-    }
+    public final Map<UriRef,String> defaultThumbnails = new 
HashMap<UriRef,String>();
 
     protected ContentItem contentItem;
 
@@ -126,6 +121,10 @@ public class ContentItemResource extends
             this.downloadHref = rawURI;
             this.metadataHref = 
uriInfo.getBaseUriBuilder().path("/store/metadata").path(localId).build();
         }
+        defaultThumbnails.put(DBPEDIA_PERSON, getStaticRootUrl() + 
"/home/images/user_48.png");
+        defaultThumbnails.put(DBPEDIA_ORGANISATION, getStaticRootUrl() + 
"/home/organization_48.png");
+        defaultThumbnails.put(DBPEDIA_PLACE, getStaticRootUrl() + 
"/home/images/compass_48.png");
+
     }
 
     public String getRdfMetadata(String mediatype) throws 
UnsupportedEncodingException {
@@ -217,7 +216,7 @@ public class ContentItemResource extends
 
             EntityExtractionSummary entity = occurrenceMap.get(text);
             if (entity == null) {
-                entity = new EntityExtractionSummary(text, type);
+                entity = new EntityExtractionSummary(text, type, 
defaultThumbnails);
                 occurrenceMap.put(text, entity);
             }
             UriRef entityUri = (UriRef) mapping.get("entity");
@@ -241,14 +240,18 @@ public class ContentItemResource extends
 
         protected List<String> mentions = new ArrayList<String>();
 
-        public EntityExtractionSummary(String name, UriRef type) {
+        public final Map<UriRef,String> defaultThumbnails;
+
+        public EntityExtractionSummary(String name, UriRef type, 
Map<UriRef,String> defaultThumbnails) {
             this.name = name;
             this.type = type;
             mentions.add(name);
+            this.defaultThumbnails = defaultThumbnails;
         }
 
         public void addSuggestion(UriRef uri, String label, Double confidence, 
TripleCollection properties) {
-            EntitySuggestion suggestion = new EntitySuggestion(uri, type, 
label, confidence, properties);
+            EntitySuggestion suggestion = new EntitySuggestion(uri, type, 
label, confidence, properties,
+                    defaultThumbnails);
             if (!suggestions.contains(suggestion)) {
                 suggestions.add(suggestion);
                 Collections.sort(suggestions);
@@ -280,13 +283,13 @@ public class ContentItemResource extends
 
         public String getThumbnailSrc() {
             if (suggestions.isEmpty()) {
-                return DEFAULT_THUMBNAILS.get(type);
+                return defaultThumbnails.get(type);
             }
             return suggestions.get(0).getThumbnailSrc();
         }
 
         public String getMissingThumbnailSrc() {
-            return DEFAULT_THUMBNAILS.get(type);
+            return defaultThumbnails.get(type);
         }
 
         public EntitySuggestion getBestGuess() {
@@ -341,16 +344,20 @@ public class ContentItemResource extends
 
         protected TripleCollection entityProperties;
 
+        protected final Map<UriRef,String> defaultThumbnails;
+
         public EntitySuggestion(UriRef uri,
                                 UriRef type,
                                 String label,
                                 Double confidence,
-                                TripleCollection entityProperties) {
+                                TripleCollection entityProperties,
+                                Map<UriRef,String> defaultThumbnails) {
             this.uri = uri;
             this.label = label;
             this.type = type;
             this.confidence = confidence;
             this.entityProperties = entityProperties;
+            this.defaultThumbnails = defaultThumbnails;
         }
 
         @Override
@@ -379,11 +386,11 @@ public class ContentItemResource extends
                     return ((UriRef) object).getUnicodeString();
                 }
             }
-            return DEFAULT_THUMBNAILS.get(type);
+            return defaultThumbnails.get(type);
         }
 
         public String getMissingThumbnailSrc() {
-            return DEFAULT_THUMBNAILS.get(type);
+            return defaultThumbnails.get(type);
         }
 
         public String getSummary() {

Modified: 
incubator/stanbol/branches/http-endpoint-refactoring/enhancer/jersey/src/main/resources/org/apache/stanbol/enhancer/jersey/templates/imports/contentitem.ftl
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/branches/http-endpoint-refactoring/enhancer/jersey/src/main/resources/org/apache/stanbol/enhancer/jersey/templates/imports/contentitem.ftl?rev=1088437&r1=1088436&r2=1088437&view=diff
==============================================================================
--- 
incubator/stanbol/branches/http-endpoint-refactoring/enhancer/jersey/src/main/resources/org/apache/stanbol/enhancer/jersey/templates/imports/contentitem.ftl
 (original)
+++ 
incubator/stanbol/branches/http-endpoint-refactoring/enhancer/jersey/src/main/resources/org/apache/stanbol/enhancer/jersey/templates/imports/contentitem.ftl
 Sun Apr  3 23:18:14 2011
@@ -57,7 +57,7 @@ $(document).ready(function() {
   };
   var graphic = new OpenLayers.Layer.Image(
     'Default World Map',
-    '${it.staticRootUrl}/images/world_map_1024_512.png',
+    '${it.staticRootUrl}/home/images/world_map_1024_512.png',
     extent,
     new OpenLayers.Size(1024, 512),
     options
@@ -103,7 +103,7 @@ $(document).ready(function() {
       var position = new OpenLayers.LonLat(long, lat);
          var iconSize = new OpenLayers.Size(32, 32);
       var offset = new OpenLayers.Pixel(-(iconSize.w/2), -iconSize.h);
-      var markerIcon = new 
OpenLayers.Icon('${it.staticRootUrl}/images/pin_map_32.png', iconSize, offset);
+      var markerIcon = new 
OpenLayers.Icon('${it.staticRootUrl}/home/images/pin_map_32.png', iconSize, 
offset);
          var popupSize = new OpenLayers.Size(200, 20);
       var marker = new OpenLayers.Marker(position, markerIcon);
       var popup = new OpenLayers.Popup.Anchored("popup-" + id, position, 
popupSize, label, markerIcon, false);

Modified: 
incubator/stanbol/branches/http-endpoint-refactoring/enhancer/jersey/src/main/resources/org/apache/stanbol/enhancer/jersey/templates/org/apache/stanbol/enhancer/jersey/resource/EnginesRootResource/index.ftl
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/branches/http-endpoint-refactoring/enhancer/jersey/src/main/resources/org/apache/stanbol/enhancer/jersey/templates/org/apache/stanbol/enhancer/jersey/resource/EnginesRootResource/index.ftl?rev=1088437&r1=1088436&r2=1088437&view=diff
==============================================================================
--- 
incubator/stanbol/branches/http-endpoint-refactoring/enhancer/jersey/src/main/resources/org/apache/stanbol/enhancer/jersey/templates/org/apache/stanbol/enhancer/jersey/resource/EnginesRootResource/index.ftl
 (original)
+++ 
incubator/stanbol/branches/http-endpoint-refactoring/enhancer/jersey/src/main/resources/org/apache/stanbol/enhancer/jersey/templates/org/apache/stanbol/enhancer/jersey/resource/EnginesRootResource/index.ftl
 Sun Apr  3 23:18:14 2011
@@ -44,7 +44,7 @@ $(".enginelisting p").click(function () 
       </select> <input class="submit" type="submit" value="Run engines">
     </p>
   </form>
-<script language="javascript"><!--
+<script language="javascript">
 function registerFormHandler() {
    $("#enginesInput input.submit", this).click(function(e) {
      // disable regular form click
@@ -61,7 +61,7 @@ function registerFormHandler() {
      // submit the form query using Ajax
      $.ajax({
        type: "POST",
-       url: "${it.rootUrl}/engines",
+       url: "${it.publicBaseUri}engines",
        data: data,
        dataType: "html",
        cache: false,
@@ -77,10 +77,10 @@ function registerFormHandler() {
    });
  }
  $(document).ready(registerFormHandler);
---></script>
+</script>
   <div id="enginesOuputWaiter" style="display: none">
-    <p>the Stanbol enhancer is analysing your content...</p>
-    <p><img alt="Waiting..." src="${it.staticRootUrl}/images/ajax-loader.gif" 
/></p>
+    <p>Stanbol is analysing your content...</p>
+    <p><img alt="Waiting..." 
src="${it.staticRootUrl}/home/images/ajax-loader.gif" /></p>
   </div>
   <p id="enginesOuput"></p>
 </#if>

Modified: 
incubator/stanbol/branches/http-endpoint-refactoring/enhancer/launchers/full/src/main/bundles/list.xml
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/branches/http-endpoint-refactoring/enhancer/launchers/full/src/main/bundles/list.xml?rev=1088437&r1=1088436&r2=1088437&view=diff
==============================================================================
--- 
incubator/stanbol/branches/http-endpoint-refactoring/enhancer/launchers/full/src/main/bundles/list.xml
 (original)
+++ 
incubator/stanbol/branches/http-endpoint-refactoring/enhancer/launchers/full/src/main/bundles/list.xml
 Sun Apr  3 23:18:14 2011
@@ -314,6 +314,21 @@
             <artifactId>org.apache.stanbol.jsonld</artifactId>
             <version>0.9-SNAPSHOT</version>
         </bundle>
+               <bundle>
+                       <groupId>org.apache.stanbol</groupId>
+                       
<artifactId>org.apache.stanbol.commons.web.base</artifactId>
+                       <version>0.9-SNAPSHOT</version>
+               </bundle>
+               <bundle>
+                       <groupId>org.apache.stanbol</groupId>
+                       
<artifactId>org.apache.stanbol.commons.web.home</artifactId>
+                       <version>0.9-SNAPSHOT</version>
+               </bundle>
+               <bundle>
+                       <groupId>org.apache.stanbol</groupId>
+                       
<artifactId>org.apache.stanbol.commons.web.sparql</artifactId>
+                       <version>0.9-SNAPSHOT</version>
+               </bundle>
        </startLevel>
 
        <!-- Stanbol Enhancer plug-ins -->

Modified: 
incubator/stanbol/branches/http-endpoint-refactoring/enhancer/launchers/lite/src/main/bundles/list.xml
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/branches/http-endpoint-refactoring/enhancer/launchers/lite/src/main/bundles/list.xml?rev=1088437&r1=1088436&r2=1088437&view=diff
==============================================================================
--- 
incubator/stanbol/branches/http-endpoint-refactoring/enhancer/launchers/lite/src/main/bundles/list.xml
 (original)
+++ 
incubator/stanbol/branches/http-endpoint-refactoring/enhancer/launchers/lite/src/main/bundles/list.xml
 Sun Apr  3 23:18:14 2011
@@ -282,6 +282,23 @@
                        <artifactId>org.apache.stanbol.jsonld</artifactId>
                        <version>0.9-SNAPSHOT</version>
                </bundle>
+
+               <!-- Stanbol Web interface -->
+               <bundle>
+                       <groupId>org.apache.stanbol</groupId>
+                       
<artifactId>org.apache.stanbol.commons.web.base</artifactId>
+                       <version>0.9-SNAPSHOT</version>
+               </bundle>
+               <bundle>
+                       <groupId>org.apache.stanbol</groupId>
+                       
<artifactId>org.apache.stanbol.commons.web.home</artifactId>
+                       <version>0.9-SNAPSHOT</version>
+               </bundle>
+               <bundle>
+                       <groupId>org.apache.stanbol</groupId>
+                       
<artifactId>org.apache.stanbol.commons.web.sparql</artifactId>
+                       <version>0.9-SNAPSHOT</version>
+               </bundle>
        </startLevel>
 
        <!-- Stanbol Enhancer  -->

Modified: 
incubator/stanbol/branches/http-endpoint-refactoring/launchers/mini/src/main/bundles/list.xml
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/branches/http-endpoint-refactoring/launchers/mini/src/main/bundles/list.xml?rev=1088437&r1=1088436&r2=1088437&view=diff
==============================================================================
--- 
incubator/stanbol/branches/http-endpoint-refactoring/launchers/mini/src/main/bundles/list.xml
 (original)
+++ 
incubator/stanbol/branches/http-endpoint-refactoring/launchers/mini/src/main/bundles/list.xml
 Sun Apr  3 23:18:14 2011
@@ -7,6 +7,11 @@
        <!-- OSGi infrastructure -->
        <startLevel level="5">
                <bundle>
+                       <groupId>org.apache.stanbol</groupId>
+                       
<artifactId>org.apache.stanbol.frameworkfragment</artifactId>
+                       <version>0.9.0-SNAPSHOT</version>
+               </bundle>
+               <bundle>
                        <groupId>org.apache.sling</groupId>
                        <artifactId>org.apache.sling.commons.log</artifactId>
                        <version>2.0.6</version>


Reply via email to