Packageorg.springextensions.actionscript.context.support.mxml
SVN browsingMXMLApplicationContext.as
FisheyeMXMLApplicationContext.as
Classpublic class MXMLApplicationContext
InheritanceMXMLApplicationContext Inheritance FlexXMLApplicationContext Inheritance XMLApplicationContext Inheritance XMLObjectFactory Inheritance DefaultListableObjectFactory Inheritance AbstractObjectFactory Inheritance flash.events.EventDispatcher
Implementsmx.core.IMXMLObject

Extension of FlexXMLApplicationContext that enables configuration to be defined in MXML instead of an external XML file.

Default MXML PropertydefinitionsList


Example
  <sas:MXMLApplicationContext id="applicationContext">
  
   <sas:ObjectDefinition id="amfChannel" class="mx.messaging.channels.AMFChannel">
    <sas:ConstructorArg value="amfChannel"/>
    <sas:ConstructorArg value="http://\{server.name\}:\{server.port\}/flex2gateway/"/>
    <sas:Property name="pollingEnabled" value="false"/>
    <sas:Property name="id" value="amfChannel"/>
   </sas:ObjectDefinition>
  
   <sas:ObjectDefinition id="channelset" clazz="{mx.messaging.ChannelSet}">
    <sas:MethodInvocation name="addChannel">
     <arg ref="{amfChannel}"/>
    </sas:MethodInvocation>
   </sas:ObjectDefinition>
  
   <sas:Template id="remoteObject">
    <sas:ObjectDefinition clazz="{mx.rpc.remoting.mxml.RemoteObject}">
     <sas:Property name="destination" value="ColdFusion"/>
     <sas:Property name="concurrency" value="multiple"/>
     <sas:Property name="makeObjectsBindable" value="false"/>
     <sas:Property name="showBusyCursor" value="true"/>
     <sas:Property name="source" value="com.serverside.remote.$#serviceClass#"/>
     <sas:Property name="channelSet" ref={channelSet}>
    </property>
    </sas:ObjectDefinition>
   </sas:Template>
  
   <sas:ObjectDefinition id="templatedRemoteObject" template="{remoteObject}">
    <sas:Param name="serviceClass" value="remotegateway"/>
   </sas:ObjectDefinition>
   
  </sas:MXMLApplicationContext>
  



Documentation reference: composing mxml based configuration metadata


Public Properties
 PropertyDefined by
 InheritedallowObjectDefinitionOverriding : Boolean
Set whether it should be allowed to override object definitions by registering a different definition with the same name, automatically replacing the former.
DefaultListableObjectFactory
  autoInit : Boolean

True if the MXMLApplicationContext should start registering its ObjectDefinitions immeditiately after being created.

When set to false the load() method can be invoked manually to get the context ready for use.

MXMLApplicationContext
 InheritedautowireProcessor : IAutowireProcessor
AbstractObjectFactory
  configLocation : String
The location of the configuration file that the MXMLApplicationContext needs to load after initialization.
MXMLApplicationContext
  configLocations : Array
[write-only]
MXMLApplicationContext
 InheriteddefaultAutowiringStageProcessorName : String
The name of an IStageProcessor instance in the configuration that will override the default autowiring stage processor created by the current instance.
FlexXMLApplicationContext
  definitionsList : Array
An Array of ObjectDefinitions that have been added to this MXMLApplicationContext.
MXMLApplicationContext
  interfaces : Array
An Array of Interfaces that have been added to this MXMLApplicationContext.
MXMLApplicationContext
 InheritedloadedProperties : Array
An Array of Properties instances that represent all the loaded property file.
XMLObjectFactory
 InheritednumObjectDefinitions : int
Returns the number of definitions present in the object definition registry
DefaultListableObjectFactory
 InheritednumObjectPostProcessors : int
Returns the number of object post processors.
AbstractObjectFactory
 InheritedobjectDefinitionNames : Array
Returns an array containing all object definition names.
DefaultListableObjectFactory
 InheritedobjectDefinitions : Object
AbstractObjectFactory
 Inheritedparser : XMLObjectDefinitionsParser
Contains the parser of the XML definitions.
XMLObjectFactory
  templates : Array
An Array of Templates that have been added to this MXMLApplicationContext.
MXMLApplicationContext
 InheritedtypeConverter : ITypeConverter
The current type converter implementation
AbstractObjectFactory
Protected Properties
 PropertyDefined by
 InheritedconfigurationReady : Boolean = false
True if the FlexXMLApplicationContext has finished loading and parsing its configuration
FlexXMLApplicationContext
 InheritedcurrentConfigLocation : String = ""
XMLObjectFactory
 InheritedearlySingletonCache : Object
Cache of early cached singletons for circular references
AbstractObjectFactory
 InheritedobjectPostProcessors : Array
Object post processors to apply when creating objects
AbstractObjectFactory
 InheritedreferenceResolvers : Array
Reference resolvers used when creating objects
AbstractObjectFactory
 InheritedsingletonCache : Object
Cache of created singleton objects
AbstractObjectFactory
 InheritedstageProcessorRegistrations : Array
An Array of StageProcessorRegistration instances.
FlexXMLApplicationContext
Public Methods
 MethodDefined by
  
MXMLApplicationContext(source:* = null)
Creates a new MXMLApplicationContext instance
MXMLApplicationContext
 Inherited
addConfig(config:XML):void
Use this method to add xml versions of configurations
XMLObjectFactory
 Inherited
addConfigLocation(configLocation:String):void
Use this method to add aditional configuration locations.
XMLObjectFactory
 Inherited
addEmbeddedConfig(config:Class):void
Adds an embedded config.
XMLObjectFactory
 Inherited
Adds a namespace handler to the parser of this application context.
XMLApplicationContext
 Inherited
addObjectFactoryPostProcessor(objectFactoryPostProcessor:IObjectFactoryPostProcessor, index:int = -1):void
Adds an IObjectFactoryPostProcessor instance to the current XMLApplicationContext
XMLApplicationContext
 Inherited
addObjectPostProcessor(objectPostProcessor:IObjectPostProcessor):void
Adds an object postprocessor to this object factory.
AbstractObjectFactory
 Inherited
addReferenceResolver(referenceResolver:IReferenceResolver):void
This method adds a reference resolver that will be used to resolve property references.
AbstractObjectFactory
 Inherited
clearObjectFromInternalCache(name:String):Object
Removes an object from the internal object definition cache.
AbstractObjectFactory
 Inherited
containsObject(objectName:String):Boolean
Determines if the object factory contains a definition with the given name.
AbstractObjectFactory
 Inherited
containsObjectDefinition(objectName:String):Boolean
Determines if an object definition with the given name exists
DefaultListableObjectFactory
 Inherited
getObject(name:String, constructorArguments:Array = null):*
Will retrieve an object by it's name/id If the definition is a singleton it will be retrieved from cache if possible.
AbstractObjectFactory
 Inherited
Returns the object definition associated with the given object name.
DefaultListableObjectFactory
 Inherited
getObjectNamesForType(type:Class):Array
Returns all object definitions names that implement the given type.
DefaultListableObjectFactory
 Inherited
getObjectsOfType(type:Class):Dictionary
Returns all object definitions that implement the given type.
DefaultListableObjectFactory
 Inherited
getType(objectName:String):Class
Returns the type that is defined on the object definition.
AbstractObjectFactory
  
initialized(document:Object, id:String):void
MXMLApplicationContext
 Inherited
isFactoryObject(objectName:String):Boolean
Determines if an object is a IFactoryObject implementation.
AbstractObjectFactory
 Inherited
isPrototype(objectName:String):Boolean
Determines if the definition with the given name is a prototype.
AbstractObjectFactory
 Inherited
isSingleton(objectName:String):Boolean
Determines if the definition with the given name is a singleton.
AbstractObjectFactory
  
load():void
Processes the ObjectDefinitions, Templates and Interfaces that were added to the current MXMLApplicationContext, configures ObjectDefinitions based on their Template or parent definitions.
MXMLApplicationContext
 Inherited

Checks if the objectdefinition is an implementation of IFactoryObject, if so the factory will be pre-instantiated, not the result of the factory.

Instantiates all definitions that are defined as singleton and are not lazy.
DefaultListableObjectFactory
 Inherited
registerCustomEditor(requiredType:Class, propertyEditor:IPropertyEditor):void
Registers a custom property editor.
AbstractObjectFactory
 Inherited
registerObjectDefinition(objectName:String, objectDefinition:IObjectDefinition):void
Registers the given objectDefinition with the given name.
DefaultListableObjectFactory
 Inherited
registerStageProcessor(name:String, stageProcessor:IStageProcessor):void
Adds the specified IStageProcessor instance to the collection.
FlexXMLApplicationContext
 Inherited
removeObjectDefinition(objectName:String):void
Removes the definition with the given name from the registry
DefaultListableObjectFactory
 Inherited
Remove systemManager Event.ADDED listener added during object construction.
FlexXMLApplicationContext
 Inherited
resolveReference(property:Object):Object
Resolves a property in an object definition.
AbstractObjectFactory
 Inherited
unregisterStageProcessor(name:String):void
Removes the IStageProcessor with the specified name.
FlexXMLApplicationContext
 Inherited
wire(object:*, objectDefinition:IObjectDefinition, objectName:String = null):void
AbstractObjectFactory
Protected Methods
 MethodDefined by
 Inherited

Checks if the given xml data contains any tags.

FlexXMLApplicationContext
 Inherited
afterParse():void
Hook method defined in XmlObjectFactory overridden to invoke application context specific logic.
XMLApplicationContext
 Inherited
beforeParse():void
Hook method defined in XmlObjectFactory to add the ApplicationContextAwareProcessor.
XMLApplicationContext
 Inherited
If the _loader variable is not null the onLoaderComplete and onIOError event handlers are removed.
XMLObjectFactory
 Inherited
completeHandler(event:Event):void
Event.COMPLETE event handler added in context constructor.
FlexXMLApplicationContext
 Inherited
Initializes the FlexXMLApplicationContext instance.
FlexXMLApplicationContext
 Inherited
getBaseURL(url:String):String
Returns the base url of the file this loading is loading.
XMLObjectFactory
  
getInterface(intfClass:Class):Interface
MXMLApplicationContext
  
hasMethod(objectDefinition:ObjectDefinition, method:MethodInvocation):Boolean
True if the specified ObjectDefinition already contains a definition for the specified method.
MXMLApplicationContext
  
hasProperty(objectDefinition:ObjectDefinition, propertyName:String):Boolean
True if the specified ObjectDefinition already contains a definition for the specified property.
MXMLApplicationContext
  
Invokes the load() method if autoInit is set to true.
MXMLApplicationContext
 Inherited
Invokes all object factory post processors.
XMLApplicationContext
 Inherited
loadConfigLocation(configLocation:String):void
Will load a configLocation
XMLObjectFactory
  
mergeDefinitionCollections(sourceDefinition:ObjectDefinition, destinationDefinition:ObjectDefinition):void

Copies the MethodInvocation and Property arrays of the source definition to the destination definition.

This will not override already existing methods or properties in the destination definition.

MXMLApplicationContext
  
mergeObjectDefinitions(sourceDefinition:ObjectDefinition, destinationDefinition:ObjectDefinition):void
Copies all the properties on from the source definition to the destination definition.
MXMLApplicationContext
 Inherited
processDisplayObject(dp:DisplayObject):void
Sends the specified DisplayObject instance to the processWireCandidate() method, then loops through its children and recursively sends those to the processDisplayObject() method.
FlexXMLApplicationContext
 Inherited
processInterceptionCandidate(interceptionCandidate:Object):void
Detects whether an object added to the stage is a candidate for interception through the list of StageProcessorRegistration instances, if any IObjectSelector approves of the object its associated IStageProcessor's process() method is invoked.
FlexXMLApplicationContext
  
processInterfaceData(intf:Interface, objectDefinition:ObjectDefinition):void
MXMLApplicationContext
  
processInterfacesData(objectDefinition:ObjectDefinition):void
MXMLApplicationContext
  
Optionally configures the specified ObjectDefinition with its assigned Template or parent definition, after which the IObjectDefinition gets registered in the superclass.
MXMLApplicationContext
  
processParentData(objectDefinition:ObjectDefinition):void
Configures the specified ObjectDefinition with its parent definition if the the parentObject property is not null.
MXMLApplicationContext
  
processTemplateData(objectDefinition:ObjectDefinition):void
Processes and copies the Template's method and property definition lists and merges the Template's ObjectDefinition with the specified ObjectDefinition.
MXMLApplicationContext
 Inherited
Looks for implementations of IObjectFactoryPostProcessor in the object definition of this context and add an instance of each one as a object factory post processor.
XMLApplicationContext
 Inherited
Will search all object definitions for implementations of IObjectPostProcessor.
XMLApplicationContext
  
replaceArgParams(arg:Arg, params:Dictionary):void
Replaces the Param values in the Arg's value property.
MXMLApplicationContext
  
Replaces the Param values in the MethodInvocation's name property and Arg collection.
MXMLApplicationContext
  
replacePropertyParams(propertyName:String, propertyValue:Object, params:Dictionary):Property
Replaces the Param values in the Property's name and value property.
MXMLApplicationContext
 Inherited
stageWireObjectHandler(event:Event):void
Stage add object event handler added in context constructor.
FlexXMLApplicationContext
 Inherited
wireStage():void
Loops through the all the stage components that are currently on the stage and passes them to to the processDisplayObject() method.
FlexXMLApplicationContext
 Inherited
XMLObjectFactoryInit(source:*):void
Initializes the XMLObjectFactoryInit instance
XMLObjectFactory
Events
 EventSummaryDefined by
 Inherited Dispatched as a result of a call to the load method when all available configurations have been parsed.XMLObjectFactory
 Inherited Dispatched when an input or output error occurs that causes a load operation to fail.XMLObjectFactory
Public Constants
 ConstantDefined by
 InheritedOBJECT_FACTORY_PREFIX : String = "&"
[static] Used to dereference an IFactoryObject instance and distinguish it from objects created by the IFactoryObject.
AbstractObjectFactory
Property detail
autoInitproperty
autoInit:Boolean  [read-write]

True if the MXMLApplicationContext should start registering its ObjectDefinitions immeditiately after being created.

When set to false the load() method can be invoked manually to get the context ready for use.

Implementation
    public function get autoInit():Boolean
    public function set autoInit(value:Boolean):void

See also

configLocationproperty 
configLocation:String  [read-write]

The location of the configuration file that the MXMLApplicationContext needs to load after initialization. Note: setting this property will clear the configLocations property first and then adds the specified config location.

Implementation
    public function get configLocation():String
    public function set configLocation(value:String):void
configLocationsproperty 
configLocations:Array  [write-only]Implementation
    public function set configLocations(value:Array):void
definitionsListproperty 
definitionsList:Array  [read-write]

An Array of ObjectDefinitions that have been added to this MXMLApplicationContext.

Implementation
    public function get definitionsList():Array
    public function set definitionsList(value:Array):void

See also

interfacesproperty 
interfaces:Array  [read-write]

An Array of Interfaces that have been added to this MXMLApplicationContext.

Implementation
    public function get interfaces():Array
    public function set interfaces(value:Array):void

See also

templatesproperty 
templates:Array  [read-write]

An Array of Templates that have been added to this MXMLApplicationContext.

Implementation
    public function get templates():Array
    public function set templates(value:Array):void

See also

Constructor detail
MXMLApplicationContext()constructor
public function MXMLApplicationContext(source:* = null)

Creates a new MXMLApplicationContext instance

Parameters
source:* (default = null)
Method detail
getInterface()method
protected function getInterface(intfClass:Class):InterfaceParameters
intfClass:Class

Returns
Interface
hasMethod()method 
protected function hasMethod(objectDefinition:ObjectDefinition, method:MethodInvocation):Boolean

True if the specified ObjectDefinition already contains a definition for the specified method.

Parameters
objectDefinition:ObjectDefinition
 
method:MethodInvocation

Returns
Boolean
hasProperty()method 
protected function hasProperty(objectDefinition:ObjectDefinition, propertyName:String):Boolean

True if the specified ObjectDefinition already contains a definition for the specified property.

Parameters
objectDefinition:ObjectDefinition
 
propertyName:String

Returns
Boolean
initializeContext()method 
protected function initializeContext():void

Invokes the load() method if autoInit is set to true.

See also

initialized()method 
public function initialized(document:Object, id:String):void

Parameters
document:Object
 
id:String
load()method 
public override function load():void

Processes the ObjectDefinitions, Templates and Interfaces that were added to the current MXMLApplicationContext, configures ObjectDefinitions based on their Template or parent definitions. After this function the MXMLApplicationContext is ready to be used.

See also

mergeDefinitionCollections()method 
protected function mergeDefinitionCollections(sourceDefinition:ObjectDefinition, destinationDefinition:ObjectDefinition):void

Copies the MethodInvocation and Property arrays of the source definition to the destination definition.

This will not override already existing methods or properties in the destination definition.

Parameters
sourceDefinition:ObjectDefinition — The ObjectDefinition instance whose method and property definitions should be copied.
 
destinationDefinition:ObjectDefinition — The ObjectDefinition instance who will receive the copied method and property definitions.
mergeObjectDefinitions()method 
protected function mergeObjectDefinitions(sourceDefinition:ObjectDefinition, destinationDefinition:ObjectDefinition):void

Copies all the properties on from the source definition to the destination definition. But only if these properties have not been definied in the MXML markup of the destination definition. The dependsOn property is an array and will be concatenated, so the destination will have both its own and its source dependencies.

Parameters
sourceDefinition:ObjectDefinition — The ObjectDefinition instance whose direct properties should be copied.
 
destinationDefinition:ObjectDefinition — The ObjectDefinition instance who will receive the copied properties.
processInterfaceData()method 
protected function processInterfaceData(intf:Interface, objectDefinition:ObjectDefinition):voidParameters
intf:Interface
 
objectDefinition:ObjectDefinition
processInterfacesData()method 
protected function processInterfacesData(objectDefinition:ObjectDefinition):voidParameters
objectDefinition:ObjectDefinition
processObjectDefinition()method 
protected function processObjectDefinition(objectDefinition:ObjectDefinition):void

Optionally configures the specified ObjectDefinition with its assigned Template or parent definition, after which the IObjectDefinition gets registered in the superclass.

Parameters
objectDefinition:ObjectDefinition

See also

processParentData()method 
protected function processParentData(objectDefinition:ObjectDefinition):void

Configures the specified ObjectDefinition with its parent definition if the the parentObject property is not null.

Parameters
objectDefinition:ObjectDefinition
processTemplateData()method 
protected function processTemplateData(objectDefinition:ObjectDefinition):void

Processes and copies the Template's method and property definition lists and merges the Template's ObjectDefinition with the specified ObjectDefinition.

Parameters
objectDefinition:ObjectDefinition — The ObjectDefinition that will be configured with its assigned Template instance.
replaceArgParams()method 
protected function replaceArgParams(arg:Arg, params:Dictionary):void

Replaces the Param values in the Arg's value property.

Parameters
arg:Arg
 
params:Dictionary
replaceMethodParams()method 
protected function replaceMethodParams(method:MethodInvocation, params:Dictionary):MethodInvocation

Replaces the Param values in the MethodInvocation's name property and Arg collection.

Parameters
method:MethodInvocation
 
params:Dictionary

Returns
MethodInvocation
replacePropertyParams()method 
protected function replacePropertyParams(propertyName:String, propertyValue:Object, params:Dictionary):Property

Replaces the Param values in the Property's name and value property.

Parameters
propertyName:String
 
propertyValue:Object
 
params:Dictionary

Returns
Property