Classes | Public Member Functions | Static Public Member Functions | Static Protected Member Functions | Package Functions | Static Package Attributes

org.exolab.castor.util.Configuration Class Reference

Inheritance diagram for org.exolab.castor.util.Configuration:
org.exolab.castor.util.LocalConfiguration

List of all members.

Classes

class  ConfigValues
class  Features
class  Property

Public Member Functions

boolean debug ()
boolean strictElements ()
boolean marshallingValidation ()
Properties getProperties ()
String getProperty (String name, String defValue)
XMLNaming getXMLNaming ()
Parser getParser ()
NodeType getPrimitiveNodeType ()
XMLReader getXMLReader ()
RegExpEvaluator getRegExpEvaluator ()
abstract Serializer getSerializer ()
abstract OutputFormat getOutputFormat ()
abstract DocumentHandler getSerializer (OutputStream output) throws IOException
abstract DocumentHandler getSerializer (Writer output) throws IOException

Static Public Member Functions

static boolean getDefaultDebug ()
static boolean getDefaultStrictElements ()
static boolean getDefaultMarshallingValidation ()
static synchronized Properties getDefault ()
static String getDefaultProperty (String name, String defValue)
static XMLNaming getDefaultXMLNaming ()
static Parser getDefaultParser ()
static Parser getDefaultParser (String features)
static NodeType getDefaultPrimitiveNodeType ()
static XMLReader getDefaultXMLReader ()
static XMLReader getDefaultXMLReader (String features)
static RegExpEvaluator getDefaultRegExpEvaluator ()
static Serializer getDefaultSerializer ()
static OutputFormat getDefaultOutputFormat ()
static DocumentHandler getDefaultSerializer (OutputStream output) throws IOException
static DocumentHandler getDefaultSerializer (Writer output) throws IOException
static Properties loadProperties (String resourceName, String fileName)

Static Protected Member Functions

static void loadDefaults ()

Package Functions

 Configuration ()

Static Package Attributes

static final String TRUE_VALUE = "true"
static final String ON_VALUE = "on"

Detailed Description

Provides default configuration for Castor components from the castor.properties configuration file. All Castor features rely on the central configuration file.

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.

Author:
Keith Visco
Assaf Arkin
Version:
Revision:
1.7
Date:
2004/11/05 05:41:13

Constructor & Destructor Documentation

org.exolab.castor.util.Configuration.Configuration (  )  [package]

Protected default constructor


Member Function Documentation

boolean org.exolab.castor.util.Configuration.debug (  ) 

Returns true if the configuration specifies debugging. Design note: This method should be overloaded by any sub-classes.

Returns:
true if the configuration specifies debugging.
See also:
getDefaultDebug()

Reimplemented in org.exolab.castor.util.LocalConfiguration.

References org.exolab.castor.util.Configuration.getDefaultDebug().

static boolean org.exolab.castor.util.Configuration.getDefaultDebug (  )  [static]

Returns true if the default configuration specified debugging.

Returns:
true if the configuration specifies debugging.

References org.exolab.castor.util.Configuration.getDefault().

Referenced by org.exolab.castor.util.Configuration.debug().

static boolean org.exolab.castor.util.Configuration.getDefaultMarshallingValidation (  )  [static]

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()

References org.exolab.castor.util.Configuration.getDefault().

Referenced by org.exolab.castor.util.Configuration.marshallingValidation().

static OutputFormat org.exolab.castor.util.Configuration.getDefaultOutputFormat (  )  [static]
static Parser org.exolab.castor.util.Configuration.getDefaultParser (  )  [static]

Return an XML document parser implementing the feature list specified in the default configuration file.

Returns:
a suitable XML parser
See also:
getParser()

Referenced by org.exolab.castor.util.Configuration.getParser().

static Parser org.exolab.castor.util.Configuration.getDefaultParser ( String  features  )  [static]

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

References org.exolab.castor.util.Configuration.getDefault().

static NodeType org.exolab.castor.util.Configuration.getDefaultPrimitiveNodeType (  )  [static]

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()

References org.exolab.castor.util.Configuration.getDefaultProperty().

Referenced by org.exolab.castor.util.Configuration.getPrimitiveNodeType().

static String org.exolab.castor.util.Configuration.getDefaultProperty ( String  name,
String  defValue 
) [static]

Returns a property from the default configuration file. Equivalent to calling getProperty on the result of getDefault.

Parameters:
name The property name
defValue The property's default value
Returns:
The property's value
See also:
getProperty (String, String)

References org.exolab.castor.util.Configuration.getDefault().

Referenced by org.exolab.castor.util.Configuration.getDefaultPrimitiveNodeType(), and org.exolab.castor.util.Configuration.getDefaultXMLNaming().

static RegExpEvaluator org.exolab.castor.util.Configuration.getDefaultRegExpEvaluator (  )  [static]

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()

References org.exolab.castor.util.Configuration.getDefault().

Referenced by org.exolab.castor.util.Configuration.getRegExpEvaluator().

static DocumentHandler org.exolab.castor.util.Configuration.getDefaultSerializer ( Writer  output  )  throws IOException [static]

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

References org.exolab.castor.util.Configuration.getDefaultSerializer().

static Serializer org.exolab.castor.util.Configuration.getDefaultSerializer (  )  [static]

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.

Returns:
A suitable serializer
See also:
getSerializer()

References org.exolab.castor.util.Configuration.getDefault(), and org.exolab.castor.util.Configuration.getDefaultOutputFormat().

Referenced by org.exolab.castor.util.Configuration.getDefaultSerializer().

static DocumentHandler org.exolab.castor.util.Configuration.getDefaultSerializer ( OutputStream  output  )  throws IOException [static]

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

References org.exolab.castor.util.Configuration.getDefaultSerializer().

static boolean org.exolab.castor.util.Configuration.getDefaultStrictElements (  )  [static]

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()

References org.exolab.castor.util.Configuration.getDefault().

Referenced by org.exolab.castor.util.Configuration.strictElements().

static XMLNaming org.exolab.castor.util.Configuration.getDefaultXMLNaming (  )  [static]

Returns the default naming conventions to use for the XML framework

Returns:
the default naming conventions to use for the XML framework

References org.exolab.castor.util.Configuration.getDefaultProperty(), and org.exolab.castor.xml.util.DefaultNaming.setStyle().

Referenced by org.exolab.castor.util.Configuration.getXMLNaming().

static XMLReader org.exolab.castor.util.Configuration.getDefaultXMLReader (  )  [static]

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.

Returns:
A suitable XML parser

Referenced by org.exolab.castor.util.Configuration.getXMLReader().

static XMLReader org.exolab.castor.util.Configuration.getDefaultXMLReader ( String  features  )  [static]

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

References org.exolab.castor.util.Configuration.getDefault().

abstract OutputFormat org.exolab.castor.util.Configuration.getOutputFormat (  )  [pure virtual]

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()

Implemented in org.exolab.castor.util.LocalConfiguration.

Referenced by org.exolab.castor.xml.Marshaller.setDoctype(), org.exolab.castor.xml.Marshaller.setEncoding(), and org.exolab.castor.xml.Marshaller.setMarshalAsDocument().

NodeType org.exolab.castor.util.Configuration.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()

Reimplemented in org.exolab.castor.util.LocalConfiguration.

References org.exolab.castor.util.Configuration.getDefaultPrimitiveNodeType().

Properties org.exolab.castor.util.Configuration.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()

Reimplemented in org.exolab.castor.util.LocalConfiguration.

References org.exolab.castor.util.Configuration.getDefault().

Referenced by org.exolab.castor.util.Configuration.getProperty().

String org.exolab.castor.util.Configuration.getProperty ( String  name,
String  defValue 
)

Returns a property from the current configuration. Equivalent to calling getProperty on the result of getDefault.

Parameters:
name The property name
defValue The property's default value
Returns:
The property's value
See also:
getDefaultProperty(String,String)
getProperties()

References org.exolab.castor.util.Configuration.getProperties().

Referenced by org.exolab.castor.util.LocalConfiguration.getPrimitiveNodeType(), org.exolab.castor.util.LocalConfiguration.getXMLNaming(), and org.exolab.castor.builder.BuilderConfiguration.load().

RegExpEvaluator org.exolab.castor.util.Configuration.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()

Reimplemented in org.exolab.castor.util.LocalConfiguration.

References org.exolab.castor.util.Configuration.getDefaultRegExpEvaluator().

abstract DocumentHandler org.exolab.castor.util.Configuration.getSerializer ( OutputStream  output  )  throws IOException [pure virtual]

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

Implemented in org.exolab.castor.util.LocalConfiguration.

abstract Serializer org.exolab.castor.util.Configuration.getSerializer (  )  [pure virtual]

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.

Returns:
A suitable serializer
See also:
getDefaultSerializer()

Implemented in org.exolab.castor.util.LocalConfiguration.

Referenced by org.exolab.castor.xml.Marshaller.Marshaller().

abstract DocumentHandler org.exolab.castor.util.Configuration.getSerializer ( Writer  output  )  throws IOException [pure virtual]

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

Implemented in org.exolab.castor.util.LocalConfiguration.

XMLNaming org.exolab.castor.util.Configuration.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()

Reimplemented in org.exolab.castor.util.LocalConfiguration.

References org.exolab.castor.util.Configuration.getDefaultXMLNaming().

Referenced by org.exolab.castor.xml.XMLNaming.getInstance().

XMLReader org.exolab.castor.util.Configuration.getXMLReader (  ) 

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.

Returns:
A suitable XML parser

Reimplemented in org.exolab.castor.util.LocalConfiguration.

References org.exolab.castor.util.Configuration.getDefaultXMLReader().

Referenced by org.exolab.castor.xml.Unmarshaller.unmarshal().

static void org.exolab.castor.util.Configuration.loadDefaults (  )  [static, protected]

Called by 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.

References org.exolab.castor.util.Configuration.loadProperties().

Referenced by org.exolab.castor.util.Configuration.getDefault().

static Properties org.exolab.castor.util.Configuration.loadProperties ( String  resourceName,
String  fileName 
) [static]

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.

Referenced by org.exolab.castor.util.Configuration.loadDefaults().

boolean org.exolab.castor.util.Configuration.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()

Reimplemented in org.exolab.castor.util.LocalConfiguration.

References org.exolab.castor.util.Configuration.getDefaultMarshallingValidation().

boolean org.exolab.castor.util.Configuration.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()

Reimplemented in org.exolab.castor.util.LocalConfiguration.

References org.exolab.castor.util.Configuration.getDefaultStrictElements().


Member Data Documentation


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations Properties