The following
illustrations show the directory structure of the remote plug-in sample code.
Top Level
Directory
Figure 1. Remote Plug-in
Sample Top Level Directory
Table 1. Contents of Top Level
Directory
Subdirectory
Description
remote-plugin-sample/libs
The external library (vim25.jar) that needs
to be installed as a local dependency during the project build and deploy
process.
remote-plugin-sample/src
The root of the plug-in source code. It
contains three main subdirectories:
java
resources
ui
Descriptions of these subdirectories follow.
java
Directory for Server-Side Code
The server-side code for the remote plug-in sample is
written in Java. It contains several packages. Figure 2. Remote Plug-in Sample
Server-Side Directory
Table 2. Contents of Server-Side
Directory
Subdirectory
Description
configuration
The Configuration service reads connection
properties of vCenter
Server, such as FQDN, thumbprint, port, and
GUID, and exposes them to Spring Boot components through public
accessors.
controllers
The Controller components have the logic to
keep open user sessions to the vCenter
Server.
gateway
The Session Service interacts with
vCenter
Server on behalf of the plug-in server. The
Session service authenticates the plug-in server with a clone
ticket.
model
Object definitions for plug-in server use.
services
Services that implement the plug-in
server-side business logic.
store
In-memory database to store custom data for
the plug-in.
vim25
Components that communicate with vCenter
Server:
VimObjectService retrieves data
from the vCenter Server, using the Web
Services API.
ThumbprintTrustManager helps to
authenticate the remote side of a secure socket, using
the public interface
javax.net.ssl.X509TrustManager interface.
SpringBootApplication.java
The Spring Boot Application bootstraps,
deploys, and runs the plug-in on an embedded Tomcat application
server.
resources
Directory
The resources directory of the remote
plug-in sample contains application configuration files and a certificate file for
encrypted communications. Figure 3. Remote Plug-in Sample
Resources Directory
Table 3. Contents of Resources
Directory
Subdirectory
Description
application.properties
Settings specific to the plug-in server,
including port number for incoming HTTPS connections, context
root of the web application, log level setting, and settings
pertaining to the keystore.
keystore.jks
Java keystore for self-signed certificate of
vCenter
Server.
spring-context.xml
Context configuration for plug-in server
Spring application.
static/plugin.json
Descriptors for UI components the plug-in adds
to the vSphere Client.
ui/src
Directory
The ui/src directory of the remote
plug-in sample contains the client-side code for the plug-in. The main source files
are in the app subdirectory, which contains an Angular application,
including the AppModule, services, and component files. Figure 4. Remote Plug-in Sample ui/src
Directory.
Table 4. Contents of ui/src
Directory
Subdirectory
Description
app/model
Object definitions for plug-in client-side
use.
app/services
Services that implement the plug-in
client-side business logic
app/views
UI views (Angular components) that implement
the visible functionality of the plug-in. Each view has its own
subdirectory that contains HTML, CSS, and Angular code in
separate files.
app/app.component
The main component that bootstraps the Angular
Application and initializes the htmlClientSdk
service.
app/app-routing.module
The routing module of the plug-in client-side
application.
index.html
Static HTML page that loads by default when
the plug-in server context path is loaded. The
index.html page loads
htmlClientSkd.js and
app.component, which is the entry point of
the Angular application.