public class TargetHostsBuilder extends java.lang.Object implements ITargetHostsBuilder
Modifier and Type | Field and Description |
---|---|
private static org.slf4j.Logger |
logger
The logger.
|
Constructor and Description |
---|
TargetHostsBuilder()
Instantiates a new target hosts builder.
|
Modifier and Type | Method and Description |
---|---|
private java.lang.String |
getContentFromPath(java.lang.String sourcePath,
HostsSourceType sourceType)
note that for read from file, this will just load all to memory.
|
java.util.List<java.lang.String> |
setTargetHostsFromCmsQueryUrl(java.lang.String cmsQueryUrl)
Sets the target hosts from cms query url.
|
java.util.List<java.lang.String> |
setTargetHostsFromCmsQueryUrl(java.lang.String cmsQueryUrl,
java.lang.String projection)
Sets the target hosts from cms query url.
|
java.util.List<java.lang.String> |
setTargetHostsFromJsonPath(java.lang.String jsonPath,
java.lang.String sourcePath,
HostsSourceType sourceType)
TODO https://github.com/jayway/JsonPath
|
java.util.List<java.lang.String> |
setTargetHostsFromLineByLineText(java.lang.String sourcePath,
HostsSourceType sourceType)
get target hosts from line by line.
|
java.util.List<java.lang.String> |
setTargetHostsFromList(java.util.List<java.lang.String> targetHosts)
Sets the target hosts from list.
|
java.util.List<java.lang.String> |
setTargetHostsFromString(java.lang.String targetHostsStr)
Sets the target hosts from string.
|
public TargetHostsBuilder()
private java.lang.String getContentFromPath(java.lang.String sourcePath, HostsSourceType sourceType) throws java.io.IOException
sourcePath
- the source pathsourceType
- the source typejava.io.IOException
- Signals that an I/O exception has occurred.public java.util.List<java.lang.String> setTargetHostsFromList(java.util.List<java.lang.String> targetHosts)
ITargetHostsBuilder
setTargetHostsFromList
in interface ITargetHostsBuilder
targetHosts
- the target hostspublic java.util.List<java.lang.String> setTargetHostsFromString(java.lang.String targetHostsStr)
ITargetHostsBuilder
setTargetHostsFromString
in interface ITargetHostsBuilder
targetHostsStr
- the target hosts strpublic java.util.List<java.lang.String> setTargetHostsFromJsonPath(java.lang.String jsonPath, java.lang.String sourcePath, HostsSourceType sourceType) throws TargetHostsLoadException
setTargetHostsFromJsonPath
in interface ITargetHostsBuilder
jsonPath
- the json pathsourcePath
- the source pathsourceType
- the source typeTargetHostsLoadException
- the target hosts load exceptionpublic java.util.List<java.lang.String> setTargetHostsFromLineByLineText(java.lang.String sourcePath, HostsSourceType sourceType) throws TargetHostsLoadException
setTargetHostsFromLineByLineText
in interface ITargetHostsBuilder
sourcePath
- the source pathsourceType
- the source typeTargetHostsLoadException
- the target hosts load exceptionpublic java.util.List<java.lang.String> setTargetHostsFromCmsQueryUrl(java.lang.String cmsQueryUrl) throws TargetHostsLoadException
ITargetHostsBuilder
setTargetHostsFromCmsQueryUrl
in interface ITargetHostsBuilder
cmsQueryUrl
- the cms query urlTargetHostsLoadException
- the target hosts load exceptionpublic java.util.List<java.lang.String> setTargetHostsFromCmsQueryUrl(java.lang.String cmsQueryUrl, java.lang.String projection)
ITargetHostsBuilder
setTargetHostsFromCmsQueryUrl
in interface ITargetHostsBuilder
cmsQueryUrl
- the cms query urlprojection
- the projection