public abstract class Configuration
extends java.lang.Object
The configuration file is loaded from the Java lib directory, the classpath and the Castor JAR. Properties set in the classpath file takes precedence over properties set in the Java library configuration file and properties set in the Castor JAR, allowing for each customization. All three files are named castor.properties.
For example, to change the parser in use, specify that all documents should be printed with identantion or turn debugging on, create a new configuration file in the current directory, instead of modifying the global one.
| Modifier and Type | Class and Description |
|---|---|
(package private) static class |
Configuration.ConfigValues
Inner class to hold values of the configuration
|
(package private) static class |
Configuration.Features |
static class |
Configuration.Property
Names of properties used in the configuration file.
|
| Modifier and Type | Field and Description |
|---|---|
(package private) static java.lang.String |
ON_VALUE |
(package private) static java.lang.String |
TRUE_VALUE |
| Constructor and Description |
|---|
Configuration()
Protected default constructor
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
debug()
Returns true if the configuration specifies debugging.
|
static java.util.Properties |
getDefault()
Returns the default configuration file.
|
static boolean |
getDefaultDebug()
Returns true if the default configuration specified debugging.
|
static boolean |
getDefaultMarshallingValidation()
Returns true if the default configuration specifies validation in
the marshalling framework.
|
static OutputFormat |
getDefaultOutputFormat()
Returns the default OutputFormat for use with a Serializer.
|
static org.xml.sax.Parser |
getDefaultParser()
Return an XML document parser implementing the feature list
specified in the default configuration file.
|
static org.xml.sax.Parser |
getDefaultParser(java.lang.String features)
Returns an XML document parser implementing the requested
set of features.
|
static NodeType |
getDefaultPrimitiveNodeType()
Returns the NodeType to use for Java primitives.
|
static java.lang.String |
getDefaultProperty(java.lang.String name,
java.lang.String defValue)
Returns a property from the default configuration file.
|
static RegExpEvaluator |
getDefaultRegExpEvaluator()
Returns a new instance of the specified Regular Expression
Evaluator, or null if no validator was specified
|
static Serializer |
getDefaultSerializer()
Returns a default serializer for producing an XML document.
|
static org.xml.sax.DocumentHandler |
getDefaultSerializer(java.io.OutputStream output)
Returns a default serializer for producing an XML document to
the designated output stream using the default serialization
format.
|
static org.xml.sax.DocumentHandler |
getDefaultSerializer(java.io.Writer output)
Returns a default serializer for producing an XML document to
the designated output stream using the default serialization
format.
|
static boolean |
getDefaultStrictElements()
Access to the property specifying whether to apply strictness to elements when
unmarshalling.
|
static XMLNaming |
getDefaultXMLNaming()
Returns the default naming conventions to use for the XML framework
|
static org.xml.sax.XMLReader |
getDefaultXMLReader()
Returns an XML document parser implementing the requested
set of features.
|
static org.xml.sax.XMLReader |
getDefaultXMLReader(java.lang.String features)
Returns an XML document parser implementing the requested
set of features.
|
abstract OutputFormat |
getOutputFormat()
Returns the currently configured OutputFormat for use with a Serializer.
|
org.xml.sax.Parser |
getParser()
Return an XML parser implementing the feature list specified
in the configuration file.
|
NodeType |
getPrimitiveNodeType()
Returns the currently configured NodeType to use for Java
primitives.
|
java.util.Properties |
getProperties()
Returns the current properties from the configuration file(s).
|
java.lang.String |
getProperty(java.lang.String name,
java.lang.String defValue)
Returns a property from the current configuration.
|
RegExpEvaluator |
getRegExpEvaluator()
Returns a new instance of the specified Regular Expression
Evaluator, or null if no validator was specified
|
abstract Serializer |
getSerializer()
Returns a serializer for producing an XML instance document.
|
abstract org.xml.sax.DocumentHandler |
getSerializer(java.io.OutputStream output)
Returns a serializer for producing an XML document to
the designated output stream using the default serialization
format.
|
abstract org.xml.sax.DocumentHandler |
getSerializer(java.io.Writer output)
Returns a serializer for producing an XML instance document to
the designated output stream using the default serialization
format.
|
protected static XMLSerializerFactory |
getSerializerFactory(java.util.Properties props)
Returns the currently configured XMLSerializerFactory instance.
|
XMLNaming |
getXMLNaming()
Returns the currently configured naming conventions to use
for the XML framework
Design note: This method should be overloaded by any
sub-classes.
|
org.xml.sax.XMLReader |
getXMLReader()
Returns an XML document parser implementing the requested
set of features.
|
protected static void |
loadDefaults()
Called by
getDefault() to load the configuration the
first time. |
static java.util.Properties |
loadProperties(java.lang.String resourceName,
java.lang.String fileName)
Load the configuration will not complain about inability to load
configuration file from one of the default directories, but if
it cannot find the JAR's configuration file, will throw a
run time exception.
|
boolean |
marshallingValidation()
Returns true if the current configuration (user-supplied or default)
specifies validation in the marshalling framework.
|
protected static void |
setFeaturesOnXmlReader(java.lang.String features,
boolean validation,
boolean namespaces,
org.xml.sax.XMLReader xmlReader)
Sets features on XML reader instance.
|
boolean |
strictElements()
Access to the property specifying whether to apply strictness to elements when
unmarshalling.
|
static final java.lang.String TRUE_VALUE
static final java.lang.String ON_VALUE
public boolean debug()
getDefaultDebug()public static boolean getDefaultDebug()
public boolean strictElements()
getDefaultStrictElements()public static boolean getDefaultStrictElements()
strictElements()public boolean marshallingValidation()
getDefaultMarshallingValidation()public static boolean getDefaultMarshallingValidation()
marshallingValidation()public java.util.Properties getProperties()
getDefault()public static java.util.Properties getDefault()
getProperties()public java.lang.String getProperty(java.lang.String name,
java.lang.String defValue)
getDefault().name - The property namedefValue - The property's default valuegetDefaultProperty(String,String),
getProperties()public static java.lang.String getDefaultProperty(java.lang.String name,
java.lang.String defValue)
getDefault().name - The property namedefValue - The property's default value(String, String)public XMLNaming getXMLNaming()
getDefaultXMLNaming()public static XMLNaming getDefaultXMLNaming()
public org.xml.sax.Parser getParser()
getDefaultParser()public static org.xml.sax.Parser getDefaultParser()
getParser()public static org.xml.sax.Parser getDefaultParser(java.lang.String features)
features - The requested feature list, null for the
defaultsprotected static void setFeaturesOnXmlReader(java.lang.String features,
boolean validation,
boolean namespaces,
org.xml.sax.XMLReader xmlReader)
features - validation - Whether to enable validation or not.namespaces - Whether to enable namespace support for not.xmlReader - The XMLReader instance to configure.public NodeType getPrimitiveNodeType()
getDefaultPrimitiveNodeType()public static NodeType getDefaultPrimitiveNodeType()
getPrimitiveNodeType()public org.xml.sax.XMLReader getXMLReader()
public static org.xml.sax.XMLReader getDefaultXMLReader()
public static org.xml.sax.XMLReader getDefaultXMLReader(java.lang.String features)
features - The requested feature list, null for the
defaultspublic RegExpEvaluator getRegExpEvaluator()
getDefaultRegExpEvaluator()public static RegExpEvaluator getDefaultRegExpEvaluator()
getRegExpEvaluator()public abstract Serializer getSerializer()
getDefaultSerializer()public static Serializer getDefaultSerializer()
getSerializer()public abstract OutputFormat getOutputFormat()
getDefaultOutputFormat()public static OutputFormat getDefaultOutputFormat()
public abstract org.xml.sax.DocumentHandler getSerializer(java.io.OutputStream output)
throws java.io.IOException
output - the output streamjava.io.IOExceptionpublic static org.xml.sax.DocumentHandler getDefaultSerializer(java.io.OutputStream output)
throws java.io.IOException
output - the output streamjava.io.IOExceptionpublic abstract org.xml.sax.DocumentHandler getSerializer(java.io.Writer output)
throws java.io.IOException
output - the Writer to write data to.java.io.IOExceptionpublic static org.xml.sax.DocumentHandler getDefaultSerializer(java.io.Writer output)
throws java.io.IOException
output - the Writer to write data to.java.io.IOExceptionprotected static void loadDefaults()
getDefault() to load the configuration the
first time. Will not complain about inability to load
configuration file from one of the default directories, but if
it cannot find the JAR's configuration file, will throw a
run time exception.public static java.util.Properties loadProperties(java.lang.String resourceName,
java.lang.String fileName)
protected static XMLSerializerFactory getSerializerFactory(java.util.Properties props)
props - Property set to use.Intalio Inc. (C) 1999-2006. All rights reserved http://www.intalio.com