Java Sample Programs
(JAXWS Bindings)
When you download the SDK, you can find the
Java sample programs and related files in the following directories.
- SDK\vsphere-ws\java\JAXWS\samples\com\vmware– Top-level directory for Java samples. Details listed in the following table.
- SDK\vsphere-ws\java\JAXWS\samples\com\vmware\security– Credential store utilities
- SDK\vsphere-ws\java\JAXWS\samples\com\vmware\vim25– Stub directories. Thevim25directory contains stubs for VirtualCenter 2.5 and later, including vSphere 4.0 and later.
- SDK\vsphere-ws\java\JAXWS\samples\com\vmware\vm– samples written for a single VM
Directory
| Example
| Description
| |
---|---|---|---|
alarm
| VMPowerStateAlarm
| Creates an alarm to
monitor a virtual machine's power state.
| |
events
| EventFormat
| Retrieves and formats
the last event from the host daemon or
vpxd . Includes a
function that formats the event message.
| |
EventHistoryCollectorMonitor
| Demonstrates how to
create and monitor an
EventHistoryCollector .
Uses the
latestPage property of
EventHistoryCollector
to filter the events.
| ||
VMEventHistoryCollectorMonitor
| Standalone client that
demonstrates how to perform the following tasks:
Logging into the web service.
Creating
EventHistoryCollector filtered for a single
virtual machine.
Monitoring events using the
latestPage property
of the
EventHistoryCollector .
| ||
general
| Browser
| Prints all managed
entities and for each entity its type, reference value, property name, property
value, inner object type, inner reference value and inner property value.
| |
Connect
| Connects to an ESXi
system or a vCenter Server system.
| ||
Create
| Creates a managed
entity such as a folder, datacenter, or cluster.
| ||
Delete
| Deletes a managed
entity from the inventory tree. The managed entity can be a virtual machine, a
ClusterComputeResource , or a folder.
| ||
GetCurrentTime
| Retrieves the current
time from the vSphere Server.
| ||
GetHostName
| Retrieves the hostname
of the ESXi Server.
| ||
GetUpdates
| Demonstrates how to use
the
PropertyCollector to
monitor one or more properties of one or more managed objects. In particular
this sample monitors one or all virtual machines and all hosts or one host for
changes to some basic properties.
| ||
LicenseManager
| Demonstrates uses of
the licensing API using
License managed object
reference.
| ||
Move
| Moves a managed entity
from its current location in the inventory to a new location in a specified
folder
| ||
PropertyCollector
| Illustrates the use of
the
PropertyCollector API.
| ||
RemoveManagedObject
| Destroys or unregisters
a managed inventory object like a
Host ,
VirtualMachine ,
or Folder .
| ||
Rename
| Renames a managed
entity object.
| ||
SearchIndex
| Illustrates the use of
the
SearchIndex API.
| ||
SimpleClient
| Connects to the server,
logs in, lists the inventory contents (managed entities) at the console, and
logs out.
| ||
TaskList
| Displays a list of
tasks performed on a specified managed object.
| ||
guest
| CreateTemporaryFile
| Creates a temporary
file inside a virtual machine.
| |
DownloadGuestFile
| Downloads a file from
the guest to a specified path on the host where the client is running.
| ||
RunProgram
| Runs a specified
program inside a virtual machine. RunProgram re-directs output to a temporary
file inside the guest and downloads the output file.
| ||
UploadGuestFile
| Uploads a file from the
client machine to a specified location inside the guest operating system.
| ||
host
| AcquireSessionInfo
| Acquires a session with
a vCenter Server or ESXi host and prints a cim service ticket and related
session information to a file.
| |
AddVirtualNic
RemoveVirtualNic | Adds a virtual NIC to a
port group on a virtual switch. Removes a virtual NIC from a port group.
| ||
AddVirtualSwitch
RemoveVirtualSwitch | Adds a virtual switch
to a host. Removes a virtual switch from the host.
| ||
AddVirtualSwitchPortGroup
RemoveVirtualSwitchPortGroup | Adds a port group to a
virtual switch. Removes a port group from a virtual switch.
| ||
DVSCreate
| Creates a distributed
virtual switch.
| ||
HostProfileManager
| Demonstrates the use of
HostProfileManager and
ProfileComplainceManager .
| ||
NIOCForDVS
| Adds a network resource
pool to a distributed virtual switch.
| ||
httpfileaccess
| GetVMFiles
| Retrieves configuration
files, snapshots files, log files, and virtual disk files of a virtual machine
and places them on the system on which the program is run.
| |
ColdMigration
| Puts virtual machine
files into a specified datacenter and datastore and registers and reconfigures
the corresponding virtual machine.
| ||
performance
| Basics
| Displays available
performance counters or other metadata for an ESXi host.
| |
History
| Reads performance
measurements from the current time, or from a specified start time, for a
specified duration.
| ||
PrintCounters
| Writes the available
counters of a managed entity into the specified file at the specified location.
The managed entity can be a host system, a virtual machine, or a resource pool.
| ||
Realtime
| Displays performance
measurements from the current time at the console.
| ||
VItop
| An
ESXtop -like sample
application that lets administrators specify the CPU and memory counters by
name to obtain metrics for a specified host.
| ||
VIUsage
| Creates a GUI for
graphical representation of the counters.
| ||
scheduling
| DeleteOneTimeScheduledTask
| Demonstrates deleting a
ScheduledTask .
| |
OneTimeScheduledTask
| Demonstrates creating a
ScheduledTask using
the
ScheduledTaskManager .
| ||
WeeklyRecurrenceScheduledTaks
| Demonstrates creating a
weekly recurrent scheduled task.
| ||
scsilun
| SCSILunName
| Displays the
CanonicalName ,Vendor ,
Model ,
Data ,
Namespace and
NamespaceId of the
host’s SCSI LUN.
| |
security
| credstore
| Base64
| A fast, memory
efficient class that encodes and decodes to and from BASE64 in full accordance
with RFC 2045.
|
CredentialStore
| Creates an example
credential store.
| ||
CredentialStoreAdmin
| A command-line tool
that provides complete access to the credential store backing file on the local
machine.
| ||
CredentialStoreFactory
| Factory class providing
instances of a credential store.
| ||
CredentialStoreImpl
| Implementation class
for
CredentialStoreAdmin .
| ||
CredentialStoreObfuscate
| Converts the hostname
string to lowercase, so that a uniform representation of the hostname is used
to obfuscate and de-obfuscate the password.
| ||
CredentialStoreStorage
| This class provides the
same functionality as
FileInputStream ,
except that the close() method is overridden so that
FileInputStream class’
close() method does not get called.
| ||
simpleagent
| SimpleAgent
| Accesses the local
credential store to obtain a single user account to log in to the specified
server.
| |
CreateUsers
| Creates a user account
and password and stores them in the local credential store.
| ||
storage
| CreateStorageDRS
| Creates storage DRS.
| |
SDRSRecommendation
| Runs storage DRS on an
SDRS cluster to obtain SDRS recommendations.
| ||
SDRSRules
| Configures rules for an
SDRS cluster.
| ||
vApp
| OVFManagerExportVAPP
| Demonstrates the
OvfManager by
exporting VMDKs and OVF Descriptors of all VMs in the vApps.
| |
OVFManagerExportVMDK
| Demonstrates how the
OvfManager exports
VMDKs from a VM to the localSystem.
| ||
OVFManagerImportLocal
| Use this class to
import or deploy an OVF Appliance from a local drive.
| ||
OVFManagerImportVAppFromUrl
| Use this class to
import or deploy an OVF Appliance from a specified URL.
| ||
vim25
| This
directory contains the Java classes that define the JAXWS bindings to the
vSphere API.
| ||
vm
| VMClone
| Locates an existing
virtual machine on the vCenter Server system, makes a template from this
virtual machine, and deploys instances of the template onto a datacenter.
| |
VMCreate
| Creates a virtual
machine. Different command-line input creates the virtual machine in different
ways.
| ||
VMDeltaDisk
| Creates a delta disk on
top of an existing virtual disk in a virtual machine, and simultaneously
removes the original disk using the reconfigure API.
Use delta disks in conjunction with
linked virtual machines.
| ||
VMDiskCreate
| Creates a virtual disk.
| ||
VMLinkedClone
| Creates a linked
virtual machine from an existing snapshot.
| ||
VMManageCD
| Configures a CDROM for
a virtual machine. Also lists information about the CDROMs associated with a
virtual machine.
| ||
VMManageFloppy
| Configures a floppy
drive for a virtual machine. Also lists information about the floppy drives
associated with a virtual machine.
| ||
VMotion
| Checks whether
migration with
VMotion is feasible
between two hosts. Performs the migration if the hosts are compatible.
| ||
VMpowerOps
| Performs power
operations on a virtual machine.
| ||
VMPromoteDisks
| Consolidates a linked
virtual machine by using the
VirtualMachine.PromoteDisks method.
| ||
VMReconfig
| Reconfigures a virtual
machine. Includes reconfiguring the disk size and disk mode.
| ||
VMRelocate
| Relocate a linked
virtual machine using disk move type.
| ||
VMSnapshot
| Performs virtual
machine snapshot operations
|