Search in sources :

Example 6 with ModelData

use of io.syndesis.common.model.ModelData in project syndesis by syndesisio.

the class GenerateMapperInspectionsMojo method execute.

@Override
public void execute() throws MojoExecutionException, MojoFailureException {
    try {
        final Resource resource = new Resource();
        resource.setDirectory(outputDir.getCanonicalPath());
        project.addResource(resource);
        final Set<File> generated = new HashSet<>();
        final ReadApiClientData reader = new ReadApiClientData();
        final List<ModelData<?>> modelList = reader.readDataFromFile("io/syndesis/server/dao/deployment.json");
        for (final ModelData<?> model : modelList) {
            if (model.getKind() == Kind.Connector) {
                final Connector connector = (Connector) model.getData();
                for (final ConnectorAction action : connector.getActions()) {
                    process(generated, connector, action, action.getInputDataShape());
                    process(generated, connector, action, action.getOutputDataShape());
                }
            }
        }
    } catch (final IOException e) {
        throw new MojoFailureException(e.getMessage(), e);
    }
}
Also used : ModelData(io.syndesis.common.model.ModelData) Connector(io.syndesis.common.model.connection.Connector) Resource(org.apache.maven.model.Resource) MojoFailureException(org.apache.maven.plugin.MojoFailureException) ConnectorAction(io.syndesis.common.model.action.ConnectorAction) IOException(java.io.IOException) File(java.io.File) HashSet(java.util.HashSet) ReadApiClientData(io.syndesis.server.dao.init.ReadApiClientData)

Aggregations

ModelData (io.syndesis.common.model.ModelData)6 ReadApiClientData (io.syndesis.server.dao.init.ReadApiClientData)4 Test (org.junit.Test)4 Integration (io.syndesis.common.model.integration.Integration)3 ConnectorAction (io.syndesis.common.model.action.ConnectorAction)2 Connection (io.syndesis.common.model.connection.Connection)2 Connector (io.syndesis.common.model.connection.Connector)2 InputStream (java.io.InputStream)2 ArrayList (java.util.ArrayList)2 Kind (io.syndesis.common.model.Kind)1 Action (io.syndesis.common.model.action.Action)1 ConnectorGroup (io.syndesis.common.model.connection.ConnectorGroup)1 ConnectorTemplate (io.syndesis.common.model.connection.ConnectorTemplate)1 Step (io.syndesis.common.model.integration.Step)1 File (java.io.File)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 Arrays (java.util.Arrays)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1