}
};
content.addRequiredPreceding(name);
content.addCantAppearAfter(l);
serverGroups = new ArgumentWithValue(this, new CommaSeparatedCompleter() {
@Override
protected Collection<String> getAllCandidates(CommandContext ctx) {
return Util.getServerGroups(ctx.getModelControllerClient());
}} , "--server-groups") {
@Override
public boolean canAppearNext(CommandContext ctx) throws CommandFormatException {
if(!ctx.isDomainMode()) {
return false;
}
final String actionStr = action.getValue(ctx.getParsedCommandLine());
if(actionStr == null) {
return false;
}
if(ADD.equals(actionStr) || LINK.equals(actionStr)
|| REMOVE.equals(actionStr) || LIST_LINKS.equals(actionStr)) {
return super.canAppearNext(ctx);
}
return false;
}
};
serverGroups.addRequiredPreceding(name);
allRelevantServerGroups = new ArgumentWithoutValue(this, "--all-relevant-server-groups") {
@Override
public boolean canAppearNext(CommandContext ctx) throws CommandFormatException {
if(!ctx.isDomainMode()) {
return false;
}
final String actionStr = action.getValue(ctx.getParsedCommandLine());
if(actionStr == null) {
return false;
}
if(REMOVE.equals(actionStr)) {
return super.canAppearNext(ctx);
}
return false;
}
};
allRelevantServerGroups.addRequiredPreceding(name);
allRelevantServerGroups.addCantAppearAfter(serverGroups);
serverGroups.addCantAppearAfter(allRelevantServerGroups);
allServerGroups = new ArgumentWithoutValue(this, "--all-server-groups") {
@Override
public boolean canAppearNext(CommandContext ctx) throws CommandFormatException {
if(!ctx.isDomainMode()) {
return false;
}
final String actionStr = action.getValue(ctx.getParsedCommandLine());
if(actionStr == null) {
return false;
}
if(ADD.equals(actionStr) || LINK.equals(actionStr)) {
return super.canAppearNext(ctx);
}
return false;
}
};
allServerGroups.addRequiredPreceding(name);
allServerGroups.addCantAppearAfter(serverGroups);
serverGroups.addCantAppearAfter(allServerGroups);
deployments = new ArgumentWithValue(this, new CommaSeparatedCompleter() {
@Override
protected Collection<String> getAllCandidates(CommandContext ctx) {
final String actionValue = action.getValue(ctx.getParsedCommandLine());
final ModelControllerClient client = ctx.getModelControllerClient();
if(REMOVE.equals(actionValue)) {