2 * Copyright (c) 2015 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.yang2sources.spi;
11 import java.io.IOException;
12 import java.util.Collection;
14 import java.util.Optional;
16 import java.util.function.Function;
17 import org.opendaylight.yangtools.yang.model.api.Module;
18 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
21 * Maven 3.1.x and newer uses SLF4J internally, which means we do not need to pass
22 * a logger instance around.
24 public interface BasicCodeGenerator {
26 * Generate sources from provided {@link SchemaContext}.
29 * parsed from YANG files
30 * @param outputBaseDir
31 * expected output directory for generated sources configured by
33 * @param currentModules
34 * YANG modules parsed from yangFilesRootDir
35 * @param moduleResourcePathResolver
36 * Function converting a local module to the packaged resource path
37 * @return collection of files that were generated from schema context
39 Collection<File> generateSources(SchemaContext context, File outputBaseDir, Set<Module> currentModules,
40 Function<Module, Optional<String>> moduleResourcePathResolver) throws IOException;
43 * Provided map contains all configuration that was set in pom for code
44 * generator in additionalConfiguration tag.
46 void setAdditionalConfig(Map<String, String> additionalConfiguration);
49 * Provided folder is marked as resources and its content will be packaged
50 * in resulting jar. Feel free to add necessary resources.
52 void setResourceBaseDir(File resourceBaseDir);