JBoss 7 CLI查询所有已部署的应用程序 [英] JBoss 7 CLI to query all the deployed applications

查看:120
本文介绍了JBoss 7 CLI查询所有已部署的应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用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

Best regards, 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 = *"将定向到所有部署. 并基本上请求当前服务器中所有部署的name属性.

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆