Class DefaultExtensionsRegistry
- java.lang.Object
-
- net.sf.jasperreports.extensions.DefaultExtensionsRegistry
-
- All Implemented Interfaces:
ExtensionsRegistry
public class DefaultExtensionsRegistry extends java.lang.Object implements ExtensionsRegistry
The defaultextension registryimplementation.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
ExtensionsRegistryFactoryimplementation. The registry factory class is instantiated, andExtensionsRegistryFactory.createRegistry(String, JRPropertiesMap)is called on it, using the propery 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 Modifier and Type Class Description protected static classDefaultExtensionsRegistry.URLRegistries
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringEXTENSION_RESOURCE_NAMEThe name of property file resources that are used to load JasperReports extensions.static java.lang.StringPROPERTY_REGISTRY_FACTORY_PREFIXThe property prefix of extension registry factories.static java.lang.StringPROPERTY_REGISTRY_PREFIXA prefix that can be used to provide registry-specific properties, by appending the registry ID and a fixed property suffix to it.
-
Constructor Summary
Constructors Constructor Description DefaultExtensionsRegistry()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.net.URLdetectDuplicate(JRPropertiesMap properties, java.util.Map<java.net.URL,DefaultExtensionsRegistry.URLRegistries> registries)protected java.util.Map<java.net.URL,DefaultExtensionsRegistry.URLRegistries>getClassLoaderRegistries(java.lang.ClassLoader classLoader)<T> java.util.List<T>getExtensions(java.lang.Class<T> extensionType)Returns a list of extension objects for a specific extension type.protected java.util.List<ExtensionsRegistry>getRegistries()protected ExtensionsRegistryinstantiateRegistry(JRPropertiesMap props, java.lang.String registryId, java.lang.String factoryClass)protected java.util.List<ClassLoaderResource>loadExtensionPropertyResources()protected java.util.List<ExtensionsRegistry>loadRegistries()protected java.util.List<ExtensionsRegistry>loadRegistries(JRPropertiesMap properties, java.util.Map<java.lang.String,java.lang.Exception> registryExceptions)
-
-
-
Field Detail
-
EXTENSION_RESOURCE_NAME
public static final java.lang.String EXTENSION_RESOURCE_NAME
The name of property file resources that are used to load JasperReports extensions.- See Also:
- Constant Field Values
-
PROPERTY_REGISTRY_FACTORY_PREFIX
public static final java.lang.String PROPERTY_REGISTRY_FACTORY_PREFIX
The property prefix of extension registry factories.- See Also:
- Constant Field Values
-
PROPERTY_REGISTRY_PREFIX
public static final java.lang.String 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:
- Constant Field Values
-
-
Method Detail
-
getExtensions
public <T> java.util.List<T> getExtensions(java.lang.Class<T> extensionType)
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
protected java.util.List<ExtensionsRegistry> getRegistries()
-
loadRegistries
protected java.util.List<ExtensionsRegistry> loadRegistries()
-
loadExtensionPropertyResources
protected java.util.List<ClassLoaderResource> loadExtensionPropertyResources()
-
getClassLoaderRegistries
protected java.util.Map<java.net.URL,DefaultExtensionsRegistry.URLRegistries> getClassLoaderRegistries(java.lang.ClassLoader classLoader)
-
loadRegistries
protected java.util.List<ExtensionsRegistry> loadRegistries(JRPropertiesMap properties, java.util.Map<java.lang.String,java.lang.Exception> registryExceptions)
-
instantiateRegistry
protected ExtensionsRegistry instantiateRegistry(JRPropertiesMap props, java.lang.String registryId, java.lang.String factoryClass)
-
detectDuplicate
protected java.net.URL detectDuplicate(JRPropertiesMap properties, java.util.Map<java.net.URL,DefaultExtensionsRegistry.URLRegistries> registries)
-
-