Hi
First I need to ask if you use Windows? Because there is currently an Issue with the BundleDataFile on Windows systems. On Wed, Jul 13, 2011 at 6:54 PM, Alessandro Adamou <[email protected]> wrote: > I have another question: > > How can I use the DataFileProvider to obtain a java.io.File object that is a > Directory (isDirectory() returns true)? > The DataFileProvider can not return directories. If you need a functionality like this I suggest to use a Zip archive, get the InputStream, create an ArchiveInputStream and than read the entries directly form this. > This would help a lot for the Ontonet offline mode. > >> >> I'm not getting this to work on my new module (in the sandbox). >> >> so I have my explanation bundle >> and its pom.xml has the instruction >> >> <Data-Files> >> schemas, >> schemas/registry >> </Data-Files> I have never tried this with additional spaces and line breaks. Maybe try <Data-Files>schemas,schemas/registry</Data-Files> But because most users will write it like this I will definitely test this and if currently not working add support for this. >> >> these directories exist in the explanation src/main/resources dir >> and there is a file schemas/test.owl >> >> Then I have a class in the same bundle. It references the datafile >> provider like this >> >> @Reference >> private DataFileProvider dataFileProvider; >> >> Then in that class I do >> >> Map<String,String> modelProperties = new >> HashMap<String,String>(); >> modelProperties.put("Description", "Test ontology"); >> InputStream is = dataFileProvider.getInputStream(null, >> "test.owl", >> modelProperties); >> The properties files are intended to aid users in explaining why this file is needed and how to obtain it. If you do not have such information you can also parse null or an empty map. >> and I'm getting IOExceptions and these log entries in a row >> >> 13.07.2011 18:30:12.569 *INFO* [FelixStartLevel] >> org.apache.stanbol.commons.stanboltools.datafileprovider.bundle.impl.BundleDataFileProvider >> Resource NOT found: test.owl >> 13.07.2011 18:30:12.569 *INFO* [FelixStartLevel] >> org.apache.stanbol.commons.stanboltools.datafileprovider.bundle.impl.BundleDataFileProvider >> Resource NOT found: test.owl >> 13.07.2011 18:30:12.569 *INFO* [FelixStartLevel] >> org.apache.stanbol.commons.stanboltools.datafileprovider.bundle.impl.BundleDataFileProvider >> Resource NOT found: test.owl >> >> Why? >> The MainDataFileProvider will always throw IO Exceptions if a resource is not found. best Rupert Westenthaler -- | Rupert Westenthaler [email protected] | Bodenlehenstraße 11 ++43-699-11108907 | A-5500 Bischofshofen
