org.apache.avalon.meta.info.builder
Class XMLTypeCreator

java.lang.Object
  extended byorg.apache.avalon.meta.info.builder.XMLServiceCreator
      extended byorg.apache.avalon.meta.info.builder.XMLTypeCreator
All Implemented Interfaces:
ServiceCreator, TypeCreator, TypeFactory
Direct Known Subclasses:
XMLLegacyCreator

public class XMLTypeCreator
extends XMLServiceCreator
implements TypeFactory

Handles internalization of an XML based description of a Type from a Configuration object. The format for Configuration object is specified in the package summary.

Version:
$Revision: 1.14 $ $Date: 2003/09/09 22:00:43 $
Author:
Avalon Development Team

Constructor Summary
XMLTypeCreator()
           
 
Method Summary
protected  ContextDescriptor buildContext(Configuration context)
          A utility method to build a ContextDescriptor object from specified configuraiton.
 DependencyDescriptor[] buildDependencies(Configuration configuration)
          A utility method to build an array of DependencyDescriptor objects from specified configuration.
protected  DependencyDescriptor buildDependency(Configuration dependency)
          A utility method to build a DependencyDescriptor object from specified configuraiton.
protected  ExtensionDescriptor buildExtension(Configuration config)
          Utility function to create an extension descriptor from a configuration.
protected  ExtensionDescriptor[] buildExtensions(Configuration config)
          Utility function to create a set of phase descriptor from a configuration.
 InfoDescriptor buildInfoDescriptor(String classname, Configuration info)
          A utility method to build a InfoDescriptor object from specified configuraiton data and classname.
protected  CategoryDescriptor[] buildLoggers(Configuration configuration)
          A utility method to build an array of CategoryDescriptor objects from specified configuraiton.
protected  StageDescriptor buildPhase(Configuration config)
          Utility function to create a set of phase descriptor from a configuration.
protected  ReferenceDescriptor buildReferenceDescriptor(Configuration service)
          A utility method to build a ReferenceDescriptor object from specified configuration data.
protected  ReferenceDescriptor buildReferenceDescriptor(Configuration service, String classname)
          A utility method to build a ReferenceDescriptor object from specified configuration data.
 ServiceDescriptor buildService(Configuration service)
          A utility method to build a ServiceDescriptor object from specified configuraiton data.
 ServiceDescriptor[] buildServices(Configuration servicesSet)
          A utility method to build an array of ServiceDescriptor objects from specified configuraiton.
protected  StageDescriptor[] buildStages(Configuration config)
          Utility function to create a set of phase descriptor from a configuration.
 ReferenceDescriptor createReference(String path)
          Creation of a reference descriptor from the supplied path.
 Type createType(String classname, Configuration info, Configuration defaults)
          Create an Type object for a specified classname from specified configuration data.
 Type createType(String classname, InputStream inputStream)
          Create a Type object for specified classname, loaded from specified InputStream.
 
Methods inherited from class org.apache.avalon.meta.info.builder.XMLServiceCreator
buildAttributes, buildEntries, buildEntry, buildVersion, createService
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLTypeCreator

public XMLTypeCreator()
Method Detail

createType

public Type createType(String classname,
                       InputStream inputStream)
                throws Exception
Create a Type object for specified classname, loaded from specified InputStream.

Specified by:
createType in interface TypeCreator
Parameters:
classname - The classname of Component
inputStream - the InputStream to load Type from
Returns:
the created Type
Throws:
Exception - if an error occurs

createType

public Type createType(String classname,
                       Configuration info,
                       Configuration defaults)
                throws BuildException
Create an Type object for a specified classname from specified configuration data.

Specified by:
createType in interface TypeFactory
Parameters:
classname - The classname of Component
info - the Type configuration
defaults - the default configuration
Returns:
the created Type
Throws:
Exception - if an error occurs
BuildException

buildStages

protected StageDescriptor[] buildStages(Configuration config)
                                 throws BuildException
Utility function to create a set of phase descriptor from a configuration.

Parameters:
config - a configuration containing 0..n phase elements
Returns:
an array of phase descriptors
Throws:
Exception - if a build error occurs
BuildException

buildPhase

protected StageDescriptor buildPhase(Configuration config)
                              throws BuildException
Utility function to create a set of phase descriptor from a configuration.

Parameters:
config - a configuration containing 0..n phase elements
Returns:
an array of phase descriptors
Throws:
Exception - if a build error occurs
BuildException

buildReferenceDescriptor

protected ReferenceDescriptor buildReferenceDescriptor(Configuration service)
                                                throws BuildException
A utility method to build a ReferenceDescriptor object from specified configuration data.

Parameters:
service - the service Configuration
Returns:
the created ReferenceDescriptor
Throws:
ConfigurationException - if an error occurs
BuildException

buildReferenceDescriptor

protected ReferenceDescriptor buildReferenceDescriptor(Configuration service,
                                                       String classname)
                                                throws BuildException
A utility method to build a ReferenceDescriptor object from specified configuration data.

Parameters:
service - the service Configuration
classname - the default type classname
Returns:
the created ReferenceDescriptor
Throws:
ConfigurationException - if an error occurs
BuildException

buildLoggers

protected CategoryDescriptor[] buildLoggers(Configuration configuration)
                                     throws BuildException
A utility method to build an array of CategoryDescriptor objects from specified configuraiton.

Parameters:
configuration - the loggers configuration
Returns:
the created CategoryDescriptor
Throws:
ConfigurationException - if an error occurs
BuildException

buildDependencies

public DependencyDescriptor[] buildDependencies(Configuration configuration)
                                         throws BuildException
A utility method to build an array of DependencyDescriptor objects from specified configuration.

Parameters:
configuration - the dependencies configuration
Returns:
the created DependencyDescriptor
Throws:
ConfigurationException - if an error occurs
BuildException

buildDependency

protected DependencyDescriptor buildDependency(Configuration dependency)
                                        throws BuildException
A utility method to build a DependencyDescriptor object from specified configuraiton.

Parameters:
dependency - the dependency configuration
Returns:
the created DependencyDescriptor
Throws:
BuildException - if an error occurs

buildContext

protected ContextDescriptor buildContext(Configuration context)
                                  throws BuildException
A utility method to build a ContextDescriptor object from specified configuraiton.

Parameters:
context - the dependency configuration
Returns:
the created ContextDescriptor
Throws:
ConfigurationException - if an error occurs
BuildException

buildServices

public ServiceDescriptor[] buildServices(Configuration servicesSet)
                                  throws BuildException
A utility method to build an array of ServiceDescriptor objects from specified configuraiton.

Parameters:
servicesSet - the services configuration
Returns:
the created ServiceDescriptor
Throws:
ConfigurationException - if an error occurs
BuildException

buildService

public ServiceDescriptor buildService(Configuration service)
                               throws BuildException
A utility method to build a ServiceDescriptor object from specified configuraiton data.

Parameters:
service - the service Configuration
Returns:
the created ServiceDescriptor
Throws:
ConfigurationException - if an error occurs
BuildException

buildInfoDescriptor

public InfoDescriptor buildInfoDescriptor(String classname,
                                          Configuration info)
                                   throws BuildException
A utility method to build a InfoDescriptor object from specified configuraiton data and classname.

Parameters:
classname - The classname of Component (used to create descriptor)
info - the component info configuration fragment
Returns:
the created InfoDescriptor
Throws:
ConfigurationException - if an error occurs
BuildException

buildExtensions

protected ExtensionDescriptor[] buildExtensions(Configuration config)
                                         throws BuildException
Utility function to create a set of phase descriptor from a configuration.

Parameters:
config - a configuration containing 0..n phase elements
Returns:
an array of phase descriptors
Throws:
Exception - if a build error occurs
BuildException

buildExtension

protected ExtensionDescriptor buildExtension(Configuration config)
                                      throws BuildException
Utility function to create an extension descriptor from a configuration.

Parameters:
config - a configuration containing the extension definition
Returns:
the extension descriptor
Throws:
Exception - if a build error occurs
BuildException

createReference

public ReferenceDescriptor createReference(String path)
                                    throws BuildException
Creation of a reference descriptor from the supplied path.

Parameters:
path - the classname
Returns:
the reference descriptor
Throws:
BuildException


Copyright © Apache Software Foundation. All Rights Reserved.