public class Configuration
extends java.lang.Object
| Constructor and Description |
|---|
Configuration() |
| Modifier and Type | Method and Description |
|---|---|
AccessAssertion |
getAccessAssertion() |
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() |
OldApiConfig |
getOldApi()
Get the configuration options on how to interpret the request in the form of the old API.
|
java.lang.String |
getOutputFilename() |
java.util.List<HttpProxy> |
getProxies()
Get the http proxies used by in all requests in this syste.
|
com.google.common.base.Optional<? extends org.geotools.styling.Style> |
getStyle(java.lang.String styleName,
MapfishMapContext mapContext)
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() |
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 then if the request JSON has extra parameters 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.ArrayList<java.lang.String> access)
The roles required to access this configuration/app.
|
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 |
setOldApi(OldApiConfig oldApi)
Set the configuration options on how to interpret the request in the form of the old API.
|
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 |
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) |
void |
setThrowErrorOnExtraParameters(boolean throwErrorOnExtraParameters) |
java.util.List<java.lang.Throwable> |
validate()
Validate that the configuration is valid.
|
@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 defaultpublic final void setPdfConfig(PDFConfig pdfConfig)
pdfConfig - the pdf configurationpublic 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.@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()
public 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 java.util.Map<java.lang.String,Template> getTemplates()
public final Template getTemplate(java.lang.String name)
name - the template name;public final void setTemplates(java.util.Map<java.lang.String,Template> templates)
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 com.google.common.base.Optional<? extends org.geotools.styling.Style> getStyle(java.lang.String styleName,
MapfishMapContext mapContext)
styleName - the name of the style to look upmapContext - information about the map projection, bounds, size, etc...@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)
public 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.ArrayList<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 OldApiConfig getOldApi()
public final void setOldApi(OldApiConfig oldApi)
oldApi - the old api configuration object