Class WorkflowMgr
A.3 Código OCL dos Componentes do Ambiente ExPSEE
Este apêndice apresenta as pré e pós-condições, especificadas através da linguagem OCL [Omg02], dos métodos das interfaces dos componentes que formam a arquitetura do ambiente ExPSEE.
ExternalApplicationMgr
context ExternalApplicationMgr :: IInvokeExternalApplicationMgt ::
selectExternalApplication(ExternalApplication externalApplication) : ExternalApplication
pre : -- none
post : -- externalApplication must be disposable.
externalApplication.status > 0
context ExternalApplicationMgr :: IInvokeExternalApplicationMgt ::
invokeExternalApplication(ExternalApplication externalApplication) : boolean
pre : -- externalApplication must exist.
ExternalApplication.allInstances->includes(self.externalApplication) post : -- Allocate the externalApplication
self.externalApplication.status > 0
Interpreter
context Interpreter :: IExecuteScriptMgt :: executeScript(String script) : boolean
pre : -- script must be out of errors.
post : -- none
context Interpreter :: IExecuteScriptMgt ::
invokeExternalApplication(ExternalApplication externalApplication) : boolean
pre : -- externalApplication must exist.
ExternalApplication.allInstances->includes(self.externalApplication) post : -- Allocate the externalApplication
self.externalApplication.status > 0
ResourceAllocationMgr
context ResourceAllocationMgr :: IAllocationResourceMgt ::
requestResource(Resource resource) : boolean pre : -- resource must exist.
Resource.allInstances->includes(self.resource) post : -- resource must be allocated
self.resource.status > 0
context ResourceAllocationMgr :: IAllocationResourceMgt ::
releaseResource(Resource resource) : boolean pre : -- resource must be allocated.
self.resource.status > 0
post : -- resource must not be allocated.
self.resource.status = 0
context ResourceAllocationMgr :: IAllocationResourceMgt ::
deleteResource(Resource resource) : boolean pre : -- resource must not be allocated.
self.resource.status = 0 post : -- none
context ResourceAllocationMgr :: IAllocationResourceMgt ::
retrievalResourceStatus(Resource resource) : Resource pre : -- resource must exist
Resource.allInstances->includes(self.resource) post : -- none
TaskScheduler
context TaskScheduler :: IExecuteTaskMgt :: selectTask(Task task) : Task pre : -- The task must exist.
Task.allInstances->includes(self.task) post : -- none
context TaskScheduler :: IExecuteTaskMgt :: executeTask(Task task) : boolean
pre : -- task must be in state 4 (Ready) self.task.status = 4
post : -- task must be in state 6 (Executing) self.task.status = 6
context TaskScheduler :: IExecuteTaskMgt :: cancelTask(Task task) : boolean
pre : -- task must be in state Executing (6) self.task.status = 6
post : -- task must be in state 9 (Terminated) self.task.status = 9
context TaskScheduler :: IExecuteTaskMgt :: interruptTask(Task task) : boolean
pre : -- task must be in state 6 Executing) self.task.status = 6
post : -- task must be in state 5 Suspended) self.task.status = 5
context TaskScheduler :: IExecuteTaskMgt :: restartTask(Task task) : boolean
pre : -- task must be in state 5 (Suspended) self.task.status = 5
post : -- task must be in state 6 Executing) self.task.status = 6
context TaskScheduler :: IExecuteTaskMgt :: finalizeTask(Task task) : boolean
pre : -- the status must be in state finalized self.task.status = 8
post : -- the status must be in state terminated self.task.status = 9
context TaskScheduler :: IExecuteTaskMgt :: visualizeTask(Actor actor, Role role) : Task[]
pre: -- The role name must be "WORKFLOW MANAGER" or "WORKFLOW USER".
self.role.roleName = "WORKFLOW MANAGER" or self.role.roleName =
"SOFTWARE ENGINEER"
post:
if self.role.roleName = "WORKFLOW MANAGER" then result = Task.allInstances
else
if self.role.roleName = "WORKFLOW USER" then
result = Task.allInstances->Role.includes("WORKFLOW USER") endif
endif
context TaskScheduler :: IExecuteTaskMgt :: postponeTask(Task task, String newDate, Actor actor) : boolean
pre : -- task must be in state Executing Task.status = 6
post : -- The new end date must be greater than the old end date self.newDate > Task.endDate
context TaskScheduler :: IScheduleTaskMgt :: requestConnection(String userName, String passWord) : boolean
pre : userName and passWord length must be greater than 5 self.userName.size() > 5 and
self.passWord.size() > 5
post : -- The userName and passWord must be in the users collection if self.userName.size() > 5 and self.passWord.size() > 5 then result = users->includes(self.userName, self.passWord)
else
return false
context TaskScheduler :: IScheduleTaskMgt :: scheduleTask(Task task, Actor actor, Role role, Workflow workflow) : boolean
pre :
-- The actor must have a workflow
self.actor.Workflow->inclueds(workflow) and -- The workflow must contain a task
self.workflow.Task->includes(task) and -- The actor must have a role
self.actor.Role->includes(role) post :
result = self.actor.Workflow->inclueds(workflow) and
self.workflow.Task->includes(task) and self.actor.Role->includes(role)
WorkflowArchitectureMgr
context WorkflowArchitectureMgr :: ICreateArchitectureMgt ::
requestConnection(String userName, String passWord) : boolean pre : userName and passWord length must be greater than 5 self.userName.size() > 5 and
self.passWord.size() > 5
post : -- The userName and passWord must be in the users collection if self.userName.size() > 5 and self.passWord.size() > 5 then result = users->includes(self.userName, self.passWord)
else
return false
context WorkflowArchitectureMgr :: ICreateArchitectureMgt ::
createObject(Object object) : boolean pre : -- none
post : -- object must exist
Object.allInstances->includes(self.object)
context WorkflowArchitectureMgr :: ICreateArchitectureMgt ::
deleteObject(Object object) : boolean pre : -- object must exist
Object.allInstances->includes(self.object) post : -- object must not exist
not ( Object.allInstances->includes(self.object) )
context WorkflowArchitectureMgr :: ICreateArchitectureMgt ::
retrievalObject(Object object) : boolean
pre : -- object must exist
Object.allInstances->includes(self.object) post : -- none
context WorkflowArchitectureMgr :: ICreateArchitectureMgt ::
insertObjectAttribute(Object objectAttribute) : boolean pre : -- objectAttribute must not exist
not ( Object.allInstances->includes(self.objectAttribute) ) post : -- objectAttribute must exist
Object.allInstances->includes(self.objectAttribute)
context WorkflowArchitectureMgr :: ICreateArchitectureMgt ::
deleteObjectAttribute(Object objectAttribute) : boolean pre : -- objectAttribute must not exist
not ( Object.allInstances->includes(self.objectAttribute) ) post : -- objectAttribute must exist
Object.allInstances->includes(self.objectAttribute)
context WorkflowArchitectureMgr :: ICreateArchitectureMgt ::
setBaselineArchitecture(WorkflowArchitecture architecture) : boolean pre : -- architecture must exist.
WorkflowArchitecture.allInstances->includes(self.architecture) post : -- none
context WorkflowArchitectureMgr :: ISelectArchitectureMgt ::
selectArchitecture(WorkflowArchitecture architecture) : WorkflowArchitecture
pre : -- architecture must exist.
WorkflowArchitecture.allInstances->includes(self.architecture) post : -- none
WorkflowExecutionMgr
context WorkflowExecutionMgr :: IExecuteTaskMgt :: selectTask(Task task) : Task
pre : -- The task must exist.
Task.allInstances->includes(self.task) post : -- none
context WorkflowExecutionMgr :: IExecuteTaskMgt :: executeTask(Task task) : boolean
pre : -- task must be in state 4 (Ready) self.task.status = 4
post : -- task must be in state 6 (Executing) self.task.status = 6
context WorkflowExecutionMgr :: IExecuteTaskMgt :: cancelTask(Task task) : boolean
pre : -- task must be in state Executing (6) self.task.status = 6
post : -- task must be in state 9 (Terminated) self.task.status = 9
context WorkflowExecutionMgr :: IExecuteTaskMgt :: interruptTask(Task task) : boolean
pre : -- task must be in state 6 Executing) self.task.status = 6
post : -- task must be in state 5 Suspended) self.task.status = 5
context WorkflowExecutionMgr :: IExecuteTaskMgt :: restartTask(Task task) : boolean
pre : -- task must be in state 5 (Suspended) self.task.status = 5
post : -- task must be in state 6 Executing) self.task.status = 6
context WorkflowExecutionMgr :: IExecuteTaskMgt :: finalizeTask(Task task) : boolean
pre : -- the status must be in state finalized self.task.status = 8
post : -- the status must be in state terminated self.task.status = 9
context WorkflowExecutionMgr :: IExecuteTaskMgt :: visualizeTask(Actor actor, Role role) : Task[]
pre: -- The role name must be "WORKFLOW MANAGER" or "WORKFLOW USER".
self.role.roleName = "WORKFLOW MANAGER" or self.role.roleName =
"SOFTWARE ENGINEER"
post:
if self.role.roleName = "WORKFLOW MANAGER" then result = Task.allInstances
else
if self.role.roleName = "WORKFLOW USER" then
result = Task.allInstances->Role.includes("WORKFLOW USER") endif
endif
context WorkflowExecutionMgr :: IExecuteTaskMgt :: postponeTask(Task task, String newDate, Actor actor) : boolean
pre : -- task must be in state Executing Task.status = 6
post : -- The new end date must be greater than the old end date self.newDate > Task.endDate
WorkflowMgr
context WorkflowMgr :: IInstantiateArchitectureMgt ::
requestConnection(String userName, String passWord) : boolean pre : userName and passWord length must be greater than 5 self.userName.size() > 5 and
self.passWord.size() > 5
post : -- The userName and passWord must be in the users collection if self.userName.size() > 5 and self.passWord.size() > 5 then result = users->includes(self.userName, self.passWord)
else
return false
context WorkflowMgr :: IInstantiateArchitectureMgt ::
selectArchitecture(WorkflowArchitecture architecture) : WorkflowArchitecture
pre : -- architecture must exist.
WorkflowArchitecture.allInstances->includes(self.architecture) post : -- none
context WorkflowMgr :: IInstantiateArchitectureMgt ::
instantiateObject(Object object) : Object pre : -- object must exist.
Object.allInstances->includes(self.object) post : -- none
context WorkflowMgr :: IManageWorkflowMgt:: selectResource(Resource resource) : Resource
pre : -- resource must exist.
WorkflowArchitecture.allInstances->includes(self.resource) post : -- none
context WorkflowMgr :: IProgramTaskMgt:: selectProject(Object project) : Object
pre : -- The project must exist.
Object.allInstances->includes(self.project) post : -- none
context WorkflowMgr :: IProgramTaskMgt:: selectTask(Task task) : Task pre : -- The task must exist.
Task.allInstances->includes(self.task) post : -- none
context WorkflowMgr :: IProgramTaskMgt:: selectRole(Role role) : Role pre : -- The role must exist.
Role.allInstances->includes(self.role) post : -- none
context WorkflowMgr :: IProgramTaskMgt:: selectActor(Actor actor) : Actor pre : -- The actor must exist.
Actor.allInstances->includes(self.atcor) post : -- none
context WorkflowMgr :: IProgramTaskMgt:: programTask(Task task) : boolean pre : -- task must exist.
Task.allInstances->includes(self.task) post : -- none
context WorkflowMgr :: ISelectResourceMgt :: selectResource(Resource resource) : Resource
pre : -- The resource must exist.
Resource.allInstances->includes(self.resource) post : -- none
ObjectMgr
context ObjectMgr :: IObjectStoreMgt :: insertObject(Object object) : boolean
pre : -- object must not exist
not ( Object.allInstances->includes(self.object) ) post : -- object must exist
Object.allInstances->includes(self.object)
context ObjectMgr :: IObjectStoreMgt :: updateObject(Object object) : boolean
pre : -- object must exist
Object.allInstances->includes(self.object) post : -- none
context ObjectMgr :: IObjectStoreMgt :: deleteObject(Object object) : boolean
pre : -- object must exist
Object.allInstances->includes(self.object) post : -- object must not exist
not ( Object.allInstances->includes(self.object) )
context ObjectMgr :: IObjectStoreMgt :: selectObject(Object object) : boolean
pre : -- object must exist
Object.allInstances->includes(self.object) post : -- none