WildFly and JBoss EAP are well-equipped with a powerful web-based administration console to manage most of the inner-workings of the application server. Ease of administration and usage of the application server is one of it’s strategic themes (apart from its blazing fast speed!) with constant improvements.
In this tutorial we will show you another tool that can be used to quickly perform administration tasks when you happen to be on the road. If you are using an Android powered smart-phone, you would be happy to know that an app is available on the Google Play Store that can help on the administration.
Although not all the feature-set supported by the web console is provided, still the careful chosen subset of it can help when you want to take a quick glance on your server’s health, manage your deployments or tune a setting in the server’s exposed management tree.
The app is named JBoss Admin and it’s available for immediate download from the Google Play Store free or charge. (Note: If your platform of choice is iOS then you would be happy to know that JBoss Admin is also available on the Apple Store.
Application Features
The application is able to manage the application server, by supporting the following features:
Subsystem Metrics Monitoring: The metrics currently exposed are for Configuration, JVM, Data Sources, JMS Destinations, Transactions and Web subsystems (similar to those shown in the JBoss built-in web console).
Deployments Management: You can upload an artifact (installed on your phone) and then enable/disable it on the server.
Browse the management tree: The whole management tree is exposed for you to configure, similar to the JBoss-cli {-gui} tool provided by the server. You can easily modify attributes and execute operations. Documentation of attributes and operation parameters is easily accessed for you to refer.
Note that both operating modes (Standalone/Domain) of the server are supported.
Application architecture
The application utilizes the HTTP management interface exposed by the server (the same mechanism utilized by the server’s administration console) to execute management operations. Let’s have a brief look on the code to see how it works.
In order to allow reuse (in a possible different application), the management operations that the Android UI classes invoke, are encapsulated in the JBossOperationsManager class. There you can find different methods, each responsible for a different management operation. Here is an example that executes a simple operation to fetch the management version supported by the server:
public void fetchJBossManagementVersion(final Callback callback) { ParametersMap params = ParametersMap.newMap() // 1 .add("operation", "read-attribute") .add("name", "management-major-version"); TalkToJBossServerTask task = new TalkToJBossServerTask(context, server, callback); // 2 task.execute(params); }
Inside the method we build a parameters map [1] with the command we want to execute (‘read-attribute’) plus any parameters that the command expects. Once that is done, we simple pass it to a TalkToJBossServerTask class [2], a subclass of Android’s provided AsyncTask, to execute the actual request. The class will encode the parameters to JSON representation that the server expects, and perform the actual HTTP request. Notice on the construction of the task, we pass the user’s provided Callback class to be called once the task completes (either with success or failure).
Composite operations (an operation that can contain multiple operations) are also supported by just combining the parameters during build. Here is an example that invokes a composite operation to fetch VM metrics residing in deferent management resources on the server’s management tree:
public void fetchJVMMetrics(final Callback callback) { ParametersMap memoryParams = ParametersMap.newMap() .add("operation", "read-resource") .add("address", prefixAddressWithDomainServer(Arrays.asList("core-service", "platform-mbean", "type", "memory"))) .add("include-runtime", Boolean.TRUE); ParametersMap threadingParams = ParametersMap.newMap() .add("operation", "read-resource") .add("address", prefixAddressWithDomainServer(Arrays.asList("core-service", "platform-mbean", "type", "threading"))) .add("include-runtime", Boolean.TRUE); ParametersMap os = ParametersMap.newMap() .add("operation", "read-resource") .add("address", prefixAddressWithDomainServer(Arrays.asList("core-service", "platform-mbean", "type", "operating-system"))) .add("include-runtime", Boolean.TRUE); ParametersMap params = ParametersMap.newMap() // 1 .add("operation", "composite") .add("steps", Arrays.asList(memoryParams, threadingParams, os)); TalkToJBossServerTask task = new TalkToJBossServerTask(context, server, callback); task.execute(params); }
The example is similar to the simple operation shown earlier, but in [1] we combine the parameters in one simple composite ParametersMap, which is then passed to a TalkToJBossServerTask to execute.
That completes our brief overview of the Android code. Both Android and iOS versions of the apps are available as OSS, so feel free to clone the projects from GitHub, play around and provide feedback to the developer.
See the following video which shows the App in action: