Ce contenu n'est pas disponible dans la langue sélectionnée.
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 Copier lienLien copié sur presse-papiers!
Copier lienLien copié sur presse-papiers!
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;
}