Extend the GlassFish plugin
The Deploy GlassFish plugin is designed to be extended through the Deploy plugin API type system and Jython. The plugin wraps the GlassFish command-line interface (CLI) with a Jython runtime environment, so that extenders can interact with GlassFish and Deploy from the script. The Jython script is executed on the Deploy Server and has full access to the following Deploy objects:
deployed: The current deployed object on which the operation has been triggered.
step: The step object that the script is being executed from. Exposes an Overthere remote connection for file manipulation and a method to execute GlassFish CLI commands.
container: The container object to which the deployed is targeted.
delta: The delta specification that lead to the script being executed.
deployedApplication: The entire deployed application.
The plugin associates Create, Modify, Destroy, Noop, and Inspect operations received from Deploy with jython scripts that must be executed for the specific operation to be performed.
You can also use an advanced method to extend the plugin, implementation of this type of extension must be written in the Java programming language and consists of writing
For more information, see GlassFish plugin
GlassFish artifacts and resources support the concept of additional properties. These properties are normally specified by using the
--properties argument of GlassFish CLI commands.
Deploy can be extended to add one or more additional properties. You can add them by extending a type synthetically. You need to add the property into the category “Additional Properties”.
For example, the following sample adds the additional property of
keepSessions, with a default value of
true, and makes this property available on the CI. This will result in deploying the application with the GlassFish CLI argument
<type-modification type="glassfish.WarModule"> <property name="keepSessions" kind="boolean" category="Additional Properties" default="true"/> </type-modification>
The plugin adds control tasks to
glassfish.CliManagedContainer. The control task can be specified as a Jython script that will be executed on the Deploy server. The Jython script will execute
asadmin commands on the remote host.
<type-modification type="glassfish.Domain"> <method name="listClusters" label="List clusters" delegate="asadmin" script="list-clusters.py" > </type-modification>
logOutput("Listing clusters") result = executeCmd('list-clusters') logOutput(result.output) logOutput("Done.")
The script will execute the
list-clusters command using
asadmin on the remote host and print the result.