Vdf.java (using Steve Jin's VI Java API)

Vdf.java (using Steve Jin's VI Java API)

Recently someone in the community had asked for vdf equivalent using vSphere SDK for Perl and it was pretty easy if you're familiar with the vSphere API and Perl which I ended up writing in just a few minutes: vdf.pl.

After creating the script, I was curious on how easy or difficult it might be to create the same script using VI Java API created by VMware employee Steve Jin.  I have to be honest, I've never played with Steve's VI Java API before  but I have programmed in Java before back in college thought I have not  touched Java in more than 4+years.

I followed the simple Get Started Tutorial and using the HelloVM.java example, I was up and running in < 5min! I  spent few minutes looking at a few samples programs and getting a feel  for the Java language again, the most difficult part was remembering all  the Java syntax! After an hour or so, I was able to get thevdf.pl script translated to Vdf.java

Here is the output from the vSphere SDK for Perl version:

vSphereSDKforPerlSample.png

Here is the output from VI Java API version:

VIJavaSample.png

I executed the program using Eclipse IDE and I was able to set the  commandline params to help me test while working on the application.  Just right click on the program and click "Run As->Run  configurations->Arguments" and set the required "server", "username"  and "password" fields and now you can just click on "Run As" and the  program will execute

runConfiguration.png

With a little Java know how and familiarity with the vSphere API, you  can start creating programs using Steve Jin's awesome and fast VI Java  API (much better than the VMware's Tech Preview version!)

Version history
Revision #:
1 of 1
Last update:
‎05-08-2010 03:55 PM
Updated by: