Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
org.exolab.castor.util.Configuration
public abstract class Configuration
extends java.lang.Object
Nested Class Summary | |
(package private) static class |
|
(package private) static class | |
static class |
|
Field Summary | |
(package private) static String | |
(package private) static String |
Constructor Summary | |
|
Method Summary | |
boolean |
|
static Properties |
|
static boolean |
|
static boolean |
|
static OutputFormat |
|
static Parser |
|
static Parser |
|
static NodeType |
|
static String |
|
static RegExpEvaluator |
|
static Serializer |
|
static DocumentHandler |
|
static DocumentHandler |
|
static boolean |
|
static XMLNaming |
|
abstract OutputFormat |
|
Parser |
|
NodeType |
|
Properties |
|
String |
|
RegExpEvaluator |
|
abstract Serializer |
|
abstract DocumentHandler |
|
abstract DocumentHandler |
|
XMLNaming |
|
protected static void |
|
static Properties |
|
boolean |
|
boolean |
|
(package private) static final String ON_VALUE
(package private) static final String TRUE_VALUE
public boolean debug()
Returns true if the configuration specifies debugging. Design note: This method should be overloaded by any sub-classes.
- See Also:
getDefaultDebug
public static Properties getDefault()
Returns the default configuration file. Changes to the returned properties set may affect all Castor functions relying on the default configuration.
- Returns:
- the default configuration properties
- See Also:
getProperties
public static boolean getDefaultDebug()
Returns true if the default configuration specified debugging.
public static boolean getDefaultMarshallingValidation()
Returns true if the default configuration specifies validation in the marshalling framework.
- Returns:
- true if by default validation should be performed during the marshalling and unmarshalling process, otherwise false.
- See Also:
marshallingValidation
public static OutputFormat getDefaultOutputFormat()
Returns the default OutputFormat for use with a Serializer.
- Returns:
- the default OutputFormat
public static Parser getDefaultParser()
Return an XML document parser implementing the feature list specified in the default configuration file.
- Returns:
- a suitable XML parser
- See Also:
getParser
public static Parser getDefaultParser(String features)
Returns an XML document parser implementing the requested set of features. The feature list is a comma separated list of features that parser may or may not support. No errors are generated for unsupported features. If the feature list is not null, it overrides the default feature list specified in the configuration file, including validation and Namespaces.
- Parameters:
features
- The requested feature list, null for the defaults
- Returns:
- A suitable XML parser
public static NodeType getDefaultPrimitiveNodeType()
Returns the NodeType to use for Java primitives. A null value will be returned if no NodeType was specified, indicating the default NodeType should be used.
- Returns:
- the NodeType assigned to Java primitives, or null if no NodeType was specified.
- See Also:
getPrimitiveNodeType
public static String getDefaultProperty(String name, String defValue)
Returns a property from the default configuration file. Equivalent to calling getProperty on the result ofgetDefault()
.
- Parameters:
name
- The property name
- Returns:
- The property's value
- See Also:
getProperty
public static RegExpEvaluator getDefaultRegExpEvaluator()
Returns a new instance of the specified Regular Expression Evaluator, or null if no validator was specified
- Returns:
- the regular expression evaluator,
- See Also:
getRegExpEvaluator
public static Serializer getDefaultSerializer()
Returns a default serializer for producing an XML document. The caller can specify an alternative output format, may reuse this serializer across several streams, and may serialize both DOM and SAX events. If such control is not required, it is recommended to call one of the other two methods.
- Parameters:
- Returns:
- A suitable serializer
- See Also:
getSerializer
public static DocumentHandler getDefaultSerializer(OutputStream output) throws IOException
Returns a default serializer for producing an XML document to the designated output stream using the default serialization format.
- Parameters:
output
- the output stream
- Returns:
- A suitable serializer
public static DocumentHandler getDefaultSerializer(Writer output) throws IOException
Returns a default serializer for producing an XML document to the designated output stream using the default serialization format.
- Parameters:
output
- the Writer to write data to.
- Returns:
- A suitable serializer
public static boolean getDefaultStrictElements()
Access to the property specifying whether to apply strictness to elements when unmarshalling. Default is true which means that elements appearing in the XML Documnt which cannot be mapped to a class cause a SAXException to be thrown. If set to false, these 'unknown' elements are ignored
- Returns:
- true if element processing should be "strict".
- See Also:
strictElements
public static XMLNaming getDefaultXMLNaming()
Returns the default naming conventions to use for the XML framework
- Returns:
- the default naming conventions to use for the XML framework
public abstract OutputFormat getOutputFormat()
Returns the currently configured OutputFormat for use with a Serializer. Design note: This method should be overloaded by any sub-classes.
- Returns:
- the currently configured OutputFormat.
- See Also:
getDefaultOutputFormat
public Parser getParser()
Return an XML parser implementing the feature list specified in the configuration file. Design note: This method should be overloaded by any sub-classes.
- Returns:
- a suitable XML parser
- See Also:
getDefaultParser
public NodeType getPrimitiveNodeType()
Returns the currently configured NodeType to use for Java primitives. A null value will be returned if no NodeType was specified, indicating the default NodeType should be used. Design note: This method should be overloaded by any sub-classes.
- Returns:
- the NodeType assigned to Java primitives, or null if no NodeType was specified.
- See Also:
getDefaultPrimitiveNodeType
public Properties getProperties()
Returns the current properties from the configuration file(s). The Properties returned may be empty, but never null. Design note: This method should be overloaded by any sub-classes.
- Returns:
- the current set of configuration properties.
- See Also:
getDefault
public String getProperty(String name, String defValue)
Returns a property from the current configuration. Equivalent to calling getProperty on the result ofgetDefault()
.
- Parameters:
name
- The property name
- Returns:
- The property's value
- See Also:
getDefaultProperty
,getProperties
public RegExpEvaluator getRegExpEvaluator()
Returns a new instance of the specified Regular Expression Evaluator, or null if no validator was specified
- Returns:
- the regular expression evaluator,
- See Also:
getDefaultRegExpEvaluator
public abstract Serializer getSerializer()
Returns a serializer for producing an XML instance document. The caller can specify an alternative output format, may reuse this serializer across several streams, and may serialize both DOM and SAX events. Design note: This method should be overloaded by any sub-classes.
- Parameters:
- Returns:
- A suitable serializer
- See Also:
getDefaultSerializer
public abstract DocumentHandler getSerializer(OutputStream output) throws IOException
Returns a serializer for producing an XML document to the designated output stream using the default serialization format. Design note: This method should be overloaded by any sub-classes.
- Parameters:
output
- the output stream
- Returns:
- A suitable serializer
public abstract DocumentHandler getSerializer(Writer output) throws IOException
Returns a serializer for producing an XML instance document to the designated output stream using the default serialization format. Design note: This method should be overloaded by any sub-classes.
- Parameters:
output
- the Writer to write data to.
- Returns:
- A suitable serializer
public 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.
- Returns:
- the currently configured naming conventions to use for the XML framework
- See Also:
getDefaultXMLNaming
protected static void loadDefaults()
Called bygetDefault()
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 Properties loadProperties(String resourceName, 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.
public boolean marshallingValidation()
Returns true if the current configuration (user-supplied or default) specifies validation in the marshalling framework. Design note: This method should be overloaded by any sub-classes.
- Returns:
- true if by default validation should be performed during the marshalling and unmarshalling process, otherwise false.
- See Also:
getDefaultMarshallingValidation
public boolean strictElements()
Access to the property specifying whether to apply strictness to elements when unmarshalling. Default is true which means that elements appearing in the XML Documnt which cannot be mapped to a class cause a SAXException to be thrown. If set to false, these 'unknown' elements are ignored. Design note: This method should be overloaded by any sub-classes.
- Returns:
- true if element processing should be "strict".
- See Also:
getDefaultStrictElements