Search in sources :

Example 1 with DefaultAtlasFieldActionService

use of io.atlasmap.core.DefaultAtlasFieldActionService in project atlasmap by atlasmap.

the class GenerateFieldActionsMojo method generateFieldAction.

private void generateFieldAction(List<URL> urls) throws MojoFailureException, MojoExecutionException {
    DefaultAtlasFieldActionService fieldActionService = DefaultAtlasFieldActionService.getInstance();
    ClassLoader origTccl = Thread.currentThread().getContextClassLoader();
    ActionDetails answer = new ActionDetails();
    try (URLClassLoader loader = new URLClassLoader(urls.toArray(new URL[urls.size()]), origTccl)) {
        fieldActionService.init(loader);
    } catch (Exception e) {
        throw new MojoExecutionException("Could not load field actions:", e);
    }
    answer.getActionDetail().addAll(fieldActionService.listActionDetails());
    writeToJsonFile(DEFAULT_OUTPUT_FILE_PREFIX, answer);
}
Also used : MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) URLClassLoader(java.net.URLClassLoader) URLClassLoader(java.net.URLClassLoader) ActionDetails(io.atlasmap.v2.ActionDetails) DefaultAtlasFieldActionService(io.atlasmap.core.DefaultAtlasFieldActionService) URL(java.net.URL) MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) MojoFailureException(org.apache.maven.plugin.MojoFailureException)

Aggregations

DefaultAtlasFieldActionService (io.atlasmap.core.DefaultAtlasFieldActionService)1 ActionDetails (io.atlasmap.v2.ActionDetails)1 URL (java.net.URL)1 URLClassLoader (java.net.URLClassLoader)1 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)1 MojoFailureException (org.apache.maven.plugin.MojoFailureException)1