Class ConfigMojo

java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.chenile.config.plugin.ConfigMojo
All Implemented Interfaces:
ContextEnabled, Mojo

@Mojo(name="generate", requiresProject=true, defaultPhase=INTEGRATION_TEST, requiresDependencyResolution=TEST, threadSafe=true) public class ConfigMojo extends AbstractMojo
Generate a Chenile Service Registry configuration from ChenileConfiguration
  • Field Details

    • INFO_SERVICE_NAME

      private static final String INFO_SERVICE_NAME
      The name of the info service (this will be excluded)
      See Also:
    • infoUrl

      @Parameter(defaultValue="http://localhost:8080/info", property="org.chenile.config.plugin.infoUrl", required=true) private String infoUrl
      The URL from where the api doc is retrieved.
    • serviceInfoUrlPrefix

      @Parameter(defaultValue="http://localhost:8080/service-info/", property="org.chenile.config.plugin.serviceInfoUrlPrefix", required=true) private String serviceInfoUrlPrefix
      The URL from where the api doc is retrieved.
    • outputDir

      @Parameter(defaultValue="${project.build.directory}/service-registry", property="org.chenile.config.plugin.outputDir", required=true) private File outputDir
      Output directory for the generated Service registry JSON.
    • project

      @Parameter(defaultValue="${project}", readonly=true) private MavenProject project
      The Project.
    • skip

      @Parameter(defaultValue="false", property="org.chenile.config.plugin.skip") private boolean skip
      Skip execution if set to true. Default is false.
    • skipInfoService

      @Parameter(defaultValue="true", property="org.chenile.config.plugin.skipInfoService") private boolean skipInfoService
    • projectHelper

      @Component private MavenProjectHelper projectHelper
      The Project helper.
    • GET

      private static final String GET
      The constant GET.
      See Also:
    • objectMapper

      private static final ObjectMapper objectMapper
  • Constructor Details

    • ConfigMojo

      public ConfigMojo()
  • Method Details

    • execute

      public void execute()
    • obtainServices

      private List<Info.ServiceInfo> obtainServices()
    • makeGetCall

      private byte[] makeGetCall(String url)
    • processService

      private void processService(String name)
    • readFullyAsString

      private String readFullyAsString(InputStream inputStream) throws IOException
      Read fully as string string.
      Parameters:
      inputStream - the input stream
      Returns:
      the string
      Throws:
      IOException - the io exception
    • readFully

      private ByteArrayOutputStream readFully(InputStream inputStream) throws IOException
      Read fully byte array output stream.
      Parameters:
      inputStream - the input stream
      Returns:
      the byte array output stream
      Throws:
      IOException - the io exception