/**
   * Executes the command with the command parameters passed as Properties where the keys are the
   * paramter names and the values the parameter values
   *
   * @param context information
   */
  public void execute(AdminCommandContext context) {
    final ActionReport report = context.getActionReport();

    HashMap attrList = new HashMap();
    setAttributeList(attrList);

    ResourceStatus rs;

    try {
      rs = managedExecutorServiceMgr.create(domain.getResources(), attrList, properties, target);
    } catch (Exception e) {
      report.setMessage(
          localStrings.getLocalString(
              "create.managed.executor.service.failed",
              "Managed executor service {0} creation failed",
              jndiName));
      report.setActionExitCode(ActionReport.ExitCode.FAILURE);
      report.setFailureCause(e);
      return;
    }
    ActionReport.ExitCode ec = ActionReport.ExitCode.SUCCESS;
    if (rs.getMessage() != null) {
      report.setMessage(rs.getMessage());
    }
    if (rs.getStatus() == ResourceStatus.FAILURE) {
      ec = ActionReport.ExitCode.FAILURE;
      if (rs.getException() != null) report.setFailureCause(rs.getException());
    }
    report.setActionExitCode(ec);
  }
  private void handlePoolRecreationForExistingProxies(ConnectorConnectionPool connConnPool) {

    recreatePool(connConnPool);

    Collection<BindableResource> resourcesList;
    if (!connConnPool.isApplicationScopedResource()) {
      resourcesList =
          JdbcResourcesUtil.getResourcesOfPool(domain.getResources(), connConnPool.getName());
    } else {
      PoolInfo poolInfo = connConnPool.getPoolInfo();
      Resources resources = ResourcesUtil.createInstance().getResources(poolInfo);
      resourcesList = JdbcResourcesUtil.getResourcesOfPool(resources, connConnPool.getName());
    }
    for (BindableResource bindableResource : resourcesList) {

      ResourceInfo resourceInfo = ConnectorsUtil.getResourceInfo(bindableResource);
      ConnectorRegistry.getInstance().updateResourceInfoVersion(resourceInfo);
    }
  }
  /**
   * Executes the command with the command parameters passed as Properties where the keys are the
   * parameter names and the values the parameter values
   *
   * @param context information
   */
  public void execute(AdminCommandContext context) {

    final ActionReport report = context.getActionReport();

    try {
      Collection<ManagedExecutorService> managedExecutorServices =
          domain.getResources().getResources(ManagedExecutorService.class);
      List<Map<String, String>> resourcesList = new ArrayList<Map<String, String>>();
      List<DefaultResourceProxy> drps = habitat.getAllServices(DefaultResourceProxy.class);

      for (ManagedExecutorService managedExecutorService : managedExecutorServices) {
        String jndiName = managedExecutorService.getJndiName();
        if (bindableResourcesHelper.resourceExists(jndiName, target)) {
          ActionReport.MessagePart part = report.getTopMessagePart().addChild();
          part.setMessage(jndiName);
          Map<String, String> resourceNameMap = new HashMap<String, String>();
          String logicalName = DefaultResourceProxy.Util.getLogicalName(drps, jndiName);
          if (logicalName != null) {
            resourceNameMap.put("logical-jndi-name", logicalName);
          }
          resourceNameMap.put("name", jndiName);
          resourcesList.add(resourceNameMap);
        }
      }

      Properties extraProperties = new Properties();
      extraProperties.put("managedExecutorServices", resourcesList);
      report.setExtraProperties(extraProperties);
    } catch (Exception e) {
      report.setMessage(
          localStrings.getLocalString(
              "list.managed.executor.service.failed", "List managed executor services failed"));
      report.setActionExitCode(ActionReport.ExitCode.FAILURE);
      report.setFailureCause(e);
      return;
    }
    report.setActionExitCode(ActionReport.ExitCode.SUCCESS);
  }