\section{Configuring the GNV-Server}

The configuration of the artifact- and mapserver is been done in the
central configuration directory at {\tt artifact-server/conf/}. The
central entry point is the file {\tt conf.xml}. All components of the
configuration are linked from this document. 

{\bf Within the configuration the key 
{\verb+${artifacts.config.dir}+} can be used to reference the central
configuration directory of the artifact-server instance, e.g. 
{\tt /opt/artifact-server}.}

The following structure gives an overview of the entire structure
starting from {\tt conf/}:

%% tree /opt/artifact-server/
\begin{lstlisting}
conf/
|-- arcsdeconnectionpool.properties # database connection
|-- charttemplate.xml # general properties for chart generation
|-- conf.xml # central configuration
|-- ehcache.xml # configuration of caching system
|-- log4j.properties # logging of server
|-- maptemplates # style defintions for rendering maps
|   `-- *.vm
|-- meshwidth.xml # buffer-size for querying different FIS on
                  # meshes
|-- palette # styling for 2D charts
|   `-- *.xml
|-- products # configuration of steps in workflows
|   |-- horizontalcrosssection
|   |   `-- *.xml
|   |-- horizontalprofile
|   |   `-- *.xml
|   |-- layer
|   |   `-- *.xml
|   |-- timeseries
|   |   |-- *.xml
|   |   `-- timegap_definition.xml # definition of a gap depending FIXME
|   |-- verticalcrosssection
|   |   `-- *.xml
|   `-- verticalprofile
|       `-- *.xml
`-- queries.properties # SQL configuration according to products
\end{lstlisting}


The central config-file {\tt conf/conf.xml} is XML-based and contains the
following main elements:

\begin{lstlisting}
artifact-database
|-- geo-backend # pointing to database connection, SQL configuration
|-- rest-server # port, listen addresses
|-- database # internal database storing artifacts
|-- ehcache # pointing to cache configuration
|-- cleaner # time of cleanups FIXME
|-- export-secret # signing project files
|-- factories # list of expert information systems
|-- artifacts # list of products
|-- gnv # charts, palettes, interpolation parameters
|-- mapserver # integration of mapserver
`-- velocity # templating language used in maptemplates
\end{lstlisting}

The documentation of the configuration will be split up in 4 sections
addressing different tasks:
\begin{enumerate}
    \item "Configuring and Running Artifact-Server" covering the main elements {\tt
geo-backend, rest-server, database, ehcache, cleaner, export-secret}
    \item "Generating Charts -- Background and Configuration" covering
    the main element {\tt gnv}
    \item "Generating Maps -- Background and Configuration" covering the
    main elements {\tt mapserver, velocity}
    \item "Configuring FIS, Products, States, Transitions and
    SQL-Statements" covering the main elements {\tt factories,
    artifacts}
\end{enumerate}
















Some additional Configurations will be done using Systemproperties. This 
Properties will be listed in the last Section of this chapter.


\subsubsection{artifact-factories}

These Section configures the Factories for Artifacts which can be used.
The meaning of artifact-factories are explained in Section TODO: LINK to Model of Transition

\subsubsection{artifacts}

These Section configures the Artifacts which could be reached using the Artifact-Server.
The meaning of artifacts are explained in Section TODO: LINK to Model of Transition



\paragraph{Query-configuration (queries.properties)}

This File contains Key-Value-Pairs to define SQL-Statements.
All Queries will be handle using the Prepared-Statement-Syntax using "?"
to define an Place where an dynamic Value should be placed into the Statement.

There is one special Implementation to support spatial access to the ArcSDE,
because the ArcSDE does not support the Access to spatial Objects using the
definition of the Simple Feature Specification for SQL of the OGC.

It was necessary to implement this mechanism to simulate the Access.

All Queries which contains the following Literals will be handle separate
using the ArcSDE-API.

\begin{itemize}
    \item ST\_ASTEXT(SHAPE): Will return the Geometry as an WellKnowText (WKT)
    \item ST\_ASTEXT(RASTER): Will return the Raster in an readable Way.
    \item INTERSECTS(SHAPE,"?"): Will only return the Elements which Geometry
                                 intersects the given Geometry ("?" will be 
                                 replace with an WKT) 
\end{itemize}

\subsection{Logging}
\subsection{Configure ArtifactServer using Systemproperties}
\begin{itemize}
    \item artifact.database.dir The folder where the Configuration is located-
    \item query.executor.factory: The absolute  Classname which QueryExecutorfactory should be used
    \begin{itemize}
        \item de.intevation.gnv.geobackend.base.query.QueryExecutorFactory :
              Standardfactory without any Addons.
        \item de.intevation.gnv.geobackend.base.query.CachingQueryExecutorFactory: 
              Factory with Cache for SQL-Query-Results
    \end{itemize}
    \item caching.query.executor.config: The absolute Path to the Configurationfile 
                                         for the Cache which stores the SQL-Query-
                                         Results. This only take effect if the
                                         query.executor.factory-Property is set
                                         to de.intevation.gnv.geobackend.base.query.CachingQueryExecutorFactory.
    \item caching.cleaner.interval: The Interval in seconds the Caches should be cleaned using the Cachecleaner
\end{itemize}

