[wildfly-dev] Improve query() operation for complex attributes?
Lin Gao
lgao at redhat.com
Tue Nov 22 20:39:21 EST 2016
----- Original Message -----
> From: "James Perkins" <jperkins at redhat.com>
> To: "Lin Gao" <lgao at redhat.com>
> Cc: wildfly-dev at lists.jboss.org
> Sent: Wednesday, November 23, 2016 6:11:21 AM
> Subject: Re: [wildfly-dev] Improve query() operation for complex attributes?
>
> The second case worked for me without an issue.
> [standalone at localhost:9990 /]
> /deployment=batch-chunk.war/subsystem=jaxrs/rest-resource=*:query(select=["rest-resource-paths"])
> {
> "outcome" => "success",
> "result" => [{
> "address" => [
> ("deployment" => "batch-chunk.war"),
> ("subsystem" => "jaxrs"),
> ("rest-resource" =>
> "org.jboss.example.batch.rest.BatchResource")
> ],
> "outcome" => "success",
> "result" => {"rest-resource-paths" => [
> {
> "resource-path" => "batch/jobs",
> "consumes" => undefined,
> "produces" => ["application/json"],
> "java-method" => "javax.ws.rs.core.Response
> org.jboss.example.batch.rest.BatchResource.listBatchJobs()",
> "resource-methods" => ["GET /batch-chunk/rest/batch/jobs"]
> },
> {
> "resource-path" => "batch/jobs/{status}",
> "consumes" => undefined,
> "produces" => ["application/json"],
> "java-method" => "javax.ws.rs.core.Response
> org.jboss.example.batch.rest.BatchResource.listBatchJobs(@PathParam
> java.lang.String status)",
> "resource-methods" => ["GET
> /batch-chunk/rest/batch/jobs/{status}"]
> }
> ]}
> }]
> }
You just listed all 'rest-resource-paths' without any filtering, if you have over 100 REST endpoints in 'batch-chunk.war', it will be difficult to find the one which provides "resource-path" => "batch/jobs".
Let's assume the following command can do the task:
[standalone at localhost:9990 /] /deployment=batch-chunk.war/subsystem=jaxrs/rest-resource=*:query(select=["rest-resource-paths"], where={"rest-resource-paths.resource-path"=>"batch/jobs"})
here the 'rest-resource-paths.resource-path' is the attribute name in enhanced syntax.
> The read-resource operation really does the same thing though in this case.
Yes, it does, but I think the most important feature provided by 'query()' operation is that it can filter resources by conditions specified by 'where' parameter.
It works only on simple attributes, like:
[standalone at localhost:9990 /] /subsystem=datasources/jdbc-driver=*:query(select=[driver-xa-datasource-class-name], where={driver-name=h2})
{
"outcome" => "success",
"result" => [{
"address" => [
("subsystem" => "datasources"),
("jdbc-driver" => "h2")
],
"outcome" => "success",
"result" => {"driver-xa-datasource-class-name" => "org.h2.jdbcx.JdbcDataSource"}
}]
}
It would be good if the 'query()' operation can filter the resources by specifying value of attributes which are inside the complex attribute, so that the following commands can work:
[standalone at localhost:9990 /] /core-service=capability-registry:query(select=[possible-capabilities],where={possible-capabilities.name=org.wildfly.data-source})
[standalone at localhost:9990 /] /deployment=batch-chunk.war/subsystem=jaxrs/rest-resource=*:query(select=["rest-resource-paths"], where={"rest-resource-paths.resource-path"=>"batch/jobs"})
Best Regards
--
Lin Gao
Software Engineer
JBoss by Red Hat
> On Tue, Nov 22, 2016 at 12:51 AM, Lin Gao <lgao at redhat.com> wrote:
>
> > Hi,
> >
> > Each management resource has an operation named 'query()' to filter
> > resources according to the condition passed by 'selector' and 'where'
> > parameters, however it does not work for complex attributes.
> >
> > 2 example of complex attributes:
> >
> > - 'query()' operation cannot find which 'possible-capabilities'
> > provides the capability with name 'org.wildfly.data-source'
> > - It cannot find which 'rest-resource-paths' provides the REST
> > endpoint 'resource-path=/helloworld' in jaxrs subsystem of a war deployment
> > either.
> >
> > Especially for the second case in above examples, it will be helpful for
> > users when doing troubleshooting in case of large deployment.
> >
> > Actually, it does not limit to the complex attributes, it would be good
> > to be able to filter resources by condition specified by attribute value of
> > nested child resources(not only by the first level of child resource).
> >
> > WDYT?
> >
> > Best Regards
> >
> > --
> > Lin Gao
> > Software Engineer
> > JBoss by Red Hat
> > _______________________________________________
> > wildfly-dev mailing list
> > wildfly-dev at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/wildfly-dev
> >
>
>
>
> --
> James R. Perkins
> JBoss by Red Hat
>
More information about the wildfly-dev
mailing list