Configures the given command if it has not already been configured and
this instance has been provided with a {@link CommandConfigurer}.

@param command The command to be configured.
@throws IllegalArgumentException if {@code command} is null.
339354
protected void configureIfNecessary(AbstractCommand command) {

		Assert.notNull(command, "command");

		if (getCommandConfigurer() != null) {
			if (!command.isFaceConfigured()) {
                getCommandConfigurer().configure(command);
			}
		}

	}
1006898
protected void addConfiguredProcessorArg(final CommandLineArgument arg) throws NullPointerException, BuildException {
    if (arg == null) {
      throw new NullPointerException("arg");
    }
    if (isReference()) {
      throw noChildrenAllowed();
    }
    this.processorArgs.addElement(arg);
  }
539023
@Override
	public void configure(Configuration parameters) {

		// enforce sequential configure() calls
		synchronized (CONFIGURE_MUTEX) {
			if (this.mapreduceOutputFormat instanceof Configurable) {
				((Configurable) this.mapreduceOutputFormat).setConf(this.configuration);
			}
		}
	}
1231494
protected List<String> parseCommand(ConfigurationHolder configurationHolder,String command)
    {
        //init list
        List<String> commandList=new LinkedList<String>();

        StringBuilder buffer=new StringBuilder(command);
        String part=null;
        int quoteIndex=-1;
        int spaceIndex=-1;
        int length=-1;
        do
        {
            quoteIndex=buffer.indexOf("\"");
            spaceIndex=buffer.indexOf(" ");
            if(quoteIndex==-1)
            {
                if(spaceIndex==-1)
                {
                    buffer=this.addAllBuffer(commandList,buffer);
                }
                else
                {
                    buffer=this.addPart(commandList,buffer,spaceIndex,true);
                }
            }
            else if(spaceIndex==-1)
            {
                if(quoteIndex==-1)
                {
                    buffer=this.addAllBuffer(commandList,buffer);
                }
                else if(quoteIndex==0)
                {
                    quoteIndex=buffer.indexOf("\"",1);
                    if(quoteIndex==-1)
                    {
                        throw new FaxException("Unable to parse command: "+command);
                    }

                    buffer=this.addPart(commandList,buffer,quoteIndex,false);
                }
                else
                {
                    throw new FaxException("Unable to parse command: "+command);
                }
            }
            else if(quoteIndex<spaceIndex)
            {
                if(quoteIndex==0)
                {
                    quoteIndex=buffer.indexOf("\"",1);
                    if(quoteIndex==-1)
                    {
                        throw new FaxException("Unable to parse command: "+command);
                    }

                    buffer=this.addPart(commandList,buffer,quoteIndex,false);
                }
                else
                {
                    buffer=this.addPart(commandList,buffer,spaceIndex,true);
                }
            }
            else //spaceIndex<quoteIndex
            {
                buffer=this.addPart(commandList,buffer,spaceIndex,true);
            }
            
            length=buffer.length();
            if(length>0)
            {
                part=buffer.toString();
                part=part.trim();
                buffer.delete(0,length);
                buffer.append(part);
                length=buffer.length();
            }
        }while(length>0);

        return commandList;
    }
692771
protected void validateCommand(final T command) throws CougarException {
        List<CommandValidator<T>> validators = getCommandValidators();
        for (CommandValidator<T> v : validators) {
            v.validate(command);
        }
    }
1206583
private void setCommandLineParam(String cmdArgName, String cmdArgValue) throws ConfigurationException {
        int dotInx = cmdArgName.indexOf('.');
        if (dotInx < 0 && isModuleName(cmdArgName)) {
            Map<String, Object> paramMap = parseSerialParams(cmdArgValue);
            updateMap(m_params, cmdArgName, paramMap);
        } else {
            String moduleName = dotInx <= 0 ? null : cmdArgName.substring(0, dotInx);
            String paramName = dotInx <= 0 ? cmdArgName : cmdArgName.substring(dotInx + 1);
            String[] values = cmdArgValue.split(",");
            Object paramValue = values.length <= 1 ? cmdArgValue : Arrays.asList(values); 
            if (moduleName == null) {
                setLegacyParam(cmdArgName, paramValue);
            } else {
                setModuleParam(moduleName, paramName, paramValue);
            }
        }
    }
1247750
static Action create(Runnable command)
    {
        Objects.requireNonNull(command, "The command may not be null");
        return new AbstractAction()
        {
            /**
             * Serial UID
             */
            private static final long serialVersionUID = 8693271079128413874L;

            @Override
            public void actionPerformed(ActionEvent e)
            {
                command.run();
            }
        };
    }
149530
protected boolean isCommandAvailable(String command) throws Throwable
   {
      Socket socket = null;
      try
      {
         socket = new Socket(host, port);

         ObjectOutputStream output = new ObjectOutputStream(socket.getOutputStream());
         output.writeUTF("getcommand");
         output.writeInt(1);
         output.writeUTF(command);

         output.flush();

         ObjectInputStream input = new ObjectInputStream(socket.getInputStream());

         Serializable result = (Serializable)input.readObject();

         if (result == null || !(result instanceof Throwable))
            return true;

         return false;
      }
      finally
      {
         if (socket != null)
         {
            try
            {
               socket.close();
            }
            catch (IOException ioe)
            {
               // Ignore
            }
         }
      }
   }
338287
public static void run(String[] command) throws IOException, RDF4JException, TrustyUriException {
		String cmd = command[0];
		String[] cmdArgs = Arrays.copyOfRange(command, 1, command.length);
		if (cmd.equals("CheckFile")) {
			CheckFile.main(cmdArgs);
		} else if (cmd.equals("ProcessFile")) {
			ProcessFile.main(cmdArgs);
		} else if (cmd.equals("CheckLargeRdf")) {
			CheckLargeRdf.main(cmdArgs);
		} else if (cmd.equals("TransformRdf")) {
			TransformRdf.main(cmdArgs);
		} else if (cmd.equals("TransformLargeRdf")) {
			TransformLargeRdf.main(cmdArgs);
		} else if (cmd.equals("CheckSortedRdf")) {
			CheckSortedRdf.main(cmdArgs);
		} else {
			System.err.println("ERROR: Unrecognized command " + cmd);
			System.exit(1);
		}
	}
262727
protected function runPreCommand(CommandInterface $command, ConfigurationInterface $configuration)
    {
        if ($command->hasPreCommand()) {
            $this->run($configuration->findCommand($command->getPreCommand()), $configuration);
        }
    }
552251
private void submit(final ActiveContext context, final String command) {
    try {
      LOG.log(Level.INFO, "Send command {0} to context: {1}", new Object[]{command, context});
      final JavaConfigurationBuilder cb = Tang.Factory.getTang().newConfigurationBuilder();
      cb.addConfiguration(
          TaskConfiguration.CONF
              .set(TaskConfiguration.IDENTIFIER, context.getId() + "_task")
              .set(TaskConfiguration.TASK, ShellTask.class)
              .build()
      );
      cb.bindNamedParameter(Command.class, command);
      context.submitTask(cb.build());
    } catch (final BindException ex) {
      LOG.log(Level.SEVERE, "Bad Task configuration for context: " + context.getId(), ex);
      context.close();
      throw new RuntimeException(ex);
    }
  }
238747
@Override
    public void handle(CommandContext ctx) throws CommandLineException {

        recognizeArguments(ctx);

        if(helpArg.isPresent(ctx.getParsedCommandLine())) {
            printHelp(ctx);
            return;
        }

        if(!isAvailable(ctx)) {
            throw new CommandFormatException("The command is not available in the current context (e.g. required subsystems or connection to the controller might be unavailable).");
        }

        doHandle(ctx);
    }
912281
@Override
	public void configure(Configuration parameters) {
		this.driverName = parameters.getString(DRIVER_KEY, null);
		this.username = parameters.getString(USERNAME_KEY, null);
		this.password = parameters.getString(PASSWORD_KEY, null);
		this.dbURL = parameters.getString(URL_KEY, null);
		this.query = parameters.getString(QUERY_KEY, null);
		this.fieldCount = parameters.getInteger(FIELD_COUNT_KEY, 0);
		this.batchInterval = parameters.getInteger(BATCH_INTERVAL, DEFAULT_BATCH_INTERVERAL);

		@SuppressWarnings("unchecked")
		Class<Value>[] classes = new Class[this.fieldCount];
		this.fieldClasses = classes;

		for (int i = 0; i < this.fieldCount; i++) {
			@SuppressWarnings("unchecked")
			Class<? extends Value> clazz = (Class<? extends Value>) parameters.getClass(FIELD_TYPE_KEY + i, null);
			if (clazz == null) {
				throw new IllegalArgumentException("Invalid configuration for JDBCOutputFormat: "
						+ "No type class for parameter " + i);
			}
			this.fieldClasses[i] = clazz;
		}
	}
500565
public void usage(@Nullable String programName, @Nullable String groupName, String commandName, CommandMetadata command)
    {
        StringBuilder stringBuilder = new StringBuilder();
        usage(programName, groupName, commandName, command, stringBuilder);
        System.out.println(stringBuilder.toString());
    }
225663
protected List<String> getOptionsByCommand(String command){
        String rawOption = commands.get(command);
        String[] options = rawOption.split(CoreConstants.COMMA);
        return Arrays.asList(options);
    }
284067
private static void bindService() {
        synchronized (Command.class) {
            if (!IS_BIND) {
                Context context = Cmd.getContext();
                if (context == null) {
                    throw new NullPointerException("Context not should null. Please call Cmd.init(Context)");
                } else {
                    // Cmd service
                    context.bindService(new Intent(context, CommandService.class), I_CONN, Context.BIND_AUTO_CREATE);
                    IS_BIND = true;
                }
            }
        }
    }
91683
@Override
    public String sendCommandStr(String command) {
        String str = null;
        try {
            str = sendCommand2(command);
        } catch (Exception ex) {
            logger.error("Could not run command " + command, ex);
        }
        return str;
    }