Show Table of Contents
Chapter 15. Example: Scripting Resource Deployments (JBoss EAP 5)
A common use case for management tools is to automate deployments of new or existing applications. This example creates an easy script for basic management tasks:
- Find all JBoss EAP instances for a specified JBoss ON group.
- Shut down each EAP instance.
- Update binaries for existing deployed applications or create new deployments.
- Restart the EAP instance.
- End the loop.
15.1. Declaring Custom Functions
This script will use two custom functions to deploy the packages to create new resources.
function usage() {
println("Usage: deployToGroup <fileName> <groupName>");
throw "Illegal arguments";
}
function PackageParser(fullPathName) {
var file = new java.io.File(fullPathName);
var fileName = file.getName();
var packageType = fileName.substring(fileName.lastIndexOf('.')+1);
var tmp = fileName.substring(0, fileName.lastIndexOf('.'));
var realName = tmp.substring(0, tmp.lastIndexOf('-'));
var version = tmp.substring(tmp.lastIndexOf('-') + 1);
var packageName = realName + "." + packageType;
this.packageType = packageType.toLowerCase();
this.packageName = packageName;
this.version = version;
this.realName = realName;
}
Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.