Type Descriptor
Description
The <type> element is an assembly of descriptors of the constraints a component type declares towards a container and includes declaration of service dependencies, Logger establishment criteria, Configuration, Parameters and Context establishment criteria, in addition to human-readable information about the component type.
Nested Elements
Element | Occurance | Description |
---|---|---|
info | 1 | Declaration of the component type name, version, lifestyle, collection policy and and optional attributes. |
loggers | 0..1 | Declaration of the logging channels used by the component type. |
context | 0..1 | Declaration of the context criteria including the context entries and optional context interface. |
dependencies | 0..1 | Declaration of the set of structural dependencies that the component type has towards other components. |
services | 0..1 | Declaration of the set of services that the component type provides. |
stages | 0..1 | Declaration of the set of extended deployment stage dependencies that the component type has. |
extensions | 0..1 | Declaration of the set of deployment stage handling abilities that this component type can provide. |
Example XML
Configuration instances supplied to the builder shall correspond to the type DTD. The structure of a Type XML document is described below:
<!-- Example of a component meta info external XML form. The element contains the information required to construct an instance of org.apache.avalon.meta.info.Type. It includes information about the component type, the service it provides, and the services it is dependent on. --> <type> <!-- Definition of a single component info descriptor. --> <info> <!-- the name of the component (character restrictions apply) --> <name>my-component</name> <!-- the implementation version --> <version>1.2.1</version> <!-- the set of attributes associated with the type (attribute names and values are examples only) --> <attributes> <attribute key="color" value="blue"/> <attribute key="quantity" value="35"/> </attributes> </info> <!-- The set of logging categories the component uses. --> <loggers> <logger name="store"/> <logger name="store.cache"/> <logger name="verifier"/> </loggers> <!-- Declaration of the context constraints for the compoent type. The "type" attribute is the name of an interface derived from the default context interface org.apache.avalon.framework.context.Context --> <context type="MyContextInterface"> <!-- Declaration of an entry in a context object, the "key" is the key used by a component to locate the context entry, the "type" is the classname of value (typically an interface) or primitive type. The default value is java.lang.String. The "optional" attribute is a boolean value derived from the TRUE or FALSE that indicates if the context value must be provided or not (default is FALSE). --> <entry key="base" type="java.io.File"/> <entry key="mode" optional="TRUE"/> </context> <!-- Declaration of the set of services that this component is capable of supplying. Each service declared under the services element may be referenced by other component info descriptions as a dependency. A container is responsible for the assembly of components based on the connection of supplier components to consumer components via a common service description. --> <services> <!-- The service element declares the classname of an service interface and the version identifier that qualify as the service version. The default version value is 1.0. --> <service> <reference type="SimpleService" version="3.2"> <attributes> <!-- Attributes qualifying as service implementation may be included as supplementary information to the attributes declared under a ServiceDefinition. --> </attributes> </service> </services> <!-- Declaration of the set of dependencies that this component type has on component suppliers. Dependency declarations define the role name that the component will use to access a service via a service or component manager. A dependency may be declared as optional by setting the optional attribute value to TRUE. The default value for optional is FALSE. --> <dependencies> <!-- A dependency declaration. In the following example the optional attribute is redundant as it is equivalent to the default value but is included here for completeness. --> <dependency optional="FALSE" key="my-transformer" type="org.apache.cocoon.api.Transformer version="1.1"> <!-- the set of attributes associated with the dependency --> <attributes> <!-- ServiceDefintion constraints may be included under the attributes element. --> </attributes> </dependency> </dependencies> </type>