public class Configuration extends java.lang.Object implements ConfigurationObject
| Constructor and Description |
|---|
Configuration() |
| Modifier and Type | Method and Description |
|---|---|
AccessAssertion |
getAccessAssertion() |
UriMatchers |
getAllowedReferersImpl() |
CertificateStore |
getCertificateStore()
The configuration for locating a custom certificate store.
|
java.util.List<HttpCredential> |
getCredentials()
Get the http credentials.
|
org.geotools.styling.Style |
getDefaultStyle(java.lang.String geometryType)
Get a default style.
|
java.io.File |
getDirectory() |
java.lang.String |
getOpaqueTileErrorColor()
Get the color used to draw the other tiles error default: pink.
|
java.lang.String |
getOutputFilename() |
java.util.List<HttpProxy> |
getProxies()
Get the http proxies used by in all requests in this syste.
|
java.lang.String |
getResourceBundle()
Get the resource bundle name.
|
SmtpConfig |
getSmtp() |
java.util.Optional<? extends org.geotools.styling.Style> |
getStyle(java.lang.String styleName)
Return the named style ot Optional.absent() if there is not a style with the given name.
|
Template |
getTemplate(java.lang.String name)
Retrieve the configuration of the named template.
|
java.util.Map<java.lang.String,Template> |
getTemplates() |
java.lang.String |
getTransparentTileErrorColor()
Get the color used to draw the WMS tiles error default: transparent pink.
|
void |
init()
Initialize some optionally wired fields.
|
boolean |
isAccessible(java.lang.String pathToSubResource)
check if the file exists and can be accessed by the user/template/config/etc...
|
boolean |
isThrowErrorOnExtraParameters()
If true and the request JSON has extra parameters in the layers definition, exceptions will be thrown.
|
byte[] |
loadFile(java.lang.String pathToSubResource)
Load the file related to the configuration file.
|
void |
printClientConfig(org.json.JSONWriter json)
Print out the configuration that the client needs to make a request.
|
boolean |
renderAsSvg(java.lang.Boolean renderAsSvg)
Either use the provided value (renderAsSvg) or if it is null then use
defaultToSvg. |
void |
setAccess(java.util.List<java.lang.String> access)
The roles required to access this configuration/app.
|
void |
setAllowedReferers(java.util.List<? extends URIMatcher> matchers)
The matchers used to authorize the incoming requests in function of the referer.
|
void |
setCertificateStore(CertificateStore certificateStore)
The configuration for locating a custom certificate store.
|
void |
setConfigurationFile(java.io.File configurationFile) |
void |
setCredentials(java.util.List<HttpCredential> credentials)
Http credentials to be used when making http requests.
|
void |
setDefaultStyle(java.util.Map<java.lang.String,org.geotools.styling.Style> defaultStyle)
Set the default styles.
|
void |
setDefaultToSvg(boolean defaultToSvg)
If true then all vector layers (and other parts of the system that can be either SVG or Bitmap, like
scalebar) will be rendered as SVG (unless layer specifically indicates useSvg as false).
|
void |
setFileLoaderManager(ConfigFileLoaderManager fileLoaderManager)
Set file loader manager.
|
void |
setJdbcDrivers(java.util.Set<java.lang.String> jdbcDrivers)
Set the JDBC drivers that are required to connect to the databases in the configuration.
|
void |
setOpaqueTileErrorColor(java.lang.String opaqueTileErrorColor)
Color used for tiles in error on opaque layers.
|
void |
setOutputFilename(java.lang.String outputFilename)
The default output file name of the report.
|
void |
setPdfConfig(PDFConfig pdfConfig)
Configure various properties related to the reports generated as PDFs.
|
void |
setProxies(java.util.List<HttpProxy> proxies)
Configuration for proxying http requests.
|
void |
setResourceBundle(java.lang.String resourceBundle)
Set the resource bundle name.
|
void |
setSmtp(SmtpConfig smtp) |
void |
setStyles(java.util.Map<java.lang.String,java.lang.String> styles)
Set the named styles defined in the configuration for this.
|
void |
setTemplates(java.util.Map<java.lang.String,Template> templates)
Set the configuration of the named template.
|
void |
setThrowErrorOnExtraParameters(boolean throwErrorOnExtraParameters)
If true and the request JSON has extra parameters in the layers definition, exceptions will be thrown.
|
void |
setTransparentTileErrorColor(java.lang.String transparentTileErrorColor)
Color used for tiles in error on transparent layers.
|
java.util.List<java.lang.Throwable> |
validate()
Validate that the configuration is valid.
|
void |
validate(java.util.List<java.lang.Throwable> validationErrors,
Configuration configuration)
validate that the configuration was correct.
|
public final void setPdfConfig(PDFConfig pdfConfig)
pdfConfig - the pdf configuration@PostConstruct public final void init()
public final boolean renderAsSvg(java.lang.Boolean renderAsSvg)
defaultToSvg.renderAsSvg - the value to use if non-null.public final void setDefaultToSvg(boolean defaultToSvg)
The default is false.
defaultToSvg - whether or not to create svg layers by default@Nullable public final CertificateStore getCertificateStore()
public final void setCertificateStore(CertificateStore certificateStore)
certificateStore - The configuration for locating a custom certificate storepublic final java.util.List<HttpCredential> getCredentials()
HttpProxy is a
subclass of HttpCredential.public final void setCredentials(java.util.List<HttpCredential> credentials)
If a proxy needs credentials you don't need to configure it here because the proxy configuration object also has options for declaring the credentials.
credentials - the credentialspublic final java.util.List<HttpProxy> getProxies()
ConfigFileResolvingHttpRequestFactorypublic final void setProxies(java.util.List<HttpProxy> proxies)
HttpProxy for details on how to configure them.proxies - the proxy configuration objectspublic final void printClientConfig(org.json.JSONWriter json)
throws org.json.JSONException
json - the output writer.org.json.JSONExceptionpublic final java.lang.String getOutputFilename()
public final void setOutputFilename(java.lang.String outputFilename)
Template.setOutputFilename(String) and the outputFilename parameter in the
request JSON.
This can be a string and can also have a date section in the string that will be filled when the report is created for example a section with ${<dateFormatString>} will be replaced with the current date formatted in the way defined by the <dateFormatString> string. The format rules are the rules in java.text.SimpleDateFormat (do a google search if the link above is broken).
Example: outputFilename: print-${dd-MM-yyyy} should output:
print-22-11-2014.pdf
Note: the suffix will be appended to the end of the name.
outputFilename - default output file name of the report.public final java.util.Map<java.lang.String,Template> getTemplates()
public final void setTemplates(java.util.Map<java.lang.String,Template> templates)
templates - the templates;public final Template getTemplate(java.lang.String name)
name - the template name;public final java.io.File getDirectory()
public final void setConfigurationFile(java.io.File configurationFile)
public final void setStyles(java.util.Map<java.lang.String,java.lang.String> styles)
styles - the style definition. StyleParser plugins will be used to load the style.public final java.util.Optional<? extends org.geotools.styling.Style> getStyle(java.lang.String styleName)
styleName - the name of the style to look up@Nonnull
public final org.geotools.styling.Style getDefaultStyle(@Nonnull
java.lang.String geometryType)
geometryType - the name of the geometry type (point, line, polygon)public final void setDefaultStyle(java.util.Map<java.lang.String,org.geotools.styling.Style> defaultStyle)
defaultStyle - the mapping from geometry type name (point, polygon, etc...) to the style
to use for that type.public final boolean isThrowErrorOnExtraParameters()
public final void setThrowErrorOnExtraParameters(boolean throwErrorOnExtraParameters)
throwErrorOnExtraParameters - the valuepublic void validate(java.util.List<java.lang.Throwable> validationErrors,
Configuration configuration)
ConfigurationObjectvalidate in interface ConfigurationObjectvalidationErrors - a list to add any detected errors to.configuration - the containing configurationpublic final java.util.List<java.lang.Throwable> validate()
public final boolean isAccessible(java.lang.String pathToSubResource)
throws java.io.IOException
pathToSubResource - a string representing a file that is accessible for use in printing
templates within the configuration file. In the case of a file based URI the path could be a
relative path (relative to the configuration file) or an absolute path, but it must be an
allowed file (you can't allow access to any file on the file system).java.io.IOExceptionpublic final byte[] loadFile(java.lang.String pathToSubResource)
throws java.io.IOException
pathToSubResource - a string representing a file that is accessible for use in printing
templates within the configuration file. In the case of a file based URI the path could be a
relative path (relative to the configuration file) or an absolute path, but it must be an
allowed file (you can't allow access to any file on the file system).java.io.IOExceptionpublic final void setFileLoaderManager(ConfigFileLoaderManager fileLoaderManager)
fileLoaderManager - new manager.public final void setJdbcDrivers(java.util.Set<java.lang.String> jdbcDrivers)
jdbcUrl: "jdbc:postgresql://localhost:5432/morges_dpfe"
then you need to add:
jdbcDrivers: [org.postgresql.Driver]
or
jdbcDrivers:
- org.postgresql.Driver
jdbcDrivers - the set of JDBC drivers to load before performing a print (this ensures they
are registered with the JVM)public final void setAccess(java.util.List<java.lang.String> access)
Any user without the required role will get an error when trying to access any of the templates and no templates will be listed in the capabilities requests.
access - the roles needed to access thispublic final AccessAssertion getAccessAssertion()
public final java.lang.String getTransparentTileErrorColor()
public final void setTransparentTileErrorColor(java.lang.String transparentTileErrorColor)
transparentTileErrorColor - The colorpublic final java.lang.String getOpaqueTileErrorColor()
public final void setOpaqueTileErrorColor(java.lang.String opaqueTileErrorColor)
opaqueTileErrorColor - The colorpublic final java.lang.String getResourceBundle()
public final void setResourceBundle(java.lang.String resourceBundle)
resourceBundle - the resource bundle namepublic final UriMatchers getAllowedReferersImpl()
public final void setAllowedReferers(@Nullable
java.util.List<? extends URIMatcher> matchers)
allowedReferers:
- !hostnameMatch
host: example.com
allowSubDomains: true
By default, the referer is not checked
matchers - the list of matcher to use to check if a referer is permitted or null for no
checkURIMatcherpublic SmtpConfig getSmtp()
public void setSmtp(SmtpConfig smtp)