Best Practices for Creating Plug-In Packages

To meet the requirements of your virtual environment, you must extend the capabilities of the vSphere Client by creating plug-in modules. Depending on your extension solution, you can extend the user interface layer and the service layer of the vSphere Client.

Incorrect structure of the plug-in package leads to deployment errors. To avoid these errors, consider the following best practices when creating your plug-in packages.

  • Use the generation tools provided with the vSphere Client SDK to develop your vSphere Client extensions and create plug-in packages.
  • Verify that the structure of the plug-in package is as follows:
    • plugin-package.xml - The file describes general information about the plug-in package, the deployment order of the plug-in modules, and any dependencies upon other plug-in packages.
    • plugins folder - The folder contains one or more JAR and WAR files that represent the user interface and Java services components. Limit the number of third-party libraries that you add to this folder.
  • To avoid installation errors, make sure that all third-party libraries that you use are added inside the JAR and WAR files of the plug-in package and not inside the plugins folder. If you add third-party libraries to the plugins folder, the bundles must be OSGi-compliant. Because the vSphere Client resides on the Tomcat Web Server, which is based on the SpringSource dm Server and is built on top of the Equinox OSGi framework, third-party libraries must be packaged as OSGi bundles. OSGi bundles must include an OSGi manifest file that contains correct and thorough OSGi metadata.
  • To avoid deployment errors generated by the Tomcat server, make sure that you do not include third-party libraries that are already available on the server. You can navigate to the html-client-sdk/server/webapps/h5-bridge-webapp.war/WEB-INF/eclipse/plugins directory to view the available libraries.
  • If your plug-in package contains both user interface and Java service components, place the Java service components before the user interface components in the plug-in package manifest file. Use the <bundlesOrder> element to specify the order in which the bundles are deployed to the vSphere Client.
  • For best performance, when designing your vSphere Client extension, limit the number of files included in the plugins folder of your plug-in package. Ideally, your plug-in package must contain only one WAR file, which contains the user interface plug-in modules, and one JAR file, which contains the Java service plug-in modules. Fragmenting your code into many bundles might significantly increase the deployment time and memory consumption.
  • To avoid compatibility issues in case your plug-in package depends on other plug-in packages with specific versions, make sure that you define correctly the plug-in dependencies by using the match parameter of the dependencies element in your plugin-package.xml manifest file. Otherwise, after the vSphere Client deploys your plug-in package, the plug-in will not work because the plug-in dependencies cannot be resolved and may cause errors in the vSphere Client.
    For example, you can use the following lines in the manifest file of your plug-in package to define the minimum supported version of the vSphere Client:
     ... 
       <dependencies>
          <pluginPackage id="com.vmware.vsphere.client"
                         version="5.5.0" match=“greaterOrEqual" />
       </dependencies>
     ...
    Note:

    If your plug-in package is only compatible with a specific version of the vSphere Client, you must use the equal value of the match attribute to specify the version. In this way, you ensure that when you upgrade the vSphere Client, your plug-in package is not deployed, and does not cause any errors.

    Note: If the match attribute is not provided, the default value is greaterOrEqual.
  • To avoid deployment failures, you must create a ZIP archive file for your vSphere Client extension. Moreover, if you want to complete successfully the certification for your vSphere Client plug-in, know that the plug-in signing tool signs only plug-ins that have the ZIP file format.