Yang-maven-plugin refactored and config attributes and spi adjusted.
[controller.git] / opendaylight / sal / yang-prototype / code-generator / maven-yang / src / main / java / org / opendaylight / controller / yang2sources / spi / CodeGenerator.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.controller.yang2sources.spi;
9
10 import java.io.File;
11 import java.io.IOException;
12 import java.util.Collection;
13 import java.util.Map;
14 import java.util.Set;
15
16 import org.apache.maven.plugin.logging.Log;
17 import org.apache.maven.project.MavenProject;
18 import org.opendaylight.controller.yang.model.api.Module;
19 import org.opendaylight.controller.yang.model.api.SchemaContext;
20
21 /**
22  * Classes implementing this interface can be submitted to maven-yang-plugin's
23  * generate-sources goal.
24  */
25 public interface CodeGenerator {
26
27     /**
28      * Generate sources from provided {@link SchemaContext}
29      *
30      * @param context
31      *            parsed from yang files
32      * @param outputBaseDir
33      *            expected output directory for generated sources configured by
34      *            user
35      * @param currentModules
36      *            yang modules parsed from yangFilesRootDir
37      * @param log
38      *            maven logger
39      * @return collection of files that were generated from schema context
40      * @throws IOException
41      */
42     Collection<File> generateSources(SchemaContext context, File outputBaseDir,
43             Set<Module> currentModules) throws IOException;
44
45     /**
46      * Utilize maven logging if necessary
47      *
48      * @param log
49      */
50     void setLog(Log log);
51
52     /**
53      * Provided map contains all configuration that was set in pom for code
54      * generator in additionalConfiguration tag
55      *
56      * @param additionalConfiguration
57      */
58     void setAdditionalConfig(Map<String, String> additionalConfiguration);
59
60     /**
61      * Provided folder is marked as resources and its content will be packaged
62      * in resulting jar. Feel free to add necessary resources
63      *
64      * @param resourceBaseDir
65      */
66     void setResourceBaseDir(File resourceBaseDir);
67
68     /**
69      * Provided maven project object. Any additional information about current
70      * maven project can be accessed from it.
71      *
72      * @param resourceBaseDir
73      */
74     void setMavenProject(MavenProject project);
75 }