Author: rwesten
Date: Mon Jan 20 08:38:04 2014
New Revision: 1559644

URL: http://svn.apache.org/r1559644
Log:
STANBOL-1132: Applied patch provided by Cristian Petroaca on the 11.Januray to 
this issue

Modified:
    
stanbol/trunk/enhancer/generic/nlp-json/src/main/java/org/apache/stanbol/enhancer/nlp/json/valuetype/impl/CorefFeatureSupport.java
    
stanbol/trunk/enhancer/generic/nlp-json/src/main/java/org/apache/stanbol/enhancer/nlp/json/valuetype/impl/DependencyRelationSupport.java
    
stanbol/trunk/enhancer/generic/nlp-json/src/test/java/org/apache/stanbol/enhancer/nlp/json/valuetype/CorefFeatureSupportTest.java
    
stanbol/trunk/enhancer/generic/nlp-json/src/test/java/org/apache/stanbol/enhancer/nlp/json/valuetype/DependencyRelationSupportTest.java
    
stanbol/trunk/enhancer/generic/nlp/src/main/java/org/apache/stanbol/enhancer/nlp/coref/CorefFeature.java
    
stanbol/trunk/enhancer/generic/nlp/src/main/java/org/apache/stanbol/enhancer/nlp/dependency/DependencyRelation.java
    
stanbol/trunk/enhancer/generic/nlp/src/main/java/org/apache/stanbol/enhancer/nlp/dependency/GrammaticalRelation.java
    
stanbol/trunk/enhancer/generic/nlp/src/main/java/org/apache/stanbol/enhancer/nlp/dependency/GrammaticalRelationTag.java
    
stanbol/trunk/enhancer/generic/servicesapi/src/main/java/org/apache/stanbol/enhancer/servicesapi/ContentItem.java
    
stanbol/trunk/enhancer/generic/servicesapi/src/main/java/org/apache/stanbol/enhancer/servicesapi/EnhancementEngine.java

Modified: 
stanbol/trunk/enhancer/generic/nlp-json/src/main/java/org/apache/stanbol/enhancer/nlp/json/valuetype/impl/CorefFeatureSupport.java
URL: 
http://svn.apache.org/viewvc/stanbol/trunk/enhancer/generic/nlp-json/src/main/java/org/apache/stanbol/enhancer/nlp/json/valuetype/impl/CorefFeatureSupport.java?rev=1559644&r1=1559643&r2=1559644&view=diff
==============================================================================
--- 
stanbol/trunk/enhancer/generic/nlp-json/src/main/java/org/apache/stanbol/enhancer/nlp/json/valuetype/impl/CorefFeatureSupport.java
 (original)
+++ 
stanbol/trunk/enhancer/generic/nlp-json/src/main/java/org/apache/stanbol/enhancer/nlp/json/valuetype/impl/CorefFeatureSupport.java
 Mon Jan 20 08:38:04 2014
@@ -15,7 +15,6 @@
  * limitations under the License.
  */package org.apache.stanbol.enhancer.nlp.json.valuetype.impl;
 
-import java.util.Collections;
 import java.util.HashSet;
 import java.util.Set;
 
@@ -53,24 +52,21 @@ public class CorefFeatureSupport impleme
                
                jCoref.put(IS_REPRESENTATIVE_TAG, coref.isRepresentative());
                
-        Set<Span> mentions = coref.getMentions();
+        Set<Span> mentions = coref.getMentions(); 
+        ArrayNode jMentions = mapper.createArrayNode();
         
-        if(!mentions.isEmpty()) {
-            ArrayNode jMentions = mapper.createArrayNode();
+        for(Span mention : mentions) {
+            ObjectNode jMention = mapper.createObjectNode();
             
-            for(Span mention : mentions) {
-                ObjectNode jMention = mapper.createObjectNode();
-                
-                jMention.put(MENTION_TYPE_TAG, mention.getType().toString());
-                jMention.put(MENTION_START_TAG, mention.getStart());
-                jMention.put(MENTION_END_TAG, mention.getEnd());
-                
-                jMentions.add(jMention);
-            }
+            jMention.put(MENTION_TYPE_TAG, mention.getType().toString());
+            jMention.put(MENTION_START_TAG, mention.getStart());
+            jMention.put(MENTION_END_TAG, mention.getEnd());
             
-            jCoref.put(MENTIONS_TAG, jMentions);
+            jMentions.add(jMention);
         }
         
+        jCoref.put(MENTIONS_TAG, jMentions);
+        
                return jCoref;
        }
 
@@ -121,7 +117,7 @@ public class CorefFeatureSupport impleme
                 }
             }
                }    
-                
-               return new CorefFeature(jIsRepresentative.asBoolean(), 
Collections.unmodifiableSet(mentions));
+        
+               return new CorefFeature(jIsRepresentative.asBoolean(), 
mentions);
        }       
 }
\ No newline at end of file

Modified: 
stanbol/trunk/enhancer/generic/nlp-json/src/main/java/org/apache/stanbol/enhancer/nlp/json/valuetype/impl/DependencyRelationSupport.java
URL: 
http://svn.apache.org/viewvc/stanbol/trunk/enhancer/generic/nlp-json/src/main/java/org/apache/stanbol/enhancer/nlp/json/valuetype/impl/DependencyRelationSupport.java?rev=1559644&r1=1559643&r2=1559644&view=diff
==============================================================================
--- 
stanbol/trunk/enhancer/generic/nlp-json/src/main/java/org/apache/stanbol/enhancer/nlp/json/valuetype/impl/DependencyRelationSupport.java
 (original)
+++ 
stanbol/trunk/enhancer/generic/nlp-json/src/main/java/org/apache/stanbol/enhancer/nlp/json/valuetype/impl/DependencyRelationSupport.java
 Mon Jan 20 08:38:04 2014
@@ -41,7 +41,7 @@ public class DependencyRelationSupport i
 
     private static final String RELATION_TYPE_TAG = "tag";
     private static final String RELATION_STANBOL_TYPE_TAG = "relationType";
-    private static final String RELATION_IS_DEPENDEE_TAG = "isDependent";
+    private static final String RELATION_IS_DEPENDENT_TAG = "isDependent";
     private static final String RELATION_PARTNER_TYPE_TAG = "partnerType";
     private static final String RELATION_PARTNER_START_TAG = "partnerStart";
     private static final String RELATION_PARTNER_END_TAG = "partnerEnd";
@@ -54,7 +54,7 @@ public class DependencyRelationSupport i
         GrammaticalRelationTag gramRelTag = 
relation.getGrammaticalRelationTag();
         jDependencyRelation.put(RELATION_TYPE_TAG, gramRelTag.getTag());
         jDependencyRelation.put(RELATION_STANBOL_TYPE_TAG, 
gramRelTag.getGrammaticalRelation().ordinal());
-        jDependencyRelation.put(RELATION_IS_DEPENDEE_TAG, 
(relation.isDependent()));
+        jDependencyRelation.put(RELATION_IS_DEPENDENT_TAG, 
(relation.isDependent()));
 
         Span partner = relation.getPartner();
         if (partner != null) {
@@ -90,7 +90,7 @@ public class DependencyRelationSupport i
         GrammaticalRelationTag gramRelTag = new 
GrammaticalRelationTag(tag.getTextValue(),
                 grammaticalRelation);
 
-        JsonNode isDependent = 
jDependencyRelation.path(RELATION_IS_DEPENDEE_TAG);
+        JsonNode isDependent = 
jDependencyRelation.path(RELATION_IS_DEPENDENT_TAG);
 
         if (!isDependent.isBoolean()) {
             throw new IllegalStateException("Field 'isDependent' must have a 
true/false format");

Modified: 
stanbol/trunk/enhancer/generic/nlp-json/src/test/java/org/apache/stanbol/enhancer/nlp/json/valuetype/CorefFeatureSupportTest.java
URL: 
http://svn.apache.org/viewvc/stanbol/trunk/enhancer/generic/nlp-json/src/test/java/org/apache/stanbol/enhancer/nlp/json/valuetype/CorefFeatureSupportTest.java?rev=1559644&r1=1559643&r2=1559644&view=diff
==============================================================================
--- 
stanbol/trunk/enhancer/generic/nlp-json/src/test/java/org/apache/stanbol/enhancer/nlp/json/valuetype/CorefFeatureSupportTest.java
 (original)
+++ 
stanbol/trunk/enhancer/generic/nlp-json/src/test/java/org/apache/stanbol/enhancer/nlp/json/valuetype/CorefFeatureSupportTest.java
 Mon Jan 20 08:38:04 2014
@@ -81,11 +81,11 @@ public class CorefFeatureSupportTest ext
         Set<Span> obamaMentions = new HashSet<Span>();
         obamaMentions.add(he);
         obama.addAnnotation(NlpAnnotations.COREF_ANNOTATION, 
-               Value.value(new CorefFeature(true, 
Collections.unmodifiableSet(obamaMentions))));
+               Value.value(new CorefFeature(true, obamaMentions)));
         
         Set<Span> heMentions = new HashSet<Span>();
         heMentions.add(obama);
         he.addAnnotation(NlpAnnotations.COREF_ANNOTATION, 
-               Value.value(new CorefFeature(false, 
Collections.unmodifiableSet(heMentions))));
+               Value.value(new CorefFeature(false, heMentions)));
        }
 }

Modified: 
stanbol/trunk/enhancer/generic/nlp-json/src/test/java/org/apache/stanbol/enhancer/nlp/json/valuetype/DependencyRelationSupportTest.java
URL: 
http://svn.apache.org/viewvc/stanbol/trunk/enhancer/generic/nlp-json/src/test/java/org/apache/stanbol/enhancer/nlp/json/valuetype/DependencyRelationSupportTest.java?rev=1559644&r1=1559643&r2=1559644&view=diff
==============================================================================
--- 
stanbol/trunk/enhancer/generic/nlp-json/src/test/java/org/apache/stanbol/enhancer/nlp/json/valuetype/DependencyRelationSupportTest.java
 (original)
+++ 
stanbol/trunk/enhancer/generic/nlp-json/src/test/java/org/apache/stanbol/enhancer/nlp/json/valuetype/DependencyRelationSupportTest.java
 Mon Jan 20 08:38:04 2014
@@ -2,7 +2,6 @@ package org.apache.stanbol.enhancer.nlp.
 
 import java.io.IOException;
 
-import org.apache.commons.io.FilenameUtils;
 import org.apache.stanbol.enhancer.nlp.NlpAnnotations;
 import org.apache.stanbol.enhancer.nlp.dependency.DependencyRelation;
 import org.apache.stanbol.enhancer.nlp.dependency.GrammaticalRelation;
@@ -25,7 +24,7 @@ public class DependencyRelationSupportTe
            + "    \"end\" : 5," + LINE_SEPARATOR
            + "    \"stanbol.enhancer.nlp.dependency\" : {" + LINE_SEPARATOR
            + "      \"tag\" : \"nsubj\"," + LINE_SEPARATOR
-           + "      \"relationType\" : 32," + LINE_SEPARATOR
+           + "      \"relationType\" : 33," + LINE_SEPARATOR
            + "      \"isDependent\" : true," + LINE_SEPARATOR
            + "      \"partnerType\" : \"Token\"," + LINE_SEPARATOR
            + "      \"partnerStart\" : 6," + LINE_SEPARATOR
@@ -40,7 +39,7 @@ public class DependencyRelationSupportTe
            + "    \"end\" : 13," + LINE_SEPARATOR
            + "    \"stanbol.enhancer.nlp.dependency\" : [ {" + LINE_SEPARATOR
            + "      \"tag\" : \"root\"," + LINE_SEPARATOR
-           + "      \"relationType\" : 56," + LINE_SEPARATOR
+           + "      \"relationType\" : 57," + LINE_SEPARATOR
            + "      \"isDependent\" : true," + LINE_SEPARATOR
            + "      \"partnerType\" : \"ROOT\"," + LINE_SEPARATOR
            + "      \"partnerStart\" : 0," + LINE_SEPARATOR
@@ -48,7 +47,7 @@ public class DependencyRelationSupportTe
            + "      \"class\" : 
\"org.apache.stanbol.enhancer.nlp.dependency.DependencyRelation\"" + 
LINE_SEPARATOR
            + "    }, {" + LINE_SEPARATOR
            + "      \"tag\" : \"nsubj\"," + LINE_SEPARATOR
-           + "      \"relationType\" : 32," + LINE_SEPARATOR
+           + "      \"relationType\" : 33," + LINE_SEPARATOR
            + "      \"isDependent\" : false," + LINE_SEPARATOR
            + "      \"partnerType\" : \"Token\"," + LINE_SEPARATOR
            + "      \"partnerStart\" : 0," + LINE_SEPARATOR

Modified: 
stanbol/trunk/enhancer/generic/nlp/src/main/java/org/apache/stanbol/enhancer/nlp/coref/CorefFeature.java
URL: 
http://svn.apache.org/viewvc/stanbol/trunk/enhancer/generic/nlp/src/main/java/org/apache/stanbol/enhancer/nlp/coref/CorefFeature.java?rev=1559644&r1=1559643&r2=1559644&view=diff
==============================================================================
--- 
stanbol/trunk/enhancer/generic/nlp/src/main/java/org/apache/stanbol/enhancer/nlp/coref/CorefFeature.java
 (original)
+++ 
stanbol/trunk/enhancer/generic/nlp/src/main/java/org/apache/stanbol/enhancer/nlp/coref/CorefFeature.java
 Mon Jan 20 08:38:04 2014
@@ -42,19 +42,13 @@ public class CorefFeature {
         */
        private Set<Span> mentions;
 
-       public CorefFeature() {
-               this(false, Collections.unmodifiableSet(Collections
-                               .<Span> emptySet()));
-       }
-
-       public CorefFeature(boolean isRepresentative) {
-               this(isRepresentative, Collections.unmodifiableSet(Collections
-                               .<Span> emptySet()));
-       }
-
        public CorefFeature(boolean isRepresentative, Set<Span> mentions) {
+               if (mentions == null || mentions.isEmpty()) {
+                       throw new IllegalArgumentException("The mentions set 
cannot be null or empty");
+               }
+               
                this.isRepresentative = isRepresentative;
-               this.mentions = mentions;
+               this.mentions = Collections.unmodifiableSet(mentions);
        }
 
        /**
@@ -78,11 +72,25 @@ public class CorefFeature {
        }
 
        public int hashCode() {
-               return (this.mentions != null) ? this.mentions.hashCode() : 0;
+               final int prime = 31;
+        int result = 1;
+        result = prime * result + (isRepresentative ? 1231 : 1237);
+        result = prime * result + mentions.hashCode();
+               
+        return result;
        }
 
        public boolean equals(Object obj) {
-               return (obj instanceof CorefFeature)
-                               && (this.mentions.equals(((CorefFeature) 
obj).getMentions()));
+               if (this == obj)
+                       return true;
+               if (obj == null)
+                       return false;
+               if (getClass() != obj.getClass())
+            return false;
+               
+        CorefFeature other = (CorefFeature) obj;
+        
+               return (isRepresentative == other.isRepresentative)
+                       && (mentions.equals(other.mentions));
        }
 }

Modified: 
stanbol/trunk/enhancer/generic/nlp/src/main/java/org/apache/stanbol/enhancer/nlp/dependency/DependencyRelation.java
URL: 
http://svn.apache.org/viewvc/stanbol/trunk/enhancer/generic/nlp/src/main/java/org/apache/stanbol/enhancer/nlp/dependency/DependencyRelation.java?rev=1559644&r1=1559643&r2=1559644&view=diff
==============================================================================
--- 
stanbol/trunk/enhancer/generic/nlp/src/main/java/org/apache/stanbol/enhancer/nlp/dependency/DependencyRelation.java
 (original)
+++ 
stanbol/trunk/enhancer/generic/nlp/src/main/java/org/apache/stanbol/enhancer/nlp/dependency/DependencyRelation.java
 Mon Jan 20 08:38:04 2014
@@ -45,6 +45,10 @@ public class DependencyRelation {
 
        public DependencyRelation(GrammaticalRelationTag 
grammaticalRelationTag, boolean isDependent,
                        Span partner) {
+               if (grammaticalRelationTag == null) {
+                       throw new IllegalArgumentException("The grammatical 
relation tag cannot be null");
+               }
+               
                this.grammaticalRelationTag = grammaticalRelationTag;
                this.isDependent = isDependent;
                this.partner = partner;
@@ -61,17 +65,12 @@ public class DependencyRelation {
        public Span getPartner() {
                return this.partner;
        }
-
-       public void setPartner(Span partner) {
-        this.partner = partner;
-    }
        
     @Override
     public int hashCode() {
         final int prime = 31;
         int result = 1;
-        result = prime * result + ((grammaticalRelationTag == null) ? 0
-                        : grammaticalRelationTag.hashCode());
+        result = prime * result + grammaticalRelationTag.hashCode();
         result = prime * result + (isDependent ? 1231 : 1237);
         result = prime * result + ((partner == null) ? 0 : partner.hashCode());
         return result;
@@ -85,19 +84,16 @@ public class DependencyRelation {
             return false;
         if (getClass() != obj.getClass())
             return false;
+        
         DependencyRelation other = (DependencyRelation) obj;
-        if (grammaticalRelationTag == null) {
-            if (other.grammaticalRelationTag != null)
-                return false;
-        } else if 
(!grammaticalRelationTag.equals(other.grammaticalRelationTag))
-            return false;
-        if (isDependent != other.isDependent)
-            return false;
+        
         if (partner == null) {
             if (other.partner != null)
                 return false;
         } else if (!partner.equals(other.partner))
             return false;
-        return true;
+        
+        return (grammaticalRelationTag.equals(other.grammaticalRelationTag))
+               && (isDependent == other.isDependent);
     }
 }

Modified: 
stanbol/trunk/enhancer/generic/nlp/src/main/java/org/apache/stanbol/enhancer/nlp/dependency/GrammaticalRelation.java
URL: 
http://svn.apache.org/viewvc/stanbol/trunk/enhancer/generic/nlp/src/main/java/org/apache/stanbol/enhancer/nlp/dependency/GrammaticalRelation.java?rev=1559644&r1=1559643&r2=1559644&view=diff
==============================================================================
--- 
stanbol/trunk/enhancer/generic/nlp/src/main/java/org/apache/stanbol/enhancer/nlp/dependency/GrammaticalRelation.java
 (original)
+++ 
stanbol/trunk/enhancer/generic/nlp/src/main/java/org/apache/stanbol/enhancer/nlp/dependency/GrammaticalRelation.java
 Mon Jan 20 08:38:04 2014
@@ -214,6 +214,17 @@ public enum GrammaticalRelation {
         * raise)
         */
        DirectObject(Object),
+       
+       /**
+        * The "discourse element" grammatical relation. This is used for 
interjections and
+        * other discourse particles and elements (which are not clearly linked 
to the structure
+        * of the sentence, except in an expressive way). We generally follow 
the
+        * guidelines of what the Penn Treebanks count as an INTJ.  They
+        * define this to include: interjections (oh, uh-huh, Welcome), fillers 
(um, ah),
+        * and discourse markers (well, like, actually, but not: you know).
+        * We also use it for emoticons.
+        */
+       Discourse(Modifier),
 
        /**
         * This relation captures an existential &quot;there&quot;. The main 
verb of

Modified: 
stanbol/trunk/enhancer/generic/nlp/src/main/java/org/apache/stanbol/enhancer/nlp/dependency/GrammaticalRelationTag.java
URL: 
http://svn.apache.org/viewvc/stanbol/trunk/enhancer/generic/nlp/src/main/java/org/apache/stanbol/enhancer/nlp/dependency/GrammaticalRelationTag.java?rev=1559644&r1=1559643&r2=1559644&view=diff
==============================================================================
--- 
stanbol/trunk/enhancer/generic/nlp/src/main/java/org/apache/stanbol/enhancer/nlp/dependency/GrammaticalRelationTag.java
 (original)
+++ 
stanbol/trunk/enhancer/generic/nlp/src/main/java/org/apache/stanbol/enhancer/nlp/dependency/GrammaticalRelationTag.java
 Mon Jan 20 08:38:04 2014
@@ -39,6 +39,10 @@ public class GrammaticalRelationTag exte
                        GrammaticalRelation grammaticalRelation) {
                this(tag);
 
+               if (grammaticalRelation == null) {
+                       throw new IllegalArgumentException("The grammatical 
relation cannot be null");
+               }
+               
                this.grammaticalRelation = grammaticalRelation;
        }
 
@@ -48,7 +52,11 @@ public class GrammaticalRelationTag exte
 
        @Override
        public int hashCode() {
-               return super.hashCode() + grammaticalRelation.hashCode();
+               final int prime = 31;
+        int result = super.hashCode();
+        result = prime * result + grammaticalRelation.hashCode();
+        
+        return result;
        }
 
        @Override

Modified: 
stanbol/trunk/enhancer/generic/servicesapi/src/main/java/org/apache/stanbol/enhancer/servicesapi/ContentItem.java
URL: 
http://svn.apache.org/viewvc/stanbol/trunk/enhancer/generic/servicesapi/src/main/java/org/apache/stanbol/enhancer/servicesapi/ContentItem.java?rev=1559644&r1=1559643&r2=1559644&view=diff
==============================================================================
--- 
stanbol/trunk/enhancer/generic/servicesapi/src/main/java/org/apache/stanbol/enhancer/servicesapi/ContentItem.java
 (original)
+++ 
stanbol/trunk/enhancer/generic/servicesapi/src/main/java/org/apache/stanbol/enhancer/servicesapi/ContentItem.java
 Mon Jan 20 08:38:04 2014
@@ -39,6 +39,8 @@ public interface ContentItem {
      * The binary content stream. Shortcut for
      * <code>{@link #getBlob()}{@link Blob#getStream() .getStream()}</code>
      * @return the InputStream
+     * @deprecated use <code>{@link #getBlob()}{@link Blob#getStream() 
.getStream()}</code>
+     * instead
      */
     InputStream getStream();
 
@@ -46,6 +48,8 @@ public interface ContentItem {
      * The MimeType. Shortcut for
      * <code>{@link #getBlob()}{@link Blob#getMimeType() 
.getMimeType()}</code>.
      * @return the MimeType as string
+     * @deprecated use <code>{@link #getBlob()}{@link Blob#getMimeType() 
.getMimeType()}</code>
+     * instead
      */
     String getMimeType();
 

Modified: 
stanbol/trunk/enhancer/generic/servicesapi/src/main/java/org/apache/stanbol/enhancer/servicesapi/EnhancementEngine.java
URL: 
http://svn.apache.org/viewvc/stanbol/trunk/enhancer/generic/servicesapi/src/main/java/org/apache/stanbol/enhancer/servicesapi/EnhancementEngine.java?rev=1559644&r1=1559643&r2=1559644&view=diff
==============================================================================
--- 
stanbol/trunk/enhancer/generic/servicesapi/src/main/java/org/apache/stanbol/enhancer/servicesapi/EnhancementEngine.java
 (original)
+++ 
stanbol/trunk/enhancer/generic/servicesapi/src/main/java/org/apache/stanbol/enhancer/servicesapi/EnhancementEngine.java
 Mon Jan 20 08:38:04 2014
@@ -16,6 +16,8 @@
 */
 package org.apache.stanbol.enhancer.servicesapi;
 
+import java.util.Map;
+
 /**
  * Interface to internal or external semantic enhancement engines. There will
  * usually be several of those, that the EnhancementJobManager uses to enhance
@@ -36,13 +38,13 @@ public interface EnhancementEngine {
     /**
      * Return value for {@link #canEnhance}, meaning this engine can enhance
      * supplied {@link ContentItem}, and suggests enhancing it synchronously
-     * instead of queuing a request for enhancement.
+     * instead of queueing a request for enhancement.
      */
     int ENHANCE_SYNCHRONOUS = 1;
 
     /**
      * Return value for {@link #canEnhance}, meaning this engine can enhance
-     * supplied {@link ContentItem}, and suggests queuing a request for
+     * supplied {@link ContentItem}, and suggests queueing a request for
      * enhancement instead of enhancing it synchronously.
      */
     int ENHANCE_ASYNC = 2;
@@ -52,23 +54,46 @@ public interface EnhancementEngine {
      * suggests enhancing it synchronously or asynchronously. The
      * {@link EnhancementJobManager} can force sync/async mode if desired, it 
is
      * just a suggestion from the engine.
+     * <p>
+     * This method is expected to execute fast and MUST NOT change the parsed
+     * {@link ContentItem}. It is called with a read lock on the ContentItem.
+     * <p>
+     * <b>NOTE:</b> Returning {@link #CANNOT_ENHANCE} will cause the 
+     * {@link EnhancementJobManager} to skip the execution of this Engine. If
+     * an {@link EngineException} is thrown the executed {@link Chain} will
+     * fail (unless this engine is marked as OPTIONAL).
+     *
+     * @param ci The ContentItem to enhance
+     * @param context The enhancement context: Request specific parameters
      *
      * @throws EngineException if the introspecting process of the content item
      *             fails
      */
     int canEnhance(ContentItem ci) throws EngineException;
+    //int canEnhance(ContentItem ci, Map<String,Object> context) throws 
EngineException;
 
     /**
      * Compute enhancements for supplied ContentItem. The results of the 
process
-     * are expected to be stored in the metadata of the content item.
+     * are expected to be stored in the {@link ContentItem#getMetadata() 
metadata 
+     * of the content item} or by adding/modifying any contentPart.<p>
+     * Engines that do support {@link #ENHANCE_ASYNC} are required to use the
+     * {@link ContentItem#getLock()} to acquire read/write locks when reading/
+     * modifying information of the {@link ContentItem}. For Engines that that
+     * do use {@link #ENHANCE_SYNCHRONOUS} the {@link EnhancementJobManager}
+     * is responsible to acquire a write lock before calling this method. 
+     * <p>
+     * <b>NOTE</b>: If an EnhancementEngine can not extract any information it
+     * is expected to return. In case an error is encountered during processing
+     * an {@link EngineException} need to be thrown.
      *
-     * The client (usually an {@link EnhancementJobManager}) should take care 
of
-     * persistent storage of the enhanced {@link ContentItem}.
+     * @param ci The ContentItem to enhance
+     * @param context The enhancement context: Request specific parameters
      *
      * @throws EngineException if the underlying process failed to work as
      *             expected
      */
     void computeEnhancements(ContentItem ci) throws EngineException;
+    //void computeEnhancements(ContentItem ci, Map<String,Object> context) 
throws EngineException;
     /**
      * Getter for the name of this EnhancementEngine instance as configured
      * by {@link #PROPERTY_NAME}


Reply via email to