Author: mir
Date: Tue Jan  5 10:23:02 2010
New Revision: 895973

URL: http://svn.apache.org/viewvc?rev=895973&view=rev
Log:
CLEREZZA-38: applied review comments

Modified:
    
incubator/clerezza/issues/CLEREZZA-38/org.apache.clerezza.platform.content.representations/org.apache.clerezza.platform.content.representations.core/pom.xml
    
incubator/clerezza/issues/CLEREZZA-38/org.apache.clerezza.platform.content.representations/org.apache.clerezza.platform.content.representations.core/src/main/java/org/apache/clerezza/platform/content/representations/core/AlternativeRepresentationGenerator.java
    
incubator/clerezza/issues/CLEREZZA-38/org.apache.clerezza.platform.content.representations/org.apache.clerezza.platform.content.representations.core/src/main/java/org/apache/clerezza/platform/content/representations/core/ThumbnailService.java
    
incubator/clerezza/issues/CLEREZZA-38/org.apache.clerezza.platform.content.representations/org.apache.clerezza.platform.content.representations.ontologies/src/main/resources/org/apache/clerezza/platform/content/representations/ontologies/representations.rdf

Modified: 
incubator/clerezza/issues/CLEREZZA-38/org.apache.clerezza.platform.content.representations/org.apache.clerezza.platform.content.representations.core/pom.xml
URL: 
http://svn.apache.org/viewvc/incubator/clerezza/issues/CLEREZZA-38/org.apache.clerezza.platform.content.representations/org.apache.clerezza.platform.content.representations.core/pom.xml?rev=895973&r1=895972&r2=895973&view=diff
==============================================================================
--- 
incubator/clerezza/issues/CLEREZZA-38/org.apache.clerezza.platform.content.representations/org.apache.clerezza.platform.content.representations.core/pom.xml
 (original)
+++ 
incubator/clerezza/issues/CLEREZZA-38/org.apache.clerezza.platform.content.representations/org.apache.clerezza.platform.content.representations.core/pom.xml
 Tue Jan  5 10:23:02 2010
@@ -11,7 +11,7 @@
        <packaging>bundle</packaging>
        <name>Clerezza - Platform Content Representations Core</name>
        <description>Provides a Meta Data Generator that generates alternative
-               representations for data of     various meta types</description>
+               representations for data of     various media 
types</description>
        <dependencies>
                <dependency>
                        <groupId>org.osgi</groupId>

Modified: 
incubator/clerezza/issues/CLEREZZA-38/org.apache.clerezza.platform.content.representations/org.apache.clerezza.platform.content.representations.core/src/main/java/org/apache/clerezza/platform/content/representations/core/AlternativeRepresentationGenerator.java
URL: 
http://svn.apache.org/viewvc/incubator/clerezza/issues/CLEREZZA-38/org.apache.clerezza.platform.content.representations/org.apache.clerezza.platform.content.representations.core/src/main/java/org/apache/clerezza/platform/content/representations/core/AlternativeRepresentationGenerator.java?rev=895973&r1=895972&r2=895973&view=diff
==============================================================================
--- 
incubator/clerezza/issues/CLEREZZA-38/org.apache.clerezza.platform.content.representations/org.apache.clerezza.platform.content.representations.core/src/main/java/org/apache/clerezza/platform/content/representations/core/AlternativeRepresentationGenerator.java
 (original)
+++ 
incubator/clerezza/issues/CLEREZZA-38/org.apache.clerezza.platform.content.representations/org.apache.clerezza.platform.content.representations.core/src/main/java/org/apache/clerezza/platform/content/representations/core/AlternativeRepresentationGenerator.java
 Tue Jan  5 10:23:02 2010
@@ -170,6 +170,7 @@
                String newUri;
                int lastIndexOfDot = oldUri.lastIndexOf(".");
                int lastIndexOfSlash = oldUri.lastIndexOf("/");
+               // 6 characters to keep the extension at the end.
                if (lastIndexOfSlash < lastIndexOfDot &&
                                lastIndexOfDot >= (oldUri.length() - 6)) {
                        String firstPart = oldUri.substring(0, lastIndexOfDot);

Modified: 
incubator/clerezza/issues/CLEREZZA-38/org.apache.clerezza.platform.content.representations/org.apache.clerezza.platform.content.representations.core/src/main/java/org/apache/clerezza/platform/content/representations/core/ThumbnailService.java
URL: 
http://svn.apache.org/viewvc/incubator/clerezza/issues/CLEREZZA-38/org.apache.clerezza.platform.content.representations/org.apache.clerezza.platform.content.representations.core/src/main/java/org/apache/clerezza/platform/content/representations/core/ThumbnailService.java?rev=895973&r1=895972&r2=895973&view=diff
==============================================================================
--- 
incubator/clerezza/issues/CLEREZZA-38/org.apache.clerezza.platform.content.representations/org.apache.clerezza.platform.content.representations.core/src/main/java/org/apache/clerezza/platform/content/representations/core/ThumbnailService.java
 (original)
+++ 
incubator/clerezza/issues/CLEREZZA-38/org.apache.clerezza.platform.content.representations/org.apache.clerezza.platform.content.representations.core/src/main/java/org/apache/clerezza/platform/content/representations/core/ThumbnailService.java
 Tue Jan  5 10:23:02 2010
@@ -29,9 +29,7 @@
 import org.apache.clerezza.platform.config.PlatformConfig;
 import 
org.apache.clerezza.platform.content.representations.ontologies.REPRESENTATIONS;
 import org.apache.clerezza.platform.graphprovider.content.ContentGraphProvider;
-import org.apache.clerezza.rdf.core.InvalidLiteralTypeException;
 import org.apache.clerezza.rdf.core.LiteralFactory;
-import org.apache.clerezza.rdf.core.NoConvertorException;
 import org.apache.clerezza.rdf.core.NonLiteral;
 import org.apache.clerezza.rdf.core.Resource;
 import org.apache.clerezza.rdf.core.TypedLiteral;
@@ -94,11 +92,17 @@
        }
 
        /**
-        * Returns the thumbnail uri for a specified InfoDiscoBit. If no 
thumbnail
-        * is available then the uri of the icon representing the media type is
-        * returned. If also no media type icon is available the uri to default
-        * icon is returned.
-        * @param infoBitUri
+        * Returns the thumbnail uri for a InfoDiscoBit which is located at the 
uri
+        * specified over the query parameter "uri". The thumbnails
+        * maximum width and height can optionally be specified over the query 
parameters
+        * "width" and "height". If more than one acceptable thumbnail is 
available
+        * then the thumbnail uri of the thumbnail with the highest resolution
+        * (width * height) is returned. If no thumbnail is available then the 
uri of
+        * the icon representing the media type is returned. If also no media 
type
+        * icon is available the uri to default icon is returned.
+        * @param infoBitUri the uri of the infoDiscoBit of which the thumbnail 
uri should be returned
+        * @param height the maximum height that the thumbnail has
+        * @param width the maximum width that the thumbnail has
         * @return
         */
        @GET
@@ -140,10 +144,15 @@
                        UriRef thumbnailUri = (UriRef) thumbnails.next();
                        GraphNode thumbnailNode = new GraphNode(thumbnailUri, 
                                        cgProvider.getContentGraph());
+                       Iterator<Resource> exifWidths = 
thumbnailNode.getObjects(EXIF.width);
+                       Iterator<Resource> exifHeights = 
thumbnailNode.getObjects(EXIF.height);
+                       if (!exifWidths.hasNext() || !exifHeights.hasNext()) {
+                               continue;
+                       }
                        Integer thumbnailWidth = 
LiteralFactory.getInstance().createObject(
-                                       Integer.class, (TypedLiteral) 
thumbnailNode.getObjects(EXIF.width).next());
+                                       Integer.class, (TypedLiteral) 
exifWidths.next());
                        Integer thumbnailHeight = 
LiteralFactory.getInstance().createObject(
-                                       Integer.class, (TypedLiteral) 
thumbnailNode.getObjects(EXIF.height).next());
+                                       Integer.class, (TypedLiteral) 
exifHeights.next());
                        int thumbnailPixels = thumbnailWidth * thumbnailHeight;
                        if (thumbnailHeight <= height && thumbnailWidth <= 
width && thumbnailPixels > pixels) {
                                resultThumbnailUri = thumbnailUri;

Modified: 
incubator/clerezza/issues/CLEREZZA-38/org.apache.clerezza.platform.content.representations/org.apache.clerezza.platform.content.representations.ontologies/src/main/resources/org/apache/clerezza/platform/content/representations/ontologies/representations.rdf
URL: 
http://svn.apache.org/viewvc/incubator/clerezza/issues/CLEREZZA-38/org.apache.clerezza.platform.content.representations/org.apache.clerezza.platform.content.representations.ontologies/src/main/resources/org/apache/clerezza/platform/content/representations/ontologies/representations.rdf?rev=895973&r1=895972&r2=895973&view=diff
==============================================================================
--- 
incubator/clerezza/issues/CLEREZZA-38/org.apache.clerezza.platform.content.representations/org.apache.clerezza.platform.content.representations.ontologies/src/main/resources/org/apache/clerezza/platform/content/representations/ontologies/representations.rdf
 (original)
+++ 
incubator/clerezza/issues/CLEREZZA-38/org.apache.clerezza.platform.content.representations/org.apache.clerezza.platform.content.representations.ontologies/src/main/resources/org/apache/clerezza/platform/content/representations/ontologies/representations.rdf
 Tue Jan  5 10:23:02 2010
@@ -20,10 +20,10 @@
 <!-- Properties -->
 
 <rdf:Property 
rdf:about="http://clerezza.org/2009/12/representations#isIconFor";>
-       <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#ObjectProperty"; />
+       <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#DatatypeProperty"; 
/>
        <rdfs:label xml:lang="en">is icon for</rdfs:label>
-       <skos:definition xml:lang="en">Points to a string of which the subject 
is a icon for.</skos:definition>
-       <rdfs:isDefinedBy 
rdf:resource="http://clerezza.org/2009/11/globalMenu#"; />
+       <skos:definition xml:lang="en">Points to a string specifying the 
resource type for which the subject is an icon.</skos:definition>
+       <rdfs:isDefinedBy 
rdf:resource="http://clerezza.org/2009/12/representations#"; />
        <rdfs:domain rdf:resource="http://xmlns.com/foaf/0.1/Image"; />
        <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"; />
 </rdf:Property>


Reply via email to