Class DefaultExtensionsRegistry
- All Implemented Interfaces:
ExtensionsRegistry
extension registry implementation.
The implementation builds an extension registry by scanning the context
classloader for resources named jasperreports_extension.properties.
Each such resource is loaded as a properties file, and properties that start
with net.sf.jasperreports.extension.registry.factory. are identified.
Each such property should have as value the name of a
ExtensionsRegistryFactory implementation. The registry factory class is
instantiated, and
ExtensionsRegistryFactory.createRegistry(String, JRPropertiesMap)
is called on it, using the property suffix as registry ID and passing the
properties map. The registry factory can collect properties that apply to the
specific registry by using a property prefix obtain by appending the registry ID
to "net.sf.jasperreports.extension.".
If instantiating an extension registry results in an exception, the registry is skipped and an error message is logged.
- Author:
- Lucian Chirita (lucianc@users.sourceforge.net)
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDefault extension weight.static final StringThe name of property file resources that are used to load JasperReports extensions.static final StringThe property prefix of extension registry factories.static final StringA prefix that can be used to provide registry-specific properties, by appending the registry ID and a fixed property suffix to it.static final StringA numerical weight to use for extensions created by a registry. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected URLdetectDuplicate(JRPropertiesMap properties, Map<URL, DefaultExtensionsRegistry.URLRegistries> registries) protected Map<URL, DefaultExtensionsRegistry.URLRegistries> getClassLoaderRegistries(ClassLoader classLoader) <T> List<T> getExtensions(Class<T> extensionType) Returns a list of extension objects for a specific extension type.protected List<ExtensionsRegistry> protected ExtensionsRegistryinstantiateRegistry(JRPropertiesMap props, String registryId, String factoryClass) protected List<ClassLoaderResource> protected List<ExtensionsRegistry> protected List<LoadedRegistry> loadRegistries(JRPropertiesMap properties, Map<String, Exception> registryExceptions)
-
Field Details
-
EXTENSION_RESOURCE_NAME
The name of property file resources that are used to load JasperReports extensions.- See Also:
-
PROPERTY_REGISTRY_FACTORY_PREFIX
The property prefix of extension registry factories.- See Also:
-
PROPERTY_REGISTRY_PREFIX
A prefix that can be used to provide registry-specific properties, by appending the registry ID and a fixed property suffix to it.- See Also:
-
PROPERTY_REGISTRY_WEIGHT_PREFIX
A numerical weight to use for extensions created by a registry. Extensions with bigger weights take precedence.- See Also:
-
DEFAULT_EXTENSION_WEIGHT
public static final int DEFAULT_EXTENSION_WEIGHTDefault extension weight.- See Also:
-
-
Constructor Details
-
DefaultExtensionsRegistry
public DefaultExtensionsRegistry()
-
-
Method Details
-
getExtensions
Description copied from interface:ExtensionsRegistryReturns a list of extension objects for a specific extension type.- Specified by:
getExtensionsin interfaceExtensionsRegistry- Type Parameters:
T- generic extension type- Parameters:
extensionType- the extension type- Returns:
- a list of extension objects
-
getRegistries
-
loadRegistries
-
loadExtensionPropertyResources
-
getClassLoaderRegistries
protected Map<URL,DefaultExtensionsRegistry.URLRegistries> getClassLoaderRegistries(ClassLoader classLoader) -
loadRegistries
protected List<LoadedRegistry> loadRegistries(JRPropertiesMap properties, Map<String, Exception> registryExceptions) -
instantiateRegistry
protected ExtensionsRegistry instantiateRegistry(JRPropertiesMap props, String registryId, String factoryClass) -
detectDuplicate
protected URL detectDuplicate(JRPropertiesMap properties, Map<URL, DefaultExtensionsRegistry.URLRegistries> registries)
-