Hi, an EnhancementEngine MUST only be called if all other Engines that it depends on have completed. This also includes the canEnhancement method. Therefore it is guaranteed that all information required by the Engine are already present on the call to canEnhance(..).
That said, most current EnhancementEngines do repeat checks of the canEnhance(..) methods with the call to computeEnhancement(..). While this would not be necessary based on the above definition it was still very useful in debugging EnhancementJobManager implementations. Regarding Exceptions: Engines are supposed to throw an EngineException if they encounter an error during enhancing a ContentItem. This is true for the canEnhance and the computeEnhancement method. So if an Engine can detect some Error in the canEnhance method, that it can throw this error early in the canEnhance(..) method. If it can not enhance the ContentItem (e.g. because the configuration defines that is should not process the current language) than an engine should just return CANNOT_ENHANCE. Hope this makes the intension more clear. Also have a look at the documentation of EnhancementEngines [1] and the EnhancementJobManager [2]. best Rupert [1] http://stanbol.apache.org/docs/trunk/components/enhancer/engines/ [2] http://stanbol.apache.org/docs/trunk/components/enhancer/enhancementjobmanager.html On Sun, Mar 3, 2013 at 7:38 AM, Reto Bachmann-Gmür <[email protected]> wrote: > Hello > > I have some uncertainties understanding > EnhancementEngine.canEnhance(ContentItem). > > When is this method called? Is it called immediately before > computeEnhancements or might other enhancement engines be called in > between? If the latter is the case then the ability to enhance an item > might depend on the items invoked in between. So is it ok to say first that > we can enhance and then throw an InvalidContentException on > computeEnhancement? > > Cheers, > Reto -- | Rupert Westenthaler [email protected] | Bodenlehenstraße 11 ++43-699-11108907 | A-5500 Bischofshofen
