You can extend the vSphere Web Client service layer with your own Java services. Typically, you create a Java service if your user interface extensions add actions to the vSphere Web Client, where the Java service performs the action operation on the virtual infrastructure. You can also add a Java service to perform a complex calculation, retrieve data from an external source, or perform other miscellaneous tasks.
To add a Java service, you must provide a Java Archive (JAR) bundle that contains the classes in the service. Inside the JAR bundle, you must add an XML configuration file that declares all of the Java objects that the service adds to the vSphere Web Client Virgo server framework. The Virgo server uses Spring as the application server framework.
You must locate the /src/main/resources/META-INF/MANIFEST.MF file in your service JAR bundle and ensure that the Java service package is exported. To export the package, the following line must appear in the
MANIFEST.MF file:
where com.vmware.myService is the name of the service package you have created.
You add your service to the Spring configuration on the Virgo server by creating a <bean> element in the Spring configuration file. In the JAR bundle, locate the
/src/main/resources/META-INF/spring/bundle-context.xml file. The file contains a
<beans> XML element containing services in the configuration. Add your service as a new
<bean> as follows:
where the name attribute is the name of your service implementation, and the
class attribute contains the class you have created that implements the service interface.
You must also expose the service interface as an OSGI bundle in the Spring framework. In the JAR bundle, locate the
/src/main/resources/META-INF/spring/bundle-context-osgi.xml file. This file also contains a
<beans> XML element. Add your service using the following line:
where the id attribute is the name of your service, the
ref element specifies the service implementation you have added to the
bundle-context.xml file, and the
interface element contains the class that defines the service interface.