Class BeanConfig
- java.lang.Object
-
- org.apache.jackrabbit.core.config.BeanConfig
-
- Direct Known Subclasses:
AccessManagerConfig,LoginModuleConfig,PersistenceManagerConfig,SearchConfig,SecurityManagerConfig,UserManagerConfig
public class BeanConfig extends Object
Bean configuration class. BeanConfig instances contain the class name and property information required to instantiate a class that conforms with the JavaBean conventions.
-
-
Constructor Summary
Constructors Constructor Description BeanConfig(String className, Properties properties)Creates a bean configuration.BeanConfig(BeanConfig config)Copies a bean configuration.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ClassLoadergetClassLoader()Returns the currentClassLoaderused to instantiate objects in thenewInstance(Class)method.StringgetClassName()Returns the class name of the configured bean.static ClassLoadergetDefaultClassLoader()Returns the currentClassLoaderused for new instances of this class as the loader used to instantiate objects in thenewInstance(Class)method.PropertiesgetParameters()Returns the initial properties of the configured bean.<T> TnewInstance(Class<T> klass)Creates a new instance of the configured bean class.voidsetClassLoader(ClassLoader classLoader)Sets theClassLoaderused to instantiate objects in thenewInstance(Class)method.voidsetConnectionFactory(ConnectionFactory connectionFactory)static voidsetDefaultClassLoader(ClassLoader classLoader)Sets theClassLoaderused for new instances of this class as the loader to instantiate objects in thenewInstance(Class)method.voidsetInstanceFactory(BeanFactory instanceFactory)protected voidsetValidate(boolean validate)Allows subclasses to control whether the configured bean property names should be validated.
-
-
-
Constructor Detail
-
BeanConfig
public BeanConfig(String className, Properties properties)
Creates a bean configuration. Note that a copy of the given bean properties is stored as a part of the created configuration object. Thus the caller is free to modify the given properties once the configuration object has been created.- Parameters:
className- class name of the beanproperties- initial properties of the bean
-
BeanConfig
public BeanConfig(BeanConfig config)
Copies a bean configuration.- Parameters:
config- the configuration to be copied
-
-
Method Detail
-
setValidate
protected void setValidate(boolean validate)
Allows subclasses to control whether the configured bean property names should be validated.- Parameters:
validate- flag to validate the configured property names
-
setConnectionFactory
public void setConnectionFactory(ConnectionFactory connectionFactory)
- Parameters:
connectionFactory- theConnectionFactoryto inject (if possible) in thenewInstance(Class)method
-
setInstanceFactory
public void setInstanceFactory(BeanFactory instanceFactory)
- Parameters:
instanceFactory- theBeanFactoryto use to create bean instance
-
getClassName
public String getClassName()
Returns the class name of the configured bean.- Returns:
- class name of the bean
-
getParameters
public Properties getParameters()
Returns the initial properties of the configured bean.- Returns:
- initial properties of the bean
-
newInstance
public <T> T newInstance(Class<T> klass) throws ConfigurationException
Creates a new instance of the configured bean class.- Returns:
- new bean instance
- Throws:
ConfigurationException- on bean configuration errors
-
getClassLoader
public ClassLoader getClassLoader()
Returns the currentClassLoaderused to instantiate objects in thenewInstance(Class)method.
-
setClassLoader
public void setClassLoader(ClassLoader classLoader)
Sets theClassLoaderused to instantiate objects in thenewInstance(Class)method.- Parameters:
classLoader- The class loader to set on this instance. If this isnullthe system class loader will be used, which may lead to unexpected class loading failures.- See Also:
getClassLoader(),getDefaultClassLoader(),setDefaultClassLoader(ClassLoader)
-
getDefaultClassLoader
public static ClassLoader getDefaultClassLoader()
Returns the currentClassLoaderused for new instances of this class as the loader used to instantiate objects in thenewInstance(Class)method.
-
setDefaultClassLoader
public static void setDefaultClassLoader(ClassLoader classLoader)
Sets theClassLoaderused for new instances of this class as the loader to instantiate objects in thenewInstance(Class)method.- Parameters:
classLoader- The class loader to set as the default class loader. If this isnullthe system class loader will be used, which may lead to unexpected class loading failures.- See Also:
getClassLoader(),setClassLoader(ClassLoader),getDefaultClassLoader()
-
-