X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fsal%2Fyang-prototype%2Fcode-generator%2Fmaven-yang-plugin%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fyang2sources%2Fplugin%2FYangToResourcesMojo.java;h=b4490499cfd43dcc3d727240d0ccb5b2aa9a9b16;hb=332c66867273c6d2f73080ae124c6c4d8977d099;hp=7bb49dc0dff1abb78d6d893b198077dc28425659;hpb=78718ca2980d6289703f239abb6b7928ea08c8e4;p=controller.git diff --git a/opendaylight/sal/yang-prototype/code-generator/maven-yang-plugin/src/main/java/org/opendaylight/controller/yang2sources/plugin/YangToResourcesMojo.java b/opendaylight/sal/yang-prototype/code-generator/maven-yang-plugin/src/main/java/org/opendaylight/controller/yang2sources/plugin/YangToResourcesMojo.java index 7bb49dc0df..b4490499cf 100644 --- a/opendaylight/sal/yang-prototype/code-generator/maven-yang-plugin/src/main/java/org/opendaylight/controller/yang2sources/plugin/YangToResourcesMojo.java +++ b/opendaylight/sal/yang-prototype/code-generator/maven-yang-plugin/src/main/java/org/opendaylight/controller/yang2sources/plugin/YangToResourcesMojo.java @@ -23,14 +23,40 @@ import org.opendaylight.controller.yang2sources.spi.ResourceGenerator; import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.Maps; +/** + * Generate resources from yang files using user provided set of + * {@link ResourceGenerator}s. Can be used to copy yang files that served as + * blueprint for code generation into resources directory. Steps of this + * process: + *
    + *
  1. List yang files from {@link #yangFilesRootDir} (If this goal is in the + * same execution as generate-sources, the same cached list will be used and the + * root folder will not be searched for yang files twice)
  2. + *
  3. For each {@link ResourceGenerator} from {@link #resourceProviders}:
  4. + *
      + *
    1. Instantiate using default constructor
    2. + *
    3. Call {@link ResourceGenerator#generateResourceFiles(Collection, File)}
    4. + *
    + *
+ */ @Mojo(name = "generate-resources", defaultPhase = LifecyclePhase.GENERATE_RESOURCES) public final class YangToResourcesMojo extends AbstractMojo { private static final String LOG_PREFIX = "yang-to-resources:"; + /** + * Classes implementing {@link ResourceGenerator} interface. An instance + * will be created out of every class using default constructor. Method + * {@link ResourceGenerator#generateResourceFiles(Collection, File)} will be + * called on every instance. + */ @Parameter(required = true) private ResourceProviderArg[] resourceProviders; + /** + * Source directory that will be recursively searched for yang files (ending + * with .yang suffix). + */ @Parameter(required = true) private String yangFilesRootDir;