com.facebook.presto.spark.launcher.Commands Maven / Gradle / Ivy
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.facebook.presto.spark.launcher;
import com.facebook.presto.spark.launcher.internal.com.google.common.collect.ImmutableList;
import com.facebook.presto.spark.launcher.internal.com.google.common.collect.ImmutableMap;
import com.facebook.presto.spark.launcher.internal.io.airlift.airline.DefaultCommandFactory;
import com.facebook.presto.spark.launcher.internal.io.airlift.airline.ParseState;
import com.facebook.presto.spark.launcher.internal.io.airlift.airline.Parser;
import com.facebook.presto.spark.launcher.internal.io.airlift.airline.SingleCommand;
import com.facebook.presto.spark.launcher.internal.io.airlift.airline.model.CommandMetadata;
import static com.facebook.presto.spark.launcher.internal.io.airlift.airline.ParserUtil.createInstance;
public class Commands
{
private Commands() {}
public static PrestoSparkLauncherCommand parseCommandNoValidate(SingleCommand command, String[] args)
{
CommandMetadata commandMetadata = command.getCommandMetadata();
Parser parser = new Parser();
ParseState state = parser.parseCommand(commandMetadata, ImmutableList.copyOf(args));
return createInstance(
PrestoSparkLauncherCommand.class,
commandMetadata.getAllOptions(),
state.getParsedOptions(),
commandMetadata.getArguments(),
state.getParsedArguments(),
commandMetadata.getMetadataInjections(),
ImmutableMap.of(CommandMetadata.class, commandMetadata),
new DefaultCommandFactory<>());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy