X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fsal%2Fyang-prototype%2Fyang%2Fmaven-yang%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fyang2sources%2Fspi%2FCodeGenerator.java;fp=opendaylight%2Fsal%2Fyang-prototype%2Fyang%2Fmaven-yang%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fyang2sources%2Fspi%2FCodeGenerator.java;h=3042160a2a3178e523b485b3bcddd470db6f6589;hp=0000000000000000000000000000000000000000;hb=ba1a5528e27b0ae8a883fa7b768d803659bf9336;hpb=b64d31500de4d9bd81a060432c3db20feb2e7dfa diff --git a/opendaylight/sal/yang-prototype/yang/maven-yang/src/main/java/org/opendaylight/controller/yang2sources/spi/CodeGenerator.java b/opendaylight/sal/yang-prototype/yang/maven-yang/src/main/java/org/opendaylight/controller/yang2sources/spi/CodeGenerator.java new file mode 100644 index 0000000000..3042160a2a --- /dev/null +++ b/opendaylight/sal/yang-prototype/yang/maven-yang/src/main/java/org/opendaylight/controller/yang2sources/spi/CodeGenerator.java @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.controller.yang2sources.spi; + +import java.io.File; +import java.io.IOException; +import java.util.Collection; +import java.util.Map; +import java.util.Set; + +import org.apache.maven.plugin.logging.Log; +import org.apache.maven.project.MavenProject; +import org.opendaylight.controller.yang.model.api.Module; +import org.opendaylight.controller.yang.model.api.SchemaContext; + +/** + * Classes implementing this interface can be submitted to maven-yang-plugin's + * generate-sources goal. + */ +public interface CodeGenerator { + + /** + * Generate sources from provided {@link SchemaContext} + * + * @param context + * parsed from yang files + * @param outputBaseDir + * expected output directory for generated sources configured by + * user + * @param currentModules + * yang modules parsed from yangFilesRootDir + * @return collection of files that were generated from schema context + * @throws IOException + */ + Collection generateSources(SchemaContext context, File outputBaseDir, Set currentModules) + throws IOException; + + /** + * Utilize maven logging if necessary + * + * @param log + */ + void setLog(Log log); + + /** + * Provided map contains all configuration that was set in pom for code + * generator in additionalConfiguration tag + * + * @param additionalConfiguration + */ + void setAdditionalConfig(Map additionalConfiguration); + + /** + * Provided folder is marked as resources and its content will be packaged + * in resulting jar. Feel free to add necessary resources + * + * @param resourceBaseDir + */ + void setResourceBaseDir(File resourceBaseDir); + + /** + * Provided maven project object. Any additional information about current + * maven project can be accessed from it. + * + * @param project + */ + void setMavenProject(MavenProject project); +}