Class org.as2lib.app.exec.AbstractProcess

org.as2lib.app.exec.AbstractProcess

Implemented Interfaces

Process ProcessListener

Description

AbstractProcess is a abstract helper class to implement processes.

Most of the functionalities of Process are served well within AbstractProcess. Because of the situation that most processes are simple executions AbstractProcess allows easy implementations of Process.

To use the advantage of AbstractProcess simple extend it and implement the run method.

It executes run at start and handles the exeuction of events and the correct states. If you wan't to stop your process pause and resume offer direct support.

Method Index

addAllProcessListeners(), addProcessListener(), getAllProcessListeners(), getParentProcess(), getPercentage(), hasFinished(), hasStarted(), isPaused(), isRunning(), onFinishProcess(), onPauseProcess(), onProcessError(), onResumeProcess(), onStartProcess(), onUpdateProcess(), pause(), removeAllProcessListeners(), removeProcessListener(), resume(), setParentProcess(), start(), startSubProcess()

Method Detail

setParentProcess

public function setParentProcess(p:Process):Void

Setter for a possible parent process.

Parameters

pProcess to act as parentprocess.

Throws

IllegalArgumentExceptionif the applied process has the current instance in its parents-hierarchy.

Specified By

setParentProcess() in org.as2lib.app.exec.Process

getParentProcess

public function getParentProcess(Void):Process

Getter for the parent process.

Specified By

getParentProcess() in org.as2lib.app.exec.Process

startSubProcess

public function startSubProcess(process:Process, args:Array, callBack:Executable):Void

Starts a sub process.

Your Process will not be finished until all the subprocesses are finished.

If you start more processes after each other, all will get started immediately. It is no batch system where one starts strictly after another.

You can start one specific process only if this process wasn't started before

Parameters

processProcess to be started.
argsArguments for the process start.
callBackCallback to be executed if the process finishes.

pause

public function pause(Void):Void

Pauses the process.

resume

public function resume(Void):Void

Resumes the process

start

public function start()

Starts the process.

Specified By

start() in org.as2lib.app.exec.Process

hasFinished

public function hasFinished(Void):Boolean

Return

true if the process has finished. (false if the process hasn't started yet)

Specified By

hasFinished() in org.as2lib.app.exec.Process

isPaused

public function isPaused(Void):Boolean

Return

true if the process is paused.

Specified By

isPaused() in org.as2lib.app.exec.Process

hasStarted

public function hasStarted(Void):Boolean

Return

true if the process has started.

Specified By

hasStarted() in org.as2lib.app.exec.Process

isRunning

public function isRunning(Void):Boolean

Return

true if the process is running.

Specified By

isRunning() in org.as2lib.app.exec.Process

addProcessListener

public function addProcessListener(listener:ProcessListener):Void

Adds a ProcessListener as Observer to the process.

Parameters

listenerProcessListener to be added.

Specified By

addProcessListener() in org.as2lib.app.exec.Process

removeProcessListener

public function removeProcessListener(listener:ProcessListener):Void

Removes a ProcessListener as Observer from the process.

Parameters

listenerProcessListener to be added.

Specified By

removeProcessListener() in org.as2lib.app.exec.Process

removeAllProcessListeners

public function removeAllProcessListeners(Void):Void

Removes all added Observers.

Specified By

removeAllProcessListeners() in org.as2lib.app.exec.Process

addAllProcessListeners

public function addAllProcessListeners(list:Array):Void

Adds a list of ProcessListener as Observer to the process.

Parameters

listList of listeners to be added.

Specified By

addAllProcessListeners() in org.as2lib.app.exec.Process

getAllProcessListeners

public function getAllProcessListeners(Void):Array

Flag if the process has been started.

Return

true if the process has been started and isn't finish yet else false.

Specified By

getAllProcessListeners() in org.as2lib.app.exec.Process

getPercentage

public function getPercentage(Void):Number

Getter for the currently executed percentage of the process.

Return

Percentage of execution. Null if percentage was not evaluateable.

Specified By

getPercentage() in org.as2lib.app.exec.Process

onUpdateProcess

public function onUpdateProcess(process:Process):Void

Method to be executed if a process property changes.

Parameters

processProcess that changed some properties

Specified By

onUpdateProcess() in org.as2lib.app.exec.ProcessListener

onStartProcess

public function onStartProcess(process:Process):Void

Method to be executed if a process starts execution.

Parameters

processProcess that started execution

Specified By

onStartProcess() in org.as2lib.app.exec.ProcessListener

onFinishProcess

public function onFinishProcess(process:Process):Void

Method to be executed if a process finishes its execution.

Parameters

processProcess that finished with execution

Specified By

onFinishProcess() in org.as2lib.app.exec.ProcessListener

onProcessError

public function onProcessError(process:Process, error):Void

Method to be executed if a exception was thrown during the execution.

Parameters

processProcess where a error occured
errorError that was catched with try & catch

Specified By

onProcessError() in org.as2lib.app.exec.ProcessListener

onResumeProcess

public function onResumeProcess(process:Process):Void

Method to be executed if a process awakes from pause.

Parameters

processProcess that resumes from pause

Specified By

onResumeProcess() in org.as2lib.app.exec.ProcessListener

onPauseProcess

public function onPauseProcess(process:Process):Void

Method to be executed if a process pauses.

Parameters

processProcess that paused execution

Specified By

onPauseProcess() in org.as2lib.app.exec.ProcessListener