Package org.nasutekds.server.util.args

Examples of org.nasutekds.server.util.args.StringArgument


    // Initialize all the command-line argument types and register them with the
    // parser.
    try
    {
      configClass =
           new StringArgument(
                   "configclass", OPTION_SHORT_CONFIG_CLASS,
                   OPTION_LONG_CONFIG_CLASS, true, false,
                   true, INFO_CONFIGCLASS_PLACEHOLDER.get(),
                   ConfigFileHandler.class.getName(), null,
                   INFO_DESCRIPTION_CONFIG_CLASS.get());
      configClass.setHidden(true);
      argParser.addArgument(configClass);


      configFile =
           new StringArgument(
                   "configfile", 'f', "configFile", true, false,
                   true, INFO_CONFIGFILE_PLACEHOLDER.get(), null, null,
                   INFO_DESCRIPTION_CONFIG_FILE.get());
      configFile.setHidden(true);
      argParser.addArgument(configFile);


      backendID =
           new StringArgument(
                   "backendid", 'n', "backendID", false, true, true,
                   INFO_BACKENDNAME_PLACEHOLDER.get(), null, null,
                   INFO_BACKUPDB_DESCRIPTION_BACKEND_ID.get());
      argParser.addArgument(backendID);


      backUpAll = new BooleanArgument(
                  "backupall", 'a', "backUpAll",
                  INFO_BACKUPDB_DESCRIPTION_BACKUP_ALL.get());
      argParser.addArgument(backUpAll);


      backupIDString =
           new StringArgument(
                   "backupid", 'I', "backupID", false, false, true,
                   INFO_BACKUPID_PLACEHOLDER.get(), null, null,
                   INFO_BACKUPDB_DESCRIPTION_BACKUP_ID.get());
      argParser.addArgument(backupIDString);


      backupDirectory =
           new StringArgument(
                   "backupdirectory", 'd', "backupDirectory", true,
                   false, true, INFO_BACKUPDIR_PLACEHOLDER.get(), null, null,
                   INFO_BACKUPDB_DESCRIPTION_BACKUP_DIR.get());
      argParser.addArgument(backupDirectory);


      incremental = new BooleanArgument(
                  "incremental", 'i', "incremental",
                  INFO_BACKUPDB_DESCRIPTION_INCREMENTAL.get());
      argParser.addArgument(incremental);


      incrementalBaseID =
           new StringArgument(
                   "incrementalbaseid", 'B', "incrementalBaseID",
                   false, false, true, INFO_BACKUPID_PLACEHOLDER.get(), null,
                   null,
                   INFO_BACKUPDB_DESCRIPTION_INCREMENTAL_BASE_ID.get());
      argParser.addArgument(incrementalBaseID);
View Full Code Here


                        String argName =
                          CLIProfile.getInstance().getNamingArgument(
                              path.getRelationDefinition());
                        try
                        {
                          StringArgument arg = new StringArgument(argName, null,
                              argName, false, true,
                              INFO_NAME_PLACEHOLDER.get(),
                              INFO_DSCFG_DESCRIPTION_NAME.get(
                                  d.getUserFriendlyName()));
                          arg.addValue(name);
                          builder.addArgument(arg);
                        }
                        catch (Throwable t)
                        {
                          // Bug
                          throw new RuntimeException("Unexpected error: "+t, t);
                        }
                      }

                      try
                      {
                        StringArgument arg = new StringArgument(
                            OPTION_DSCFG_LONG_SET, OPTION_DSCFG_SHORT_SET,
                            OPTION_DSCFG_LONG_SET, false, true, true,
                            INFO_VALUE_SET_PLACEHOLDER.get(), null, null,
                            INFO_DSCFG_DESCRIPTION_PROP_VAL.get());
                        PropertyDefinition<?> propertyDefinition =
                          cvc.getPropertyDefinition();
                        arg.addValue(propertyDefinition.getName()+':'+
                            castAndGetArgumentValue(propertyDefinition,
                                cvc.getValue()));
                        builder.addArgument(arg);
                      }
                      catch (Throwable t)
View Full Code Here

    // Create the naming arguments.
    this.namingArgs = createNamingArgs(subCommand, path, false);

    // Create the --set argument.
    this.propertySetArgument = new StringArgument(OPTION_DSCFG_LONG_SET,
        OPTION_DSCFG_SHORT_SET, OPTION_DSCFG_LONG_SET, false, true, true,
        INFO_VALUE_SET_PLACEHOLDER.get(), null, null,
        INFO_DSCFG_DESCRIPTION_PROP_VAL.get());
    this.subCommand.addArgument(this.propertySetArgument);

    // Create the --reset argument.
    this.propertyResetArgument = new StringArgument(OPTION_DSCFG_LONG_RESET,
        OPTION_DSCFG_SHORT_RESET, OPTION_DSCFG_LONG_RESET, false, true, true,
        INFO_PROPERTY_PLACEHOLDER.get(), null, null,
        INFO_DSCFG_DESCRIPTION_RESET_PROP.get());
    this.subCommand.addArgument(this.propertyResetArgument);

    // Create the --add argument.
    this.propertyAddArgument = new StringArgument(OPTION_DSCFG_LONG_ADD,
        OPTION_DSCFG_SHORT_ADD, OPTION_DSCFG_LONG_ADD, false, true, true,
        INFO_VALUE_SET_PLACEHOLDER.get(), null, null,
        INFO_DSCFG_DESCRIPTION_ADD_PROP_VAL.get());
    this.subCommand.addArgument(this.propertyAddArgument);

    // Create the --remove argument.
    this.propertyRemoveArgument = new StringArgument(OPTION_DSCFG_LONG_REMOVE,
        OPTION_DSCFG_SHORT_REMOVE, OPTION_DSCFG_LONG_REMOVE, false, true, true,
        INFO_VALUE_SET_PLACEHOLDER.get(), null, null,
        INFO_DSCFG_DESCRIPTION_REMOVE_PROP_VAL.get());
    this.subCommand.addArgument(this.propertyRemoveArgument);
View Full Code Here

   * @throws ArgumentException if there is a problem creating the argument.
   */
  private static <T> Argument createArgument(PropertyEditorModification<T> mod)
  throws ArgumentException
  {
    StringArgument arg;

    PropertyDefinition<T> propertyDefinition = mod.getPropertyDefinition();
    String propName = propertyDefinition.getName();

    switch (mod.getType())
    {
    case RESET:
      arg = new StringArgument(OPTION_DSCFG_LONG_RESET,
          OPTION_DSCFG_SHORT_RESET, OPTION_DSCFG_LONG_RESET, false, true, true,
          INFO_PROPERTY_PLACEHOLDER.get(), null, null,
          INFO_DSCFG_DESCRIPTION_RESET_PROP.get());
      arg.addValue(propName);
      break;
    case REMOVE:
      arg = new StringArgument(OPTION_DSCFG_LONG_REMOVE,
          OPTION_DSCFG_SHORT_REMOVE, OPTION_DSCFG_LONG_REMOVE, false, true,
          true, INFO_VALUE_SET_PLACEHOLDER.get(), null, null,
          INFO_DSCFG_DESCRIPTION_REMOVE_PROP_VAL.get());
      for (T value : mod.getModificationValues())
      {
        arg.addValue(propName+':'+getArgumentValue(propertyDefinition, value));
      }
      break;
    case ADD:
      arg = new StringArgument(OPTION_DSCFG_LONG_ADD,
          OPTION_DSCFG_SHORT_ADD, OPTION_DSCFG_LONG_ADD, false, true, true,
          INFO_VALUE_SET_PLACEHOLDER.get(), null, null,
          INFO_DSCFG_DESCRIPTION_ADD_PROP_VAL.get());
      for (T value : mod.getModificationValues())
      {
        arg.addValue(propName+':'+getArgumentValue(propertyDefinition, value));
      }
      break;
    case SET:
      arg = new StringArgument(OPTION_DSCFG_LONG_SET,
          OPTION_DSCFG_SHORT_SET, OPTION_DSCFG_LONG_SET, false, true, true,
          INFO_VALUE_SET_PLACEHOLDER.get(), null, null,
          INFO_DSCFG_DESCRIPTION_PROP_VAL.get());
      for (T value : mod.getModificationValues())
      {
        arg.addValue(propName+':'+getArgumentValue(propertyDefinition, value));
      }
      break;
    default:
      // Bug
      throw new IllegalStateException("Unknown modification type: "+
View Full Code Here

    FileBasedArgument keyStorePasswordFile   = null;
    FileBasedArgument trustStorePasswordFile = null;
    IntegerArgument   connectTimeout         = null;
    IntegerArgument   port                   = null;
    IntegerArgument   version                = null;
    StringArgument    assertionFilter        = null;
    StringArgument    bindDN                 = null;
    StringArgument    bindPassword           = null;
    StringArgument    certNickname           = null;
    StringArgument    controlStr             = null;
    StringArgument    encodingStr            = null;
    StringArgument    filename               = null;
    StringArgument    hostName               = null;
    StringArgument    keyStorePath           = null;
    StringArgument    keyStorePassword       = null;
    StringArgument    postReadAttributes     = null;
    StringArgument    preReadAttributes      = null;
    StringArgument    proxyAuthzID           = null;
    StringArgument    saslOptions            = null;
    StringArgument    trustStorePath         = null;
    StringArgument    trustStorePassword     = null;
    StringArgument    propertiesFileArgument   = null;
    BooleanArgument   noPropertiesFileArgument = null;

    // Create the command-line argument parser for use with this program.
    Message toolDescription = INFO_LDAPMODIFY_TOOL_DESCRIPTION.get();
    ArgumentParser argParser = new ArgumentParser(CLASS_NAME, toolDescription,
                                                  false);
    try
    {
      propertiesFileArgument = new StringArgument("propertiesFilePath",
          null, OPTION_LONG_PROP_FILE_PATH,
          false, false, true, INFO_PROP_FILE_PATH_PLACEHOLDER.get(), null, null,
          INFO_DESCRIPTION_PROP_FILE_PATH.get());
      argParser.addArgument(propertiesFileArgument);
      argParser.setFilePropertiesArgument(propertiesFileArgument);

      noPropertiesFileArgument = new BooleanArgument(
          "noPropertiesFileArgument", null, OPTION_LONG_NO_PROP_FILE,
          INFO_DESCRIPTION_NO_PROP_FILE.get());
      argParser.addArgument(noPropertiesFileArgument);
      argParser.setNoPropertiesFileArgument(noPropertiesFileArgument);

      hostName = new StringArgument("host", OPTION_SHORT_HOST,
                                    OPTION_LONG_HOST, false, false, true,
                                    INFO_HOST_PLACEHOLDER.get(), "localhost",
                                    null,
                                    INFO_DESCRIPTION_HOST.get());
      hostName.setPropertyName(OPTION_LONG_HOST);
      argParser.addArgument(hostName);

      port = new IntegerArgument("port", OPTION_SHORT_PORT,
                                 OPTION_LONG_PORT, false, false, true,
                                 INFO_PORT_PLACEHOLDER.get(), 389, null,
                                 INFO_DESCRIPTION_PORT.get());
      port.setPropertyName(OPTION_LONG_PORT);
      argParser.addArgument(port);

      useSSL = new BooleanArgument("useSSL", OPTION_SHORT_USE_SSL,
                                   OPTION_LONG_USE_SSL,
                                   INFO_DESCRIPTION_USE_SSL.get());
      useSSL.setPropertyName(OPTION_LONG_USE_SSL);
      argParser.addArgument(useSSL);

      startTLS = new BooleanArgument("startTLS", OPTION_SHORT_START_TLS,
                                     OPTION_LONG_START_TLS,
                                     INFO_DESCRIPTION_START_TLS.get());
      startTLS.setPropertyName(OPTION_LONG_START_TLS);
      argParser.addArgument(startTLS);

      bindDN = new StringArgument("bindDN", OPTION_SHORT_BINDDN,
                                  OPTION_LONG_BINDDN, false, false, true,
                                  INFO_BINDDN_PLACEHOLDER.get(), null, null,
                                  INFO_DESCRIPTION_BINDDN.get());
      bindDN.setPropertyName(OPTION_LONG_BINDDN);
      argParser.addArgument(bindDN);

      bindPassword = new StringArgument("bindPassword", OPTION_SHORT_BINDPWD,
                                        OPTION_LONG_BINDPWD,
                                        false, false, true,
                                        INFO_BINDPWD_PLACEHOLDER.get(),
                                        null, null,
                                        INFO_DESCRIPTION_BINDPASSWORD.get());
      bindPassword.setPropertyName(OPTION_LONG_BINDPWD);
      argParser.addArgument(bindPassword);

      bindPasswordFile =
           new FileBasedArgument("bindPasswordFile",
                                 OPTION_SHORT_BINDPWD_FILE,
                                 OPTION_LONG_BINDPWD_FILE,
                                 false, false,
                                 INFO_BINDPWD_FILE_PLACEHOLDER.get(), null,
                                 null, INFO_DESCRIPTION_BINDPASSWORDFILE.get());
      bindPasswordFile.setPropertyName(OPTION_LONG_BINDPWD_FILE);
      argParser.addArgument(bindPasswordFile);

      defaultAdd = new BooleanArgument(
              "defaultAdd", 'a', "defaultAdd",
              INFO_MODIFY_DESCRIPTION_DEFAULT_ADD.get());
      argParser.addArgument(defaultAdd);

      filename = new StringArgument("filename", OPTION_SHORT_FILENAME,
                                    OPTION_LONG_FILENAME, false, false,
                                    true, INFO_FILE_PLACEHOLDER.get(), null,
                                    null,
                                    INFO_LDAPMODIFY_DESCRIPTION_FILENAME.get());
      filename.setPropertyName(OPTION_LONG_FILENAME);
      argParser.addArgument(filename);

      saslExternal = new BooleanArgument(
              "useSASLExternal", 'r',
              "useSASLExternal",
              INFO_DESCRIPTION_USE_SASL_EXTERNAL.get());
      saslExternal.setPropertyName("useSASLExternal");
      argParser.addArgument(saslExternal);

      saslOptions = new StringArgument("saslOption", OPTION_SHORT_SASLOPTION,
                                       OPTION_LONG_SASLOPTION, false,
                                       true, true,
                                       INFO_SASL_OPTION_PLACEHOLDER.get(), null,
                                       null,
                                       INFO_DESCRIPTION_SASL_PROPERTIES.get());
      saslOptions.setPropertyName(OPTION_LONG_SASLOPTION);
      argParser.addArgument(saslOptions);

      trustAll = new BooleanArgument("trustAll", 'X', "trustAll",
                                    INFO_DESCRIPTION_TRUSTALL.get());
      trustAll.setPropertyName("trustAll");
      argParser.addArgument(trustAll);

      keyStorePath = new StringArgument("keyStorePath",
                                        OPTION_SHORT_KEYSTOREPATH,
                                        OPTION_LONG_KEYSTOREPATH,
                                        false, false, true,
                                        INFO_KEYSTOREPATH_PLACEHOLDER.get(),
                                        null, null,
                                        INFO_DESCRIPTION_KEYSTOREPATH.get());
      keyStorePath.setPropertyName(OPTION_LONG_KEYSTOREPATH);
      argParser.addArgument(keyStorePath);

      keyStorePassword =
              new StringArgument("keyStorePassword",
                                 OPTION_SHORT_KEYSTORE_PWD,
                                 OPTION_LONG_KEYSTORE_PWD,
                                 false, false,
                                 true,
                                 INFO_KEYSTORE_PWD_PLACEHOLDER.get(),
                                 null, null,
                                 INFO_DESCRIPTION_KEYSTOREPASSWORD.get());
      keyStorePassword.setPropertyName(OPTION_LONG_KEYSTORE_PWD);
      argParser.addArgument(keyStorePassword);

      keyStorePasswordFile =
           new FileBasedArgument("keystorepasswordfile",
                                 OPTION_SHORT_KEYSTORE_PWD_FILE,
                                 OPTION_LONG_KEYSTORE_PWD_FILE,
                                 false, false,
                                 INFO_KEYSTORE_PWD_FILE_PLACEHOLDER.get(),
                                 null, null,
                                 INFO_DESCRIPTION_KEYSTOREPASSWORD_FILE.get());
      keyStorePasswordFile.setPropertyName(OPTION_LONG_KEYSTORE_PWD_FILE);
      argParser.addArgument(keyStorePasswordFile);

      certNickname = new StringArgument(
              "certnickname", 'N', "certNickname",
              false, false, true, INFO_NICKNAME_PLACEHOLDER.get(), null,
              null, INFO_DESCRIPTION_CERT_NICKNAME.get());
      certNickname.setPropertyName("certNickname");
      argParser.addArgument(certNickname);

      trustStorePath = new StringArgument(
              "trustStorePath",
              OPTION_SHORT_TRUSTSTOREPATH,
              OPTION_LONG_TRUSTSTOREPATH,
              false, false, true,
              INFO_TRUSTSTOREPATH_PLACEHOLDER.get(),
              null, null,
              INFO_DESCRIPTION_TRUSTSTOREPATH.get());
      trustStorePath.setPropertyName(OPTION_LONG_TRUSTSTOREPATH);
      argParser.addArgument(trustStorePath);

      trustStorePassword =
           new StringArgument("trustStorePassword", null,
                              OPTION_LONG_TRUSTSTORE_PWD ,
                              false, false, true,
                              INFO_TRUSTSTORE_PWD_PLACEHOLDER.get(), null,
                              null, INFO_DESCRIPTION_TRUSTSTOREPASSWORD.get());
      trustStorePassword.setPropertyName(OPTION_LONG_TRUSTSTORE_PWD);
      argParser.addArgument(trustStorePassword);

      trustStorePasswordFile =
           new FileBasedArgument(
                   "truststorepasswordfile",
                   OPTION_SHORT_TRUSTSTORE_PWD_FILE,
                   OPTION_LONG_TRUSTSTORE_PWD_FILE, false, false,
                   INFO_TRUSTSTORE_PWD_FILE_PLACEHOLDER.get(), null, null,
                   INFO_DESCRIPTION_TRUSTSTOREPASSWORD_FILE.get());
      trustStorePasswordFile.setPropertyName(OPTION_LONG_TRUSTSTORE_PWD_FILE);
      argParser.addArgument(trustStorePasswordFile);

      proxyAuthzID = new StringArgument("proxy_authzid",
                                        OPTION_SHORT_PROXYAUTHID,
                                        OPTION_LONG_PROXYAUTHID, false,
                                        false, true,
                                        INFO_PROXYAUTHID_PLACEHOLDER.get(),
                                        null, null,
                                        INFO_DESCRIPTION_PROXY_AUTHZID.get());
      proxyAuthzID.setPropertyName(OPTION_LONG_PROXYAUTHID);
      argParser.addArgument(proxyAuthzID);

      reportAuthzID = new BooleanArgument(
              "reportauthzid", 'E',
              "reportAuthzID",
              INFO_DESCRIPTION_REPORT_AUTHZID.get());
      reportAuthzID.setPropertyName("reportAuthzID");
      argParser.addArgument(reportAuthzID);

      assertionFilter = new StringArgument(
              "assertionfilter", null,
              OPTION_LONG_ASSERTION_FILE,
              false, false,
              true,
              INFO_ASSERTION_FILTER_PLACEHOLDER.get(),
              null, null,
              INFO_DESCRIPTION_ASSERTION_FILTER.get());
      assertionFilter.setPropertyName(OPTION_LONG_ASSERTION_FILE);
      argParser.addArgument(assertionFilter);

      preReadAttributes = new StringArgument(
              "prereadattrs", null,
              "preReadAttributes", false, false,
              true, INFO_ATTRIBUTE_LIST_PLACEHOLDER.get(), null, null,
              INFO_DESCRIPTION_PREREAD_ATTRS.get());
      preReadAttributes.setPropertyName("preReadAttributes");
      argParser.addArgument(preReadAttributes);

      postReadAttributes = new StringArgument(
              "postreadattrs", null,
              "postReadAttributes", false,
              false, true, INFO_ATTRIBUTE_LIST_PLACEHOLDER.get(), null,
              null,
              INFO_DESCRIPTION_POSTREAD_ATTRS.get());
      postReadAttributes.setPropertyName("postReadAttributes");
      argParser.addArgument(postReadAttributes);

      controlStr =
           new StringArgument("control", 'J', "control", false, true, true,
                    INFO_LDAP_CONTROL_PLACEHOLDER.get(),
                    null, null, INFO_DESCRIPTION_CONTROLS.get());
      controlStr.setPropertyName("control");
      argParser.addArgument(controlStr);

      version = new IntegerArgument("version", OPTION_SHORT_PROTOCOL_VERSION,
                              OPTION_LONG_PROTOCOL_VERSION,
                              false, false, true,
                              INFO_PROTOCOL_VERSION_PLACEHOLDER.get(), 3, null,
                              INFO_DESCRIPTION_VERSION.get());
      version.setPropertyName(OPTION_LONG_PROTOCOL_VERSION);
      argParser.addArgument(version);

      int defaultTimeout = ConnectionUtils.getDefaultLDAPTimeout();
      connectTimeout = new IntegerArgument(OPTION_LONG_CONNECT_TIMEOUT,
          null, OPTION_LONG_CONNECT_TIMEOUT,
          false, false, true, INFO_TIMEOUT_PLACEHOLDER.get(),
          defaultTimeout, null,
          true, 0, false, Integer.MAX_VALUE,
          INFO_DESCRIPTION_CONNECTION_TIMEOUT.get());
      connectTimeout.setPropertyName(OPTION_LONG_CONNECT_TIMEOUT);
      argParser.addArgument(connectTimeout);

      encodingStr = new StringArgument("encoding", 'i', "encoding",
                                      false, false,
                                      true, INFO_ENCODING_PLACEHOLDER.get(),
                                      null, null,
                                      INFO_DESCRIPTION_ENCODING.get());
      encodingStr.setPropertyName("encoding");
View Full Code Here

    createAdsSubCmd = new SubCommand(argParser, SubCommandNameEnum.CREATE_ADS
        .toString(), INFO_ADMIN_SUBCMD_CREATE_ADS_DESCRIPTION.get());
    createAdsSubCmd.setHidden(true);
    subCommands.add(createAdsSubCmd);

    createAdsBackendNameArg = new StringArgument("backendName",
        OPTION_SHORT_BACKENDNAME, OPTION_LONG_BACKENDNAME, false, true,
        INFO_BACKENDNAME_PLACEHOLDER.get(),
        INFO_ADMIN_ARG_BACKENDNAME_DESCRIPTION.get());
    createAdsSubCmd.addArgument(createAdsBackendNameArg);

    // delete-ads
    deleteAdsSubCmd = new SubCommand(argParser,SubCommandNameEnum.DELETE_ADS
        .toString(), INFO_ADMIN_SUBCMD_DELETE_ADS_DESCRIPTION.get());
    deleteAdsSubCmd.setHidden(true);
    subCommands.add(deleteAdsSubCmd);

    deleteAdsBackendNameArg = new StringArgument("backendName",
        OPTION_SHORT_BACKENDNAME, OPTION_LONG_BACKENDNAME, true, true,
        INFO_BACKENDNAME_PLACEHOLDER.get(),
        INFO_ADMIN_ARG_BACKENDNAME_DESCRIPTION.get());
    deleteAdsSubCmd.addArgument(deleteAdsBackendNameArg);
  }
View Full Code Here

    BooleanArgument   showUsage;
    BooleanArgument   sslBlindTrust;
    BooleanArgument   useSSL;
    BooleanArgument   useStartTLS;
    FileBasedArgument bindPWFile;
    StringArgument    certNickname           = null;
    FileBasedArgument currentPWFile;
    FileBasedArgument newPWFile;
    FileBasedArgument sslKeyStorePINFile;
    FileBasedArgument sslTrustStorePINFile;
    IntegerArgument   ldapPort;
    StringArgument    authzID;
    StringArgument    bindDN;
    StringArgument    bindPW;
    StringArgument    controlStr;
    StringArgument    currentPW;
    StringArgument    ldapHost;
    StringArgument    newPW;
    StringArgument    sslKeyStore;
    StringArgument    sslKeyStorePIN;
    StringArgument    sslTrustStore;
    StringArgument    sslTrustStorePIN;
    IntegerArgument   connectTimeout;
    StringArgument    propertiesFileArgument;
    BooleanArgument   noPropertiesFileArgument;


    // Initialize the argument parser.
    Message toolDescription = INFO_LDAPPWMOD_TOOL_DESCRIPTION.get();
    ArgumentParser argParser = new ArgumentParser(CLASS_NAME, toolDescription,
                                                  false);

    try
    {
      propertiesFileArgument = new StringArgument("propertiesFilePath",
          null, OPTION_LONG_PROP_FILE_PATH,
          false, false, true, INFO_PROP_FILE_PATH_PLACEHOLDER.get(), null, null,
          INFO_DESCRIPTION_PROP_FILE_PATH.get());
      argParser.addArgument(propertiesFileArgument);
      argParser.setFilePropertiesArgument(propertiesFileArgument);

      noPropertiesFileArgument = new BooleanArgument(
          "noPropertiesFileArgument", null, OPTION_LONG_NO_PROP_FILE,
          INFO_DESCRIPTION_NO_PROP_FILE.get());
      argParser.addArgument(noPropertiesFileArgument);
      argParser.setNoPropertiesFileArgument(noPropertiesFileArgument);

      ldapHost = new StringArgument("ldaphost", OPTION_SHORT_HOST,
                                    OPTION_LONG_HOST, false, false,
                                    true, INFO_HOST_PLACEHOLDER.get(),
                                    "127.0.0.1", null,
                                    INFO_LDAPPWMOD_DESCRIPTION_HOST.get());
      ldapHost.setPropertyName(OPTION_LONG_HOST);
      argParser.addArgument(ldapHost);


      ldapPort = new IntegerArgument(
              "ldapport", OPTION_SHORT_PORT,
              OPTION_LONG_PORT, false, false,
              true, INFO_PORT_PLACEHOLDER.get(), 389,
              null, true, 1, true,
              65535, INFO_LDAPPWMOD_DESCRIPTION_PORT.get());
      ldapPort.setPropertyName(OPTION_LONG_PORT);
      argParser.addArgument(ldapPort);


      useSSL = new BooleanArgument("usessl", OPTION_SHORT_USE_SSL,
                                   OPTION_LONG_USE_SSL,
                                   INFO_LDAPPWMOD_DESCRIPTION_USE_SSL.get());
      useSSL.setPropertyName(OPTION_LONG_USE_SSL);
      argParser.addArgument(useSSL);


      useStartTLS = new BooleanArgument("usestarttls", OPTION_SHORT_START_TLS,
                             OPTION_LONG_START_TLS,
                             INFO_LDAPPWMOD_DESCRIPTION_USE_STARTTLS.get());
      useStartTLS.setPropertyName(OPTION_LONG_START_TLS);
      argParser.addArgument(useStartTLS);


      bindDN = new StringArgument("binddn", OPTION_SHORT_BINDDN,
                                  OPTION_LONG_BINDDN, false, false, true,
                                  INFO_BINDDN_PLACEHOLDER.get(), null, null,
                                  INFO_LDAPPWMOD_DESCRIPTION_BIND_DN.get());
      bindDN.setPropertyName(OPTION_LONG_BINDDN);
      argParser.addArgument(bindDN);


      bindPW = new StringArgument("bindpw", OPTION_SHORT_BINDPWD,
                                  OPTION_LONG_BINDPWD, false, false,
                                  true, INFO_BINDPWD_PLACEHOLDER.get(), null,
                                  null,
                                  INFO_LDAPPWMOD_DESCRIPTION_BIND_PW.get());
      bindPW.setPropertyName(OPTION_LONG_BINDPWD);
      argParser.addArgument(bindPW);


      bindPWFile =
           new FileBasedArgument("bindpwfile", OPTION_SHORT_BINDPWD_FILE,
                                 OPTION_LONG_BINDPWD_FILE, false,
                                 false, INFO_BINDPWD_FILE_PLACEHOLDER.get(),
                                 null, null,
                                 INFO_LDAPPWMOD_DESCRIPTION_BIND_PW_FILE.get());
      bindPWFile.setPropertyName(OPTION_LONG_BINDPWD_FILE);
      argParser.addArgument(bindPWFile);


      authzID = new StringArgument("authzid", 'a', "authzID", false, false,
                                   true, INFO_PROXYAUTHID_PLACEHOLDER.get(),
                                   null, null,
                                   INFO_LDAPPWMOD_DESCRIPTION_AUTHZID.get());
      authzID.setPropertyName("authzID");
      argParser.addArgument(authzID);


      provideDNForAuthzID =
           new BooleanArgument("providednforauthzid", 'A',"provideDNForAuthzID",
                    INFO_LDAPPWMOD_DESCRIPTION_PROVIDE_DN_FOR_AUTHZID.get());
      provideDNForAuthzID.setPropertyName("provideDNForAuthzID");
      argParser.addArgument(provideDNForAuthzID);


      newPW = new StringArgument("newpw", 'n', "newPassword", false, false,
                                 true, INFO_NEW_PASSWORD_PLACEHOLDER.get(),
                                 null, null,
                                 INFO_LDAPPWMOD_DESCRIPTION_NEWPW.get());
      newPW.setPropertyName("newPassword");
      argParser.addArgument(newPW);


      newPWFile = new FileBasedArgument(
              "newpwfile", 'N', "newPasswordFile",
              false, false, INFO_FILE_PLACEHOLDER.get(), null, null,
              INFO_LDAPPWMOD_DESCRIPTION_NEWPWFILE.get());
      newPWFile.setPropertyName("newPasswordFile");
      argParser.addArgument(newPWFile);


      currentPW =
           new StringArgument("currentpw", 'c', "currentPassword", false, false,
                              true, INFO_CURRENT_PASSWORD_PLACEHOLDER.get(),
                              null,  null,
                              INFO_LDAPPWMOD_DESCRIPTION_CURRENTPW.get());
      currentPW.setPropertyName("currentPassword");
      argParser.addArgument(currentPW);


      currentPWFile =
           new FileBasedArgument(
                   "currentpwfile", 'C', "currentPasswordFile",
                   false, false, INFO_FILE_PLACEHOLDER.get(), null, null,
                   INFO_LDAPPWMOD_DESCRIPTION_CURRENTPWFILE.get());
      currentPWFile.setPropertyName("currentPasswordFile");
      argParser.addArgument(currentPWFile);


      sslBlindTrust =
           new BooleanArgument("blindtrust", 'X', "trustAll",
                               INFO_LDAPPWMOD_DESCRIPTION_BLIND_TRUST.get());
      sslBlindTrust.setPropertyName("trustAll");
      argParser.addArgument(sslBlindTrust);


      sslKeyStore =
           new StringArgument("keystorepath", OPTION_SHORT_KEYSTOREPATH,
                              OPTION_LONG_KEYSTOREPATH, false, false,
                              true, INFO_KEYSTOREPATH_PLACEHOLDER.get(), null,
                              null,
                              INFO_LDAPPWMOD_DESCRIPTION_KEYSTORE.get());
      sslKeyStore.setPropertyName(OPTION_LONG_KEYSTOREPATH);
      argParser.addArgument(sslKeyStore);


      sslKeyStorePIN =
           new StringArgument("keystorepassword",
                              OPTION_SHORT_KEYSTORE_PWD,
                              OPTION_LONG_KEYSTORE_PWD ,
                              false, false, true,
                              INFO_KEYSTORE_PWD_PLACEHOLDER.get(),
                              null, null,
                              INFO_LDAPPWMOD_DESCRIPTION_KEYSTORE_PIN.get());
      sslKeyStorePIN.setPropertyName(OPTION_LONG_KEYSTORE_PWD);
      argParser.addArgument(sslKeyStorePIN);


      sslKeyStorePINFile =
           new FileBasedArgument(
                   "keystorepasswordfile",
                   OPTION_SHORT_KEYSTORE_PWD_FILE,
                   OPTION_LONG_KEYSTORE_PWD_FILE,
                   false, false, INFO_KEYSTORE_PWD_FILE_PLACEHOLDER.get(),
                   null, null,
                   INFO_LDAPPWMOD_DESCRIPTION_KEYSTORE_PINFILE.get());
      sslKeyStorePINFile.setPropertyName(OPTION_LONG_KEYSTORE_PWD_FILE);
      argParser.addArgument(sslKeyStorePINFile);

      certNickname = new StringArgument("certnickname", null, "certNickname",
          false, false, true, INFO_NICKNAME_PLACEHOLDER.get(), null, null,
          INFO_DESCRIPTION_CERT_NICKNAME.get());
      certNickname.setPropertyName("certNickname");
      argParser.addArgument(certNickname);



      sslTrustStore =
           new StringArgument("truststorepath",
                              OPTION_SHORT_TRUSTSTOREPATH,
                              OPTION_LONG_TRUSTSTOREPATH, false,
                              false, true,
                              INFO_TRUSTSTOREPATH_PLACEHOLDER.get(), null, null,
                              INFO_LDAPPWMOD_DESCRIPTION_TRUSTSTORE.get());
      sslTrustStore.setPropertyName(OPTION_LONG_TRUSTSTOREPATH);
      argParser.addArgument(sslTrustStore);


      sslTrustStorePIN =
           new StringArgument("truststorepassword", null,
                              OPTION_LONG_TRUSTSTORE_PWD,
                              false, false, true,
                              INFO_TRUSTSTORE_PWD_PLACEHOLDER.get(), null, null,
                              INFO_LDAPPWMOD_DESCRIPTION_TRUSTSTORE_PIN.get());
      sslTrustStorePIN.setPropertyName(OPTION_LONG_TRUSTSTORE_PWD);
      argParser.addArgument(sslTrustStorePIN);


      sslTrustStorePINFile =
           new FileBasedArgument("truststorepasswordfile",
                    OPTION_SHORT_TRUSTSTORE_PWD_FILE,
                    OPTION_LONG_TRUSTSTORE_PWD_FILE, false, false,
                    INFO_TRUSTSTORE_PWD_FILE_PLACEHOLDER.get(), null,
                    null, INFO_LDAPPWMOD_DESCRIPTION_TRUSTSTORE_PINFILE.get());
      sslTrustStorePINFile.setPropertyName(OPTION_LONG_TRUSTSTORE_PWD_FILE);
      argParser.addArgument(sslTrustStorePINFile);


      controlStr =
           new StringArgument("control", 'J', "control", false, true, true,
                    INFO_LDAP_CONTROL_PLACEHOLDER.get(),
                    null, null, INFO_DESCRIPTION_CONTROLS.get());
      controlStr.setPropertyName("control");
      argParser.addArgument(controlStr);
View Full Code Here

    // Initialize all the command-line argument types and register them with the
    // parser.
    try
    {
      configClass =
           new StringArgument("configclass", 'C', "configClass", true, false,
                              true, INFO_CONFIGCLASS_PLACEHOLDER.get(),
                              ConfigFileHandler.class.getName(), null,
                              INFO_DESCRIPTION_CONFIG_CLASS.get());
      configClass.setHidden(true);
      argParser.addArgument(configClass);


      configFile =
           new StringArgument("configfile", 'f', "configFile", true, false,
                              true, INFO_CONFIGFILE_PLACEHOLDER.get(), null,
                              null,
                              INFO_DESCRIPTION_CONFIG_FILE.get());
      configFile.setHidden(true);
      argParser.addArgument(configFile);


      baseDNString =
           new StringArgument("basedn", 'b', "baseDN", true, false, true,
                              INFO_BASEDN_PLACEHOLDER.get(), null, null,
                              INFO_REBUILDINDEX_DESCRIPTION_BASE_DN.get());
      argParser.addArgument(baseDNString);


      indexList =
           new StringArgument("index", 'i', "index",
                              false, true, true,
                              INFO_INDEX_PLACEHOLDER.get(), null, null,
                              INFO_REBUILDINDEX_DESCRIPTION_INDEX_NAME.get());
      argParser.addArgument(indexList);


      rebuildAll =
           new BooleanArgument("rebuildAll", null, "rebuildAll",
                    INFO_REBUILDINDEX_DESCRIPTION_REBUILD_ALL.get());
      argParser.addArgument(rebuildAll);


      tmpDirectory =
           new StringArgument("tmpdirectory", null, "tmpdirectory", false,
                   false, true, INFO_REBUILDINDEX_TEMP_DIR_PLACEHOLDER.get(),
                   "import-tmp",
                    null, INFO_REBUILDINDEX_DESCRIPTION_TEMP_DIRECTORY.get());
      argParser.addArgument(tmpDirectory);
View Full Code Here

        InstantiableRelationDefinition<? super C, ? super S> r,
        AbstractManagedObjectDefinition<C, S> d, String name) {
      sz--;

      String argName = CLIProfile.getInstance().getNamingArgument(r);
      StringArgument arg;

      try {
        if (isCreate && sz == 0) {
          // The final path element in create-xxx sub-commands should
          // have a different usage.
          PropertyDefinition<?> pd = r.getNamingPropertyDefinition();

          if (pd != null) {
            // Use syntax and description from naming property.
            PropertyDefinitionUsageBuilder b =
              new PropertyDefinitionUsageBuilder(false);
            Message usage = Message.raw("{" + b.getUsage(pd) + "}");
            arg = new StringArgument(argName, null, argName, false, true,
                usage, INFO_DSCFG_DESCRIPTION_NAME_CREATE_EXT.get(d
                    .getUserFriendlyName(), pd.getName(), pd.getSynopsis()));
          } else {
            arg = new StringArgument(argName, null, argName, false, true,
                INFO_NAME_PLACEHOLDER.get(),
                INFO_DSCFG_DESCRIPTION_NAME_CREATE.get(
                    d.getUserFriendlyName()));
          }
        } else {
          // A normal naming argument.
          arg = new StringArgument(argName, null, argName, false, true,
              INFO_NAME_PLACEHOLDER.get(), INFO_DSCFG_DESCRIPTION_NAME.get(
                  d.getUserFriendlyName()));
        }
        subCommand.addArgument(arg);
        arguments.add(arg);
View Full Code Here

      if (isCreate && sz == 0) {
        return;
      }

      String argName = CLIProfile.getInstance().getNamingArgument(r);
      StringArgument arg;

      try {
        arg =
            new StringArgument(argName, null, argName, false, true,
                INFO_NAME_PLACEHOLDER.get(),
                INFO_DSCFG_DESCRIPTION_NAME.get(d.getUserFriendlyName()));
        subCommand.addArgument(arg);
        arguments.add(arg);
      } catch (ArgumentException e) {
View Full Code Here

TOP

Related Classes of org.nasutekds.server.util.args.StringArgument

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.