コード例 #1
0
  /**
   * Services a Commandline Request.
   *
   * @param rc Request Context.
   * @throw CLIException if the request cannot serviced.
   */
  public void handleRequest(RequestContext rc) throws CLIException {
    super.handleRequest(rc);
    ldapLogin();

    String serviceName = getStringOptionValue(IArgument.SERVICE_NAME);
    String i18nKey = getStringOptionValue(ARGUMENT_I18N_KEY);

    ServiceSchemaManager ssm = getServiceSchemaManager();
    IOutput outputWriter = getOutputWriter();

    try {
      String[] params = {serviceName, i18nKey};
      writeLog(LogWriter.LOG_ACCESS, Level.INFO, "ATTEMPT_SET_SERVICE_SCHEMA_I18N_KEY", params);
      ssm.setI18NKey(i18nKey);
      writeLog(LogWriter.LOG_ACCESS, Level.INFO, "SUCCEED_SET_SERVICE_SCHEMA_I18N_KEY", params);
      outputWriter.printlnMessage(
          MessageFormat.format(
              getResourceString("service-schema-set-i18n-key-succeed"), (Object[]) params));
    } catch (SSOException e) {
      String[] args = {serviceName, i18nKey, e.getMessage()};
      debugError("SetServiceSchemaI18nKey.handleRequest", e);
      writeLog(LogWriter.LOG_ERROR, Level.INFO, "FAILED_SET_SERVICE_SCHEMA_I18N_KEY", args);
      throw new CLIException(e, ExitCodes.REQUEST_CANNOT_BE_PROCESSED);
    } catch (SMSException e) {
      String[] args = {serviceName, i18nKey, e.getMessage()};
      debugError("SetServiceSchemaI18nKey.handleRequest", e);
      writeLog(LogWriter.LOG_ERROR, Level.INFO, "FAILED_SET_SERVICE_SCHEMA_I18N_KEY", args);
      throw new CLIException(e, ExitCodes.REQUEST_CANNOT_BE_PROCESSED);
    }
  }
コード例 #2
0
  /**
   * Services a Commandline Request.
   *
   * @param rc Request Context.
   * @throw CLIException if the request cannot serviced.
   */
  public void handleRequest(RequestContext rc) throws CLIException {
    super.handleRequest(rc);
    ldapLogin();

    String serviceName = getStringOptionValue(IArgument.SERVICE_NAME);
    String subConfigName = getStringOptionValue(IArgument.SUB_CONFIGURATION_NAME);
    String realmName = getStringOptionValue(IArgument.REALM_NAME);

    if ((realmName == null) || (realmName.length() == 0)) {
      deleteSubConfigToRoot(serviceName, subConfigName);
    } else {
      deleteSubConfigFromRealm(realmName, serviceName, subConfigName);
    }
  }
コード例 #3
0
  /**
   * Services a Commandline Request.
   *
   * @param rc Request Context.
   * @throws CLIException if the request cannot serviced.
   */
  public void handleRequest(RequestContext rc) throws CLIException {
    super.handleRequest(rc);
    ldapLogin();

    String serviceName = getStringOptionValue(IArgument.SERVICE_NAME);
    String subConfigName = getStringOptionValue(IArgument.SUB_CONFIGURATION_NAME);
    String realmName = getStringOptionValue(IArgument.REALM_NAME);
    String subConfigId = getStringOptionValue(IArgument.SUB_CONFIGURATION_ID);
    String datafile = getStringOptionValue(IArgument.DATA_FILE);
    List attrValues = rc.getOption(IArgument.ATTRIBUTE_VALUES);

    if ((datafile == null) && (attrValues == null)) {
      throw new CLIException(
          getResourceString("missing-attributevalues"),
          ExitCodes.INCORRECT_OPTION,
          rc.getSubCommand().getName());
    }

    int priority = 0;
    String strPriority = getStringOptionValue(OPTION_PRIORITY);
    if ((strPriority != null) && (strPriority.length() > 0)) {
      try {
        priority = Integer.parseInt(strPriority);
      } catch (NumberFormatException ex) {
        throw new CLIException(
            getResourceString("add-sub-configuration-priority-no-integer"),
            ExitCodes.INVALID_OPTION_VALUE);
      }
    }

    Map<String, Set<String>> attributeValues =
        AttributeValues.parse(getCommandManager(), datafile, attrValues);

    attributeValues = processFileAttributes(attributeValues);

    if ((realmName == null) || (realmName.length() == 0)) {
      addSubConfigToRoot(serviceName, subConfigName, subConfigId, attributeValues, priority);
    } else {
      addSubConfigToRealm(
          realmName, serviceName, subConfigName, subConfigId, attributeValues, priority);
    }
  }