io.vlingo.maven.codegen.ActorProxyGenerator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of vlingo-maven-plugin Show documentation
Show all versions of vlingo-maven-plugin Show documentation
Maven plugin supporting the vlingo platform.
// Copyright © 2012-2018 Vaughn Vernon. All rights reserved.
//
// This Source Code Form is subject to the terms of the
// Mozilla Public License, v. 2.0. If a copy of the MPL
// was not distributed with this file, You can obtain
// one at https://mozilla.org/MPL/2.0/.
package io.vlingo.maven.codegen;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.Mojo;
import io.vlingo.actors.ProxyGenerator;
@Mojo(name="actorProxyGen")
public class ActorProxyGenerator extends AbstractMojo {
@org.apache.maven.plugins.annotations.Parameter(required=true)
private String[] actorProtocols;
private final io.vlingo.actors.Logger logger;
public ActorProxyGenerator() {
this.logger = io.vlingo.actors.Logger.testLogger();
logger.log("vlingo/maven: Actor proxy generator loaded.");
}
public void execute() throws MojoExecutionException {
try (final ProxyGenerator generator = ProxyGenerator.forMain(true, logger)) {
for (final String actorProtocol : actorProtocols) {
logger.log("vlingo/maven: Generating proxy for: " + actorProtocol);
generator.generateFor(actorProtocol);
logger.log("vlingo/maven: Generation done.");
}
} catch (Exception e) {
final String message = "Proxy generator failed because: " + e.getMessage();
logger.log(message, e);
e.printStackTrace();
throw new MojoExecutionException(message, e);
}
}
}