com.caucho.config
Class Config

java.lang.Object
  extended by com.caucho.config.Config

public class Config
extends java.lang.Object

Facade for Resin's configuration builder.


Constructor Summary
Config()
           
Config(java.lang.ClassLoader loader)
           
 
Method Summary
static void checkCanInstantiate(java.lang.Class beanClass)
          Returns true if the class can be instantiated.
static void checkCanInstantiate(java.lang.Class beanClass, java.lang.Class type)
          Returns true if the class can be instantiated using zero args constructor or constructor that accepts an instance of class passed in type argument
 java.lang.Object configure(java.lang.Object obj, java.io.InputStream is)
          Configures a bean with a configuration file.
 java.lang.Object configure(java.lang.Object obj, java.io.InputStream is, Schema schema)
          Configures a bean with a configuration file.
 java.lang.Object configure(java.lang.Object obj, java.io.InputStream is, java.lang.String schemaLocation)
          Configures a bean with a configuration file.
 java.lang.Object configure(java.lang.Object obj, org.w3c.dom.Node topNode)
          Configures a bean with a DOM.
 java.lang.Object configure(java.lang.Object obj, Path path)
          Configures a bean with a configuration file.
 java.lang.Object configure(java.lang.Object obj, Path path, Schema schema)
          Configures a bean with a configuration file and schema.
 java.lang.Object configure(java.lang.Object obj, Path path, java.lang.String schemaLocation)
          Configures a bean with a configuration file and schema.
 void configureBean(java.lang.Object obj, org.w3c.dom.Node topNode)
          Configures a bean with a DOM.
 void configureBean(java.lang.Object obj, Path path)
          Configures a bean with a configuration file and schema.
 void configureBean(java.lang.Object obj, Path path, Schema schema)
          Configures a bean with a configuration file and schema.
 void configureBean(java.lang.Object obj, Path path, java.lang.String schemaLocation)
          Configures a bean with a configuration file and schema.
static java.lang.RuntimeException createLine(java.lang.String systemId, int line, java.lang.Throwable e)
           
static ConfigException error(java.lang.reflect.Field field, java.lang.String msg)
           
static ConfigException error(java.lang.reflect.Method method, java.lang.String msg)
           
static boolean evalBoolean(java.lang.String str)
          Evaluates an EL boolean in the context.
static java.lang.String evalString(java.lang.String str)
          Evaluates an EL string in the context.
static java.lang.String evalString(java.lang.String str, java.util.HashMap<java.lang.String,java.lang.Object> varMap)
          Evaluates an EL string in the context.
static com.caucho.config.Config.ConfigProperties getConfigProperties()
           
static java.lang.Object getCurrentVar(java.lang.String var)
          Sets an EL configuration variable.
static ConfigELContext getELContext()
          Returns the variable resolver.
static java.lang.Object getElVar(java.lang.String var)
           
static ELContext getEnvironment()
          Returns the variable resolver.
static ELContext getEnvironment(java.util.HashMap<java.lang.String,java.lang.Object> varMap)
           
static java.lang.Object getProperty(java.lang.String key)
          Returns an environment property
static void init(java.lang.Object bean)
           
static void inject(java.lang.Object bean)
           
 boolean isEL()
          True if EL expressions are allowed
 boolean isIgnoreEnvironment()
          True if environment tags are ignored
static java.lang.String location(java.lang.reflect.Field field)
           
static java.lang.String location(java.lang.reflect.Method method)
           
static java.lang.Object replaceObject(java.lang.Object bean)
           
static void setAttribute(java.lang.Object obj, java.lang.String attr, java.lang.Object value)
          Sets an attribute with a value.
 void setEL(boolean isEL)
          True if EL expressions are allowed
 void setIgnoreEnvironment(boolean isIgnore)
          True if environment tags are ignored
static void setProperty(java.lang.String key, java.lang.Object value)
          Sets a environment property
static void setProperty(java.lang.String key, java.lang.Object value, java.lang.ClassLoader loader)
          Sets a environment property
 void setResinInclude(boolean useResinInclude)
          Set true if resin:include should be allowed.
static void setStringAttribute(java.lang.Object obj, java.lang.String attr, java.lang.String value)
          Sets an attribute with a value.
static void validate(java.lang.Class cl, java.lang.Class api)
          Returns true if the class can be instantiated.
static void validate(java.lang.Class cl, java.lang.Class api, java.lang.Class type)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Config

public Config()

Config

public Config(java.lang.ClassLoader loader)
Parameters:
loader - the class loader environment to use.
Method Detail

setResinInclude

public void setResinInclude(boolean useResinInclude)
Set true if resin:include should be allowed.


isEL

public boolean isEL()
True if EL expressions are allowed


setEL

public void setEL(boolean isEL)
True if EL expressions are allowed


isIgnoreEnvironment

public boolean isIgnoreEnvironment()
True if environment tags are ignored


setIgnoreEnvironment

public void setIgnoreEnvironment(boolean isIgnore)
True if environment tags are ignored


getProperty

public static java.lang.Object getProperty(java.lang.String key)
Returns an environment property


getConfigProperties

public static com.caucho.config.Config.ConfigProperties getConfigProperties()

setProperty

public static void setProperty(java.lang.String key,
                               java.lang.Object value)
Sets a environment property


setProperty

public static void setProperty(java.lang.String key,
                               java.lang.Object value,
                               java.lang.ClassLoader loader)
Sets a environment property


configure

public java.lang.Object configure(java.lang.Object obj,
                                  Path path)
                           throws ConfigException,
                                  java.io.IOException
Configures a bean with a configuration file.

Throws:
ConfigException
java.io.IOException

configure

public java.lang.Object configure(java.lang.Object obj,
                                  java.io.InputStream is)
                           throws java.lang.Exception
Configures a bean with a configuration file.

Throws:
java.lang.Exception

configure

public java.lang.Object configure(java.lang.Object obj,
                                  Path path,
                                  java.lang.String schemaLocation)
                           throws ConfigException
Configures a bean with a configuration file and schema.

Throws:
ConfigException

configure

public java.lang.Object configure(java.lang.Object obj,
                                  Path path,
                                  Schema schema)
                           throws ConfigException
Configures a bean with a configuration file and schema.

Throws:
ConfigException

configure

public java.lang.Object configure(java.lang.Object obj,
                                  java.io.InputStream is,
                                  java.lang.String schemaLocation)
                           throws java.lang.Exception
Configures a bean with a configuration file.

Throws:
java.lang.Exception

configure

public java.lang.Object configure(java.lang.Object obj,
                                  java.io.InputStream is,
                                  Schema schema)
                           throws java.lang.Exception
Configures a bean with a configuration file.

Throws:
java.lang.Exception

configure

public java.lang.Object configure(java.lang.Object obj,
                                  org.w3c.dom.Node topNode)
                           throws java.lang.Exception
Configures a bean with a DOM.

Throws:
java.lang.Exception

configureBean

public void configureBean(java.lang.Object obj,
                          Path path,
                          java.lang.String schemaLocation)
                   throws java.lang.Exception
Configures a bean with a configuration file and schema.

Throws:
java.lang.Exception

configureBean

public void configureBean(java.lang.Object obj,
                          Path path)
                   throws java.lang.Exception
Configures a bean with a configuration file and schema.

Throws:
java.lang.Exception

configureBean

public void configureBean(java.lang.Object obj,
                          org.w3c.dom.Node topNode)
                   throws java.lang.Exception
Configures a bean with a DOM. configureBean does not apply init() or replaceObject().

Throws:
java.lang.Exception

configureBean

public void configureBean(java.lang.Object obj,
                          Path path,
                          Schema schema)
                   throws java.lang.Exception
Configures a bean with a configuration file and schema.

Throws:
java.lang.Exception

checkCanInstantiate

public static void checkCanInstantiate(java.lang.Class beanClass)
                                throws ConfigException
Returns true if the class can be instantiated.

Throws:
ConfigException

validate

public static void validate(java.lang.Class cl,
                            java.lang.Class api)
                     throws ConfigException
Returns true if the class can be instantiated.

Throws:
ConfigException

checkCanInstantiate

public static void checkCanInstantiate(java.lang.Class beanClass,
                                       java.lang.Class type)
                                throws ConfigException
Returns true if the class can be instantiated using zero args constructor or constructor that accepts an instance of class passed in type argument

Throws:
ConfigException

validate

public static void validate(java.lang.Class cl,
                            java.lang.Class api,
                            java.lang.Class type)
                     throws ConfigException
Throws:
ConfigException

setAttribute

public static void setAttribute(java.lang.Object obj,
                                java.lang.String attr,
                                java.lang.Object value)
Sets an attribute with a value.

Parameters:
obj - the bean to be set
attr - the attribute name
value - the attribute value

setStringAttribute

public static void setStringAttribute(java.lang.Object obj,
                                      java.lang.String attr,
                                      java.lang.String value)
                               throws java.lang.Exception
Sets an attribute with a value.

Parameters:
obj - the bean to be set
attr - the attribute name
value - the attribute value
Throws:
java.lang.Exception

init

public static void init(java.lang.Object bean)
                 throws ConfigException
Throws:
ConfigException

inject

public static void inject(java.lang.Object bean)
                   throws ConfigException
Throws:
ConfigException

replaceObject

public static java.lang.Object replaceObject(java.lang.Object bean)
                                      throws java.lang.Exception
Throws:
java.lang.Exception

getEnvironment

public static ELContext getEnvironment()
Returns the variable resolver.


getELContext

public static ConfigELContext getELContext()
Returns the variable resolver.


getElVar

public static java.lang.Object getElVar(java.lang.String var)

getCurrentVar

public static java.lang.Object getCurrentVar(java.lang.String var)
Sets an EL configuration variable.


evalString

public static java.lang.String evalString(java.lang.String str)
                                   throws ELException
Evaluates an EL string in the context.

Throws:
ELException

evalString

public static java.lang.String evalString(java.lang.String str,
                                          java.util.HashMap<java.lang.String,java.lang.Object> varMap)
                                   throws ELException
Evaluates an EL string in the context.

Throws:
ELException

evalBoolean

public static boolean evalBoolean(java.lang.String str)
                           throws ELException
Evaluates an EL boolean in the context.

Throws:
ELException

getEnvironment

public static ELContext getEnvironment(java.util.HashMap<java.lang.String,java.lang.Object> varMap)

error

public static ConfigException error(java.lang.reflect.Field field,
                                    java.lang.String msg)

error

public static ConfigException error(java.lang.reflect.Method method,
                                    java.lang.String msg)

createLine

public static java.lang.RuntimeException createLine(java.lang.String systemId,
                                                    int line,
                                                    java.lang.Throwable e)

location

public static java.lang.String location(java.lang.reflect.Field field)

location

public static java.lang.String location(java.lang.reflect.Method method)