@Singleton public class MachineUtils extends Object
Modifier and Type | Field and Description |
---|---|
String |
IP_V4_ADDRESS_PATTERN |
protected Logger |
logger |
Constructor and Description |
---|
MachineUtils(com.google.common.base.Supplier<org.virtualbox_4_1.VirtualBoxManager> manager,
RunScriptOnNode.Factory scriptRunner,
IpAddressesLoadingCache ipAddressesLoadingCache) |
Modifier and Type | Method and Description |
---|---|
<T> T |
applyForMachine(String machineId,
com.google.common.base.Function<org.virtualbox_4_1.IMachine,T> function) |
String |
getIpAddressFromFirstNIC(String machineName) |
static boolean |
isIpv4(String s) |
protected <T> T |
lockSessionOnMachineAndApply(String machineId,
org.virtualbox_4_1.LockType type,
com.google.common.base.Function<org.virtualbox_4_1.ISession,T> function)
Locks the machine and executes the given function using the current session.
|
static boolean |
machineNotFoundException(org.virtualbox_4_1.VBoxException e) |
com.google.common.util.concurrent.ListenableFuture<ExecResponse> |
runScriptOnNode(NodeMetadata metadata,
Statement statement,
RunScriptOptions options) |
<T> T |
sharedLockMachineAndApply(String machineId,
com.google.common.base.Function<org.virtualbox_4_1.IMachine,T> function)
Locks the machine and executes the given function using the machine matching the given id.
|
<T> T |
sharedLockMachineAndApplyToSession(String machineId,
com.google.common.base.Function<org.virtualbox_4_1.ISession,T> function)
Locks the machine and executes the given function to the session using the machine matching
the given id.
|
<T> T |
writeLockMachineAndApply(String machineId,
com.google.common.base.Function<org.virtualbox_4_1.IMachine,T> function)
Locks the machine and executes the given function using the machine matching the given id.
|
<T> T |
writeLockMachineAndApplyToSession(String machineId,
com.google.common.base.Function<org.virtualbox_4_1.ISession,T> function)
Locks the machine and executes the given function using the machine matching the given id.
|
public final String IP_V4_ADDRESS_PATTERN
@Named(value="jclouds.compute") protected Logger logger
@Inject public MachineUtils(com.google.common.base.Supplier<org.virtualbox_4_1.VirtualBoxManager> manager, RunScriptOnNode.Factory scriptRunner, IpAddressesLoadingCache ipAddressesLoadingCache)
public com.google.common.util.concurrent.ListenableFuture<ExecResponse> runScriptOnNode(NodeMetadata metadata, Statement statement, RunScriptOptions options)
public <T> T writeLockMachineAndApply(String machineId, com.google.common.base.Function<org.virtualbox_4_1.IMachine,T> function)
machineId
- the id of the machinefunction
- the function to executepublic <T> T writeLockMachineAndApplyToSession(String machineId, com.google.common.base.Function<org.virtualbox_4_1.ISession,T> function)
machineId
- the id of the machinefunction
- the function to executepublic <T> T sharedLockMachineAndApply(String machineId, com.google.common.base.Function<org.virtualbox_4_1.IMachine,T> function)
machineId
- the id of the machinefunction
- the function to executepublic <T> T sharedLockMachineAndApplyToSession(String machineId, com.google.common.base.Function<org.virtualbox_4_1.ISession,T> function)
machineId
- the id of the machinefunction
- the function to executeprotected <T> T lockSessionOnMachineAndApply(String machineId, org.virtualbox_4_1.LockType type, com.google.common.base.Function<org.virtualbox_4_1.ISession,T> function)
type
- the kind of lock to use when initially locking the machine.machineId
- the id of the machinefunction
- the function to executepublic <T> T applyForMachine(String machineId, com.google.common.base.Function<org.virtualbox_4_1.IMachine,T> function)
machineId
- function
- public static boolean machineNotFoundException(org.virtualbox_4_1.VBoxException e)
public static boolean isIpv4(String s)
Copyright © 2009-2013 jclouds. All Rights Reserved.