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;
13 import net.sourceforge.argparse4j.ArgumentParsers;
14 import net.sourceforge.argparse4j.annotation.Arg;
15 import net.sourceforge.argparse4j.inf.ArgumentParser;
16 import org.slf4j.Logger;
17 import org.slf4j.LoggerFactory;
21 private static final Logger LOG = LoggerFactory.getLogger(Params.class);
22 @Arg(dest = "yang-source-dir")
23 private File yangSourceDir;
25 static ArgumentParser getParser() throws URISyntaxException {
26 final ArgumentParser parser = ArgumentParsers.newArgumentParser("jar_file_name");
27 parser.description("Validation Tool for Yang Models")
30 parser.addArgumentGroup("Required arguments")
31 .addArgument("--yang-source-dir")
34 .help("directory containing yang models which will be parsed")
35 .dest("yang-source-dir")
41 public boolean isValid() {
42 if (yangSourceDir == null) {
45 if (!yangSourceDir.exists()) {
46 LOG.error("Yang source directory has to exist");
49 if (!yangSourceDir.canRead()) {
50 LOG.error("Yang source directory has to be readable");
53 if (yangSourceDir.list().length == 0) {
54 LOG.error("Yang source directory {} doesn't contain any model", yangSourceDir.getPath());
61 public File getYangSourceDir() {