Package io.wcm.devops.conga.model.role
Class RoleFile
- java.lang.Object
-
- io.wcm.devops.conga.model.shared.AbstractModel
-
- io.wcm.devops.conga.model.role.RoleFile
-
- All Implemented Interfaces:
Serializable
public final class RoleFile extends AbstractModel
Defines a file to be generated or downloaded for a role.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
RoleFile.RoleFileVariantMetadata
Role file variant with metadata.
-
Constructor Summary
Constructors Constructor Description RoleFile()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getCharset()
Defines a charset to be used for the generated file.String
getCondition()
Defines a condition whether the file should be generated or not.String
getDir()
Sets the directory to generate or download the file in.String
getEscapingStrategy()
Defines an handlebars escaping strategy plugin to be used.String
getFile()
Defines the file name of the generated or downloaded file.String
getFileHeader()
Defines the name of a file header plugin that should be applied to the generated file.LineEndings
getLineEndings()
Defines the line endings style for the generated files.Map<String,Object>
getModelOptions()
Defines additional options that are written to the exported model metadata for this file.String
getMultiply()
Defines a multiply plugin name to be used.Map<String,Object>
getMultiplyOptions()
Defines configuration parameters that are passed as options to the multiply plugin.Map<String,Object>
getPostProcessorOptions()
Defines configuration parameters that are passed as options to the post processor plugins.List<String>
getPostProcessors()
Defines a list of post processor plugin names that should be applied to the generated file.String
getSymlinkTarget()
Target path for symlink.String
getTemplate()
Defines the template name to be used to generate the file.String
getUrl()
URL to download file from.Map<String,Object>
getValidatorOptions()
Defines configuration parameters that are passed as options to the validator plugins.List<String>
getValidators()
Defines a list of validator plugin names that should be applied to the generated file.List<String>
getVariants()
Defines the role variant names for which this file should be generated.List<RoleFile.RoleFileVariantMetadata>
getVariantsMetadata()
boolean
isDeleteSource()
Whether to delete the the source file that was copied with this file definition.void
setCharset(String charset)
void
setCondition(String condition)
void
setDeleteSource(boolean deleteSource)
void
setDir(String dir)
void
setEscapingStrategy(String escapingStrategy)
void
setFile(String name)
void
setFileHeader(String fileHeader)
void
setLineEndings(LineEndings lineEndings)
void
setModelOptions(Map<String,Object> modelOptions)
void
setMultiply(String multiply)
void
setMultiplyOptions(Map<String,Object> multiplyOptions)
void
setPostProcessorOptions(Map<String,Object> postProcessorOptions)
void
setPostProcessors(List<String> postProcessors)
void
setSymlinkTarget(String symlinkTarget)
void
setTemplate(String template)
void
setUrl(String url)
void
setValidatorOptions(Map<String,Object> validatorOptions)
void
setValidators(List<String> validators)
void
setVariants(List<String> variants)
-
Methods inherited from class io.wcm.devops.conga.model.shared.AbstractModel
toString
-
-
-
-
Method Detail
-
getFile
public String getFile()
Defines the file name of the generated or downloaded file. Variable placeholders can be used to reference variables or context properties, e.g.${tenant}
for the current tenant name if a tenant multiply plugin is used.- Returns:
- File name
-
setFile
public void setFile(String name)
-
getDir
public String getDir()
Sets the directory to generate or download the file in. The directory name is relative to the configuration target directory of the node. Variable placeholders can be used to reference variables or context properties, e.g.${tenant}
for the current tenant name if a tenant multiply plugin is used.- Returns:
- Directory name
-
setDir
public void setDir(String dir)
-
getTemplate
public String getTemplate()
Defines the template name to be used to generate the file. The template file should have an ".hbs" extension. The file name is resolved relative to the template directory of the role.- Returns:
- Template file name
-
setTemplate
public void setTemplate(String template)
-
getUrl
public String getUrl()
URL to download file from. If a URL is defined the template is ignored, and the target file property optional. If no file property is defined, the file name of the downloaded file is used. For URL protocols you can use http://, https://, classpath:// file:// or mvn://.- Returns:
- Download URL
-
setUrl
public void setUrl(String url)
-
getSymlinkTarget
public String getSymlinkTarget()
Target path for symlink. If a symlink target is defined, no file is generated or downloaded, but a symlink is created in the file system pointing to the given target. The target has to point to another file generated or downloaded by CONGA.- Returns:
- Symlink target
-
setSymlinkTarget
public void setSymlinkTarget(String symlinkTarget)
-
getVariants
public List<String> getVariants()
Defines the role variant names for which this file should be generated. If no names are defined the file is generated for all role variants. If the node/role has multiple variants, the file is generated if at least one variant from the file definition matches with at least one variant from the role/file ("or"). If the variant name is suffixed with a "*" this variant has to be matched ("and"). The "*" is not part of the variant name.- Returns:
- List of role variant names
-
getVariantsMetadata
public List<RoleFile.RoleFileVariantMetadata> getVariantsMetadata()
- Returns:
- List of variants with metadata ("*" suffix is parsed)
-
getCondition
public String getCondition()
Defines a condition whether the file should be generated or not. The condition contains one single variable placeholder reference, e.g.${myvar}
. The condition is true if the resulting string of the variable is not empty and does not match "false".- Returns:
- Condition expression
-
setCondition
public void setCondition(String condition)
-
getFileHeader
public String getFileHeader()
Defines the name of a file header plugin that should be applied to the generated file. If no name is given the best-matching plugin is detected automatically by the file extension. If this is not wished, explicitly setting the property to "none" ensures that no plugin is applied.- Returns:
- File header plugin name
-
setFileHeader
public void setFileHeader(String fileHeader)
-
getValidators
public List<String> getValidators()
Defines a list of validator plugin names that should be applied to the generated file. If none is given the best-matching plugins are detected automatically by the file extension. If this is not wished, explicitly setting a list entry with "none" ensures that no plugin is applied.- Returns:
- List of validator plugin names
-
getValidatorOptions
public Map<String,Object> getValidatorOptions()
Defines configuration parameters that are passed as options to the validator plugins. They are merged with the configuration parameters from the configuration inheritance tree.- Returns:
- Configuration parameters
-
getPostProcessors
public List<String> getPostProcessors()
Defines a list of post processor plugin names that should be applied to the generated file.- Returns:
- List of post processor plugin names
-
getPostProcessorOptions
public Map<String,Object> getPostProcessorOptions()
Defines configuration parameters that are passed as options to the post processor plugins. They are merged with the configuration parameters from the configuration inheritance tree.Two generic parameters are supported for all post processor:
postProcessor.fileHeader
: Allows to set a file header for the post-processed files (or "none" for no header).postProcessor.validators
: Allows to set a list of validators for the post-processed files (or "none" for no validation)
- Returns:
- Configuration parameters
-
setPostProcessorOptions
public void setPostProcessorOptions(Map<String,Object> postProcessorOptions)
-
getMultiply
public String getMultiply()
Defines a multiply plugin name to be used. Using a mulitply plugin multiple files are generated instead of a single file, e.g. one per tenant. To ensure each file has a unique file name variables have to be used in the "file" property.- Returns:
- Multiply plugin name
-
setMultiply
public void setMultiply(String multiply)
-
getMultiplyOptions
public Map<String,Object> getMultiplyOptions()
Defines configuration parameters that are passed as options to the multiply plugin. They are merged with the configuration parameters from the configuration inheritance tree.- Returns:
- Configuration parameters
-
getCharset
public String getCharset()
Defines a charset to be used for the generated file. It is expected that the templates is encoded in the same charset. If not set UTF-8 is the default charset.- Returns:
- Charset name
-
setCharset
public void setCharset(String charset)
-
getLineEndings
public LineEndings getLineEndings()
Defines the line endings style for the generated files. Possible values are 'unix', 'windows' and 'macos'. If not set 'unix' line endings are the default.- Returns:
- Line endings style
-
setLineEndings
public void setLineEndings(LineEndings lineEndings)
-
getEscapingStrategy
public String getEscapingStrategy()
Defines an handlebars escaping strategy plugin to be used. If no name is given the best-matching plugin is detected automatically by the file extension. If this is not wished, explicitly setting the property to "none" ensures that no plugin is applied.- Returns:
- Handlebars escaping strategy plugin name.
-
setEscapingStrategy
public void setEscapingStrategy(String escapingStrategy)
-
getModelOptions
public Map<String,Object> getModelOptions()
Defines additional options that are written to the exported model metadata for this file.- Returns:
- Model options
-
isDeleteSource
public boolean isDeleteSource()
Whether to delete the the source file that was copied with this file definition. This can only be applied when a) the file defined was not generated but copied from an url and b) the url file provider supports deleting the source file (e.g. in local file system and not a remote URL).- Returns:
- true if the source file references by the url should be deleted
-
setDeleteSource
public void setDeleteSource(boolean deleteSource)
-
-