2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.yangtools.yang.validation.tool;
11 import java.net.URISyntaxException;
12 import net.sourceforge.argparse4j.ArgumentParsers;
13 import net.sourceforge.argparse4j.annotation.Arg;
14 import net.sourceforge.argparse4j.inf.ArgumentParser;
15 import org.slf4j.Logger;
16 import org.slf4j.LoggerFactory;
20 private static final Logger LOGGER = LoggerFactory.getLogger(Params.class);
21 @Arg(dest = "yang-source-dir")
22 private File yangSourceDir;
24 static ArgumentParser getParser() throws URISyntaxException {
25 final ArgumentParser parser = ArgumentParsers.newArgumentParser("jar_file_name");
26 parser.description("Validation Tool for Yang Models")
29 parser.addArgumentGroup("Required arguments")
30 .addArgument("--yang-source-dir")
33 .help("directory containing yang models which will be parsed")
34 .dest("yang-source-dir")
40 public boolean isValid() {
41 if (yangSourceDir == null) {
44 if (!yangSourceDir.exists()) {
45 LOGGER.error("Yang source directory has to exist");
48 if (!yangSourceDir.canRead()) {
49 LOGGER.error("Yang source directory has to be readable");
52 if (yangSourceDir.list().length == 0) {
53 LOGGER.error("Yang source directory {} doesn't contain any model", yangSourceDir.getPath());
60 public File getYangSourceDir() {