fp = FailurePolicy.Error;
} else {
fp = clAnnotation.ifFailure();
}
}
TargetType tgtTypeAnnotation = command.getClass().getAnnotation(TargetType.class);
//@ExecuteOn(RuntimeType.SINGLE_INSTANCE) cannot be combined with
//@TargetType since we do not want to replicate the command
if (runtimeTypes.contains(RuntimeType.SINGLE_INSTANCE)) {
if (tgtTypeAnnotation != null) {
report.setActionExitCode(ActionReport.ExitCode.FAILURE);
report.setMessage(adminStrings.getLocalString("commandrunner.executor.targettype.unallowed",
"Target type is not allowed on single instance command {0} ,"
, model.getCommandName()));
return;
}
//Do not replicate the command when there is
//@ExecuteOn(RuntimeType.SINGLE_INSTANCE)
doReplication = false;
}
String targetName = parameters.getOne("target");
if (targetName == null || model.getModelFor("target").getParam().obsolete()) {
if (command instanceof DeploymentTargetResolver) {
targetName = ((DeploymentTargetResolver) command).getTarget(parameters);
} else {
targetName = "server";
}
}
logger.fine(adminStrings.getLocalString("dynamicreconfiguration.diagnostics.target",
"@ExecuteOn parsing and default settings done; Current target is {0}", targetName));
if (serverEnv.isDas()) {
//Do not replicate this command if it has @ExecuteOn(RuntimeType.SINGLE_INSTANCE)
//and the user is authorized to execute on DAS
// TODO add authorization check
/*if (runtimeTypes.contains(RuntimeType.SINGLE_INSTANCE)) {
//If authorization fails
report.setActionExitCode(ActionReport.ExitCode.FAILURE);
report.setMessage(adminStrings.getLocalString("commandrunner.executor.das.unallowed",
"Not authorized to execute command {0} on DAS"
, model.getCommandName()));
progressHelper.complete(context);
return;
}*/
// Check if the command allows this target type; first read the annotation
//TODO : See is @TargetType can also be moved to the CommandModel
if (tgtTypeAnnotation != null) {
targetTypesAllowed.addAll(Arrays.asList(tgtTypeAnnotation.value()));
}
//If not @TargetType, default it
if (targetTypesAllowed.isEmpty()) {
targetTypesAllowed.add(CommandTarget.DAS);
targetTypesAllowed.add(CommandTarget.STANDALONE_INSTANCE);