org.ow2.jasmine.jadort.service.implementation
Class ActionManager

java.lang.Object
  extended by org.ow2.jasmine.jadort.service.implementation.OperationPersistenceManager
      extended by org.ow2.jasmine.jadort.service.implementation.ActionManager
Direct Known Subclasses:
StepManager

public class ActionManager
extends OperationPersistenceManager

Manages the link between server and worker states and the messages to send.

Author:
Arda Aydin, Malek Chahine, S. Ali Tokmen

Field Summary
 
Fields inherited from class org.ow2.jasmine.jadort.service.implementation.OperationPersistenceManager
em, operation
 
Constructor Summary
ActionManager()
           
 
Method Summary
protected  boolean checkApplication(org.ow2.jasmine.jadort.api.entities.deployment.ServerProgressBean serverProgress, org.ow2.jasmine.jadort.api.entities.deployment.ApplicationBean application, java.lang.String state, java.lang.String policy)
          Checks if an application is already deployed on the server, or if has a bad policy, or if has a bad state
protected  java.util.List<org.ow2.jasmine.jadort.api.entities.topology.GroupBean> fetchGroups(boolean fillApplications)
          Returns the list of groups obtained from the loaded topology in the current operation.
protected  void fillApplications(org.ow2.jasmine.jadort.api.entities.topology.GroupBean groupBean)
          Fills the applications of a GroupBean and all ServerBeans it contains.
protected  void fillVMImages(org.ow2.jasmine.jadort.api.entities.topology.GroupBean groupBean)
          Fills the vmImages fields of a GroupBean.
protected  void fillWorkerProgressListBasedOnServerProgressList()
          Fills the workerProgress list of the current operation based on the serverProgress list.
protected  org.ow2.jasmine.jadort.api.entities.deployment.ServerProgressBean getServerProgress(org.ow2.jasmine.jadort.api.entities.topology.ServerBean server)
          Returns the serverProgress object of a server
protected  org.ow2.jasmine.jadort.api.entities.deployment.WorkerProgressBean getWorkerProgress(org.ow2.jasmine.jadort.api.entities.topology.WorkerBean worker)
          Returns the workerProgress object of a worker
protected  boolean isSameApplication(org.ow2.jasmine.jadort.api.entities.deployment.ApplicationBean a1, org.ow2.jasmine.jadort.api.entities.deployment.ApplicationBean a2)
          Compares two application, tests if a two applications are equal).
protected  void reachAimedServerProgressState(org.ow2.jasmine.jadort.api.entities.deployment.ServerProgressBean serverProgress)
          this function allows the serverProgress to executes the proper task to attend the Aimed ServerProgressState this function executes the correspondent task to go from the current serverProgress state to the Aimed ServerProgressList State.
protected  void reachAimedWorkerProgressState(org.ow2.jasmine.jadort.api.entities.deployment.WorkerProgressBean workerProgress)
          this function allows the workerProgress to executes the proper task to attend the Aimed WorkerProgress this function executes the correspondent task to go from the current serverProgress state to the Aimed WorkerProgress State.
protected  void refreshActiveSessions()
           
 
Methods inherited from class org.ow2.jasmine.jadort.service.implementation.OperationPersistenceManager
mergeOperation, refreshOperation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ActionManager

public ActionManager()
Method Detail

reachAimedServerProgressState

protected void reachAimedServerProgressState(org.ow2.jasmine.jadort.api.entities.deployment.ServerProgressBean serverProgress)
this function allows the serverProgress to executes the proper task to attend the Aimed ServerProgressState this function executes the correspondent task to go from the current serverProgress state to the Aimed ServerProgressList State.

Parameters:
serverProgress - the serverProgress that will execute the task.

reachAimedWorkerProgressState

protected void reachAimedWorkerProgressState(org.ow2.jasmine.jadort.api.entities.deployment.WorkerProgressBean workerProgress)
this function allows the workerProgress to executes the proper task to attend the Aimed WorkerProgress this function executes the correspondent task to go from the current serverProgress state to the Aimed WorkerProgress State.

Parameters:
workerProgress - the workerProgress that will execute the task.

fillApplications

protected void fillApplications(org.ow2.jasmine.jadort.api.entities.topology.GroupBean groupBean)
                         throws org.ow2.jasmine.jadort.api.JadortServiceException
Fills the applications of a GroupBean and all ServerBeans it contains.

Parameters:
groupBean - Group to fill.
Throws:
org.ow2.jasmine.jadort.api.JadortServiceException - If getting the list of applications fails.

fillVMImages

protected void fillVMImages(org.ow2.jasmine.jadort.api.entities.topology.GroupBean groupBean)
                     throws org.ow2.jasmine.jadort.api.JadortServiceException
Fills the vmImages fields of a GroupBean.

Parameters:
groupBean - Group to fill.
Throws:
org.ow2.jasmine.jadort.api.JadortServiceException - If getting the list of applications fails.

fetchGroups

protected java.util.List<org.ow2.jasmine.jadort.api.entities.topology.GroupBean> fetchGroups(boolean fillApplications)
                                                                                      throws org.ow2.jasmine.jadort.api.JadortServiceException
Returns the list of groups obtained from the loaded topology in the current operation.(returns a copy since operation.getTopology().getGroups() does lazy)

Parameters:
fillApplications - Whether to fill the applications list.
Returns:
The list of groups
Throws:
org.ow2.jasmine.jadort.api.JadortServiceException - If getting the list of applications fails.

isSameApplication

protected boolean isSameApplication(org.ow2.jasmine.jadort.api.entities.deployment.ApplicationBean a1,
                                    org.ow2.jasmine.jadort.api.entities.deployment.ApplicationBean a2)
Compares two application, tests if a two applications are equal). The comparison is based on the name,and version of each application. the result is a true the two applications are the same. the result is false if the two applications are different.

Parameters:
a1 - the first application to be compared.
a2 - the second application to be compared.
Returns:
True the two applications are the same. False if the two applications are different.

checkApplication

protected boolean checkApplication(org.ow2.jasmine.jadort.api.entities.deployment.ServerProgressBean serverProgress,
                                   org.ow2.jasmine.jadort.api.entities.deployment.ApplicationBean application,
                                   java.lang.String state,
                                   java.lang.String policy)
Checks if an application is already deployed on the server, or if has a bad policy, or if has a bad state

Parameters:
serverProgress - serverProgress of the server on which the application will be checked.
application - the application to be checked
state - the state that the application should has.
policy - the policy that the application should has.
Returns:
true if no problem is found while checking the application false if a problem is found while checking the application

refreshActiveSessions

protected void refreshActiveSessions()
                              throws org.ow2.jasmine.jadort.api.JadortServiceException
Throws:
org.ow2.jasmine.jadort.api.JadortServiceException
See Also:
Note that this doesn't merge with the current operation in DB.

getServerProgress

protected org.ow2.jasmine.jadort.api.entities.deployment.ServerProgressBean getServerProgress(org.ow2.jasmine.jadort.api.entities.topology.ServerBean server)
                                                                                       throws org.ow2.jasmine.jadort.api.JadortServiceException
Returns the serverProgress object of a server

Parameters:
server - the server that the method will return his serverProgress
Returns:
the serverProgress of the server
Throws:
org.ow2.jasmine.jadort.api.JadortServiceException - If server not found

getWorkerProgress

protected org.ow2.jasmine.jadort.api.entities.deployment.WorkerProgressBean getWorkerProgress(org.ow2.jasmine.jadort.api.entities.topology.WorkerBean worker)
                                                                                       throws org.ow2.jasmine.jadort.api.JadortServiceException
Returns the workerProgress object of a worker

Parameters:
worker - the server that the method will return his workerProgress
Returns:
the workerProgress of the worker
Throws:
org.ow2.jasmine.jadort.api.JadortServiceException - If server not found

fillWorkerProgressListBasedOnServerProgressList

protected void fillWorkerProgressListBasedOnServerProgressList()
Fills the workerProgress list of the current operation based on the serverProgress list.



Copyright © 2009 OW2 Consortium. All Rights Reserved.