[jboss-as7-dev] Deployment API List Deployments

Brian Stansberry brian.stansberry at redhat.com
Thu Jun 2 23:37:04 EDT 2011


On 6/2/11 6:36 PM, James Perkins wrote:
> I'm working on the deployment maven plugin. I want the redeploy goal to
> either deploy if the deployment does not exist or redeploy if it does
> exist. I'm having trouble determining if the deployment already exists.
>
> This bit of CLI :read-children-names(child-type=deployment) shows me
> what deployments exist. I've tried to duplicate it via a ModelNode.
>    ModelNode op = new ModelNode();
>    op.get("operation", READ_CHILDREN_NAMES_OPERATION).set(CHILD_TYPE,
> DEPLOYMENT);

op.get("operation").set(READ_CHILDREN_NAMES_OPERATION);
op.get(CHILD_TYPE).set(DEPLOYMENT);

>    final InetAddress host = InetAddress.getByName(hostname);
>    final ModelControllerClient client =
> ModelControllerClient.Factory.create(host, port);
>    ModelNode result = client.execute(op);
>
> which results in
> {
>       "outcome" =>  "failed",
>       "failure-description" =>  "No handler for {\"read-children-names\"
> =>  (\"child-type\" =>  \"deployment\")} at address []"
> }
>
> I tried assigning an address, but I don't know I did it right. Any
> pointers would be appreciated.
>

FYI, your op doesn't require an address, but if it did, e.g. if in the 
CLI it was:

/a=b/c=d:read-children-names(child-type=deployment)

then you'd include this:

ModelNode address = op.get("address");
address.add("a", "b");
address.add("c", "d");

-- 
Brian Stansberry
Principal Software Engineer
JBoss by Red Hat


More information about the jboss-as7-dev mailing list