本文整理汇总了Java中uk.co.flamingpenguin.jewel.cli.ArgumentValidationException类的典型用法代码示例。如果您正苦于以下问题:Java ArgumentValidationException类的具体用法?Java ArgumentValidationException怎么用?Java ArgumentValidationException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ArgumentValidationException类属于uk.co.flamingpenguin.jewel.cli包,在下文中一共展示了ArgumentValidationException类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: makeParser
import uk.co.flamingpenguin.jewel.cli.ArgumentValidationException; //导入依赖的package包/类
@Deprecated
public static Parser makeParser(final File modelFolder, final Optional<Double> supertaggerWeight)
throws IOException {
CommandLineArguments commandLineOptions;
try {
// Meh.
String rootCats = "";
for (final Category cat : Training.ROOT_CATEGORIES) {
rootCats = rootCats + cat + " ";
}
commandLineOptions = CliFactory.parseArguments(CommandLineArguments.class,
new String[] { "-m", modelFolder.toString() });
} catch (final ArgumentValidationException e) {
throw new RuntimeException(e);
}
return makeParser(commandLineOptions,
commandLineOptions.getParsingAlgorithm().equals("astar") ? 20000 : 400000, true, supertaggerWeight,
true);
}
示例2: processRequest
import uk.co.flamingpenguin.jewel.cli.ArgumentValidationException; //导入依赖的package包/类
@Override
public void processRequest(String[] args) throws IOException, ArgumentValidationException
{
ProcessUpdatesCLI options = CliFactory.parseArguments(ProcessUpdatesCLI.class, args);
if (options.isUpdateTables())
{
updateTables();
}
else if (options.isUpdateUserRatingCount())
{
updateUserRatingCount();
}
else
{
printHelpAndExit("no valid argument passed", ProcessUpdatesCLI.class);
}
}
示例3: TaggerflowServer
import uk.co.flamingpenguin.jewel.cli.ArgumentValidationException; //导入依赖的package包/类
public TaggerflowServer(String[] args) {
try {
final CommandLineArguments cmd = CliFactory.parseArguments(CommandLineArguments.class, args);
LibraryUtil.setLibraryPath("lib");
this.taggerflow = new Taggerflow(new File(cmd.getModel(), "taggerflow"), cmd.getBeam());
this.port = cmd.getPort();
} catch (ArgumentValidationException e) {
throw new RuntimeException(e);
}
}
示例4: main
import uk.co.flamingpenguin.jewel.cli.ArgumentValidationException; //导入依赖的package包/类
/**
* Run with -logconfig logback_test.xml or use the example runner below.
*/
public static void main(final String... args) {
final Options options;
try {
options = CliFactory.parseArguments(Options.class, args);
} catch (ArgumentValidationException e) {
e.printStackTrace();
System.exit(1);
return;
}
JewelCliLoggingConfigurator.configure(options);
while (true) {
// Should be logged twice per iteration, by both the console appender and the trace appender.
logger.info("info!");
// Should be logged once per iteration by the trace appender only.
logger.trace("trace!");
logger.debug("debug!");
logger.warn("warn!");
logger.error("error!");
try {
Thread.sleep(1000);
} catch (InterruptedException ignore) {
}
}
}
示例5: main
import uk.co.flamingpenguin.jewel.cli.ArgumentValidationException; //导入依赖的package包/类
/**
* Run with -info or use the example runner below.
*/
public static void main(final String... args) {
final Options options;
try {
options = CliFactory.parseArguments(Options.class, args);
} catch (ArgumentValidationException e) {
e.printStackTrace();
System.exit(1);
return;
}
JewelCliLoggingConfigurator.configure(options);
while (true) {
// Should be logged once per iteration.
logger.info("info!");
logger.warn("warn!");
logger.error("error!");
// Should not be logged.
logger.trace("trace!");
logger.debug("debug!");
try {
Thread.sleep(1000);
} catch (InterruptedException ignore) {
}
}
}
示例6: WorkflowManager
import uk.co.flamingpenguin.jewel.cli.ArgumentValidationException; //导入依赖的package包/类
public WorkflowManager() throws ArgumentValidationException
{
// -Dzieook.data.port=\"DATA_PORT\" -Dzieook.workflow.port=\"WORKFLOW_PORT\" "-Dzieook.server=\"$ZIEOOK_SERVER\"
config = Config.getInstance();
String host = System.getProperty("zieook.server");
String port = System.getProperty("zieook.workflow.port");
server = "http://" + host + ":" + port;
}
示例7: main
import uk.co.flamingpenguin.jewel.cli.ArgumentValidationException; //导入依赖的package包/类
/**
* Not-really-supported function for getting supertags out.
* @throws ArgumentValidationException
*/
public static void main(String[] args) throws ArgumentValidationException {
CommandLineArguments parsedArgs = CliFactory.parseArguments(CommandLineArguments.class, args);
if (!parsedArgs.getModel().exists()) throw new InputMismatchException("Couldn't load model from from: " + parsedArgs.getModel());
System.err.println("Loading model...");
Tagger tagger = new TaggerEmbeddings(parsedArgs.getModel(), parsedArgs.getMaxLength(), parsedArgs.getSupertaggerbeam(), parsedArgs.getMaxTagsPerWord());
// Read from stdin
Scanner sc = new Scanner(System.in,"UTF-8");
System.err.println("Model loaded, ready to parse.");
DecimalFormat df = new DecimalFormat("#.########");
Stopwatch timer = Stopwatch.createStarted();
InputReader inputReader = InputReader.make(InputFormat.POSTAGGED, new SyntaxTreeNodeFactory(parsedArgs.getMaxLength(), 0));
int id = 0;
while(sc.hasNext()) {
String line = sc.nextLine().trim();
if (line.startsWith("#") || line.isEmpty()) continue ;
List<List<SyntaxTreeNodeLeaf>> supertags = tagger.tag(inputReader.readInput(line).getInputWords());
id++;
for (int i=0 ; i < supertags.size(); i++) {
List<SyntaxTreeNodeLeaf> tagsForWord = supertags.get(i);
boolean isFirstTag = true;
if (i > 0) {
System.out.print("|");
}
for (SyntaxTreeNodeLeaf tagForWord : tagsForWord) {
if (isFirstTag) {
System.out.print(tagForWord.getWord() + "\t" + tagForWord.getPos() + "\t0");
isFirstTag = false;
}
System.out.print("\t" + tagForWord.getCategory() + "\t" + df.format(Math.exp(tagForWord.probability)));
}
}
System.out.println();
}
System.err.println("Time taken: " + timer.elapsed(TimeUnit.SECONDS));
}
示例8: main
import uk.co.flamingpenguin.jewel.cli.ArgumentValidationException; //导入依赖的package包/类
public static void main(String[] args) {
// TODO: parse command line args, figure out what to do and
// delegate it to one of the specialist-classes
// for now only the query is implemented.
try {
options =
CliFactory.parseArguments(SesameCLIOptions.class, args);
} catch (ArgumentValidationException e) {
System.err.println("Error parsing options: " + e);
System.exit(1);
}
if(options.isUrl() && options.isDir()) {
System.err.println("Options serverUrl and sesameDir cannot be used at the same time");
System.exit(1);
}
if(!options.isUrl() && !options.isDir()) {
System.err.println("Either option serverUrl or option sesameDir must be specified");
}
if(options.isUrl()) {
optionUrl = options.getUrl();
} else if (options.isDir()) {
optionDir = options.getDir();
}
if(options.isId()) {
optionId = options.getId();
}
optionCmd = options.getCmd();
// if we need other args, this is how to do it
//List<String> otherArgs = options.getArgs();
//if (otherArgs == null) {
// otherArgs = new LinkedList<String>();
//}
// depending on the command, delegate to one of the functions
if (optionCmd.equals("clear")) {
do_clear();
mManager.disconnect();
} else if (optionCmd.equals("query")) {
do_query();
mManager.disconnect();
} else if (optionCmd.equals("ask")) {
do_ask();
mManager.disconnect();
} else if (optionCmd.equals("update")) {
do_update();
mManager.disconnect();
} else if (optionCmd.equals("import")) {
do_import();
mManager.disconnect();
} else if (optionCmd.equals("export")) {
do_export();
mManager.disconnect();
} else if (optionCmd.equals("create")) {
try {
do_create();
} catch(Exception ex) {
System.err.println("Problem creating repository");
ex.printStackTrace(System.err);
} finally {
mManager.disconnect();
}
} else if (optionCmd.equals("delete")) {
do_delete();
mManager.disconnect();
} else if (optionCmd.equals("listids")) {
do_listids();
mManager.disconnect();
} else {
System.err.println("Unknown command: " + optionCmd);
System.err.println("Use one of: query,import,export,create,clear,delete,listids");
System.exit(1);
}
}
示例9: parse
import uk.co.flamingpenguin.jewel.cli.ArgumentValidationException; //导入依赖的package包/类
public static <A> A parse(String[] args, Class<? extends A> c) throws ArgumentValidationException {
return CliFactory.parseArguments(c, args);
}
示例10: processRequest
import uk.co.flamingpenguin.jewel.cli.ArgumentValidationException; //导入依赖的package包/类
@Override
public void processRequest(String[] args) throws ArgumentValidationException, IOException
{
HBaseCLI options = CliFactory.parseArguments(HBaseCLI.class, args);
if (options.isCreateTemplates())
{
createTemplates();
}
else if (options.isDropAllTable())
{
dropAllTables();
}
else if (options.isDeleteRecommender())
{
String recommender = options.getCollection();
String collection = options.getRecommender();
String cp = options.getContentProvider();
if (recommender.isEmpty() || collection.isEmpty() || cp.isEmpty())
{
System.out.println(getHelp(HBaseCLI.class));
System.exit(-1);
}
else
{
deleteRecommender(cp, recommender, collection);
}
}
else if (options.isInitZieOok())
{
initZieOok();
}
// else if (options.isReadRecommender())
// {
// // String result = operations.readRecommenders(null, null);
// // System.out.println(result);
// }
else if (options.isShowTable())
{
StringBuilder result = showTables();
System.out.println(result.toString());
}
else if (options.getHelp())
{
System.out.println(getHelp(HBaseCLI.class));
System.exit(-1);
}
else
{
System.out.println(getHelp(HBaseCLI.class));
System.exit(-1);
}
LOG.info("done");
}
示例11: processRequest
import uk.co.flamingpenguin.jewel.cli.ArgumentValidationException; //导入依赖的package包/类
@Override
public void processRequest(String[] args) throws ArgumentValidationException
{
if (!super.confirmYesNo("using server: <" + server + "> is this correct? [yes/no]"))
{
return;
}
options = CliFactory.parseArguments(WorkFlowCLI.class, args);
RegisterBuiltin.register(ResteasyProviderFactory.getInstance());
recommender = options.getCollection();
collection = options.getRecommender();
cp = options.getContentProvider();
// type = options.getCollectionType();
// location = options.getCollectionLocation();
// interval = options.getCollectionInterval();
if (options.isContentProvider() || options.isDeleteCP() || options.isShowCP())
{
// content provider stuff:
processContentProvider();
}
else if (options.isCreateCollection() || options.isDeleteCollection() || options.isShowCollection())
{
// collection stuff:
processCollection();
}
else if (options.isCreateRecommender() || options.isDeleteRecommender() || options.isShowRecommender())
{
// recommender stuff:
processRecommender();
}
else if (options.isExecuteStatistics())
{
if (cp.isEmpty())
{
printHelpAndExit("please provide a content provider", WorkFlowCLI.class);
}
else
{
runStatistics(cp);
}
}
{
printHelpAndExit("no valid argument passed", WorkFlowCLI.class);
}
}
示例12: processRequest
import uk.co.flamingpenguin.jewel.cli.ArgumentValidationException; //导入依赖的package包/类
public void processRequest(String[] args) throws IOException, ArgumentValidationException;