[ 
https://issues.apache.org/jira/browse/STANBOL-44?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Rupert Westenthaler resolved STANBOL-44.
----------------------------------------

    Resolution: Fixed

STANBOL-414 provides an alternate solution. (the use of Blobs as content 
parts). Both the MetaxaEngine (STANBOL-478) and the new TikaEngine 
(STANBOL-512) use already the solution introduced by STANBOL-414
                
> Use an adapter pattern in ContentItem
> -------------------------------------
>
>                 Key: STANBOL-44
>                 URL: https://issues.apache.org/jira/browse/STANBOL-44
>             Project: Stanbol
>          Issue Type: Improvement
>          Components: Enhancer
>            Reporter: Fabian Christ
>            Priority: Minor
>
> Reported by project member bdelacretaz, May 26, 2010
> The ContentItem can currently only provide an InputStream for its data, but 
> in some cases other 
> data types (String, RDF graph, etc.) might be convenient.
> As discussed at the hackathon, using an adapter pattern allows us to do this 
> in a flexible way, the 
> ContentItem interface would then look like this:
> public interface ContentItem {
>     /** Unique ID, either supplied by client or generated by FISE */
>     String getId();
>     
>     /** The binary content stream 
>      *        @deprecated use adaptTo(InputStream.class) */ 
>     InputStream getStream();
>     
>     /** Adapt to specified class, for example InputStream, String,
>      *   RDF graph or future raw/formatted content types.
>     *    @return null if not adaptable
>      */
>     <AdapterType> AdapterType adaptTo(Class<AdapterType> type);
>     
>     /** Mime-type of the input stream */
>     String getMimeType();
>     
>     /** Optional metadata */
>     MGraph getMetadata();
> }
> At first adaptTo would only work for InputStream, so it's a minor code 
> change. 
> Later we can add an AdapterFactory service interface to provide more adapters.
> The Sling codebase uses that pattern, see examples there.
> The adaptTo method needs a second parameter for options, probably a Map.
> Use case: adapt to an InputStream with mime type image/jpeg

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to