public class VmwareViJavaAccess extends Object
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_TIMEOUT |
Constructor and Description |
---|
VmwareViJavaAccess(String hostname)
Constructor for creating a instance for a given server.
|
VmwareViJavaAccess(String hostname,
String username,
String password)
Constructor for creating a instance for a given server and credentials.
|
VmwareViJavaAccess(VmwareServer vmwareServer) |
Modifier and Type | Method and Description |
---|---|
void |
connect() |
void |
connect(int timeout)
Connects to the server.
|
void |
disconnect()
Disconnects from the server.
|
com.vmware.vim25.mo.HostSystem |
getHostSystemByManagedObjectId(String managedObjectId)
Returns a host system by a given managed object Id.
|
TreeSet<String> |
getHostSystemIpAddresses(com.vmware.vim25.mo.HostSystem hostSystem)
Searches for all ip addresses of a host system
|
int |
getMajorApiVersion()
Return the major API version for this management server
|
com.vmware.vim25.mo.ManagedEntity |
getManagedEntityByManagedObjectId(String managedObjectId)
Returns a managed entitiy for a given managed object Id.
|
Map<Integer,com.vmware.vim25.PerfCounterInfo> |
getPerfCounterInfoMap()
This method retrieves the performance counters available.
|
String |
getPrimaryHostSystemIpAddress(com.vmware.vim25.mo.HostSystem hostSystem)
Searches for the primary ip address of a host system.
|
String |
getPropertyOfCimObject(org.sblim.wbem.cim.CIMObject cimObject,
String propertyName)
Returns the value of a given cim object and property.
|
int |
getTimeout() |
com.vmware.vim25.mo.VirtualMachine |
getVirtualMachineByManagedObjectId(String managedObjectId)
Returns a virtual machine by a given managed object Id.
|
TreeSet<String> |
getVirtualMachineIpAddresses(com.vmware.vim25.mo.VirtualMachine virtualMachine)
Searches for all ip addresses of a virtual machine
|
List<org.sblim.wbem.cim.CIMObject> |
queryCimObjects(com.vmware.vim25.mo.HostSystem hostSystem,
String cimClass)
Queries a host system for Cim data.
|
List<org.sblim.wbem.cim.CIMObject> |
queryCimObjects(com.vmware.vim25.mo.HostSystem hostSystem,
String cimClass,
String primaryIpAddress)
Queries a host system for Cim data.
|
VmwarePerformanceValues |
queryPerformanceValues(com.vmware.vim25.mo.ManagedEntity managedEntity)
This method queries performance values for a given managed entity.
|
protected void |
relax()
This method is used to "relax" the policies concerning self-signed certificates.
|
com.vmware.vim25.mo.ManagedEntity[] |
searchManagedEntities(String type)
Searches for a managed entity by a given type.
|
static void |
setServiceInstancePool(ServiceInstancePool serviceInstancePool) |
boolean |
setTimeout(int timeout)
Sets the timeout for server connections.
|
public static final int DEFAULT_TIMEOUT
public VmwareViJavaAccess(String hostname, String username, String password)
hostname
- the vCenter's hostnameusername
- the usernamepassword
- the passwordpublic VmwareViJavaAccess(String hostname) throws IOException
hostname
- the vCenter's hostnameIOException
public VmwareViJavaAccess(VmwareServer vmwareServer)
public int getTimeout()
public void connect(int timeout) throws MalformedURLException, RemoteException
MalformedURLException
RemoteException
public void connect() throws MalformedURLException, RemoteException
MalformedURLException
RemoteException
public boolean setTimeout(int timeout)
timeout
- the timeout to be used for connectingpublic void disconnect()
protected void relax()
public Map<Integer,com.vmware.vim25.PerfCounterInfo> getPerfCounterInfoMap()
public com.vmware.vim25.mo.ManagedEntity getManagedEntityByManagedObjectId(String managedObjectId)
managedObjectId
- the managed object Idpublic com.vmware.vim25.mo.VirtualMachine getVirtualMachineByManagedObjectId(String managedObjectId)
managedObjectId
- the managed object Idpublic com.vmware.vim25.mo.HostSystem getHostSystemByManagedObjectId(String managedObjectId)
managedObjectId
- the managed object Idpublic VmwarePerformanceValues queryPerformanceValues(com.vmware.vim25.mo.ManagedEntity managedEntity) throws RemoteException
managedEntity
- the managed entity to queryRemoteException
public List<org.sblim.wbem.cim.CIMObject> queryCimObjects(com.vmware.vim25.mo.HostSystem hostSystem, String cimClass, String primaryIpAddress) throws ConnectException, RemoteException, org.sblim.wbem.cim.CIMException
hostSystem
- the host system to querycimClass
- the class of Cim objects to retrieveprimaryIpAddress
- the Ip address to useRemoteException
org.sblim.wbem.cim.CIMException
ConnectException
public List<org.sblim.wbem.cim.CIMObject> queryCimObjects(com.vmware.vim25.mo.HostSystem hostSystem, String cimClass) throws ConnectException, RemoteException, org.sblim.wbem.cim.CIMException
hostSystem
- the host system to querycimClass
- the class of Cim objects to retrieveRemoteException
org.sblim.wbem.cim.CIMException
ConnectException
public String getPrimaryHostSystemIpAddress(com.vmware.vim25.mo.HostSystem hostSystem)
The idea is to resolve the HostSystem's name and use the resulting IP if the IP is listed on the available addresses list, otherwise, use the first ip listed on the available list.
hostSystem
- the host system to querypublic TreeSet<String> getHostSystemIpAddresses(com.vmware.vim25.mo.HostSystem hostSystem)
hostSystem
- the host system to querypublic TreeSet<String> getVirtualMachineIpAddresses(com.vmware.vim25.mo.VirtualMachine virtualMachine)
virtualMachine
- the virtual machine to querypublic com.vmware.vim25.mo.ManagedEntity[] searchManagedEntities(String type) throws RemoteException
type
- the type string to search forRemoteException
public int getMajorApiVersion()
public String getPropertyOfCimObject(org.sblim.wbem.cim.CIMObject cimObject, String propertyName)
cimObject
- the Cim objectpropertyName
- the property's namepublic static void setServiceInstancePool(ServiceInstancePool serviceInstancePool)
Copyright © 2021. All rights reserved.