-
Language:
English
-
Language:
English
Red Hat Training
A Red Hat training course is available for Red Hat JBoss Operations Network
9. Reference: Methods Specific to the JBoss ON CLI
Some classes and methods are available to the JBoss ON CLI and JBoss ON server scripts which are not part of the regular API.
9.1. Methods Available to the CLI and Server Scripts
9.1.1. Assert
Provides assertion utilities for CLI scripts. More information about using Java assertions is in the Java language documentation.
Method | Signature |
---|---|
Assert.assertEquals |
assertEquals(float, float, float, String) assertEquals(short, short, String) assertEquals(double, double, double) assertEquals(long, long, String) assertEquals(byte, byte, String) assertEquals(Object, Object) assertEquals(char, char, String) assertEquals(Object, Object, String) assertEquals(double, double, double, String) assertEquals(byte[], byte[]) assertEquals(boolean, boolean) assertEquals(Object[], Object[], String) assertEquals(Collection, Collection) assertEquals(Object[], Object[]) assertEquals(byte, byte) assertEquals(float, float, float) assertEquals(char, char) assertEquals(int, int) assertEquals(long, long) assertEquals(Collection, Collection, String) assertEquals(short, short) assertEquals(String, String, String) assertEquals(byte[], byte[], String) assertEquals(boolean, boolean, String) assertEquals(String, String) assertEquals(int, int, String) |
Assert.assertEqualsNoOrder |
assertEqualsNoOrder(Object[], Object[], String) assertEqualsNoOrder(Object[], Object[]) |
Assert.assertExists |
assertExists(String) |
Assert.assertFalse |
assertFalse(boolean) assertFalse(boolean, String) |
Assert.assertNotNull |
assertNotNull(Object) assertNotNull(Object, String) |
Assert.assertNotSame |
assertNotSame(Object, Object, String) assertNotSame(Object, Object) |
Assert.assertNull |
assertNull(Object) assertNull(Object, String) |
Assert.assertNumberEqualsJS |
assertNumberEqualsJS(double, double, String) |
Assert.assertSame |
assertSame(Object, Object, String) assertSame(Object, Object) |
Assert.assertTrue |
assertTrue(boolean, String) assertTrue(boolean) |
Assert.fail |
fail() fail(String, Throwable) fail(String) |
9.1.2. Subject
Represents the current logged-in JBoss ON user. smsAddress toString userConfiguration
Method | Signature |
---|---|
subject.addLdapRole |
addLdapRole(Role) |
subject.addRole |
addRole(Role) addRole(Role, boolean) |
subject.department | Prints the department value (if any) for the current user. |
subject.emailAddress | Prints the email address for the current user. |
subject.factive | Prints whether the user account is active. |
subject.firstName | Prints whether the first name of the user. |
subject.fsystem | |
subject.id | Prints the ID number for the user account within JBoss ON. |
subject.lastName | Prints the surname for the user. |
subject.ldapRoles | Lists any roles associated with LDAP groups to which the current user is a member. |
subject.name | Prints the JBoss ON user ID of the current user. |
subject.ownedGroups | |
subject.phoneNumber | Prints thephone number, if any exists, for the current user. |
subject.removeLdapRole |
removeLdapRole(Role) |
subject.removeRole |
removeRole(Role) |
subject.roles | Prints the role name, permissions, associated LDAP users and groups, associated resource groups, and other information about every role to which the current user belongs. |
subject.sessionId | Prints the current session ID number. |
subject.smsAddress | Returns the pager number, if it exists, for the user. |
subject.toString |
String toString() |
subject.userConfiguration | Returns all of the dashboard information, based on the configured portlets, dashboards, and settings that are specific to the logged-in user. |
9.1.3. pretty
Converts CLI objects (particularly search results and other domain objects) into a pretty-print format in the output.
Method | Signature |
---|---|
pretty.exportMode | Prints the current export setting for the server. |
pretty.print |
print(String[][]) print(PropertySimple, int) print(Configuration) print(PropertyMap, int) print(PropertyList, int) print(Collection) print(Map) print(Object[]) print(Object) |
pretty.width | Prints the current width settings for the console display. |
9.1.4. unlimitedPC and pageControl
Sets paging and sorting settings for returned data.
Method | Signature |
---|---|
unlimitedPC.addDefaultOrderingField |
addDefaultOrderingField(String, PageOrdering) addDefaultOrderingField(String) |
unlimitedPC.clone |
clone() |
unlimitedPC.firstRecord | Returns the first record in the results page. |
unlimitedPC.getExplicitPageControl |
PageControl getExplicitPageControl(int, int) |
unlimitedPC.getSingleRowInstance |
PageControl getSingleRowInstance() |
unlimitedPC.getUnlimitedInstance |
PageControl getUnlimitedInstance() |
unlimitedPC.initDefaultOrderingField |
initDefaultOrderingField(String) initDefaultOrderingField(String, PageOrdering) |
unlimitedPC.orderingFields | |
unlimitedPC.orderingFieldsAsArray | |
unlimitedPC.pageNumber | Returns the current page number for paged results. |
unlimitedPC.pageSize | Returns the current configured page size (number of returned entries per page). |
unlimitedPC.primarySortColumn | |
unlimitedPC.primarySortOrder | |
unlimitedPC.removeOrderingField |
removeOrderingField(String) |
unlimitedPC.reset |
reset() |
unlimitedPC.setPrimarySort |
setPrimarySort(String, PageOrdering) |
unlimitedPC.setPrimarySortOrder |
setPrimarySortOrder(PageOrdering) |
unlimitedPC.sortBy |
sortBy(String) |
unlimitedPC.startRow | Returns the current starting row number. |
unlimitedPC.toString |
String toString() |
unlimitedPC.truncateOrderingFields |
truncateOrderingFields(int) |
9.1.5. exporter
Writes the CLI output to a specified file.
Method | Signature |
---|---|
exporter.close |
close() |
exporter.file | |
exporter.format | Shows the current configured output format. |
exporter.pageWidth | Shows the configured line length ofor content in the output file. |
exporter.setFormat |
setFormat(String) |
exporter.setFile |
setFile(String) |
exporter.setPageWidth |
setPageWidth(int) |
exporter.setTarget |
setTarget(String, String) |
exporter.write |
write(Object) |
9.1.6. ProxyFactory
Provides specialized methods to make it easier and simpler to manage resource objects.
Method | Signature |
---|---|
ProxyFactory.getResource |
ResourceClientProxy getResource(int) |
ProxyFactory.outputWriter | |
ProxyFactory.remoteClient | Returns information about the managers and configuration used by the remote client. In the interactive CLI, this prints information about the manager beans used by the interactive CLI. |
ProxyFactory.resource |
9.1.7. scriptUtil
Provides utilities to use for writing CLI scripts.
Method | Signature |
---|---|
scriptUtil.findResources |
PageList<Resource> findResources(String) |
scriptUtil.getFileBytes |
byte[] getFileBytes(String) |
scriptUtil.isDefined |
boolean isDefined(String) |
scriptUtil.saveBytesToFile |
saveBytesToFile(byte[], String) |
scriptUtil.sleep |
sleep(long) |
scriptUtil.waitForScheduledOperationToComplete |
ResourceOperationHistory waitForScheduledOperationToComplete(ResourceOperationSchedule, long, int) ResourceOperationHistory waitForScheduledOperationToComplete(ResourceOperationSchedule) |
9.2. Methods Available to Proxy Resources
The ProxyFactory classes provide shortcuts for a lot of common resource management tasks, such as viewing monitoring data, running operations, or changing the resource or plug-in configuration. These methods are not in the regular API, but they can be used both by the JBoss ON CLI and by JBoss ON server-side scripts.
The shortcuts and methods available through ProxyFactory are different, depending on the resource type. Methods are only available if the resource type supports that functional area.
This section lists the three most common resource types:
Note
Use tab-complete in the interactive CLI to find the specific methods available for a resource type or to get the method signatures for individual methods.
Using proxy resources is covered in Section 4.8, “Using Resource Proxies”.
Table 4. Proxy Methods for Platforms
Information Methods | |
---|---|
measurements | Displays a pretty-print list of the available metrics, current values, and description of all measurements for the platform resource. |
operations | Lists the available operations for the resource type. |
Shortcut Metric Methods | |||
---|---|---|---|
OSName | OSVersion | architecture | createdDate |
description | distributionName | distributionVersion | freeMemory |
freeSwapSpace | hostname | idle | totalMemory |
systemLoad | totalSwapSpace | usedSwapSpace | usedMemory |
userLoad | modifiedDate | waitLoad | version |
Shortcut Resource Entry Methods | ||
---|---|---|
id (inventory ID number) | resourceType | name (inventory name) |
Shortcut Operation Methods | ||
---|---|---|
manualAutodiscovery | cleanYumMetadataCache | viewProcessList |
Shortcut Configuration Methods | |
---|---|
editPluginConfiguration() | pluginConfiguration |
pluginConfigurationDefinition |
Shortcut Content Methods |
---|
contentTypes |
Shortcut Inventory Methods |
---|
children |
Method | Signature |
---|---|
platform.getChild |
ResourceClientProxy getChild(String) |
platform.getMeasurement |
Measurement getMeasurement(String) |
platform.updatePluginConfiguration |
PluginConfigurationUpdate updatePluginConfiguration(Configuration) |
platform.toString |
String toString() |
Table 5. Proxy Methods for JBoss AS/EAP Servers
Information Methods | |
---|---|
measurements | Displays a pretty-print list of the available metrics, current values, and description of all measurements for the JBoss resource. |
operations | Lists the available operations for the resource type. |
Shortcut Metric Methods | |||
---|---|---|---|
JVMFreeMemory | JVMMaxMemory | JVMTotalMemory | activeThreadCount |
activeThreadGroupCount | buildDate | createdDate | description |
modifiedDate | startDate | totalTransactions | totalTransactionsperMinute |
transactionsCommitted | transactionsCommittedperMinute | transactionsRolledback | transactionsRolledbackperMinute |
partitionName | versionName | version |
Shortcut Resource Entry Methods | ||
---|---|---|
id (inventory ID number) | resourceType | name (inventory name) |
Shortcut Operation Methods | ||
---|---|---|
restart | shutdown | start |
Shortcut Configuration Methods | |
---|---|
editPluginConfiguration() | pluginConfiguration |
pluginConfigurationDefinition |
Shortcut Content Methods |
---|
contentTypes |
Shortcut Inventory Methods |
---|
children |
Method | Signature |
---|---|
jbossas.getChild |
ResourceClientProxy getChild(String) |
jbossas.getMeasurement |
Measurement getMeasurement(String) |
jbossas.updatePluginConfiguration |
PluginConfigurationUpdate updatePluginConfiguration(Configuration) |
jbossas.toString |
String toString() |
Table 6. Proxy Methods for Content Sources (EARs, WARs, JARs)
Information Methods | |
---|---|
measurements | Displays a pretty-print list of the available metrics, current values, and description of all measurements for the content resource. |
operations | Lists the available operations for the resource type. |
Shortcut Metric Methods | ||
---|---|---|
createdDate | modifiedDate | description |
path | version | exploded |
Shortcut Resource Entry Methods | ||
---|---|---|
id (inventory ID number) | resourceType | name (inventory name) |
Shortcut Operation Methods |
---|
revert |
Shortcut Configuration Methods | |
---|---|
editPluginConfiguration() | pluginConfiguration |
pluginConfigurationDefinition |
Shortcut Content Methods | |
---|---|
contentTypes | backingContent |
Shortcut Inventory Methods |
---|
children |
Method | Signature |
---|---|
content.getChild |
ResourceClientProxy getChild(String) |
content.getMeasurement |
Measurement getMeasurement(String) |
content.updatePluginConfiguration |
PluginConfigurationUpdate updatePluginConfiguration(Configuration) |
content.toString |
String toString() |
content.retrieveBackingContent |
retrieveBackingContent(String fileName) |
content.updateBackingContent |
updateBackingContent(String filename, String displayVersion) |