org.ow2.jasmine.jadort.service.action
Class JasmineVMMAction

java.lang.Object
  extended by org.ow2.jasmine.jadort.service.action.AbstractAction
      extended by org.ow2.jasmine.jadort.service.action.AbstractJMXAction
          extended by org.ow2.jasmine.jadort.service.action.VMMAction
              extended by org.ow2.jasmine.jadort.service.action.JasmineVMMAction

public class JasmineVMMAction
extends VMMAction

Action for the JASMINe VMM Agent.

Author:
Malek Chahine, S. Ali Tokmen

Nested Class Summary
 
Nested classes/interfaces inherited from class org.ow2.jasmine.jadort.service.action.VMMAction
VMMAction.VMState
 
Field Summary
 
Fields inherited from class org.ow2.jasmine.jadort.service.action.AbstractJMXAction
connector, JMX_CHECK_TIMEOUT, JMX_CONNECT_TIMEOUT, mbscnx
 
Constructor Summary
JasmineVMMAction(org.ow2.jasmine.jadort.api.entities.topology.VMBean vm)
           
 
Method Summary
protected  void connectViaJMX()
          Connects via JMX.
 void deployImageOnVM(java.lang.String copyVM, java.lang.String newVMName, java.lang.String vmImageUUID)
          Creates the VM with the given name and deploys the given image on it.
 void destroyVM(java.lang.String vmName)
          Destroys a VM host.
 java.lang.String getFullVMName(java.lang.String vmName)
          Gets the full VM name of a RUNNING VM.
protected  javax.management.ObjectName getObjectNameForVMHost(java.lang.String vmName)
          Gets the ObjectName for a given VM host name.
 java.util.List<org.ow2.jasmine.jadort.api.entities.deployment.VMImageBean> getVMImages()
          Gets the list of VM images on the current host's image repository.
 org.ow2.jasmine.vmm.api.VirtualMachineMXBean.PowerState getVMState(java.lang.String vmName)
          Gets the state of a VM host.
 void startVM(java.lang.String vmName)
          Sends the "start" signal to a VM host.
 void stopVM(java.lang.String vmName)
          Sends the "stop" signal to a VM host.
 void waitForVMState(java.lang.String vmName, org.ow2.jasmine.vmm.api.VirtualMachineMXBean.PowerState state, long timeout)
          Wait for the given VM host to reach a given state.
 
Methods inherited from class org.ow2.jasmine.jadort.service.action.VMMAction
getConstructor, getVMMAction, newInstance
 
Methods inherited from class org.ow2.jasmine.jadort.service.action.AbstractJMXAction
checkJMXConnection, disconnectJMX, establishJMXConnection
 
Methods inherited from class org.ow2.jasmine.jadort.service.action.AbstractAction
appendToLog, flushLog
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JasmineVMMAction

public JasmineVMMAction(org.ow2.jasmine.jadort.api.entities.topology.VMBean vm)
Method Detail

connectViaJMX

protected void connectViaJMX()
                      throws java.lang.Exception
Description copied from class: AbstractJMXAction
Connects via JMX. This is expected to call AbstractJMXAction.establishJMXConnection(JMXServiceURL, Map) at some point.

Specified by:
connectViaJMX in class AbstractJMXAction
Throws:
java.lang.Exception - If any exception occurs.

getObjectNameForVMHost

protected javax.management.ObjectName getObjectNameForVMHost(java.lang.String vmName)
                                                      throws java.lang.Exception
Gets the ObjectName for a given VM host name.

Throws:
java.lang.Exception

getFullVMName

public java.lang.String getFullVMName(java.lang.String vmName)
                               throws java.lang.Exception
Description copied from class: VMMAction
Gets the full VM name of a RUNNING VM.

Specified by:
getFullVMName in class VMMAction
Parameters:
vmName - Name of the VM host to get the full VM name for.
Returns:
Full VM name. That might be equal to the vmName passed as argument.
Throws:
java.lang.Exception - If any exception occurs.

startVM

public void startVM(java.lang.String vmName)
             throws java.lang.Exception
Description copied from class: VMMAction
Sends the "start" signal to a VM host.

Specified by:
startVM in class VMMAction
Parameters:
vmName - Name of the VM host to start.
Throws:
java.lang.Exception - If any exception occurs.

stopVM

public void stopVM(java.lang.String vmName)
            throws java.lang.Exception
Description copied from class: VMMAction
Sends the "stop" signal to a VM host.

Specified by:
stopVM in class VMMAction
Parameters:
vmName - Name of the VM host to stop.
Throws:
java.lang.Exception - If any exception occurs.

getVMState

public org.ow2.jasmine.vmm.api.VirtualMachineMXBean.PowerState getVMState(java.lang.String vmName)
                                                                   throws java.lang.Exception
Description copied from class: VMMAction
Gets the state of a VM host.

Specified by:
getVMState in class VMMAction
Parameters:
vmName - Name of the VM host to get the state of.
Throws:
java.lang.Exception - If any exception occurs.

waitForVMState

public void waitForVMState(java.lang.String vmName,
                           org.ow2.jasmine.vmm.api.VirtualMachineMXBean.PowerState state,
                           long timeout)
                    throws java.lang.Exception
Description copied from class: VMMAction
Wait for the given VM host to reach a given state.

Specified by:
waitForVMState in class VMMAction
Parameters:
vmName - Name of the VM host to get the state of.
state - State to wait for.
timeout - Number of seconds after which to throw.
Throws:
java.lang.Exception - If any exception occurs.

deployImageOnVM

public void deployImageOnVM(java.lang.String copyVM,
                            java.lang.String newVMName,
                            java.lang.String vmImageUUID)
                     throws java.lang.Exception
Description copied from class: VMMAction
Creates the VM with the given name and deploys the given image on it.

Specified by:
deployImageOnVM in class VMMAction
Parameters:
copyVM - Name of the VM host to copy properties (disk size, memory, etc.) from.
newVMName - Name of the new VM host to create.
vmImageUUID - UUID of the VM image to deploy.
Throws:
java.lang.Exception - If any exception occurs.

destroyVM

public void destroyVM(java.lang.String vmName)
               throws java.lang.Exception
Description copied from class: VMMAction
Destroys a VM host.

Specified by:
destroyVM in class VMMAction
Parameters:
vmName - Name of the VM host to destroy.
Throws:
java.lang.Exception - If any exception occurs.

getVMImages

public java.util.List<org.ow2.jasmine.jadort.api.entities.deployment.VMImageBean> getVMImages()
                                                                                       throws java.lang.Exception
Description copied from class: VMMAction
Gets the list of VM images on the current host's image repository.

Specified by:
getVMImages in class VMMAction
Returns:
List of VM images on the current host's image repository.
Throws:
java.lang.Exception - If any exception occurs.


Copyright © 2009 OW2 Consortium. All Rights Reserved.