Chapter 6. Configuration reference

This section has been generated from the schema file 'spring-actionscript-objects-1.0.xsd'

6.1. General description

<literallayout> Spring ActionScript Framework 1.0 Schema Schema Authors: Ryan Gardner, Erik Westra, Christophe Herreman, Roland Zwaga This defines a simple and consistent way of creating a namespace of ActionScript objects, managed by a Spring ActionScript IoC Container, read by XmlObjectDefinitionParser. Every attempt has been made to make this scheme comprehensive and correct. Configuring your XML context-configuration like this: <?xml version="1.0" encoding="UTF-8" standalone="no"?> <objects xmlns="http://www.springactionscript.org/schema/objects" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springactionscript.org/schema/objects http://www.springactionscript.org/schema/objects/spring-actionscript-objects-1.0.xsd"> <!-- object and template definitions --> </objects> Will enable most schema-aware tools to automatically retrieve the schema and provide on-the-fly validation and code-completion as you create your context definition. The main goal of this schema is to provide easy assistance in creating the file, and basic validation of the syntax. Please feel free to provide updates to the Spring ActionScript team if you see any areas to improve. </literallayout><section> <title> <programlisting><arg/></programlisting> </title> <literallayout>Defines a method argument.</literallayout> <itemizedlist> <title>Attributes</title> <listitem>value<remark> <literallayout>A literal value for the argument.</literallayout> </remark> </listitem> <listitem>ref<remark> <literallayout>A reference to another object defined in the container.</literallayout> </remark> </listitem> <listitem>template<remark> <literallayout>The name of a template which should be used as the value of the specified argument. When defined as an attribute no parameters can be passed to the template, so no placeholder substitution will occur. Use a child template element instead if parameters are needed.</literallayout> </remark> </listitem> </itemizedlist> </section><section> <title> <programlisting><array/></programlisting> </title> <literallayout>The array contains a list of the following possible values, these types can be mixed.</literallayout> </section><section> <title> <programlisting><array-collection/></programlisting> </title> <literallayout>The array-collection contains a list of the following possible values, these types can be mixed</literallayout> </section><section> <title> <programlisting><constructor-arg/></programlisting> </title> <literallayout>Constructor arguments. You can pass in a comma-delimited set of values, or a more complex value.</literallayout> <itemizedlist> <title>Attributes</title> <listitem>value<remark> <literallayout>A literal value for this particular argument. This can be a comma-delimited set of values</literallayout> </remark> </listitem> <listitem>ref<remark> <literallayout>A reference to an object defined in the container.</literallayout> </remark> </listitem> <listitem>template<remark> <literallayout>The name of a template which should be used to instantiate this specific argument. When defined as an attribute no parameters can be passed to the template, so no placeholder substitution will occur. Use a child template elementinstead if parameters are needed.</literallayout> </remark> </listitem> <listitem>type<remark> <literallayout> Defines an optional type for the constructor argument, the value of the value attribute will be cast to this type at runtime. </literallayout> </remark> </listitem> </itemizedlist> </section><section> <title> <programlisting><dictionary/></programlisting> </title> <literallayout>A dictionary contains a list properties specified like this: <property name="level"> <dictionary> <entry> <key>a key</key> <value>a</value> </entry> <entry> <key>another key</key> <value>1</value> </entry> <entry> <key>true</key> <value> <array> <value>b</value> <value>c</value> </array> </value> </entry> </dictionary> </property> </literallayout> <para> The following elements occur in dictionary: </para> <simplelist> <member> <link>entry</link> </member> </simplelist> </section><section> <title> <programlisting><entry/></programlisting> </title> <literallayout>Defines an entry that will be added to a dictionary instance.</literallayout> <itemizedlist> <title>Attributes</title> <listitem>key<remark> <literallayout>A literal key name for the specified entry.</literallayout> </remark> </listitem> <listitem>value<remark> <literallayout>A literal value for the specified entry.</literallayout> </remark> </listitem> </itemizedlist> <para> The following elements occur in entry: </para> <simplelist> <member> <link>key</link> </member> <member> <link>value</link> </member> </simplelist> </section><section> <title> <programlisting><import/></programlisting> </title> <literallayout>Imports an external configuration file, this way its possible to split up a configuration into multiple files to keep a better overview or to keep different version of the configuration across different servers.</literallayout> <itemizedlist> <title>Attributes</title> <listitem>file (required)<remark> <literallayout>A valid URI for the specified file. For a flex project this can be a relative URI, when used in an AIR application make sure to add a fully qualified local URI such as file:///subconfig.xml</literallayout> </remark> </listitem> </itemizedlist> </section><section> <title> <programlisting><interface/></programlisting> </title> <literallayout>The Interface type defines properties and methods for objects that implement the specified interface.</literallayout> <itemizedlist> <title>Attributes</title> <listitem>class<remark> <literallayout>The fully qualified classname for the specified interface. This class needs to be known at compile-time otherwise a runtime error will occur.</literallayout> </remark> </listitem> <listitem>init-method<remark> <literallayout>The name of a generic initialization method which will be called directly after instantiation and property injection.</literallayout> </remark> </listitem> </itemizedlist> <para> The following elements occur in interface: </para> <simplelist></simplelist> </section><section> <title> <programlisting><key/></programlisting> </title> <literallayout>Defines a key that will be used for a dictionary entry.</literallayout> <itemizedlist> <title>Attributes</title> <listitem>type<remark></remark> </listitem> </itemizedlist> <para> The following elements occur in key: </para> <simplelist> <member> <link>object</link> </member> <member> <link>array</link> </member> <member> <link>array-collection</link> </member> <member> <link>dictionary</link> </member> <member> <link>ref</link> </member> </simplelist> </section><section> <title> <programlisting><method-invocation/></programlisting> </title> <literallayout>Defines a method and optional method arguments. After instantiation of the object the specified method will be invoked with the specified arguments. No compile checks are possible for this definition, so if the method does not exist on the object this will result in a runtime error.</literallayout> <itemizedlist> <title>Attributes</title> <listitem>name (required)<remark> <literallayout>The name of the method.</literallayout> </remark> </listitem> </itemizedlist> <para> The following elements occur in method-invocation: </para> <simplelist> <member> <link>arg</link> </member> </simplelist> </section><section> <title> <programlisting><object/></programlisting> </title> <literallayout>The Object type defines the basic Object that is configured by the IoC container.</literallayout> <itemizedlist> <title>Attributes</title> <listitem>class<remark> <literallayout>The fully qualified classname for the specified object. This class needs to be known at compile-time otherwise a runtime error will occur.</literallayout> </remark> </listitem> <listitem>id<remark> <literallayout>A unique id. This id can be used to retrieve an object by calling the getObject method on the applicationcontext.</literallayout> </remark> </listitem> <listitem>factory-method<remark> <literallayout>Optional method that will be called instead of the constructor.</literallayout> </remark> </listitem> <listitem>scope =enumeration(prototype,singleton) <remark> <literallayout>When an object is a singleton, only one shared instance of the object will be managed, and all requests for objects with an id or ids matching that object definition will result in that one specific bean instance being returned by the Spring container. The non-singleton, prototype scope of object deployment results in the creation of a new object instance every time a request for that specific object is made (that is, it is injected into another object or it is requested via a programmatic getObject() method call on the container). As a rule of thumb, you should use the prototype scope for all objects that are stateful, while the singleton scope should be used for stateless objects.</literallayout> </remark> </listitem> <listitem>lazy-init<remark> <literallayout>By default objects marked as a singleton will be constructed immediately after the container has finished initializing. When lazy-init is set to true though, instantation will be deferred until the first time that the getObject method is called for the specified singleton.</literallayout> </remark> </listitem> <listitem>init-method<remark> <literallayout>The name of a generic initialization method which will be called directly after instantation and property injection.</literallayout> </remark> </listitem> <listitem>singleton<remark> <literallayout>When set to true, this property determines that the getObject method will always return a reference to the same instance of the specified object. When set to false, the getObject method will always return a new instance.</literallayout> </remark> </listitem> <listitem>template<remark> <literallayout>The id of a template defined in the current container.</literallayout> </remark> </listitem> <listitem>abstract<remark> <literallayout>When set to true this property determines that the specified object cannot be directly instantiated on its own since it is incomplete. When a definition is considered abstract like this (explicitly or implicitly), it's usable just as a pure template or abstract object definition that will serve as parent definition for child definitions.</literallayout> </remark> </listitem> <listitem>parent<remark> <literallayout>The id of another object defined in the current container. A child object definition will use the object class from the parent definition if none is specified, but can also override it. In the latter case, the child object class must be compatible with the parent, i.e. it must accept the parent's property values. A child object definition will inherit constructor argument values, property values and method overrides from the parent, with the option to add new values. If init method, destroy method and/or static factory method are specified, they will override the corresponding parent settings. The remaining settings will always be taken from the child definition: depends-on, dependency check, singleton, lazy-init.</literallayout> </remark> </listitem> <listitem>depends-on<remark> <literallayout>For the relatively infrequent situations where dependencies between objects are less direct (for example, when a static initializer in a class needs to be triggered), the depends-on element may be used to explicitly force one or more objects to be initialized before the object using this element is initialized.</literallayout> </remark> </listitem> <listitem>autowire-candidate<remark> <literallayout>True if this object may be used as an autowiring candidate when another object is autowired byType</literallayout> </remark> </listitem> <listitem>primary<remark> <literallayout>True if more than one object of the same type exists in the configuration and the current object needs to be the autowire candidate.</literallayout> </remark> </listitem> <listitem>skip-postprocessors<remark> <literallayout>Determines whether the object factory will send the created object through its list of IObjectProcessors.</literallayout> </remark> </listitem> <listitem>skip-metadata<remark> <literallayout>Determines whether the autowire processor will examine the class metadata.</literallayout> </remark> </listitem> <listitem>autowire =enumeration(autodetect,byName,byType,constructor,no) <remark> <literallayout>Defines the autowiring strategy to be used for the current object, default is 'no'.</literallayout> </remark> </listitem> <listitem>dependency-check =enumeration(all,none,objects,simple) <remark> <literallayout>Defines the dependency check strategy to be used after autowired properties are set for the current object, default is 'none'.</literallayout> </remark> </listitem> </itemizedlist> <para> The following elements occur in object: </para> <simplelist></simplelist> </section><section> <title> <programlisting><param/></programlisting> </title> <literallayout>Template parameters have a name and a value. Currently only string replacement for parameter values is allowed.</literallayout> </section><section> <title> <programlisting><property/></programlisting> </title> <literallayout>Can be used to load external properties from a file. This is similar to how Ant loads external properties. <property file="strings.properties" /> the property file looks like: s1=First string s2=Second string Note: the path to the property file is relative to the path of the application context xml file. Note: on some servers, the "properties" extension might be blocked. You can either allow the extension in the server configuration or add an extra "txt" (or other) prefix that is allowed to be served: <property file="strings.properties.txt" /> The properties loader will prevent caching of the properties by default, to turn this behavior off set the prevent-cache attribute to false: <property file="strings.properties.txt" prevent-cache="false"/> By default the properties loader will throw an error if a properties file could not be loaded, to ignore the error and resume loading set the required attribute to false: <property file="strings.properties.txt" required="false"/> it is also possible to directly define properties using this element. In this case omit the file attribute and add the name and value as attributes, like this: <property name="s1" value="First string"/> <property name="s2" value="Second string"/> The file attribute will take precedence over the name and value attributes. </literallayout> <itemizedlist> <title>Attributes</title> <listitem>file<remark> <literallayout>A valid URI for the specified properties file. For a flex project this can be a relative URI, when used in an AIR application make sure to add a fully qualified local URI such as file:///subconfig.xml</literallayout> </remark> </listitem> <listitem>prevent-cache<remark> <literallayout>If true the properties loader will make sure no cached copy of the file will be loaded</literallayout> </remark> </listitem> <listitem>required<remark> <literallayout>If true the properties loader will throw an error when the file could not be loaded</literallayout> </remark> </listitem> <listitem>name<remark> <literallayout>The name of the property</literallayout> </remark> </listitem> <listitem>value<remark> <literallayout>The value of the property</literallayout> </remark> </listitem> </itemizedlist> </section><section> <title> <programlisting><property/></programlisting> </title> <literallayout>Defines the value of a property on an object.</literallayout> <itemizedlist> <title>Attributes</title> <listitem>name<remark> <literallayout>The name of the specified property.</literallayout> </remark> </listitem> <listitem>value<remark> <literallayout>A literal value for the property.</literallayout> </remark> </listitem> <listitem>type<remark> <literallayout>Defines an optional type for the property, the value of the value attribute will be cast to this type at runtime.</literallayout> </remark> </listitem> <listitem>ref<remark> <literallayout>A reference to another object defined in the container.</literallayout> </remark> </listitem> <listitem>template<remark> <literallayout>The name of a template which should be used to instantiate this specific property. When defined as an attribute no parameters can be passed to the template, so no placeholder substitution will occur. Use a child template element instead if parameters are needed.</literallayout> </remark> </listitem> </itemizedlist> </section><section> <title> <programlisting><template/></programlisting> </title> <literallayout>A template is used to assist in creation of other objects. It can define a number of properties that will be injected by the same values and instances for every object based on this template. To use a template, you can specify variables in braces (placeholders). Here is an example: <template id="remoteObject"> <object class="mx.rpc.remoting.mxml.RemoteObject"> <property name="destination" value="GenericDestination"/> <property name="endpoint" ref="remoteGateway"/> <property name="source" value="ApplicationDomain.Services.${serviceClass}"/> </object> </template> and used like: <object id="serviceLocator" class="org.springextensions.actionscript.cairngorm.CairngormServiceLocator" factory-method="getInstance"> <property name="assetService" template="remoteObject"> <param name="serviceClass" value="AssetService"/> </property> <property name="packageService" template="remoteObject"> <param name="serviceClass" value="PackageService"/> </property> <property name="userService" template="remoteObject"> <param name="serviceClass" value="UserService"/> </property> </object> </literallayout> <itemizedlist> <title>Attributes</title> <listitem>id<remark> <literallayout>A unique identifier for the specified template.</literallayout> </remark> </listitem> </itemizedlist> <para> The following elements occur in template: </para> <simplelist> <member> <link>object</link> </member> </simplelist> </section><section> <title> <programlisting><value/></programlisting> </title> <literallayout>Defines a value that will be used for a dictionary entry.</literallayout> <itemizedlist> <title>Attributes</title> <listitem>type<remark></remark> </listitem> </itemizedlist> <para> The following elements occur in value: </para> <simplelist> <member> <link>object</link> </member> <member> <link>array</link> </member> <member> <link>array-collection</link> </member> <member> <link>dictionary</link> </member> <member> <link>ref</link> </member> </simplelist> </section><section> <title> <programlisting><vector/></programlisting> </title> <literallayout>The vector contains a list of the following possible values, these types can be mixed. The eventual resolved objects need to be of the same Class as the type attribute indicates.</literallayout> <itemizedlist> <title>Attributes</title> <listitem>type (required)<remark></remark> </listitem> </itemizedlist> <para> The following elements occur in vector: </para> <simplelist> <member> <link>value</link> </member> <member> <link>ref</link> </member> <member> <link>object</link> </member> </simplelist> </section>