public class VmwareViJavaAccess extends Object
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.
|
Modifier and Type | Method and Description |
---|---|
void |
connect()
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.
|
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.
|
boolean |
setTimeout(int timeout)
Sets the timeout for server connections.
|
public VmwareViJavaAccess(String hostname, String username, String password)
hostname
- the vCenter's hostnameusername
- the usernamepassword
- the passwordpublic VmwareViJavaAccess(String hostname) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException, IOException
hostname
- the vCenter's hostnameorg.exolab.castor.xml.MarshalException
org.exolab.castor.xml.ValidationException
IOException
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) throws RemoteException
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 queryRemoteException
public TreeSet<String> getHostSystemIpAddresses(com.vmware.vim25.mo.HostSystem hostSystem) throws RemoteException
hostSystem
- the host system to queryRemoteException
public TreeSet<String> getVirtualMachineIpAddresses(com.vmware.vim25.mo.VirtualMachine virtualMachine) throws RemoteException
virtualMachine
- the virtual machine to queryRemoteException
public com.vmware.vim25.mo.ManagedEntity[] searchManagedEntities(String type) throws RemoteException
type
- the type string to search forRemoteException
public int getMajorApiVersion()
Copyright © 2017. All rights reserved.