<p>
getInstance.
</p>

@param commandPrefix a char.
@param allowEmbeddedCommandPrefix a boolean.
@param args a {@link java.io.File} object.
@return a {@link com.obdobion.argument.input.IParserInput} object.
@throws java.io.IOException if any.
191719
static public IParserInput getInstance(
            final char commandPrefix,
            final boolean allowEmbeddedCommandPrefix,
            final File args)
                    throws IOException
    {
        final CommandLineParser parser = new CommandLineParser();
        parser.commandPrefix = commandPrefix;
        parser.allowEmbeddedCommandPrefix = allowEmbeddedCommandPrefix;
        parser.commandLine = convertToString(args).toString();
        return parser;
    }
305494
private CharSequence documentCommand(String command) {
		MethodTarget methodTarget = commandRegistry.listCommands().get(command);
		if (methodTarget == null) {
			throw new IllegalArgumentException("Unknown command '" + command + "'");
		}

		AttributedStringBuilder result = new AttributedStringBuilder().append("\n\n");
		List<ParameterDescription> parameterDescriptions = getParameterDescriptions(methodTarget);

		// NAME
		documentCommandName(result, command, methodTarget.getHelp());

		// SYNOPSYS
		documentSynopsys(result, command, parameterDescriptions);

		// OPTIONS
		documentOptions(result, parameterDescriptions);

		// ALSO KNOWN AS
		documentAliases(result, command, methodTarget);

		// AVAILABILITY
		documentAvailability(result, methodTarget);

		result.append("\n");
		return result;
	}
459538
@SuppressWarnings("unchecked")
    public static <K, V> String getFirstString(CommandArgs<K, V> commandArgs) {

        for (SingularArgument singularArgument : commandArgs.singularArguments) {

            if (singularArgument instanceof StringArgument) {
                return ((StringArgument) singularArgument).val;
            }
        }

        return null;
    }
1126027
public static CommandProcessor getInstance() {
        if (null == instance) {
            synchronized (CommandProcessor.class) {
                if (null == instance) {
                    instance = new CommandProcessor();
                }
            }
        }
        return instance;
    }
1146230
public static void processCommandLine(TextUICommandLine commandLine, String[] argv, IFindBugsEngine findBugs)
            throws IOException, FilterException {
        // Expand option files in command line.
        // An argument beginning with "@" is treated as specifying
        // the name of an option file.
        // Each line of option files are treated as a single argument.
        // Blank lines and comment lines (beginning with "#")
        // are ignored.
        try {
            argv = commandLine.expandOptionFiles(argv, true, true);
        } catch (HelpRequestedException e) {
            showHelp(commandLine);
        }

        int argCount = 0;
        try {
            argCount = commandLine.parse(argv);
        } catch (IllegalArgumentException e) {
            LOG.severe(e.getMessage());
            showHelp(commandLine);
        } catch (HelpRequestedException e) {
            showHelp(commandLine);
        }

        Project project = commandLine.getProject();
        for (int i = argCount; i < argv.length; ++i) {
            project.addFile(argv[i]);
        }
        commandLine.handleXArgs();

        commandLine.configureEngine(findBugs);
        if (commandLine.getProject().getFileCount() == 0 &&
                !commandLine.justPrintConfiguration() && !commandLine.justPrintVersion()) {
            LOG.warning("No files to be analyzed");

            showHelp(commandLine);
        }
    }
61955
private String getArgumentDescription(
            final Map<String, NamedArgumentDefinition> allActualArguments,
            final Collection<CommandLinePluginDescriptor<?>> pluginDescriptors) {
        final StringBuilder sb = new StringBuilder();
        if (!getDocString().isEmpty()) {
            sb.append(getDocString());
            sb.append("  ");
        }
        if (isCollection()) {
            if (isOptional()) {
                sb.append("This argument may be specified 0 or more times. ");
            } else {
                sb.append("This argument must be specified at least once. ");
            }
        }
        if (isOptional()) {
            sb.append("Default value: ");
            sb.append(getDefaultValueAsString());
            sb.append(". ");
        } else {
            sb.append("Required. ");
        }

        // if this argument definition is a string field claimed by a plugin descriptor (i.e.,
        // it holds the names of plugins specified by the user on the command line, such as read filter names),
        // then we need to delegate to the plugin descriptor to generate the list of allowed values
        if (!usageForPluginDescriptorArgument(sb, pluginDescriptors)) {
            // If the argument wasn't claimed by any descriptor, treat it as a normal argument
            sb.append(getOptionsAsDisplayString());
        }

        if (!getMutexTargetList().isEmpty()) {
            sb.append(" Cannot be used in conjunction with argument(s)");
            for (final String argument : getMutexTargetList()) {
                final NamedArgumentDefinition mutexArgumentDefinition = allActualArguments.get(argument);
                sb.append(" ").append(mutexArgumentDefinition.getUnderlyingField().getName());
                if (!mutexArgumentDefinition.getShortName().isEmpty()) {
                    sb.append(" (").append(mutexArgumentDefinition.getShortName()).append(")");
                }
            }
        }
        return sb.toString();
    }
1256755
@Override
    protected FileInfo getFileInfoFromInputDataImpl(String[] inputData)
    {
        //get amount
        int amount=inputData.length;

        FileInfo fileInfo=null;
        if((amount%2)==0)
        {
            String argument=null;
            String value=null;
            for(int index=0;index<inputData.length;index=index+2)
            {
                //get next argument and value
                argument=inputData[index];
                value=inputData[index+1];

                if(argument.equals("-file"))    //only looks for file argument, the update fax job will validate the full command line arguments for correctness
                {
                    //get file
                    File file=new File(value);

                    //create file info
                    fileInfo=new FileInfo(file);

                    break;
                }
            }
        }
        else
        {
            throw new FaxException("Invalid input provided, expected even number of arguments.");
        }

        return fileInfo;
    }
1063153
public <T extends Commands> T getCommands(Class<T> commandInterface) {

        LettuceAssert.notNull(commandInterface, "Redis Command Interface must not be null");

        RedisCommandsMetadata metadata = new DefaultRedisCommandsMetadata(commandInterface);

        InvocationProxyFactory factory = new InvocationProxyFactory();
        factory.addInterface(commandInterface);

        BatchAwareCommandLookupStrategy lookupStrategy = new BatchAwareCommandLookupStrategy(
                new CompositeCommandLookupStrategy(), metadata);

        factory.addInterceptor(new DefaultMethodInvokingInterceptor());
        factory.addInterceptor(new CommandFactoryExecutorMethodInterceptor(metadata, lookupStrategy));

        return factory.createProxy(commandInterface.getClassLoader());
    }
23601
public static final SyslogIF getInstance(String protocol) throws SyslogRuntimeException {
        String _protocol = protocol.toLowerCase();

        if (instances.containsKey(_protocol)) {
            return (SyslogIF) instances.get(_protocol);

        } else {
            StringBuffer message = new StringBuffer("Syslog protocol \"" + protocol + "\" not defined; call Syslogger.createSyslogInstance(protocol,config) first");

            if (instances.size() > 0) {
                message.append(" or use one of the following instances: ");

                Iterator i = instances.keySet().iterator();
                while (i.hasNext()) {
                    String k = (String) i.next();

                    message.append(k);
                    if (i.hasNext()) {
                        message.append(' ');
                    }
                }
            }

            throwRuntimeException(message.toString());
            return null;
        }
    }
159593
private static Definition inputFromCommandLine() throws IOException
   {
      BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
      Definition def = new Definition();
      Set<String> classes = new HashSet<String>();

      //profile version
      String version;
      do
      {
         System.out.print(rb.getString("profile.version") + " " +
               rb.getString("profile.version.values") + " [1.7]: ");
         version = in.readLine();
         if (version == null || version.equals(""))
            version = "1.7";
      } while (!(version.equals("1.7") || version.equals("1.6") || version.equals("1.5") || version.equals("1.0")));

      def.setVersion(version);

      //by default, support outbound, but not inbound
      def.setSupportOutbound(true);
      def.setSupportInbound(false);

      //bound
      if (!version.equals("1.0"))
      {
         System.out.print(rb.getString("support.bound") + " " + rb.getString("support.bound.values") + " [O]: ");
         String bound = in.readLine();
         if (bound == null || bound.equals("") || bound.equals("O") || bound.equals("o") || bound.equals("Outbound"))
         {
            //keep default bound 
         }
         else if (bound.equals("I") || bound.equals("i") || bound.equals("Inbound"))
         {
            def.setSupportOutbound(false);
            def.setSupportInbound(true);
         }
         else if (bound.equals("B") || bound.equals("b") || bound.equals("Bidirectional"))
         {
            def.setSupportOutbound(true);
            def.setSupportInbound(true);
         }
      }

      //package name
      String packageName;
      do
      {
         System.out.print(rb.getString("package.name") + ": ");
         packageName = in.readLine();
         if (packageName.contains(".") && Pattern.matches(PACKAGE_NAME_PATTERN, packageName))
            break;
         System.out.println(rb.getString("package.name.validated"));
      } while (true);
      def.setRaPackage(packageName);

      //transaction
      if (def.isSupportOutbound())
      {
         System.out.print(rb.getString("support.transaction") + " " +
               rb.getString("support.transaction.values") + " [N]: ");
         String trans = in.readLine();
         if (trans == null || trans.equals(""))
            def.setSupportTransaction("NoTransaction");
         else if (trans.equals("L") || trans.equals("l") || trans.equals("LocalTransaction"))
         {
            def.setSupportTransaction("LocalTransaction");
         }
         else if (trans.equals("X") || trans.equals("x") || trans.equals("XATransaction"))
         {
            def.setSupportTransaction("XATransaction");
         }
         else
         {
            def.setSupportTransaction("NoTransaction");
         }
      }

      //reauthentication
      if (def.isSupportOutbound() && !version.equals("1.0"))
      {
         System.out.print(rb.getString("support.reauthentication") + " " + rb.getString("yesno") + " [N]: ");
         String reauth = in.readLine();
         if (reauth == null || reauth.equals(""))
            def.setSupportReauthen(false);
         else if (reauth.equals("Y") || reauth.equals("y") || reauth.equals("Yes"))
         {
            def.setSupportReauthen(true);
         }
         else
         {
            def.setSupportReauthen(false);
         }
      }

      //support annotation
      if (version.equals("1.7") || version.equals("1.6"))
      {
         System.out.print(rb.getString("use.annotation") + " " + rb.getString("yesno") + " [Y]: ");
         String useAnnotation = in.readLine();
         if (useAnnotation == null)
            def.setUseAnnotation(true);
         else
         {
            if (useAnnotation.equals("N") || useAnnotation.equals("n") || useAnnotation.equals("No"))
               def.setUseAnnotation(false);
            else
               def.setUseAnnotation(true);
         }
      }
      else
      {
         def.setUseAnnotation(false);
      }

      //use resource adapter
      if (def.isSupportOutbound() && !def.isSupportInbound() &&
            (version.equals("1.7") || version.equals("1.6") || version.equals("1.5")))
      {
         System.out.print(rb.getString("use.ra") + " " + rb.getString("yesno") + " [Y]: ");
         String useRa = in.readLine();
         if (useRa == null)
            def.setUseRa(true);
         else
         {
            if (useRa.equals("N") || useRa.equals("n") || useRa.equals("No"))
               def.setUseRa(false);
            else
               def.setUseRa(true);
         }
      }
      else if (version.equals("1.0"))
      {
         def.setUseRa(false);
      }
      else
      {
         def.setUseRa(true);
      }

      //input ra class name
      if (def.isUseRa() || def.isSupportInbound())
      {
         String raClassName;
         do
         {
            System.out.print(rb.getString("ra.class.name"));
            System.out.print(" [" + def.getRaClass() + "]: ");
            raClassName = in.readLine();
            if (raClassName != null && !raClassName.equals(""))
            {
               if (!Pattern.matches(CLASS_NAME_PATTERN, raClassName))
               {
                  System.out.println(rb.getString("class.name.validated"));
                  continue;
               }
               def.setRaClass(raClassName);
               classes.add(raClassName);
               setDefaultValue(def, raClassName, "ResourceAdapter");
               setDefaultValue(def, raClassName, "Ra");
            }
            break;
         } while (true);

         System.out.print(rb.getString("ra.serial") + " " + rb.getString("yesno") + " [Y]: ");
         String raSerial = in.readLine();
         if (raSerial == null)
            def.setRaSerial(true);
         else
         {
            if (raSerial.equals("N") || raSerial.equals("n") || raSerial.equals("No"))
               def.setRaSerial(false);
            else
               def.setRaSerial(true);
         }

         List<ConfigPropType> raProps = inputProperties("ra", in, false);
         def.setRaConfigProps(raProps);
      }

      //outbound
      if (def.isSupportOutbound())
      {
         List<McfDef> mcfDefs = new ArrayList<>();
         def.setMcfDefs(mcfDefs);
         int mcfID = 1;
         boolean moreMcf;
         do
         {
            McfDef mcfdef = new McfDef(mcfID, def);
            String mcfClassName = "";
            do
            {
               System.out.print(rb.getString("mcf.class.name"));
               System.out.print(" [" + mcfdef.getMcfClass() + "]: ");
               mcfClassName = in.readLine();
               if (!mcfClassName.equals("") && !Pattern.matches(CLASS_NAME_PATTERN, mcfClassName))
               {
                  System.out.println(rb.getString("class.name.validated"));
               }
            } while ((classes.contains(mcfClassName) || !Pattern.matches(CLASS_NAME_PATTERN, mcfClassName))
                  && !mcfClassName.equals(""));
            classes.add(mcfClassName);
            if (!mcfClassName.equals(""))
            {
               mcfdef.setMcfClass(mcfClassName);
               setDefaultValue(def, mcfClassName, "ManagedConnectionFactory");
               setDefaultValue(def, mcfClassName, "Mcf");
            }

            List<ConfigPropType> mcfProps = inputProperties("mcf", in, false);
            mcfdef.setMcfConfigProps(mcfProps);

            if (def.isUseRa())
            {
               System.out.print(rb.getString("mcf.impl.raa") + " " + rb.getString("yesno") + " [Y]: ");
               String raAssociation = in.readLine();
               if (raAssociation == null || raAssociation.equals(""))
                  mcfdef.setImplRaAssociation(true);
               else
               {
                  if (raAssociation.equals("Y") || raAssociation.equals("y") || raAssociation.equals("Yes"))
                     mcfdef.setImplRaAssociation(true);
                  else
                     mcfdef.setImplRaAssociation(false);
               }
            }

            String mcClassName = "";
            do
            {
               System.out.print(rb.getString("mc.class.name"));
               System.out.print(" [" + mcfdef.getMcClass() + "]: ");
               mcClassName = in.readLine();
               if (!mcClassName.equals("") && !Pattern.matches(CLASS_NAME_PATTERN, mcClassName))
               {
                  System.out.println(rb.getString("class.name.validated"));
               }
            } while ((classes.contains(mcClassName) || !Pattern.matches(CLASS_NAME_PATTERN, mcClassName))
                  && !mcClassName.equals(""));
            classes.add(mcClassName);

            if (mcClassName != null && !mcClassName.equals(""))
               mcfdef.setMcClass(mcClassName);

            System.out.print(rb.getString("mcf.use.cci") + " " + rb.getString("yesno") + " [N]: ");
            String useCciConnection = in.readLine();
            if (useCciConnection == null)
               mcfdef.setUseCciConnection(false);
            else
            {
               if (useCciConnection.equals("Y") || useCciConnection.equals("y") || useCciConnection.equals("Yes"))
                  mcfdef.setUseCciConnection(true);
               else
                  mcfdef.setUseCciConnection(false);
            }

            if (!mcfdef.isUseCciConnection())
            {
               String cfInterfaceName = "";
               do
               {
                  System.out.print(rb.getString("cf.interface.name"));
                  System.out.print(" [" + mcfdef.getCfInterfaceClass() + "]: ");
                  cfInterfaceName = in.readLine();
                  if (!cfInterfaceName.equals("") && !Pattern.matches(CLASS_NAME_PATTERN, cfInterfaceName))
                  {
                     System.out.println(rb.getString("class.name.validated"));
                  }
               } while ((classes.contains(cfInterfaceName) || !Pattern.matches(CLASS_NAME_PATTERN, cfInterfaceName))
                     && !cfInterfaceName.equals(""));
               classes.add(cfInterfaceName);
               if (cfInterfaceName != null && !cfInterfaceName.equals(""))
                  mcfdef.setCfInterfaceClass(cfInterfaceName);

               String cfClassName = "";
               do
               {
                  System.out.print(rb.getString("cf.class.name"));
                  System.out.print(" [" + mcfdef.getCfClass() + "]: ");
                  cfClassName = in.readLine();
                  if (!cfClassName.equals("") && !Pattern.matches(CLASS_NAME_PATTERN, cfClassName))
                  {
                     System.out.println(rb.getString("class.name.validated"));
                  }
               } while ((classes.contains(cfClassName) || !Pattern.matches(CLASS_NAME_PATTERN, cfClassName))
                     && !cfClassName.equals(""));
               classes.add(cfClassName);
               if (cfClassName != null && !cfClassName.equals(""))
                  mcfdef.setCfClass(cfClassName);

               String connInterfaceName = "";
               do
               {
                  System.out.print(rb.getString("conn.interface.name"));
                  System.out.print(" [" + mcfdef.getConnInterfaceClass() + "]: ");
                  connInterfaceName = in.readLine();
                  if (!connInterfaceName.equals("") && !Pattern.matches(CLASS_NAME_PATTERN, connInterfaceName))
                  {
                     System.out.println(rb.getString("class.name.validated"));
                  }
               } while ((classes.contains(connInterfaceName) || !Pattern.matches(CLASS_NAME_PATTERN, connInterfaceName))
                     && !connInterfaceName.equals(""));
               classes.add(connInterfaceName);
               if (connInterfaceName != null && !connInterfaceName.equals(""))
                  mcfdef.setConnInterfaceClass(connInterfaceName);

               String connImplName = "";
               do
               {
                  System.out.print(rb.getString("conn.class.name"));
                  System.out.print(" [" + mcfdef.getConnImplClass() + "]: ");
                  connImplName = in.readLine();
                  if (!connImplName.equals("") && !Pattern.matches(CLASS_NAME_PATTERN, connImplName))
                  {
                     System.out.println(rb.getString("class.name.validated"));
                  }
               } while ((classes.contains(connImplName) || !Pattern.matches(CLASS_NAME_PATTERN, connImplName))
                     && !connImplName.equals(""));
               classes.add(connImplName);
               if (connImplName != null && !connImplName.equals(""))
                  mcfdef.setConnImplClass(connImplName);

               System.out.print(rb.getString("connection.method.support") + " " + rb.getString("yesno") + " [N]: ");
               String supportMethod = in.readLine();
               if (supportMethod == null)
                  mcfdef.setDefineMethodInConnection(false);
               else
               {
                  if (supportMethod.equals("Y") || supportMethod.equals("y") || supportMethod.equals("Yes"))
                     mcfdef.setDefineMethodInConnection(true);
                  else
                     mcfdef.setDefineMethodInConnection(false);
               }
               if (mcfdef.isDefineMethodInConnection())
               {
                  mcfdef.setMethods(inputMethod(in));
               }
            }
            mcfDefs.add(mcfdef);
            mcfID++;
            moreMcf = false;

            if (def.getVersion().equals("1.5") || def.getVersion().equals("1.6") || def.getVersion().equals("1.7"))
            {
               System.out.print(rb.getString("more.mcf") + " " + rb.getString("yesno") + " [N]: ");
               String inputMoreMcf = in.readLine();
               if (inputMoreMcf != null && (inputMoreMcf.equals("Y") || inputMoreMcf.equals("y") || inputMoreMcf
                     .equals("Yes")))
                  moreMcf = true;
            }
         } while (moreMcf);
      }

      //inbound
      if (def.isSupportInbound())
      {
         String mlClassName = "";
         do
         {
            System.out.print(rb.getString("ml.interface.name"));
            System.out.print(" [" + def.getMlClass() + "]: ");
            mlClassName = in.readLine();
            if (!mlClassName.equals("") && !Pattern.matches(CLASS_NAME_PATTERN, mlClassName))
            {
               System.out.println(rb.getString("class.name.validated"));
            }
         } while ((classes.contains(mlClassName) || !Pattern.matches(CLASS_NAME_PATTERN, mlClassName)) && !mlClassName
               .equals(""));
         classes.add(mlClassName);
         boolean defaultPackage = true;
         if (mlClassName != null && !mlClassName.equals(""))
         {
            def.setMlClass(mlClassName);
            if (mlClassName.contains("."))
               defaultPackage = false;
            else
            {
               setDefaultValue(def, mlClassName, "MessageListener");
               setDefaultValue(def, mlClassName, "Ml");
            }
         }
         def.setDefaultPackageInbound(defaultPackage);

         String asClassName = "";
         do
         {
            System.out.print(rb.getString("as.class.name"));
            System.out.print(" [" + def.getAsClass() + "]: ");
            asClassName = in.readLine();
            if (!asClassName.equals("") && !Pattern.matches(CLASS_NAME_PATTERN, asClassName))
            {
               System.out.println(rb.getString("class.name.validated"));
            }
         } while ((classes.contains(asClassName) || !Pattern.matches(CLASS_NAME_PATTERN, asClassName)) && !asClassName
               .equals(""));
         classes.add(asClassName);
         if (asClassName != null && !asClassName.equals(""))
            def.setAsClass(asClassName);

         List<ConfigPropType> asProps = inputProperties("as", in, true);
         def.setAsConfigProps(asProps);

         String actiClassName = "";
         do
         {
            System.out.print(rb.getString("acti.class.name"));
            System.out.print(" [" + def.getActivationClass() + "]: ");
            actiClassName = in.readLine();
            if (!actiClassName.equals("") && !Pattern.matches(CLASS_NAME_PATTERN, actiClassName))
            {
               System.out.println(rb.getString("class.name.validated"));
            }
         } while ((classes.contains(actiClassName) || !Pattern.matches(CLASS_NAME_PATTERN, actiClassName))
               && !actiClassName.equals(""));
         classes.add(actiClassName);
         if (actiClassName != null && !actiClassName.equals(""))
            def.setActivationClass(actiClassName);
      }

      //admin object
      System.out.print(rb.getString("gen.adminobject") + " " + rb.getString("yesno") + " [N]: ");
      String genAo = in.readLine();
      if (genAo == null)
         def.setGenAdminObject(false);
      else
      {
         if (genAo.equals("Y") || genAo.equals("y") || genAo.equals("Yes"))
            def.setGenAdminObject(true);
         else
            def.setGenAdminObject(false);
      }

      if (def.isGenAdminObject())
      {
         System.out.print(rb.getString("adminobject.raa") + " " + rb.getString("yesno") + " [Y]: ");
         String aoRaAssociation = in.readLine();
         if (aoRaAssociation == null || aoRaAssociation.equals(""))
            def.setAdminObjectImplRaAssociation(true);
         else
         {
            if (aoRaAssociation.equals("Y") || aoRaAssociation.equals("y") || aoRaAssociation.equals("Yes"))
               def.setAdminObjectImplRaAssociation(true);
            else
               def.setAdminObjectImplRaAssociation(false);
         }
      }
      int numOfAo = 0;
      while (numOfAo >= 0 && def.isGenAdminObject())
      {
         String strOrder = numOfAo > 0 ? Integer.valueOf(numOfAo).toString() : "";
         AdminObjectType aoType = new AdminObjectType();

         String aoInterfaceName = "";
         do
         {
            System.out.print(rb.getString("adminobject.interface.name"));
            System.out.print(" [" + def.getDefaultValue() + strOrder + "AdminObject]: ");
            aoInterfaceName = in.readLine();
            if (!aoInterfaceName.equals("") && !Pattern.matches(CLASS_NAME_PATTERN, aoInterfaceName))
            {
               System.out.println(rb.getString("class.name.validated"));
            }
         } while ((classes.contains(aoInterfaceName) || !Pattern.matches(CLASS_NAME_PATTERN, aoInterfaceName))
               && !aoInterfaceName.equals(""));
         classes.add(aoInterfaceName);

         if (aoInterfaceName != null && !aoInterfaceName.equals(""))
         {
            aoType.setAdminObjectInterface(aoInterfaceName);
         }
         else
         {
            aoType.setAdminObjectInterface(def.getDefaultValue() + strOrder + "AdminObject");
         }

         String aoClassName = "";
         do
         {
            System.out.print(rb.getString("adminobject.class.name"));
            System.out.print(" [" + def.getDefaultValue() + strOrder + "AdminObjectImpl]: ");
            aoClassName = in.readLine();
            if (!aoClassName.equals("") && !Pattern.matches(CLASS_NAME_PATTERN, aoClassName))
            {
               System.out.println(rb.getString("class.name.validated"));
            }
         } while ((classes.contains(aoClassName) || !Pattern.matches(CLASS_NAME_PATTERN, aoClassName)) && !aoClassName
               .equals(""));
         classes.add(aoClassName);
         if (aoClassName != null && !aoClassName.equals(""))
         {
            aoType.setAdminObjectClass(aoClassName);
         }
         else
         {
            aoType.setAdminObjectClass(def.getDefaultValue() + strOrder + "AdminObjectImpl");
         }

         List<ConfigPropType> aoProps = inputProperties("adminobject", in, false);
         aoType.setAoConfigProps(aoProps);

         if (def.getAdminObjects() == null)
            def.setAdminObjects(new ArrayList<AdminObjectType>());
         def.getAdminObjects().add(aoType);

         System.out.print(rb.getString("gen.adminobject.other") + " " + rb.getString("yesno") + " [N]: ");
         String genAoAgain = in.readLine();
         if (genAoAgain == null)
            numOfAo = -1;
         else
         {
            if (genAoAgain.equals("Y") || genAoAgain.equals("y") || genAoAgain.equals("Yes"))
               numOfAo++;
            else
               numOfAo = -1;
         }
      }

      if (!def.getVersion().equals("1.0") &&
            def.isSupportOutbound() &&
            !def.getMcfDefs().get(0).isUseCciConnection())
      {
         //generate mbean classes
         System.out.print(rb.getString("gen.mbean") + " " + rb.getString("yesno") + " [Y]: ");
         String genMbean = in.readLine();
         if (genMbean == null)
            def.setGenMbean(true);
         else
         {
            if (genMbean.equals("N") || genMbean.equals("n") || genMbean.equals("No"))
               def.setGenMbean(false);
            else
               def.setGenMbean(true);
         }

         //generate eis test server support
         System.out.print(rb.getString("gen.eis") + " " + rb.getString("yesno") + " [N]: ");
         String genEis = in.readLine();
         if (genEis == null)
            def.setSupportEis(false);
         else
         {
            if (genEis.equals("Y") || genEis.equals("y") || genEis.equals("Yes"))
               def.setSupportEis(true);
            else
               def.setSupportEis(false);
         }

         if (def.isSupportEis())
         {
            //add default host and post for eis server
            if (def.getMcfDefs().get(0).getMcfConfigProps() == null)
            {
               def.getMcfDefs().get(0).setMcfConfigProps(new ArrayList<ConfigPropType>());
            }
            List<ConfigPropType> props = def.getMcfDefs().get(0).getMcfConfigProps();

            ConfigPropType host = new ConfigPropType("host", "String", "localhost", false);
            props.add(host);
            ConfigPropType port = new ConfigPropType("port", "Integer", "1400", false);
            props.add(port);
         }
      }

      //generate logging support
      System.out.print(rb.getString("support.jbosslogging") + " " + rb.getString("yesno") + " [N]: ");
      String supportJbossLogging = in.readLine();
      if (supportJbossLogging == null)
         def.setSupportJbossLogging(false);
      else
      {
         if (supportJbossLogging.equals("Y") || supportJbossLogging.equals("y") || supportJbossLogging.equals("Yes"))
            def.setSupportJbossLogging(true);
         else
            def.setSupportJbossLogging(false);
      }

      //build environment
      System.out.print(rb.getString("build.env") + " " + rb.getString("build.env.values"));
      System.out.print(" [" + def.getBuild() + "]: ");
      String buildEnv = in.readLine();
      if (buildEnv != null && !buildEnv.equals(""))
      {
         if (buildEnv.equalsIgnoreCase("i") ||
               buildEnv.equalsIgnoreCase("ant+ivy") ||
               buildEnv.equalsIgnoreCase("ivy"))
         {
            def.setBuild("ivy");
         }
         else if (buildEnv.equalsIgnoreCase("m") || buildEnv.equalsIgnoreCase("maven"))
         {
            def.setBuild("maven");
         }
         else if (buildEnv.equalsIgnoreCase("g") || buildEnv.equalsIgnoreCase("gradle"))
         {
            def.setBuild("gradle");
         }
         else
            def.setBuild("ant");
      }
      else
         def.setBuild("ant");

      return def;
   }
847133
@Override
    public String getValue(ParsedCommandLine args, boolean required) throws CommandFormatException {
        return getResolvedValue(args, required);
    }
1229230
public static CommandLine processCommandLineArgs(Option[] customOptions, String[] args) {
    Options options = new Options();

    options.addOption("h", "help", false, "Print this message");
    options.addOption("v", "verbose", false, "Generate verbose log messages");

    if (customOptions != null) {
      for (int i = 0; i < customOptions.length; i++)
        options.addOption(customOptions[i]);
    }

    CommandLine cli = null;
    try {
      cli = (new GnuParser()).parse(options, args);
    } catch (ParseException exp) {
      boolean hasHelpArg = false;
      if (args != null && args.length > 0) {
        for (int z = 0; z < args.length; z++) {
          if ("-h".equals(args[z]) || "-help".equals(args[z])) {
            hasHelpArg = true;
            break;
          }
        }
      }
      if (!hasHelpArg) {
        System.err.println("Failed to parse command-line arguments due to: " + exp.getMessage());
      }
      HelpFormatter formatter = new HelpFormatter();
      formatter.printHelp(SparkApp.class.getName(), options);
      System.exit(1);
    }

    if (cli.hasOption("help")) {
      HelpFormatter formatter = new HelpFormatter();
      formatter.printHelp(SparkApp.class.getName(), options);
      System.exit(0);
    }

    return cli;
  }
94285
static public IParserInput getInstance(
            final char commandPrefix,
            final File args)
                    throws IOException
    {
        return getInstance(commandPrefix, false, args);
    }
360794
public String promptForPassword(String arg) {

		char[] pass1 = console.readPassword(CommandUtils.getMessage("password.enterText", arg) + " ");		
		char[] pass2 = console.readPassword(CommandUtils.getMessage("password.reenterText", arg) + " ");
		
		if (pass1 == null && pass2 == null) {
            throw new IllegalArgumentException("Unable to read either entry. Aborting prompt.");
        }
		if (pass1 == null || pass2 == null) {
            stdout.println(CommandUtils.getMessage("password.readError"));
            return promptForPassword(arg);
        }
				
		String password1 =  String.valueOf(pass1);
		String password2 =  String.valueOf(pass2);
		
       if (password1.equals(password2)) {
            return password1;
        } else {
            stdout.println(CommandUtils.getMessage("password.entriesDidNotMatch"));
            return promptForPassword(arg);
        }		
	}
1232889
public static ResourceDescriptionResolver getResourceDescriptionResolver(final String... keyPrefix) {
        StringBuilder prefix = new StringBuilder(SUBSYSTEM_NAME);
        for (String kp : keyPrefix) {
            prefix.append('.').append(kp);
        }
        return new StandardResourceDescriptionResolver(prefix.toString(), RESOURCE_NAME, LoggingExtension.class.getClassLoader(), true, false) {
            @Override
            public String getOperationParameterDescription(final String operationName, final String paramName, final Locale locale, final ResourceBundle bundle) {
                if (DELEGATE_DESC_OPTS.contains(operationName)) {
                    return getResourceAttributeDescription(paramName, locale, bundle);
                }
                return super.getOperationParameterDescription(operationName, paramName, locale, bundle);
            }

            @Override
            public String getOperationParameterValueTypeDescription(final String operationName, final String paramName, final Locale locale,
                                                                    final ResourceBundle bundle, final String... suffixes) {
                if (DELEGATE_DESC_OPTS.contains(operationName)) {
                    return getResourceAttributeDescription(paramName, locale, bundle);
                }
                return super.getOperationParameterValueTypeDescription(operationName, paramName, locale, bundle, suffixes);
            }

            @Override
            public String getOperationParameterDeprecatedDescription(final String operationName, final String paramName, final Locale locale, final ResourceBundle bundle) {
                if (DELEGATE_DESC_OPTS.contains(operationName)) {
                    return getResourceAttributeDeprecatedDescription(paramName, locale, bundle);
                }
                return super.getOperationParameterDeprecatedDescription(operationName, paramName, locale, bundle);
            }
        };
    }
1180114
private Commandline _createCommandLine ()
  {
    /*
     * NOTE: This method is designed to work with plexus-utils:1.1 which is used
     * by all Maven versions before 2.0.6 regardless of our plugin dependency.
     * Therefore, we use setWorkingDirectory(String) rather than
     * setWorkingDirectory(File) and addArguments() rather than createArg().
     */

    final Commandline cli = new Commandline ();

    cli.setExecutable (this.executable);

    if (this.workingDirectory != null)
    {
      cli.setWorkingDirectory (this.workingDirectory.getAbsolutePath ());
    }

    final String classPath = _getClassPath ();
    if (classPath != null && classPath.length () > 0)
    {
      cli.addArguments (new String [] { "-cp", classPath });
    }

    if (this.mainClass != null && this.mainClass.length () > 0)
    {
      cli.addArguments (new String [] { this.mainClass });
    }

    cli.addArguments (_getArguments ());

    return cli;
  }
924071
private boolean parseAndExecute(
            Class<?> docletClass,
            String[] argv,
            Iterable<? extends JavaFileObject> fileObjects) throws IOException {
        long tm = System.currentTimeMillis();

        ListBuffer<String> javaNames = new ListBuffer<>();

        // Preprocess @file arguments
        try {
            argv = CommandLine.parse(argv);
        } catch (FileNotFoundException e) {
            messager.error(Messager.NOPOS, "main.cant.read", e.getMessage());
            exit();
        } catch (IOException e) {
            e.printStackTrace(System.err);
            exit();
        }


        fileManager = context.get(JavaFileManager.class);

        setDocletInvoker(docletClass, fileManager, argv);

        compOpts = Options.instance(context);
        // Make sure no obsolete source/target messages are reported
        compOpts.put("-Xlint:-options", "-Xlint:-options");

        // Parse arguments
        for (int i = 0 ; i < argv.length ; i++) {
            String arg = argv[i];

            ToolOption o = ToolOption.get(arg);
            if (o != null) {
                // hack: this restriction should be removed
                if (o == ToolOption.LOCALE && i > 0)
                    usageError("main.locale_first");

                try {
                    if (o.hasArg) {
                        oneArg(argv, i++);
                        o.process(this, argv[i]);
                    } else {
                        setOption(arg);
                        o.process(this);
                    }
                } catch (Option.InvalidValueException e) {
                    usageError("main.option.invalid.value", e.getMessage());
                }
            } else if (arg.equals("-XDaccessInternalAPI")) {
                // pass this hidden option down to the doclet, if it wants it
                if (docletInvoker.optionLength("-XDaccessInternalAPI") == 1) {
                    setOption(arg);
                }
            } else if (arg.startsWith("-XD")) {
                // hidden javac options
                String s = arg.substring("-XD".length());
                int eq = s.indexOf('=');
                String key = (eq < 0) ? s : s.substring(0, eq);
                String value = (eq < 0) ? s : s.substring(eq+1);
                compOpts.put(key, value);
            }
            // call doclet for its options
            // other arg starts with - is invalid
            else if (arg.startsWith("-")) {
                int optionLength;
                optionLength = docletInvoker.optionLength(arg);
                if (optionLength < 0) {
                    // error already displayed
                    exit();
                } else if (optionLength == 0) {
                    // option not found
                    usageError("main.invalid_flag", arg);
                } else {
                    // doclet added option
                    if ((i + optionLength) > argv.length) {
                        usageError("main.requires_argument", arg);
                    }
                    ListBuffer<String> args = new ListBuffer<>();
                    for (int j = 0; j < optionLength-1; ++j) {
                        args.append(argv[++i]);
                    }
                    setOption(arg, args.toList());
                }
            } else {
                javaNames.append(arg);
            }
        }

        if (fileManager == null) {
            JavacFileManager.preRegister(context);
            fileManager = context.get(JavaFileManager.class);
            if (fileManager instanceof BaseFileManager) {
                ((BaseFileManager) fileManager).autoClose = true;
            }
        }
        if (fileManager instanceof BaseFileManager) {
            ((BaseFileManager) fileManager).handleOptions(fileManagerOpts);
        }

        Arguments arguments = Arguments.instance(context);
        arguments.init(messager.programName);
        arguments.allowEmpty();
        arguments.validate();

        String platformString = compOpts.get("--release");

        if (platformString != null) {
            if (compOpts.isSet("-source")) {
                usageError("main.release.bootclasspath.conflict", "-source");
            }
            if (fileManagerOpts.containsKey(Option.BOOT_CLASS_PATH)) {
                usageError("main.release.bootclasspath.conflict", Option.BOOT_CLASS_PATH.getPrimaryName());
            }

            PlatformDescription platformDescription =
                    PlatformUtils.lookupPlatformDescription(platformString);

            if (platformDescription == null) {
                usageError("main.unsupported.release.version", platformString);
            }

            compOpts.put(Option.SOURCE, platformDescription.getSourceVersion());

            context.put(PlatformDescription.class, platformDescription);

            Collection<Path> platformCP = platformDescription.getPlatformPath();

            if (platformCP != null) {
                if (fileManager instanceof StandardJavaFileManager) {
                    StandardJavaFileManager sfm = (StandardJavaFileManager) fileManager;

                    sfm.setLocationFromPaths(StandardLocation.PLATFORM_CLASS_PATH, platformCP);
                } else {
                    usageError("main.release.not.standard.file.manager", platformString);
                }
            }
        }

        compOpts.notifyListeners();

        if (javaNames.isEmpty() && subPackages.isEmpty() && isEmpty(fileObjects)) {
            usageError("main.No_packages_or_classes_specified");
        }

        if (!docletInvoker.validOptions(options.toList())) {
            // error message already displayed
            exit();
        }

        JavadocTool comp = JavadocTool.make0(context);
        if (comp == null) return false;

        if (showAccess == null) {
            setFilter(defaultFilter);
        }

        LanguageVersion languageVersion = docletInvoker.languageVersion();
        RootDocImpl root = comp.getRootDocImpl(
                docLocale,
                encoding,
                showAccess,
                javaNames.toList(),
                options.toList(),
                fileObjects,
                breakiterator,
                subPackages.toList(),
                excludedPackages.toList(),
                docClasses,
                // legacy?
                languageVersion == null || languageVersion == LanguageVersion.JAVA_1_1,
                quiet);

        // release resources
        comp = null;

        // pass off control to the doclet
        boolean ok = root != null;
        if (ok) ok = docletInvoker.start(root);

        // We're done.
        if (compOpts.get("-verbose") != null) {
            tm = System.currentTimeMillis() - tm;
            messager.notice("main.done_in", Long.toString(tm));
        }

        return ok;
    }