code: public ReturnValue invoke(final CommandDefinition cd, final String[] argsAry) {
          String pluginName = cd.getPluginName();
          try {
  
              String[] commandLine = cd.getCommandLine();
  
              if (acceptParams) {
                  for (int j = 0; j < commandLine.length; j++) {
                      for (int i = 0; i < argsAry.length; i++) {
                          commandLine[j] = commandLine[j].replaceAll("\\$[Aa][Rr][Gg]" + (i + 1) + "\\$", Matcher.quoteReplacement(argsAry[i]));
                      }
                  }
              }
  
              PluginProxy plugin = (PluginProxy) pluginRepository.getPlugin(pluginName);
  
              if (plugin == null) {
                  LOG.info(context, "Unable to instantiate plugin named " + pluginName);
                  //context.getEventBus().post(new LogEvent(this, LogEventType.INFO, "Unable to instantiate plugin named " + pluginName));
                  //EventsUtil.sendEvent(listenersList, this, LogEvent.INFO, "Unable to instantiate plugin named " + pluginName);
                  return new ReturnValue(Status.UNKNOWN, "Error instantiating plugin '" + pluginName + "' : bad plugin name?");
              }
  
              //plugin.addListeners(listenersList);
              InjectionUtils.inject(plugin, context);
              //plugin.setContext(context);
  
              return plugin.execute(commandLine);
          } catch (Throwable thr) {
              LOG.error(context, "Plugin [" + pluginName + "] execution error", thr);
              //context.getEventBus().post(new LogEvent(this, LogEventType.ERROR, "Plugin [" + pluginName + "] execution error", thr));
              return new ReturnValue(Status.UNKNOWN, "Plugin [" + pluginName + "] execution error: " + thr.getMessage());
          }
      }
docs: This method executes external commands (plugins) The methods also expands
  the $ARG?$ macros.
  
  @param cd
  The command definition
  @param argsAry
  The arguments to pass to the command as configured in the
  server configuration XML (with the $ARG?$ macros)
  
  @return The result of the command