...
Loading the report definition from an XML file hasnt hasn't changed much.
Instead of using the ReportFactory
, we now use a centralized ResourceManager
. That resource manager handles all load-operations. It keeps track of changes to the underlying files and tries to apply as much caching as possible. The resource-manager is contained in LibLoader.
...
The resource manager provides resource-objects, which grant access to some additional meta-data. The first parameter of the 'create' operation is the source object. This can be anything, like an URL, a File (or a string representation of those) or a byte containing the raw-data. Resources stored on the classpath can be accessed using the String "res:/package/file.name".
You may want to have a look at the sources of the libloader, especially the subpackages file, raw, resource and zip of the package org.jfree.resourceloader.loader and the code of the method org.jfree.resourceloader.ResourceManager.registerDefaultLoaders() in order to understand the resource handling better.
There are ResourceLoaders for reading from Files, from the Classloader, from given byte[] arrays and from zip archives (i.e. jar files). You can register your own implementations of ResourceLoader and AbstractResourceData in order to add other sources.
Code Block |
---|
Resource res = manager.createDirectly(source, JFreeReport.class); |
...