Skip to content

Commit

Permalink
WFLY-3703
Browse files Browse the repository at this point in the history
Proxies must be enabled for remote servers
Recursive depth is limited to 3
Use of recursive attributes is consitent for
pre-WFLY-3705 and post-WFLY-3705 behavior
  • Loading branch information
arcivanov committed Aug 17, 2014
1 parent 77ed3cf commit 0dab650
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
Expand Up @@ -26,10 +26,12 @@
import static org.jboss.as.controller.client.helpers.ClientConstants.OP;
import static org.jboss.as.controller.client.helpers.ClientConstants.OP_ADDR;
import static org.jboss.as.controller.client.helpers.ClientConstants.OUTCOME;
import static org.jboss.as.controller.client.helpers.ClientConstants.PROXIES;
import static org.jboss.as.controller.client.helpers.ClientConstants.READ_ATTRIBUTE_OPERATION;
import static org.jboss.as.controller.client.helpers.ClientConstants.READ_CHILDREN_NAMES_OPERATION;
import static org.jboss.as.controller.client.helpers.ClientConstants.READ_RESOURCE_OPERATION;
import static org.jboss.as.controller.client.helpers.ClientConstants.RECURSIVE;
import static org.jboss.as.controller.client.helpers.ClientConstants.RECURSIVE_DEPTH;
import static org.jboss.as.controller.client.helpers.ClientConstants.RESULT;
import static org.jboss.as.controller.client.helpers.ClientConstants.SERVER;
import static org.jboss.as.controller.client.helpers.ClientConstants.SERVER_CONFIG;
Expand Down Expand Up @@ -78,6 +80,8 @@ public class ManagementClient {
private static final String POSTFIX_WEB = ".war";
private static final String POSTFIX_EAR = ".ear";

private static final int ROOT_RECURSIVE_DEPTH = 3;

private final String mgmtAddress;
private final int mgmtPort;
private final ModelControllerClient client;
Expand Down Expand Up @@ -287,7 +291,7 @@ private URI extractProtocolURI(Server server, String protocol) {
}

private void readRootNode() throws Exception {
rootNode = readResource(new ModelNode());
rootNode = readResource(new ModelNode(), true, ROOT_RECURSIVE_DEPTH);
}

private String getSocketBindingGroup(String serverGroup) {
Expand Down Expand Up @@ -392,10 +396,22 @@ private ModelNode readResource(ModelNode address) throws Exception {
}

private ModelNode readResource(ModelNode address, boolean includeRuntime) throws Exception {
return readResource(address, includeRuntime, null);
}

private ModelNode readResource(ModelNode address, boolean includeRuntime, Integer recursiveDepth) throws Exception {
final ModelNode operation = new ModelNode();
operation.get(OP).set(READ_RESOURCE_OPERATION);
operation.get(RECURSIVE).set("true");
if(recursiveDepth == null) {
operation.get(RECURSIVE).set(true);
}
else {
// To make it compatible with WFLY-3705 and pre-WFLY-3705 behavior
// "recursive" is not set
operation.get(RECURSIVE_DEPTH).set(recursiveDepth);
}
operation.get(INCLUDE_RUNTIME).set(includeRuntime);
operation.get(PROXIES).set(true);
operation.get(OP_ADDR).set(address);

return executeForResult(operation);
Expand Down
Expand Up @@ -51,10 +51,12 @@ public class ClientConstants {
public static final String OP_ADDR = "address";
public static final String OUTCOME = "outcome";
public static final String PATH = "path";
public static final String PROXIES = "proxies";
public static final String READ_ATTRIBUTE_OPERATION = "read-attribute";
public static final String READ_CHILDREN_NAMES_OPERATION = "read-children-names";
public static final String READ_RESOURCE_OPERATION = "read-resource";
public static final String RECURSIVE = "recursive";
public static final String RECURSIVE_DEPTH = "recursive-depth";
public static final String REMOVE_OPERATION = "remove";
public static final String RESULT = "result";
public static final String ROLLBACK_ON_RUNTIME_FAILURE = "rollback-on-runtime-failure";
Expand Down

0 comments on commit 0dab650

Please sign in to comment.