Package cmion.level2
Class Competency
- java.lang.Object
-
- ion.Meta.Element
-
- cmion.architecture.CmionComponent
-
- cmion.level2.Competency
-
- All Implemented Interfaces:
java.lang.Runnable
- Direct Known Subclasses:
ExampleCompetency,Migration,RemoteCompetency,TestCompetency1,TestCompetency2,TestCompetency3,TestCompetency4,TestCompetency5,TestCompetency6,TestCompetency7,TestCompetency8
public abstract class Competency extends CmionComponent implements java.lang.Runnable
competencies are represented by objects of subclasses of this class
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanavailablethis boolean indicates whether the competency is available or notprotected java.lang.StringcompetencyNamethe name of the competency, what is it calledprotected java.lang.StringcompetencyTypethe type of the competency, what does it do (competency Execution plans refer to the type not the name)protected CompetencyExecutionPlanplanthe competency execution plan as part of which this competency was startedprotected booleanrunningthis boolean indicates whether the competency is running or not-
Fields inherited from class cmion.architecture.CmionComponent
architecture
-
-
Constructor Summary
Constructors Constructor Description Competency(IArchitecture architecture)create a competency object
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidcancel()Competencies can (and should) override this method to allow the execution system to cancel them.protected abstract booleancompetencyCode(java.util.HashMap<java.lang.String,java.lang.String> parameters)every competency sub class must implement this method and in it perform the competency code.java.lang.StringgetCompetencyName()returns the name of the competencyjava.lang.StringgetCompetencyType()returns the type of the competencyabstract voidinitialize()custom competency initialisation code should go in herebooleanisAvailable()returns whether the competency is available (i.e.booleanisRunning()returns whether the competency is currently running or notvoidregisterHandlers()registers request and event handlers of the competency execution system, if overridden, remember to call super.registerHandlers(); from withinvoidrequestStartCompetency(java.util.HashMap<java.lang.String,java.lang.String> parameters, CompetencyExecutionPlan cep, long executionID)convenience method to schedule a request for starting this competencyvoidrun()this is the thread main method, do not call it directlyabstract booleanrunsInBackground()every competency must provide information of whether it will run in the background permanently (returns true) or whether it will be invoked through the competency execution system (returns false)voidsetAdditionalData(java.lang.Object data)a convenience function (i.e.-
Methods inherited from class cmion.architecture.CmionComponent
getArchitecture, isConnected, onDestroy, raise
-
-
-
-
Field Detail
-
competencyName
protected java.lang.String competencyName
the name of the competency, what is it called
-
competencyType
protected java.lang.String competencyType
the type of the competency, what does it do (competency Execution plans refer to the type not the name)
-
running
protected boolean running
this boolean indicates whether the competency is running or not
-
available
protected boolean available
this boolean indicates whether the competency is available or not
-
plan
protected CompetencyExecutionPlan plan
the competency execution plan as part of which this competency was started
-
-
Constructor Detail
-
Competency
public Competency(IArchitecture architecture)
create a competency object
-
-
Method Detail
-
getCompetencyName
public java.lang.String getCompetencyName()
returns the name of the competency
-
getCompetencyType
public java.lang.String getCompetencyType()
returns the type of the competency
-
isRunning
public boolean isRunning()
returns whether the competency is currently running or not
-
isAvailable
public boolean isAvailable()
returns whether the competency is available (i.e. able to run), check isRunning to find out whether it is running or not
-
runsInBackground
public abstract boolean runsInBackground()
every competency must provide information of whether it will run in the background permanently (returns true) or whether it will be invoked through the competency execution system (returns false)
-
competencyCode
protected abstract boolean competencyCode(java.util.HashMap<java.lang.String,java.lang.String> parameters) throws CompetencyCancelledExceptionevery competency sub class must implement this method and in it perform the competency code. This method will run in a seperate thread, so can take its time. It should not be called from outside, instead a request should be scheduled or the convenience function requestStartComptency of this class should be used- Parameters:
parameters- a map including running parameters and their values- Returns:
- the return value of this method should indicate, whether the competency execution was a success (true) or failure (false)
- Throws:
CompetencyCancelledException
-
initialize
public abstract void initialize()
custom competency initialisation code should go in here
-
run
public final void run()
this is the thread main method, do not call it directly- Specified by:
runin interfacejava.lang.Runnable
-
requestStartCompetency
public void requestStartCompetency(java.util.HashMap<java.lang.String,java.lang.String> parameters, CompetencyExecutionPlan cep, long executionID)convenience method to schedule a request for starting this competency- Parameters:
parameters- a map including the parameters that this competence should work withcep- the competency execution plan, as part of which this competency was started, or null if the competency was not started by the execution systemexecutionID-
-
cancel
public void cancel()
Competencies can (and should) override this method to allow the execution system to cancel them. When this method is called the competency should stop its execution as quickly as possible by throwing a CompetencyCancelledException in the comptencyCode method
-
registerHandlers
public void registerHandlers()
registers request and event handlers of the competency execution system, if overridden, remember to call super.registerHandlers(); from within- Specified by:
registerHandlersin classCmionComponent
-
setAdditionalData
public void setAdditionalData(java.lang.Object data)
a convenience function (i.e. dirty hack) to allow samgar competency construction Please ignore this and don't call it :)
-
-