net.sf.jasperreports.extensions
Class DefaultExtensionsRegistry

java.lang.Object
  extended by net.sf.jasperreports.extensions.DefaultExtensionsRegistry
All Implemented Interfaces:
ExtensionsRegistry

public class DefaultExtensionsRegistry
extends Object
implements ExtensionsRegistry

The default 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 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.

Version:
$Id: DefaultExtensionsRegistry.java 5050 2012-03-12 10:11:26Z teodord $
Author:
Lucian Chirita (lucianc@users.sourceforge.net)

Field Summary
static String EXTENSION_RESOURCE_NAME
          The name of property file resources that are used to load JasperReports extensions.
static String PROPERTY_REGISTRY_FACTORY_PREFIX
          The property prefix of extension registry factories.
static 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.
 
Constructor Summary
DefaultExtensionsRegistry()
           
 
Method Summary
protected  Map<URL,List<ExtensionsRegistry>> getClassLoaderRegistries(ClassLoader classLoader)
           
<T> List<T>
getExtensions(Class<T> extensionType)
          Returns a list of extension objects for a specific extension type.
protected  List<ExtensionsRegistry> getRegistries()
           
protected  ExtensionsRegistry instantiateRegistry(JRPropertiesMap props, String registryId, String factoryClass)
           
protected  List<ClassLoaderResource> loadExtensionPropertyResources()
           
protected  List<ExtensionsRegistry> loadRegistries()
           
protected  List<ExtensionsRegistry> loadRegistries(URL url)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EXTENSION_RESOURCE_NAME

public static final 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 String PROPERTY_REGISTRY_FACTORY_PREFIX
The property prefix of extension registry factories.

See Also:
Constant Field Values

PROPERTY_REGISTRY_PREFIX

public static final 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
Constructor Detail

DefaultExtensionsRegistry

public DefaultExtensionsRegistry()
Method Detail

getExtensions

public <T> List<T> getExtensions(Class<T> extensionType)
Description copied from interface: ExtensionsRegistry
Returns a list of extension objects for a specific extension type.

Specified by:
getExtensions in interface ExtensionsRegistry
Type Parameters:
T - generic extension type
Parameters:
extensionType - the extension type
Returns:
a list of extension objects

getRegistries

protected List<ExtensionsRegistry> getRegistries()

loadRegistries

protected List<ExtensionsRegistry> loadRegistries()

loadExtensionPropertyResources

protected List<ClassLoaderResource> loadExtensionPropertyResources()

getClassLoaderRegistries

protected Map<URL,List<ExtensionsRegistry>> getClassLoaderRegistries(ClassLoader classLoader)

loadRegistries

protected List<ExtensionsRegistry> loadRegistries(URL url)

instantiateRegistry

protected ExtensionsRegistry instantiateRegistry(JRPropertiesMap props,
                                                 String registryId,
                                                 String factoryClass)


Copyright © 2012. All Rights Reserved.