Use Bundle Extender Pattern to allow Bundles to expose Resource to the 
DataFileProvider
---------------------------------------------------------------------------------------

                 Key: STANBOL-234
                 URL: https://issues.apache.org/jira/browse/STANBOL-234
             Project: Stanbol
          Issue Type: New Feature
          Components: Commons
            Reporter: Rupert Westenthaler
            Assignee: Rupert Westenthaler


If a bundle contains the "Data-Files" header field the values are interpreted 
as paths within the Bundle that contain data files. Multiple paths can be 
defined by using ',' as separator.
A BundleListerner keeps track of all active Bundles with this header and 
registers a DataFileProvider for the configured paths. By this data files 
contained by a Bundle are available via the main DataFileProvider.
In addition the "Data-Files-Priority" header may by used to define the service 
ranking for the DataFileProvider created and registered for this bundle. 
Bundles that provide default data should use a negative value to ensure that 
they get overridden by Bundles that do not define this property. Bundles that 
need to override preexisting data files should use positive values. Note that 
the main DataFileProvider (loading files form the /datafiles folder) uses 
Integer.MAX_VALUE as ranking.

Creating such Bundles can be done by adding 
"<Data-Files>{path1},{path2}</Data-Files>" to the instructions of the 
maven-bundle-plugin


The first place to use this will be the "org.apache.stanbol.defaultdata" bundle 
that provides the minimal set of data needed for the configuration shipped with 
different launchers. Currently it contains the statistical model for OpenNLP.

Current Situation

* The path to the files needs to be hard coded in all bundles using this models 
(currently the opennlp-ner enhancement engine)
* An own Classpath based DataFileProvider must be implemented and registered as 
Service to allow loading that resources via the classpath (while still using 
the DataFileProvider
* Because the DataFileProvider is used additional files can be provided by 
copying Files to the /datafiles folder

By using the proposed Bundle DataFileProvider

* A component may define a dependency to the Bundle containing the required 
data. This ensures that required data are available.
* The component must not do anything to get access to the data, because the 
required DataFileProvider for the Bundle is initialized automatically.
* Default Data can be overridden by specifying the "Data-Files-Priority" header 
for a Bundle. 
* Additional data can be made available automatically by adding an other Bundle 
with the "Data-Files" header or by directly copying Files to the /datafiles 
folder

For more Information on the Bundle Extender Pattern see 
http://www.aqute.biz/Snippets/Extender

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to