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 ClassLoader
getClassLoader()
Returns the currentClassLoader
used to instantiate objects in thenewInstance(Class)
method.String
getClassName()
Returns the class name of the configured bean.static ClassLoader
getDefaultClassLoader()
Returns the currentClassLoader
used for new instances of this class as the loader used to instantiate objects in thenewInstance(Class)
method.Properties
getParameters()
Returns the initial properties of the configured bean.<T> T
newInstance(Class<T> klass)
Creates a new instance of the configured bean class.void
setClassLoader(ClassLoader classLoader)
Sets theClassLoader
used to instantiate objects in thenewInstance(Class)
method.void
setConnectionFactory(ConnectionFactory connectionFactory)
static void
setDefaultClassLoader(ClassLoader classLoader)
Sets theClassLoader
used for new instances of this class as the loader to instantiate objects in thenewInstance(Class)
method.void
setInstanceFactory(BeanFactory instanceFactory)
protected void
setValidate(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
- theConnectionFactory
to inject (if possible) in thenewInstance(Class)
method
-
setInstanceFactory
public void setInstanceFactory(BeanFactory instanceFactory)
- Parameters:
instanceFactory
- theBeanFactory
to 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 currentClassLoader
used to instantiate objects in thenewInstance(Class)
method.
-
setClassLoader
public void setClassLoader(ClassLoader classLoader)
Sets theClassLoader
used to instantiate objects in thenewInstance(Class)
method.- Parameters:
classLoader
- The class loader to set on this instance. If this isnull
the 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 currentClassLoader
used 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 theClassLoader
used 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 isnull
the system class loader will be used, which may lead to unexpected class loading failures.- See Also:
getClassLoader()
,setClassLoader(ClassLoader)
,getDefaultClassLoader()
-
-