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

java.lang.Object
  extended by org.ow2.jasmine.jadort.service.implementation.OperationPersistenceManager
      extended by org.ow2.jasmine.jadort.service.implementation.ActionManager
          extended by org.ow2.jasmine.jadort.service.implementation.StepManager
              extended by org.ow2.jasmine.jadort.service.implementation.JadortServiceStatefulBean
All Implemented Interfaces:
IJadortService

public class JadortServiceStatefulBean
extends StepManager
implements IJadortService

Stateful session bean that provides the JaDOrT service.

Author:
Malek Chahine, Remy Bresson, S. Ali Tokmen

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.ow2.jasmine.jadort.api.IJadortService
IJadortService.OperationType
 
Field Summary
 
Fields inherited from class org.ow2.jasmine.jadort.service.implementation.OperationPersistenceManager
em, operation
 
Fields inherited from interface org.ow2.jasmine.jadort.api.IJadortService
EJB_JNDI_NAME
 
Constructor Summary
JadortServiceStatefulBean()
           
 
Method Summary
 void abortServer(ServerBean server)
          Aborts the task a ServerBean is currently doing.
 void abortWorker(WorkerBean worker)
          Aborts the task a WorkerBean is currently doing.
 boolean checkServer(ServerBean server)
          Checks if the problem on a given ServerBean has been resolved.
 boolean checkWorker(WorkerBean worker)
          Checks if the problem on a given WorkerBean has been resolved.
static ApplicationBean createApplicationBeanFromFile(java.io.File file)
          Application bean constructor.
 void createNewOperation(java.lang.String newOperationName)
          Create a new operation
 void deleteOperation(OperationStateBean selectedOperation)
          Delete an Operation from the operation list
 OperationStateBean getCurrentOperation()
          Returns the current operation.
 OperationStateBean.Step getCurrentStep()
          Returns the current Step of the current operation

IMPORTANT: Avoid calling this method from inside other methods of the JadortServiceStatefulBean class (it will be costly)
 java.util.List<OperationStateBean> getOperationsList()
          Returns the list of operations
 void ignoreServer(ServerBean server)
          Ignores the error on a given ServerBean.
 void ignoreWorker(WorkerBean worker)
          Ignores the error on a given WorkerBean.
protected  void initialize()
           
 void loadTopology(java.lang.String topology)
          Loads the topology using an XML stream passed as a string.
 void next()
          goes to next step
 void previous()
          Goes back to the previous step.
 void restartServer(ServerBean server)
          Restarts a ServerBean that's in an error.
 void restartWorker(WorkerBean worker)
          Restarts a WorkerBean that's in an error.
 void selectApplication(java.net.URL url)
          Create a new application
 void selectGroup(GroupBean selectedGroup)
          Select the group that JaDOrT will be maintaining or migrating
 void selectOperation(OperationStateBean selectedOperation)
          Select an Operation from the operation list
 void selectOperationType(IJadortService.OperationType operationType)
          Select the operation type
 void selectServers(java.util.List<ServerBean> selectedServers)
          Select the servers to process
 void selectVMImage(VMImageBean selectedVMImage)
          Select a VM image from the VM images list.
 void selectVMImage(VMImageBean selectedVMImage, ServerBean server)
          Select a VM image from the VM images list for a given server.
protected  void terminate()
           
 
Methods inherited from class org.ow2.jasmine.jadort.service.implementation.StepManager
canGoToNextStep, canGoToPreviousStep, checkStep, executeNextStep, executePreviousStep
 
Methods inherited from class org.ow2.jasmine.jadort.service.implementation.ActionManager
checkApplication, fetchGroups, fillApplications, fillVMImages, fillWorkerProgressListBasedOnServerProgressList, getServerProgress, getWorkerProgress, isSameApplication, reachAimedServerProgressState, reachAimedWorkerProgressState, 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

JadortServiceStatefulBean

public JadortServiceStatefulBean()
Method Detail

initialize

@PostConstruct
protected void initialize()

terminate

@PreDestroy
protected void terminate()

getCurrentStep

public OperationStateBean.Step getCurrentStep()
Returns the current Step of the current operation

IMPORTANT: Avoid calling this method from inside other methods of the JadortServiceStatefulBean class (it will be costly)

Specified by:
getCurrentStep in interface IJadortService
Returns:
The current step.

getOperationsList

public java.util.List<OperationStateBean> getOperationsList()
                                                     throws JadortServiceException
Returns the list of operations

Specified by:
getOperationsList in interface IJadortService
Returns:
List of Operations.
Throws:
JadortServiceException - if the getOperationsList() method can not be called in the current step. (this method can be called only in the OperationStateBean.Step.SELECT_OPERATION step)

deleteOperation

public void deleteOperation(OperationStateBean selectedOperation)
                     throws JadortServiceException
Delete an Operation from the operation list

Specified by:
deleteOperation in interface IJadortService
Parameters:
selectedOperation - the operation to be deleted
Throws:
JadortServiceException -
  • if the selectOperation can not be called in the current step. (this method can be called only in the OperationStateBean.Step.SELECT_OPERATION step)
  • if the operation to delete is still in progress in a critical phase and therefore cannot be deleted

selectOperation

public void selectOperation(OperationStateBean selectedOperation)
                     throws JadortServiceException
Select an Operation from the operation list

Specified by:
selectOperation in interface IJadortService
Parameters:
selectedOperation - the operation to be selected
Throws:
JadortServiceException - if the selectOperation can not be called in the current step. (this method can be called only in the OperationStateBean.Step.SELECT_OPERATION step)

createNewOperation

public void createNewOperation(java.lang.String newOperationName)
                        throws JadortServiceException
Create a new operation

Specified by:
createNewOperation in interface IJadortService
Parameters:
newOperationName - the name of the new operation that will be created
Throws:
JadortServiceException -

getCurrentOperation

public OperationStateBean getCurrentOperation()
                                       throws JadortServiceException
Returns the current operation. You need to use this method in order to get all details related to the progress of the current operation, the list of groups, the list of applications, etc.

Specified by:
getCurrentOperation in interface IJadortService
Returns:
The current operation.
Throws:
JadortServiceException - If fetching fails.

next

public void next()
          throws JadortServiceException
goes to next step

Specified by:
next in interface IJadortService
Throws:
JadortServiceException - if going to the next step is not allowed.
See Also:
IJadortService#canGoToNextStep()

previous

public void previous()
              throws JadortServiceException
Goes back to the previous step.

Specified by:
previous in interface IJadortService
Throws:
JadortServiceException - if going to the previous step is not allowed.
See Also:
IJadortService#canGoToPreviousStep()

loadTopology

public void loadTopology(java.lang.String topology)
                  throws JadortServiceException
Loads the topology using an XML stream passed as a string.

Specified by:
loadTopology in interface IJadortService
Parameters:
topology - Topology XML stream passed as a string.
Throws:
JadortServiceException -

selectGroup

public void selectGroup(GroupBean selectedGroup)
                 throws JadortServiceException
Select the group that JaDOrT will be maintaining or migrating

Specified by:
selectGroup in interface IJadortService
Parameters:
selectedGroup - the group that JaDOrT will be maintaining or migrating
Throws:
JadortServiceException - if the selectedGroup method can not be called in the current step. (this method can be called only in the OperationStateBean.Step.SELECT_GROUP step)

selectOperationType

public void selectOperationType(IJadortService.OperationType operationType)
                         throws JadortServiceException
Select the operation type

Specified by:
selectOperationType in interface IJadortService
Parameters:
operationType - the operation type
Throws:
JadortServiceException - if the selectedGroup method can not be called in the current step. (this method can be called only in the OperationStateBean.Step.SELECT_OPERATION_TYPE step)

selectApplication

public void selectApplication(java.net.URL url)
                       throws JadortServiceException
Create a new application

Specified by:
selectApplication in interface IJadortService
Parameters:
url - URL where to fetch the application. Can be local, remote (HTTP, FTP, ...)
Throws:
JadortServiceException -

selectVMImage

public void selectVMImage(VMImageBean selectedVMImage)
                   throws JadortServiceException
Select a VM image from the VM images list. If this method is called, the selected VM image will be deployed on all maintained VMs. If you want to deploy a different VM image on each server, don't call this method but go to the next step directly.

Specified by:
selectVMImage in interface IJadortService
Parameters:
selectedVMImage - the VM image to be selected
Throws:
JadortServiceException
JadortServiceException

selectVMImage

public void selectVMImage(VMImageBean selectedVMImage,
                          ServerBean server)
                   throws JadortServiceException
Select a VM image from the VM images list for a given server.

Specified by:
selectVMImage in interface IJadortService
Parameters:
selectedVMImage - the VM image to be selected
server - the server on which this image shall be deployed
Throws:
JadortServiceException
    -
  • if the selectVMImage can not be called in the current step. (this method can be called only in the OperationStateBean.Step.SELECT_VM_IMAGE step)
  • or if selectedVMImage is not known
  • or if server is not known
  • or if fetching fails
JadortServiceException

selectServers

public void selectServers(java.util.List<ServerBean> selectedServers)
                   throws JadortServiceException
Select the servers to process

Specified by:
selectServers in interface IJadortService
Parameters:
selectedServers - the servers to process
Throws:
JadortServiceException - if the selectServers method can not be called in the current step (this method can be called only in the OperationStateBean.Step.SELECT_SERVERS step)

abortServer

public void abortServer(ServerBean server)
                 throws JadortServiceException
Aborts the task a ServerBean is currently doing.

Specified by:
abortServer in interface IJadortService
Parameters:
server - the server that will be aborted
Throws:
JadortServiceException - If the abortServer can not be called in the current step. (this method can be called only in the OperationStateBean.Step.EXECUTING_MIGRATION, OperationStateBean.Step.UNDEPLOY_ERASE_OLD_VERSION, OperationStateBean.Step.EXECUTING_MIGRATION_OSGI, OperationStateBean.Step.ERASE_OLD_VERSIONS, OperationStateBean.Step.EXECUTING_MAINTENANCE_CLUSTER and OperationStateBean.Step.EXECUTING_MAINTENANCE_NO_CLUSTER steps)

restartServer

public void restartServer(ServerBean server)
                   throws JadortServiceException
Restarts a ServerBean that's in an error.

Specified by:
restartServer in interface IJadortService
Parameters:
server - the server on which the task will be restarted
Throws:
JadortServiceException -

checkServer

public boolean checkServer(ServerBean server)
                    throws JadortServiceException
Checks if the problem on a given ServerBean has been resolved.

Specified by:
checkServer in interface IJadortService
Parameters:
server - the server that will be checked
Returns:
true if the problem is resolved and it can be ignored safely, false if the problem still persists
Throws:
JadortServiceException - if the checkServer can not be called in the current step. (this method can be called only in the OperationStateBean.Step.EXECUTING_MIGRATION, OperationStateBean.Step.UNDEPLOY_ERASE_OLD_VERSION, OperationStateBean.Step.EXECUTING_MIGRATION_OSGI, OperationStateBean.Step.ERASE_OLD_VERSIONS, OperationStateBean.Step.EXECUTING_MAINTENANCE_CLUSTER and OperationStateBean.Step.EXECUTING_MAINTENANCE_NO_CLUSTER steps)

ignoreServer

public void ignoreServer(ServerBean server)
                  throws JadortServiceException
Ignores the error on a given ServerBean.

Specified by:
ignoreServer in interface IJadortService
Parameters:
server - the server that will be ignored
Throws:
JadortServiceException -

abortWorker

public void abortWorker(WorkerBean worker)
                 throws JadortServiceException
Aborts the task a WorkerBean is currently doing.

Specified by:
abortWorker in interface IJadortService
Parameters:
worker - the worker that will be aborted
Throws:
JadortServiceException - If the abortWorker can not be called in the current step. (this method can be called only in the OperationStateBean.Step.EXECUTING_MAINTENANCE_CLUSTER and OperationStateBean.Step.EXECUTING_MAINTENANCE_NO_CLUSTER steps)

restartWorker

public void restartWorker(WorkerBean worker)
                   throws JadortServiceException
Restarts a WorkerBean that's in an error.

Specified by:
restartWorker in interface IJadortService
Parameters:
worker - the worker on which the task will be restarted
Throws:
JadortServiceException -

checkWorker

public boolean checkWorker(WorkerBean worker)
                    throws JadortServiceException
Checks if the problem on a given WorkerBean has been resolved.

Specified by:
checkWorker in interface IJadortService
Parameters:
worker - the worker that will be checked
Returns:
true if the problem is resolved and it can be ignored safely, false if the problem still persists
Throws:
JadortServiceException - if the checkWorker can not be called in the current step. (this method can be called only in the OperationStateBean.Step.EXECUTING_MAINTENANCE_CLUSTER and OperationStateBean.Step.EXECUTING_MAINTENANCE_NO_CLUSTER steps)

ignoreWorker

public void ignoreWorker(WorkerBean worker)
                  throws JadortServiceException
Ignores the error on a given WorkerBean.

Specified by:
ignoreWorker in interface IJadortService
Parameters:
worker - the worker that will be ignored
Throws:
JadortServiceException -

createApplicationBeanFromFile

public static ApplicationBean createApplicationBeanFromFile(java.io.File file)
                                                     throws java.io.FileNotFoundException,
                                                            org.ow2.util.ee.deploy.impl.helper.DeployableHelperException,
                                                            org.ow2.util.archive.api.ArchiveException
Application bean constructor. Build a application bean from his archive file.

Parameters:
file - The archive file.
Throws:
java.io.FileNotFoundException - Throw if the archive file is not found.
org.ow2.util.ee.deploy.impl.helper.DeployableHelperException - Throw if the archive hasn't any deployable.
org.ow2.util.archive.api.ArchiveException - Throw if the file given isn't a archive.


Copyright © 2010 OW2 Consortium. All Rights Reserved.