Package org.chenile.config.plugin
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 Summary
Modifier and TypeFieldDescriptionprivate static final String
The constant GET.private static final String
The name of the info service (this will be excluded)private String
The URL from where the api doc is retrieved.private static final ObjectMapper
private File
Output directory for the generated Service registry JSON.private MavenProject
The Project.private MavenProjectHelper
The Project helper.private String
The URL from where the api doc is retrieved.private boolean
Skip execution if set to true.private boolean
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
execute()
private byte[]
makeGetCall
(String url) private List<Info.ServiceInfo>
private void
processService
(String name) private ByteArrayOutputStream
readFully
(InputStream inputStream) Read fully byte array output stream.private String
readFullyAsString
(InputStream inputStream) Read fully as string string.Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
Field Details
-
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 infoUrlThe 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 serviceInfoUrlPrefixThe 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 outputDirOutput directory for the generated Service registry JSON. -
project
The Project. -
skip
@Parameter(defaultValue="false", property="org.chenile.config.plugin.skip") private boolean skipSkip execution if set to true. Default is false. -
skipInfoService
@Parameter(defaultValue="true", property="org.chenile.config.plugin.skipInfoService") private boolean skipInfoService -
projectHelper
The Project helper. -
GET
The constant GET.- See Also:
-
objectMapper
-
-
Constructor Details
-
ConfigMojo
public ConfigMojo()
-
-
Method Details
-
execute
public void execute() -
obtainServices
-
makeGetCall
-
processService
-
readFullyAsString
Read fully as string string.- Parameters:
inputStream
- the input stream- Returns:
- the string
- Throws:
IOException
- the io exception
-
readFully
Read fully byte array output stream.- Parameters:
inputStream
- the input stream- Returns:
- the byte array output stream
- Throws:
IOException
- the io exception
-