org.apache.jackrabbit.core.config
Class BeanConfig

java.lang.Object
  extended by 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
BeanConfig(BeanConfig config)
          Copies a bean configuration.
BeanConfig(String className, Properties properties)
          Creates a bean configuration.
 
Method Summary
 ClassLoader getClassLoader()
          Returns the current ClassLoader used to instantiate objects in the #newInstance() method.
 String getClassName()
          Returns the class name of the configured bean.
static ClassLoader getDefaultClassLoader()
          Returns the current ClassLoader used for new instances of this class as the loader used to instantiate objects in the #newInstance() 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 the ClassLoader used to instantiate objects in the #newInstance() method.
 void setConnectionFactory(ConnectionFactory connectionFactory)
           
static void setDefaultClassLoader(ClassLoader classLoader)
          Sets the ClassLoader used for new instances of this class as the loader to instantiate objects in the #newInstance() method.
protected  void setValidate(boolean validate)
          Allows subclasses to control whether the configured bean property names should be validated.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 bean
properties - 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 - the ConnectionFactory to inject (if possible) in the #newInstance() method

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 current ClassLoader used to instantiate objects in the #newInstance() method.

See Also:
#newInstance(), setClassLoader(ClassLoader), getDefaultClassLoader(), setDefaultClassLoader(ClassLoader)

setClassLoader

public void setClassLoader(ClassLoader classLoader)
Sets the ClassLoader used to instantiate objects in the #newInstance() method.

Parameters:
classLoader - The class loader to set on this instance. If this is null the system class loader will be used, which may lead to unexpected class loading failures.
See Also:
#newInstance(), getClassLoader(), getDefaultClassLoader(), setDefaultClassLoader(ClassLoader)

getDefaultClassLoader

public static ClassLoader getDefaultClassLoader()
Returns the current ClassLoader used for new instances of this class as the loader used to instantiate objects in the #newInstance() method.

See Also:
#newInstance(), getClassLoader(), setClassLoader(ClassLoader), setDefaultClassLoader(ClassLoader)

setDefaultClassLoader

public static void setDefaultClassLoader(ClassLoader classLoader)
Sets the ClassLoader used for new instances of this class as the loader to instantiate objects in the #newInstance() method.

Parameters:
classLoader - The class loader to set as the default class loader. If this is null the system class loader will be used, which may lead to unexpected class loading failures.
See Also:
#newInstance(), getClassLoader(), setClassLoader(ClassLoader), getDefaultClassLoader()


Copyright © 2004-2010 The Apache Software Foundation. All Rights Reserved.