org.glassfish.virtualization.spi
Interface VirtualMachine


public interface VirtualMachine

Defines a Virtual machine

Author:
Jerome Dochez

Nested Class Summary
static class VirtualMachine.PropertyName
           
 
Method Summary
 void delete()
          Deletes the virtual machine and all associated storage
 boolean download(File remoteFile, File localTargetDirectory)
          Download a file from the virtual machine.
 String executeOn(String[] args)
           
 InetAddress getAddress()
          Returns the IP address of the machine, which can be varying at runtime
 VirtualMachineConfig getConfig()
          Returns the persisted information for this virtual machine.
 VirtualMachineInfo getInfo()
          Returns the current machine information
 Machine getMachine()
          Returns the machine (if exists) on which this virtual machine was allocated on or null if there is no notion of Machines on the server pool used.
 String getName()
          Returns the machine's name
 String getProperty(VirtualMachine.PropertyName name)
          Gets a property value by its name as defined in VirtualMachine.PropertyName
 ServerPool getServerPool()
          Returns the server pool this virtual machine was allocated on
 VirtUser getUser()
          Returns the user used to run software in this virtual machine
 void resume()
          Resumes the virtual machine.
 void setAddress(InetAddress address)
          Sets the IO address of the machine, usually performed by a back end operation.
 void setProperty(VirtualMachine.PropertyName name, String value)
          Sets a VirtualMachine.PropertyName property on this virtual machine instance.
 void start()
          Starts the virtual machine
 void stop()
          Stops a virtual machine.
 void suspend()
          Suspend the virtual machine
 boolean upload(File localFile, File remoteTargetDirectory)
          Upload a file to the virtual machine.
 

Method Detail

getName

String getName()
Returns the machine's name

Returns:
machine's name as it is registered in the configuration

getAddress

InetAddress getAddress()
Returns the IP address of the machine, which can be varying at runtime

Returns:
the machine's IP address

setAddress

void setAddress(InetAddress address)
Sets the IO address of the machine, usually performed by a back end operation.

Parameters:
address - the new IP address

start

void start()
           throws VirtException
Starts the virtual machine

Throws:
VirtException - if the request to start failed.

suspend

void suspend()
             throws VirtException
Suspend the virtual machine

Throws:
VirtException - if the request to suspend failed

resume

void resume()
            throws VirtException
Resumes the virtual machine.

Throws:
VirtException - if the request to resume failed

stop

void stop()
          throws VirtException
Stops a virtual machine.

Throws:
VirtException - if the request to stop failed

delete

void delete()
            throws VirtException
Deletes the virtual machine and all associated storage

Throws:
VirtException - if the deletion failed

getInfo

VirtualMachineInfo getInfo()
Returns the current machine information

Returns:
the machine's current information

getServerPool

ServerPool getServerPool()
Returns the server pool this virtual machine was allocated on

Returns:
the server pool

getMachine

Machine getMachine()
Returns the machine (if exists) on which this virtual machine was allocated on or null if there is no notion of Machines on the server pool used.

Returns:
the machine

getUser

VirtUser getUser()
Returns the user used to run software in this virtual machine

Returns:
the virtual machine user

setProperty

void setProperty(VirtualMachine.PropertyName name,
                 String value)
Sets a VirtualMachine.PropertyName property on this virtual machine instance.

Parameters:
name - the property name
value - the property value

getProperty

String getProperty(VirtualMachine.PropertyName name)
Gets a property value by its name as defined in VirtualMachine.PropertyName

Parameters:
name - the requested property name.
Returns:
the property value if found, or null if not found.

executeOn

String executeOn(String[] args)
                 throws IOException,
                        InterruptedException
Throws:
IOException
InterruptedException

upload

boolean upload(File localFile,
               File remoteTargetDirectory)
Upload a file to the virtual machine.

Parameters:
localFile - Location of the file in the local system.
remoteTargetDirectory - An existing directory inside the virtual machine where the file needs to be uploaded to.
Returns:
true if upload is successful, false otherwise

download

boolean download(File remoteFile,
                 File localTargetDirectory)
Download a file from the virtual machine.

Parameters:
remoteFile - Location of the file in the virtual machine.
localTargetDirectory - An existing directory in the local system where the file needs to be downloaded to.
Returns:
true if download is successful, false otherwise

getConfig

VirtualMachineConfig getConfig()
Returns the persisted information for this virtual machine.

Returns:
the configuration of this virtual machine


Copyright © 2012. All Rights Reserved.