VMware

Developer Center Blog

VMware Developer Blog provides content for the VMware Developer Community.

5 Posts tagged with the java tag
0

We wanted to let you know we ran a very successful vSphere SDK lab at [Partner Exchange / Tech Exchange a few weeks ago in Orlando. For those of you who missed the event, I'm posting the manuals and code files. Going through the lab is a great way to get started with the API and includes handy sample code for modification or inclusion in your own programs.

{youtube}http://www.youtube.com/watch?v=paGqr9SWl-4{youtube}

The lab covers both the Java and C# versions of the VI SDK and uses the vSphere Web Services SDK 4.0 (formerly VI SDK 4.0). Though the lab doesn't cover any vSphere-specific features, I haven't tested it with VI SDK 2.5 and it will probably require some minor modification. For scripters that would prefer an introduction to the vSphere Perl SDK (formerly the VI Perl Toolkit) or the vSphere PowerCLI (formerly VI Toolkit for Windows), I posted a similar lab for those in an earlier blog post.

Exercises cover all the basics for using the SDK:
* Understanding managed objects and data objects
* Connecting to the VI API webservice
* getting the properties of managed objects using the PropertyCollector
* Using the SearchIndex
* Finding objects using TraversalSpecs
* Finding objects based on arbitrary criteria
* Collecting properties of multiple objects at the same time
* Understanding performance differences in some basic property collection strategies
* Monitoring properties for changes
* Monitoring tasks for completion
* Gathering performance statistics

There's obviously a lot more to do in the SDK, but once you've mastered those basic skills, most of the rest of the SDK is just an extension of what you already know. The exercises on collecting multiple objects properties at the same time and understanding performance differences due to property collector strategies cover some common problems I see with the management ecosystem partners I handle and are a great review for anyone trying to make sure their SDK code scales well.

A few things to note: I didn't update the doc with the new names of the various API components... I wrote the lab while those names were still under development. Also, I want to thank the other folks who helped put this lab together: Balaji Parimi (who wrote the Java code), Rajesh Kamal (who wrote the C# code), Alton Yu, John Kennedy, Paul Vasquez, and Steve Jin.

While most of the code handles errors gracefully and follows best practices, I’d like to point out that the code here is designed to teach concepts, not to be “enterprise ready”.

0 Comments Permalink
0

Folks,

We are extremely happy to announce the availability of our VMware vSphere SDKs and Toolkits to support the relase of the vSphere platform.

Congratulations to the teams around the world working day and night to make this happen.

New SDKs & Toolkits released today

VMware vSphere Web Services SDK 4.0

VMware vSphere Guest SDK 4.0

VMware Virtual Disk Development Kit 1.1

VMware CIM SDK 4.0

VMware SDK for Perl 4.0

VMware vSphere Client Plug-ins

VMware vSphere CLI 4.0

VMware vSphere PowerCLI 4.0

VMware vSphere Management Assistant 4.0

VMware Open Virtual Format Tool 1.0

Changes to our site:

o Creation of dedicated community style product pages. Product pages have links to Documentation, Discussions and community contributed documents.

o Added Events Calendar for exclusive developer / administrator topics - visit our VMware Coffee Talk Webinars for more info

o Consolidated our Community Contributed & VMware Sample Code into one site we call Code Central

o Updated the VMware Icons for the vSphere platform

lunar-landing.jpg

0 Comments Permalink
0

December 31st 2008 article from NetworkWorld / NY Times recommends our VMware Developer websites as the # 3 Website IT Pros should master... ;)

"..... To get the best real-world feedback on how best to deploy VMware, keep your eyes on the VMware Communities Web site. It’s got user groups in your community and lots of tips from other VMware developers that can help you solve problems faster..."

NY Times: http://www.nytimes.com/external/idg/2008/12/31/31idg-Nine-Web-sites.html?em

Network World: http://www.nytimes.com/external/idg/2008/12/31/31idg-Nine-Web-sites.html?em

Big Thanks to our VMware community of developers for your contributions !!

number3.jpg


Pablo Roesch
VI SDK Product Marketing
http://vmware.com/developer

0 Comments 0 References Permalink
1

I presented the Java API for VI SDK at VMware Technology Exchange in San Jose yesterday and got very positive feedbacks.

Here are two UML diagrams I used in my presentation. I think they are very helpful to understand the API and the design thoughts behind it.

1. The overall object model

overall.JPG

It can be inferred from our VI SDK API reference. Please note that we don't have a managed object type called ManagedObject in our reference. This is a type defined to capture all the common properties and behaviors of all managed objects. Given the limited size, I only show the names of the types, not properties and methods.

To better group these managed object types, I used colors. On the right most side of the diagram are the ServiceInstance class and various "manager" classes like AuthorizationManager. From the ServiceInstance, you can get any object of these types with single call, for example getAuthorizationManager().

In the middle of left side, you can find ManagedEntity class and its sub-classes like HostSystem, VirtualMachine. These classes represent all the items you could find in the inventory tree from VI client. They are the most important managed objects in the whole model, and all tagged with orange color except the HostSystem.

The HostSystem is very much like ServiceInstance in that it has many "System" or "Manager" types closely attached to it, for example, HostDatastoreSystem. You can get hold of these objects with a single method call from a HostSystem object. For this reason, both HostSystem and all the attached classes are tagged the same color.

2. A detailed partial UML diagram

detail.JPG

This UML diagram is extracted from the overall model but adds much more details with properties and methods. If you can understand this diagram, you can then easily understand all the other managed object types.

The ManagedObject class holds three properties:

1. mor of type ManagedObjectReference -- pointing to the ManagedObjectReference object that is used to represent a managed object in VI SDK.

2. serverConnection of type ServerConnection -- pointing to the ServerConnection object I will cover later.

3. objectContent of type ObjectContent -- used for local caching for better performance.

Besides accessors, the class has getCurrentProperty() method defined to encapsulate the PropertyCollector. This method gets called in subclasses to get a property. For example, the getName() in ManagedEntity called it like (String) getCurrentProperty("name"); In most of cases, you don't need to use it at all, I already provide explicit getter methods in concrete subclasses. I may change its visibility to protected later. The other two methods, "getCachedProperty() and refreshPropertyCache()" are designed for caching.

The ServerConnection is used to represent a connection to the server under a specific login user. It holds information like url to the server, the userSession with username etc., and vimService which is the JUMBO interfaces with 300+ methods. For convenience, ServerConnection also has a reference to a ServiceInstance object.

Now let us take a look at the ServiceInstance type. It's a special managed object and the first managed object you will have in a typical application logic flow. You can create a new ServiceInstance object by providing url/username/password, or url/sessionID combination. The later is not used as much as the first constructor, but very helpful when you develop a VI client plugin in Java. I will talk more about it later blogs.

According to the API reference, the ServiceInstance has a ServiceContent object, which holds all the ManagedObjectReferences to various "manager" attached to it, and an AboutInfo object. You can get any of them in a single call. ServiceContent object is, therefore, no long needed, and I don't even provide a getter to it.

The right side of the diagram are the ExtensibleManagedObject and its subclass ManagedEnity. E.M.O doesn't have methods defined at all, but three properties. Therefore it only has three corresponding getters.

ManagedEntity is one of the most important class given that VirtualMachine, HostSystem etc. are all inherited from it. Besides accessors and several methods, I provides some methods to retrieve items in the inventory tree. For example, you can easily find all the Virtual in one single call. Property is used within these methods, but you don't see it.

The above two ML diagrams should have given you a big picture about the object model and how key types are related to each other. If you really need to know more details. Please click into my May 8 posting and read the source code there. For sure, it will give you much more details than I can cover in these two ML diagrams.

1 Comments Permalink
1

The open source client side Java API for VI can now be found at

http://sourceforge.net/projects/vijava

Thanks!

1 Comments Permalink

Developer Center Blog

VMware Developer Blog provides content for the VMware Developer Community.

Communities