use of io.micronaut.starter.application.Project in project micronaut-starter by micronaut-projects.
the class CreateKafkaProducer method call.
@Override
public Integer call() throws Exception {
Project project = getProject(producerName);
TemplateRenderer templateRenderer = getTemplateRenderer(project);
RenderResult renderResult = null;
String path = "/{packagePath}/{className}";
path = config.getSourceLanguage().getSourcePath(path);
RockerModel rockerModel = null;
if (config.getSourceLanguage() == Language.JAVA) {
rockerModel = javaProducer.template(project);
} else if (config.getSourceLanguage() == Language.GROOVY) {
rockerModel = groovyProducer.template(project);
} else if (config.getSourceLanguage() == Language.KOTLIN) {
rockerModel = kotlinProducer.template(project);
}
renderResult = templateRenderer.render(new RockerTemplate(path, rockerModel), overwrite);
if (renderResult != null) {
if (renderResult.isSuccess()) {
out("@|blue ||@ Rendered Kafka producer to " + renderResult.getPath());
} else if (renderResult.isSkipped()) {
warning("Rendering skipped for " + renderResult.getPath() + " because it already exists. Run again with -f to overwrite.");
} else if (renderResult.getError() != null) {
throw renderResult.getError();
}
}
return 0;
}
use of io.micronaut.starter.application.Project in project micronaut-starter by micronaut-projects.
the class CreateNatsProducer method call.
@Override
public Integer call() throws Exception {
Project project = getProject(producerName);
TemplateRenderer templateRenderer = getTemplateRenderer(project);
RenderResult renderResult = null;
String path = "/{packagePath}/{className}";
path = config.getSourceLanguage().getSourcePath(path);
RockerModel rockerModel = null;
if (config.getSourceLanguage() == Language.JAVA) {
rockerModel = javaProducer.template(project);
} else if (config.getSourceLanguage() == Language.GROOVY) {
rockerModel = groovyProducer.template(project);
} else if (config.getSourceLanguage() == Language.KOTLIN) {
rockerModel = kotlinProducer.template(project);
}
renderResult = templateRenderer.render(new RockerTemplate(path, rockerModel), overwrite);
if (renderResult != null) {
if (renderResult.isSuccess()) {
out("@|blue ||@ Rendered Nats producer to " + renderResult.getPath());
} else if (renderResult.isSkipped()) {
warning("Rendering skipped for " + renderResult.getPath() + " because it already exists. Run again with -f to overwrite.");
} else if (renderResult.getError() != null) {
throw renderResult.getError();
}
}
return 0;
}
use of io.micronaut.starter.application.Project in project micronaut-starter by micronaut-projects.
the class CreateRabbitMQProducer method call.
@Override
public Integer call() throws Exception {
Project project = getProject(producerName);
TemplateRenderer templateRenderer = getTemplateRenderer(project);
RenderResult renderResult = null;
String path = "/{packagePath}/{className}";
path = config.getSourceLanguage().getSourcePath(path);
RockerModel rockerModel = null;
if (config.getSourceLanguage() == Language.JAVA) {
rockerModel = javaProducer.template(project);
} else if (config.getSourceLanguage() == Language.GROOVY) {
rockerModel = groovyProducer.template(project);
} else if (config.getSourceLanguage() == Language.KOTLIN) {
rockerModel = kotlinProducer.template(project);
}
renderResult = templateRenderer.render(new RockerTemplate(path, rockerModel), overwrite);
if (renderResult != null) {
if (renderResult.isSuccess()) {
out("@|blue ||@ Rendered RabbitMQ producer to " + renderResult.getPath());
} else if (renderResult.isSkipped()) {
warning("Rendering skipped for " + renderResult.getPath() + " because it already exists. Run again with -f to overwrite.");
} else if (renderResult.getError() != null) {
throw renderResult.getError();
}
}
return 0;
}
use of io.micronaut.starter.application.Project in project micronaut-starter by micronaut-projects.
the class CreateWebsocketServerCommand method call.
@Override
public Integer call() throws Exception {
Project project = getProject(serverName);
TemplateRenderer templateRenderer = getTemplateRenderer(project);
RenderResult renderResult = null;
if (config.getSourceLanguage() == Language.JAVA) {
renderResult = templateRenderer.render(new RockerTemplate("src/main/java/{packagePath}/{className}Server.java", javaWebsocketServer.template(project)), overwrite);
} else if (config.getSourceLanguage() == Language.GROOVY) {
renderResult = templateRenderer.render(new RockerTemplate("src/main/groovy/{packagePath}/{className}Server.groovy", groovyWebsocketServer.template(project)), overwrite);
} else if (config.getSourceLanguage() == Language.KOTLIN) {
renderResult = templateRenderer.render(new RockerTemplate("src/main/kotlin/{packagePath}/{className}Server.kt", kotlinWebsocketServer.template(project)), overwrite);
}
if (renderResult != null) {
if (renderResult.isSuccess()) {
out("@|blue ||@ Rendered websocket server to " + renderResult.getPath());
} else if (renderResult.isSkipped()) {
warning("Rendering skipped for " + renderResult.getPath() + " because it already exists. Run again with -f to overwrite.");
} else if (renderResult.getError() != null) {
throw renderResult.getError();
}
}
return 0;
}
use of io.micronaut.starter.application.Project in project micronaut-starter by micronaut-projects.
the class AwsLambdaCustomRuntime method apply.
@SuppressWarnings("EmptyBlock")
@Override
public void apply(GeneratorContext generatorContext) {
ApplicationFeature.super.apply(generatorContext);
ApplicationType applicationType = generatorContext.getApplicationType();
Project project = generatorContext.getProject();
if (shouldGenerateMainClassForRuntime(generatorContext)) {
addBookLambdaRuntime(generatorContext, project);
}
addBootstrap(generatorContext, applicationType);
}
Aggregations