此内容没有您所选择的语言版本。

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.
Expand
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)
Copy to Clipboard Toggle word wrap
Assert.assertEqualsNoOrder
assertEqualsNoOrder(Object[], Object[], String)
assertEqualsNoOrder(Object[], Object[])
Copy to Clipboard Toggle word wrap
Assert.assertExists
assertExists(String)
Copy to Clipboard Toggle word wrap
Assert.assertFalse
assertFalse(boolean)
assertFalse(boolean, String)
Copy to Clipboard Toggle word wrap
Assert.assertNotNull
assertNotNull(Object)
assertNotNull(Object, String)
Copy to Clipboard Toggle word wrap
Assert.assertNotSame
assertNotSame(Object, Object, String)
assertNotSame(Object, Object)
Copy to Clipboard Toggle word wrap
Assert.assertNull
assertNull(Object)
assertNull(Object, String)
Copy to Clipboard Toggle word wrap
Assert.assertNumberEqualsJS
assertNumberEqualsJS(double, double, String)
Copy to Clipboard Toggle word wrap
Assert.assertSame
assertSame(Object, Object, String)
assertSame(Object, Object)
Copy to Clipboard Toggle word wrap
Assert.assertTrue
assertTrue(boolean, String)
assertTrue(boolean)
Copy to Clipboard Toggle word wrap
Assert.fail
fail()
fail(String, Throwable)
fail(String)
Copy to Clipboard Toggle word wrap

9.1.2. Subject

Represents the current logged-in JBoss ON user. smsAddress toString userConfiguration
Expand
Method Signature
subject.addLdapRole
addLdapRole(Role)
Copy to Clipboard Toggle word wrap
subject.addRole
addRole(Role)
addRole(Role, boolean)
Copy to Clipboard Toggle word wrap
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)
Copy to Clipboard Toggle word wrap
subject.removeRole
removeRole(Role)
Copy to Clipboard Toggle word wrap
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()
Copy to Clipboard Toggle word wrap
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.
Expand
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)
Copy to Clipboard Toggle word wrap
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.
Expand
Method Signature
unlimitedPC.addDefaultOrderingField
addDefaultOrderingField(String, PageOrdering)
addDefaultOrderingField(String)
Copy to Clipboard Toggle word wrap
unlimitedPC.clone
clone()
Copy to Clipboard Toggle word wrap
unlimitedPC.firstRecord Returns the first record in the results page.
unlimitedPC.getExplicitPageControl
PageControl getExplicitPageControl(int, int)
Copy to Clipboard Toggle word wrap
unlimitedPC.getSingleRowInstance
PageControl getSingleRowInstance()
Copy to Clipboard Toggle word wrap
unlimitedPC.getUnlimitedInstance
PageControl getUnlimitedInstance()
Copy to Clipboard Toggle word wrap
unlimitedPC.initDefaultOrderingField
initDefaultOrderingField(String)
initDefaultOrderingField(String, PageOrdering)
Copy to Clipboard Toggle word wrap
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)
Copy to Clipboard Toggle word wrap
unlimitedPC.reset
reset()
Copy to Clipboard Toggle word wrap
unlimitedPC.setPrimarySort
setPrimarySort(String, PageOrdering)
Copy to Clipboard Toggle word wrap
unlimitedPC.setPrimarySortOrder
setPrimarySortOrder(PageOrdering)
Copy to Clipboard Toggle word wrap
unlimitedPC.sortBy
sortBy(String)
Copy to Clipboard Toggle word wrap
unlimitedPC.startRow Returns the current starting row number.
unlimitedPC.toString
String toString()
Copy to Clipboard Toggle word wrap
unlimitedPC.truncateOrderingFields
truncateOrderingFields(int)
Copy to Clipboard Toggle word wrap

9.1.5. exporter

Writes the CLI output to a specified file.
Expand
Method Signature
exporter.close
close()
Copy to Clipboard Toggle word wrap
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)
Copy to Clipboard Toggle word wrap
exporter.setFile
setFile(String)
Copy to Clipboard Toggle word wrap
exporter.setPageWidth
setPageWidth(int)
Copy to Clipboard Toggle word wrap
exporter.setTarget
setTarget(String, String)
Copy to Clipboard Toggle word wrap
exporter.write
write(Object)
Copy to Clipboard Toggle word wrap

9.1.6. ProxyFactory

Provides specialized methods to make it easier and simpler to manage resource objects.
Expand
Method Signature
ProxyFactory.getResource
ResourceClientProxy getResource(int)
Copy to Clipboard Toggle word wrap
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.
Expand
Method Signature
scriptUtil.findResources
PageList<Resource> findResources(String)
Copy to Clipboard Toggle word wrap
scriptUtil.getFileBytes
byte[] getFileBytes(String)
Copy to Clipboard Toggle word wrap
scriptUtil.isDefined
boolean isDefined(String)
Copy to Clipboard Toggle word wrap
scriptUtil.saveBytesToFile
saveBytesToFile(byte[], String)
Copy to Clipboard Toggle word wrap
scriptUtil.sleep
sleep(long)
Copy to Clipboard Toggle word wrap
scriptUtil.waitForScheduledOperationToComplete
ResourceOperationHistory waitForScheduledOperationToComplete(ResourceOperationSchedule, long, int)
ResourceOperationHistory waitForScheduledOperationToComplete(ResourceOperationSchedule)
Copy to Clipboard Toggle word wrap

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”.
Expand
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.
Table 4. Proxy Methods for Platforms
Shortcut Metric Methods
OSName OSVersion architecture createdDate
description distributionName distributionVersion freeMemory
freeSwapSpace hostname idle totalMemory
systemLoad totalSwapSpace usedSwapSpace usedMemory
userLoad modifiedDate waitLoad version
Table 4. Proxy Methods for Platforms
Shortcut Resource Entry Methods
id (inventory ID number) resourceType name (inventory name)
Table 4. Proxy Methods for Platforms
Shortcut Operation Methods
manualAutodiscovery cleanYumMetadataCache viewProcessList
Table 4. Proxy Methods for Platforms
Shortcut Configuration Methods
editPluginConfiguration() pluginConfiguration
pluginConfigurationDefinition
Table 4. Proxy Methods for Platforms
Shortcut Content Methods
contentTypes
Table 4. Proxy Methods for Platforms
Shortcut Inventory Methods
children
Table 4. Proxy Methods for Platforms
Method Signature
platform.getChild
ResourceClientProxy getChild(String)
Copy to Clipboard Toggle word wrap
platform.getMeasurement
Measurement getMeasurement(String)
Copy to Clipboard Toggle word wrap
platform.updatePluginConfiguration
PluginConfigurationUpdate updatePluginConfiguration(Configuration)
Copy to Clipboard Toggle word wrap
platform.toString
String toString()
Copy to Clipboard Toggle word wrap
Expand
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.
Table 5. Proxy Methods for JBoss AS/EAP Servers
Shortcut Metric Methods
JVMFreeMemory JVMMaxMemory JVMTotalMemory activeThreadCount
activeThreadGroupCount buildDate createdDate description
modifiedDate startDate totalTransactions totalTransactionsperMinute
transactionsCommitted transactionsCommittedperMinute transactionsRolledback transactionsRolledbackperMinute
partitionName versionName version
Table 5. Proxy Methods for JBoss AS/EAP Servers
Shortcut Resource Entry Methods
id (inventory ID number) resourceType name (inventory name)
Table 5. Proxy Methods for JBoss AS/EAP Servers
Shortcut Operation Methods
restart shutdown start
Table 5. Proxy Methods for JBoss AS/EAP Servers
Shortcut Configuration Methods
editPluginConfiguration() pluginConfiguration
pluginConfigurationDefinition
Table 5. Proxy Methods for JBoss AS/EAP Servers
Shortcut Content Methods
contentTypes
Table 5. Proxy Methods for JBoss AS/EAP Servers
Shortcut Inventory Methods
children
Table 5. Proxy Methods for JBoss AS/EAP Servers
Method Signature
jbossas.getChild
ResourceClientProxy getChild(String)
Copy to Clipboard Toggle word wrap
jbossas.getMeasurement
Measurement getMeasurement(String)
Copy to Clipboard Toggle word wrap
jbossas.updatePluginConfiguration
PluginConfigurationUpdate updatePluginConfiguration(Configuration)
Copy to Clipboard Toggle word wrap
jbossas.toString
String toString()
Copy to Clipboard Toggle word wrap
Expand
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.
Table 6. Proxy Methods for Content Sources (EARs, WARs, JARs)
Shortcut Metric Methods
createdDate modifiedDate description
path version exploded
Table 6. Proxy Methods for Content Sources (EARs, WARs, JARs)
Shortcut Resource Entry Methods
id (inventory ID number) resourceType name (inventory name)
Table 6. Proxy Methods for Content Sources (EARs, WARs, JARs)
Shortcut Operation Methods
revert
Table 6. Proxy Methods for Content Sources (EARs, WARs, JARs)
Shortcut Configuration Methods
editPluginConfiguration() pluginConfiguration
pluginConfigurationDefinition
Table 6. Proxy Methods for Content Sources (EARs, WARs, JARs)
Shortcut Content Methods
contentTypes backingContent
Table 6. Proxy Methods for Content Sources (EARs, WARs, JARs)
Shortcut Inventory Methods
children
Table 6. Proxy Methods for Content Sources (EARs, WARs, JARs)
Method Signature
content.getChild
ResourceClientProxy getChild(String)
Copy to Clipboard Toggle word wrap
content.getMeasurement
Measurement getMeasurement(String)
Copy to Clipboard Toggle word wrap
content.updatePluginConfiguration
PluginConfigurationUpdate updatePluginConfiguration(Configuration)
Copy to Clipboard Toggle word wrap
content.toString
String toString()
Copy to Clipboard Toggle word wrap
content.retrieveBackingContent
retrieveBackingContent(String fileName)
Copy to Clipboard Toggle word wrap
content.updateBackingContent
updateBackingContent(String filename, String displayVersion)
Copy to Clipboard Toggle word wrap
返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat