JBoss 7 CLI 查询所有已部署的应用程序 [英] JBoss 7 CLI to query all the deployed applications
问题描述
使用 JBoss 7 的 jboss-cli 我可以查询已部署的应用程序:
Using JBoss 7's jboss-cli I can query the deployed applications:
[standalone@localhost:9999 /] deployment-info --headers=
NAME RUNTIME-NAME PERSISTENT ENABLED STATUS
jboss-ejb-in-ear.ear jboss-ejb-in-ear.ear true true OK
singleton_in_war.war singleton_in_war.war true true OK
以编程方式我可以查询任何以/开头的 CLI 查询,例如:
Programatically I can query any CLI query starting with /, for example this:
/path=jboss.server.log.dir:read-attribute(name=path)
地址在哪里
/path=jboss.server.log.dir
操作是
read-attribute(name=path)
我的问题是,对于 CLI 查询
My question is, for the CLI query
deployment-info --headers=
地址是什么,操作是什么?
what is the address and what is the operation?
最好的问候,SK
推荐答案
我发现这个解决方案对于使用 CLI api 在独立模式下查询已部署的应用程序很有用.
I've found this solution useful for querying the deployed applications in standalone mode by using CLI api.
CLI 查询是:
/deployment=*:read-attribute(name=name)
地址/deployment=*"将针对所有部署.并且基本上请求当前服务器中所有部署的名称属性.
where the address "/deployment=*" will target all the deployments. And basically requests the name attribute for all deployments in current server.
最后这个片段显示了使用模型控制器 api 执行查询的代码:
Finally this snippet shows the code for executing the query by using the model controller api:
ModelControllerClient client = "...create the controller client";
ModelNode operation = new ModelNode( );
operation.get( "address" ).add( "deployment", "*" );
operation.get( "operation" ).set( "read-attribute" );
operation.get( "name" ).set( "name" );
ModelNode result = client.execute( operation );
List<ModelNode> deployments = result.get( "result" ).asList();
String deploymentName;
// finally we can iterate and get the deployment names.
for ( ModelNode deployment : deployments ) {
deploymentName = deployment.get( "result" ).asString();
System.out.println( "deploymentName = " + deploymentName );
}
适用于 WF10 和 EAP7
Works for both WF10 and EAP7
这篇关于JBoss 7 CLI 查询所有已部署的应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!