use of fish.payara.audit.AdminAuditService in project Payara by payara.
the class ResourceUtil method runCommand.
/**
* Executes the specified __asadmin command.
* @param commandName
* @param parameters
* @param subject
* @param managedJob
* @return
*/
public static RestActionReporter runCommand(String commandName, ParameterMap parameters, Subject subject, boolean managedJob) {
AsadminRecorderService asadminRecorderService = Globals.get(AsadminRecorderService.class);
if (asadminRecorderService != null && asadminRecorderService.isEnabled()) {
asadminRecorderService.recordAsadminCommand(commandName, parameters);
}
AdminAuditService auditService = Globals.getDefaultHabitat().getService(AdminAuditService.class);
if (auditService != null && auditService.isEnabled()) {
auditService.recordAsadminCommand(commandName, parameters, subject);
}
CommandRunner cr = Globals.getDefaultHabitat().getService(CommandRunner.class);
RestActionReporter ar = new RestActionReporter();
final CommandInvocation commandInvocation = cr.getCommandInvocation(commandName, ar, subject);
if (managedJob) {
commandInvocation.managedJob();
}
commandInvocation.parameters(parameters).execute();
addCommandLog(ar, commandName, parameters);
return ar;
}
Aggregations