2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
\r
4 * This program and the accompanying materials are made available under the
\r
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
\r
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
\r
9 package org.opendaylight.controller;
\r
11 import java.io.File;
\r
12 import java.util.Map;
\r
14 import org.opendaylight.controller.model.parser.builder.YangModelBuilder;
\r
20 public static void main(String[] args) throws Exception {
\r
22 String yangFilesDir;
\r
23 if(args.length > 0) {
\r
24 yangFilesDir = args[0];
\r
26 yangFilesDir = "src/main/resources";
\r
29 File resourceDir = new File(yangFilesDir);
\r
30 if(!resourceDir.exists()) {
\r
31 throw new IllegalArgumentException("Specified resource directory does not exists: "+ resourceDir.getAbsolutePath());
\r
34 String[] dirList = resourceDir.list();
\r
35 String[] absFiles = new String[dirList.length];
\r
38 for(String fileName : dirList) {
\r
39 File f = new File(fileName);
\r
40 absFiles[i] = f.getAbsolutePath();
\r
44 YangModelBuilder builder = new YangModelBuilder(absFiles);
\r
45 Map<String, org.opendaylight.controller.yang.model.api.Module> builtModules = builder.build();
\r
47 System.out.println("Modules built: "+ builtModules.size());
\r