Packagech.capi.net.app
Classpublic final class ApplicationFile
InheritanceApplicationFile Inheritance Object

Represents an application file. An ApplicationFile is always registered in an IApplicationContext that will manage the unicity of each ApplicationFile. Basically, an ApplicationFile just holds an ILoadableFile and stores the dependencies of it.

See also

ApplicationFileParser
ApplicationMassLoader
ApplicationContext


Public Properties
 PropertyDefined By
  applicationContext : IApplicationContext
[read-only] Defines the IApplicationContext of the ApplicationFile.
ApplicationFile
  dependencies : Array
[read-only] Defines the dependencies.
ApplicationFile
  global : Boolean
Defines if the ApplicationFile is global or not.
ApplicationFile
  loadableFile : ILoadableFile
Defines the ILoadableFile.
ApplicationFile
  name : String
[read-only] Defines the name.
ApplicationFile
  priority : int
Defines the priority of the ApplicationFile.
ApplicationFile
  properties : IProperties
[read-only] Defines the Properties of the linked ILoadableFile.
ApplicationFile
Public Methods
 MethodDefined By
  
ApplicationFile(name:String, context:IApplicationContext, loadableFile:ILoadableFile = null)
Creates a new ApplicationFile object.
ApplicationFile
  
Add an ApplicationFile as dependency of this file.
ApplicationFile
  
Removes all the dependencies of the ApplicationFile.
ApplicationFile
  
getData(asClass:String = null, appDomain:ApplicationDomain = null):*
Retrieves the data of the ILoadableFile linked to the ApplicationFile.
ApplicationFile
  
getParents():Array
Get all the ApplicationFile that have this file as direct dependency.
ApplicationFile
  
getProperty(key:*):*
Retrieves the value of the specified key from the properties of the ILoadableFile.
ApplicationFile
  
isDependencyOf(file:ApplicationFile, recursiveSearch:Boolean = true):Boolean
Retrieves if the ApplicationFile is a dependency of the specified ApplicationFile.
ApplicationFile
  
removeDependency(file:ApplicationFile, recursiveSearch:Boolean = false):void
Removes a dependency from the ApplicationFile.
ApplicationFile
  
this method is just used to communicate the context between the ApplicationFile and ApplicationContext classes and shouldn't be used !
ApplicationFile
  
toString():String
Represents this ApplicationFile in a String.
ApplicationFile
Protected Methods
 MethodDefined By
  
Check if the dependency is safe for a ApplicationFile.
ApplicationFile
Property Detail
applicationContextproperty
applicationContext:IApplicationContext  [read-only]

Defines the IApplicationContext of the ApplicationFile.


Implementation
    public function get applicationContext():IApplicationContext
dependenciesproperty 
dependencies:Array  [read-only]

Defines the dependencies. This is an Array of ApplicationFile that is duplicated from the original Array.


Implementation
    public function get dependencies():Array
globalproperty 
global:Boolean  [read-write]

Defines if the ApplicationFile is global or not.


Implementation
    public function get global():Boolean
    public function set global(value:Boolean):void
loadableFileproperty 
loadableFile:ILoadableFile  [read-write]

Defines the ILoadableFile.


Implementation
    public function get loadableFile():ILoadableFile
    public function set loadableFile(value:ILoadableFile):void
nameproperty 
name:String  [read-only]

Defines the name. The name is unique trough all the ApplicationFile objects.


Implementation
    public function get name():String
priorityproperty 
priority:int  [read-write]

Defines the priority of the ApplicationFile. This value is only used if the ApplicationFile is directly added in the ApplicationMassLoader.


Implementation
    public function get priority():int
    public function set priority(value:int):void

See also

propertiesproperty 
properties:IProperties  [read-only]

Defines the Properties of the linked ILoadableFile.


Implementation
    public function get properties():IProperties

See also

Constructor Detail
ApplicationFile()Constructor
public function ApplicationFile(name:String, context:IApplicationContext, loadableFile:ILoadableFile = null)

Creates a new ApplicationFile object.

Parameters
name:String — The name. It must be unique !
 
context:IApplicationContext — The IApplicationContext. If not specified, then the global context will be used.
 
loadableFile:ILoadableFile (default = null) — The linked ILoadableFile.

Throws
ch.capi.errors:NameAlreadyExistsError If — the specified name already exists in the specified IApplicationContext.
Method Detail
addDependency()method
public function addDependency(file:ApplicationFile):void

Add an ApplicationFile as dependency of this file. It means that the specified file is necessary to be loaded before the current ApplicationFile can be executed.

The ApplicationFile added as dependency must be in the same IApplicationContext.

Parameters

file:ApplicationFile — The ApplicationFile to add.


Throws
ArgumentError If — the IApplicationContext is not the same.
 
ch.capi.errors:DependencyNotSafeError If — the dependency is not safe.
clearDependencies()method 
public function clearDependencies():void

Removes all the dependencies of the ApplicationFile.

getData()method 
public function getData(asClass:String = null, appDomain:ApplicationDomain = null):*

Retrieves the data of the ILoadableFile linked to the ApplicationFile. If the loadManagerObject is a URLLoader, then the data are returned else the loadManagerObject itself is returned.

Parameters

asClass:String (default = null) — The class that should be returned by the method (cf ILoadableFile implementation).
 
appDomain:ApplicationDomain (default = null) — The ApplicationDomain of the class.

Returns
* — The data of the ILoadableFile.

See also

getParents()method 
public function getParents():Array

Get all the ApplicationFile that have this file as direct dependency.

Returns
Array — The parents.
getProperty()method 
public function getProperty(key:*):*

Retrieves the value of the specified key from the properties of the ILoadableFile. If the ILoadableFile is not defined, null is returned.

Parameters

key:* — The key.

Returns
* — The value or null.

See also

isDependencyOf()method 
public function isDependencyOf(file:ApplicationFile, recursiveSearch:Boolean = true):Boolean

Retrieves if the ApplicationFile is a dependency of the specified ApplicationFile.

Parameters

file:ApplicationFile — The parent ApplicationFile.
 
recursiveSearch:Boolean (default = true) — Defines if the dependency must be searched recursively.

Returns
Boolean
isDependencyRecursive()method 
protected function isDependencyRecursive(file:ApplicationFile):Boolean

Check if the dependency is safe for a ApplicationFile.

Parameters

file:ApplicationFile — The file to add as a dependency.

Returns
Booleantrue is the dependency is safe.
removeDependency()method 
public function removeDependency(file:ApplicationFile, recursiveSearch:Boolean = false):void

Removes a dependency from the ApplicationFile.

Parameters

file:ApplicationFile — The dependency to remove.
 
recursiveSearch:Boolean (default = false) — Defines if the search of the dependency must recursive through the dependency tree. The removal will be stopped after the first instance of the dependency has been found.

setContext()method 
public function setContext(value:IApplicationContext):void

this method is just used to communicate the context between the ApplicationFile and ApplicationContext classes and shouldn't be used !

Parameters

value:IApplicationContext

toString()method 
public function toString():String

Represents this ApplicationFile in a String. This gives just useful information for debugging purpose.

Returns
String — A String representation of this ApplicationFile.