view doc/config-manual/model_of_transitions.tex @ 909:fcde68463722

Added description for Configuration of OutputStates and OutputModes doc/trunk@1043 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Mon, 03 May 2010 14:11:33 +0000
parents babeef4f8480
children 329a510ba5a2
line wrap: on
line source
\section{Model of transitions}
\subsection{General principle of model of transitions}
        - FIS -> product -> transitions in data model

It is possible to configure the GNV in many ways.
It is possible to add or remove FIS, add or remove Products from a FIS or
to manipulate the steps which must be gone until a product can be create
a diagramm or generate an CSV-Export.

The configuration of the provided FIS are devided in three main parts.

\begin{itemize}
    \item Configuration of the Artifactfactories which represents the FIS.
    \item Configuration of main Artifacts which will be instantiated if an 
  Artifactfactory was called.
    \item Configuration of the different Artifacts which provides Products which can be 
  served by the FIS.
\end{itemize}

\subsubsection{Configuration of ArtifactFactories}
The Point of Enty into the system is to configure an Artifactfactory.
Each Artifactfactory represents one FIS.
It is possible to configure several Artifactfactories.
The Artifactfactories will be configured in the Section 
/artifact-database/artifact-factories of the Configurationfile.

\begin{lstlisting}
<artifact-factory name='fis\_marnet' 
                  description='Factory to create an artifact to be used with the FIS NEWFISNAME'  
                  ttl='3600000' 
                  artifact='de.intevation.artifactdatabase.ProxyArtifact'>
                  de.intevation.gnv.artifacts.GNVProductArtifactFactory
</artifact-factory>
\end{lstlisting}

At this moment the following Attributes of an Artifact-Factory are configurabel.
\begin{itemize}
    \item name: The Name of the Artifact. Must be unique in one Artifact-Server
    \item description: Short description which Job the Artifactfactory has to do.
    \item  ttl: The Time to Live: The Time using Milliseconds an Artifact, created using this 
                factory, can live without any Userinteraction.
    \item artifact: The Name of the Class of the Artifact which should be created.
\end{itemize}

// TODO: List of Artifacts which currently used in this Configuration? 

\subsubsection{Configuration of main Artifact}
For each Artifact-Factory it is necessary to configure one Artifact which will be 
created using the Factory.
This Artifact is the representation of the specific FIS.
It contains the Configuration which products will be serverd for ths FIS.

The Artifacts are configured in the Section /artifact-database/artifacts of 
the Configurationfile.

\begin{lstlisting}
<artifact name='fis\_marnet'>
    <products>
     ...
    </products>
</artifact>
\end{lstlisting}

The Key is to use the same Name for the Artifact as used for the Artifactfactory.
The Name has to be unique.
In the Section /artifact/products it is possible to define several Products as 
explained in the next Section.

\paragraph{Products to an Artifact}
One Artifact can provide several Products.
To do this it is required to configure them as shown below in the Section 
/artifact/products

\begin{lstlisting}
<product name= "timeSeries">
      <artifact-factory name="timeSeries" 
                        description="Artiefactfactory for Instantiating the Artifact for TimeSeries on TimeSeriesPoints"  
                        ttl="300000" 
                        artifact="de.intevation.gnv.timeseries.TimeSeriesArtifact">
           de.intevation.gnv.artifacts.GNVArtifactFactory
      </artifact-factory>
      <parameters>
          <parameter name="sourceid" 
                     value="4"/>
          <parameter name="fisname" 
                     value="fis\_marnet"/>
      </parameters>
 </product>
 \end{lstlisting}

Each Product is also represented by an Artifact. To create this Artifact we have to 
use an Artifact-Factory which is configured in each product 
(/product/artifact-factory).

Each Product can have several parameters /product/parameters/parameters.
The Parameter named sourceid and fisname are required Parameters.

The Parameter fisname contains the key to the Name of the FIS. The Key must be 
unique.
The Parameter sourceid contains the key to identify the FIS in the 
DataWareHouse. (MEDIAN.SOURCEINFO)


\subsubsection{Configuration of the Product-Artifacts}
The Products of the different FIS are also modeled as Artifact-Objects.
The different Products which are currently avaliable are stored in separate
Files in the Folder project.

In those Files the Workflow of each product is configured.  Each step which is
required to model a new Diagramm is represented using a state in the
Configuration-File.

To move between those States it is required to model Transitions which define
between which States it is possible to move and which conditions must be
fulfilled.

The Last step is called OutputState. This State is responsible to generate the
output for the different Formats which can be served from the Product (Diagramm,
CSV, ODV, WMS,...).

\paragraph{States}
A state is one Step which is required to fetch the Data for generating e.g. an
Diagramm.

For example in each Product it is Possible to choose one or more Parameters.

To configure a State you have to use a XML-Fragment as shown below:

\begin{lstlisting}
<state id="timeseries_parameter" description="timeseries_parameter" state="de.intevation.gnv.state.DefaultState">
   <queryID>timeseries_parameter</queryID>
   <dataname>parameterid</dataname>
   <data-multiselect>true</data-multiselect>
   <inputvalues>
        <inputvalue name="featureid" type="Integer" multiselect="false"/>
        <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
        <inputvalue name="parameterid" type="Integer" multiselect="true" usedinquery="0"/>
   </inputvalues>
</state>
\end{lstlisting}

At this moment the following Attributes of an Artifact-Factory are configurabel.
\begin{itemize}
    \item id: The Name of the Artifact. Must be unique in one Artifact-Server
    \item description: Short description which Job the Artifactfactory has to do.
    \item queryID: The ID of the Query which should be used to fetch the Data 
                   displayed in this state. //TODO: Reference to queries.properties
    \item dataname: The ID of the Data which will be displaied in this State.
                    The ID will be use to localize the description of the Data.
    \item data-multiselect: true it is possible to select 1 or more Items.
                            false ist is possible to select only one Item.
    \item inputvalues: The Values which can be "feed" //TODO: How to explain this
                       to this State.
\end{itemize}


\paragraph{Transitions}

To move between two States it is necessary to configure dependencies between
the different States.
This dependencies are called. Transitions.

There are different Kind of Transitions which can be used.
\begin{itemize}
  \item Transitions which only link two States
  \item Transition which link two States with a aditional Condition. 
        (e.g. If a region was selected in the Regionfilter or not )
\end{itemize}

The listing below shows a Transition with an additional Condition.
\begin{lstlisting}
<transition transition="de.intevation.gnv.transition.ValueCompareTransition">
    <from state="timeseries_area"/>
    <to state="timeseries_without_geom"/>
    <condition inputvalue="areaid" value="n/n" operator="equal"/>
</transition>
\end{lstlisting}

\begin{itemize}
  \item from: The ID of the State which you have to come from
  \item to:   The ID of the State which can be reached.
  \item condition: The Condition which have to be fulfilled.
\end{itemize}

\paragraph{Outputstate}

The OutputState is an special State which was created to define
the different possibilities of Outputs for each Product.
An OutputState is handled as an State which is described above.
Additionally you are able to configure which kind of outputs should
be provided.

There are several OutputStates. Each one is designed to create 
the output for one special Product (Verticalprofile, TimeSeries,...)

//TODO: Listing of each OutputStates?

You can configure an OutputState as shown below:

\begin{lstlisting}
<state id="timeseries_calculate_results" description="timeseries_interval" state="de.intevation.gnv.state.timeseries.TimeSeriesOutputState">
    <queryID>timeseries_chart_data</queryID>
     ...
    <outputsModes>
        <outputsMode name="chart" description="Chartrepresentation of the Values" mime-type="image/png">
        ...
        </outputsMode>
    </outputsModes>
 </state>
\end{lstlisting}

At Section /state/outputsModes it is possible to add one ore more OutputModes
to one State as shown in the next Paragraph.

\paragraph{OutputModes}

It is possible to configure several OutputModes in one OutputState.
Inserting or deleting the Configuration of an special
OutputMode will cause that the pending Item will be shown or hidden 
in the GUI.

WARNING: IT MIGHT BE POSSIBLE THAT ONE OR MORE OUTPUTMODES ARE NOT
         SUPPORTED BY AN PRODUCT. IN THAT CASE IT IS NECESSARY TO
         IMPLEMENT THE REQUIRED FUNCTIONALITY BEFORE IT IS POSSIBLE
         TO OFFER THIS OUTPUTMODE.

Currently the following outputmodes are supported:

\begin{itemize}
   \item chart
   \item histogram
   \item csv
   \item odv
   \item statistics
   \item wms
   \item shapefile
\end{itemize}

The following Example shows the Configuration for the OutputMode Chart.

\begin{lstlisting}
<outputsMode name="chart" description="Chartrepresentation of the Values" mime-type="image/png">
    <parameters>
        <inputvalue name="width" type="Integer" value="600"/>
        <inputvalue name="height" type="Integer" value="400"/>
        <inputvalue name="points" type="Boolean" value="false"/>
    </parameters>
    <exportModes>
        <export name="img" description="IMG-Export der Daten" mime-type="image/png" />
        <export name="pdf" description="PDF-Export der Daten" mime-type="application/pdf" />
        <export name="svg" description="SVG-Export der Daten" mime-type="image/svg+xml" />
      </exportModes>
</outputsMode>
\end{lstlisting}

// TODO add simple OutputMode e.g. for CSV??

\begin{itemize}
   \item name: The name of the Mode. This must not be changed because it is used 
               by the Programm.
   \item description: a short description of this OutputMode. 
   \item parameters: one ore more parameters which will be shown in the GUI e.g. 
                     for changing the Size of an Chart.
   \item exportModes: one or more formats which can be served.
\end{itemize}


\subsection{Adding a new FIS}
In this Section it will be explained which steps has to be done to integrate a
new FIS into the Artifact-Server.  This will be done using the Configuration for
an FIS which use data from MEDIAN.TIMESERIES Section of the DataWareHouse e.g.
MARNET or STAUN

Pay attention that for publishing the Changes to the Artifact-Server you will 
have to restart it. 

\subsubsection{Adding a new Artifactfactory}
First step is to add a new Artifactfactory to the Configuration conf/conf.xml
To do this you have to add a new XML-Fragment into the Section 
/factories/artifact-factories  which look like that:

\begin{lstlisting}
<artifact-factory name='fis\_NEWFISNAME' 
                  description='Factory to create an artifact to be used with the FIS NEWFISNAME'  
                  ttl='3600000' 
                  artifact='de.intevation.artifactdatabase.ProxyArtifact'>
                  de.intevation.gnv.artifacts.GNVProductArtifactFactory
</artifact-factory>
\end{lstlisting}
 
In this XML-Fragment you only have to replace the placeholder NEWFISNAME with a 
unique short Name for the new FIS.

\subsubsection{Adding a new Artifact for Artifactfactory}
The next Step is to define the Artifact itself.
For this it is necessary to add an XML-Fragment into the Section /artifacts of 
the main Configuration-File /conf/conf.xml
\begin{lstlisting}
<artifact name='fis\_NEWFISNAME'>
    <products>
     ...
    </products>
</artifact>
\end{lstlisting}

In this XML- Fragment it is also required to replave the placeholder NEWFISNAME 
with the name which was used to configure the Artifact-Factory.

Now the ArtifactServer can serv an additional FIS without any Products yet.

To prevent needless Configuration-Work it is useful way to clone an Artifact 
which handle the same Kind of work as the new FIS.

\subsubsection{Adding removing Products to the specific Artifact}
Now it is Time to configure the different Products which the FIS should be able 
to provide.
To do this it is necessary to Copy the XML-Fragments of the products into the
XML-Element <products> of the previously integrated Artifact.
\begin{lstlisting}
<artifact name='fis\_NEWFISNAME'>
     <products>
         <product name= "timeSeries">
              <artifact-factory name="timeSeries" 
                                description="Artiefactfactory for Instantiating the Artifact for TimeSeries on TimeSeriesPoints"  
                                ttl="300000" 
                                artifact="de.intevation.gnv.timeseries.TimeSeriesArtifact">
                  de.intevation.gnv.artifacts.GNVArtifactFactory
              </artifact-factory>
              <parameters>
                  <parameter name="sourceid" 
                             value="VALUEOFSOURCEID"/>
                  <parameter name="fisname" 
                             value="fis\_NEWFISNAME"/>
              </parameters>
          </product>
          <product name= "verticalProfile">
              <artifact-factory name="verticalProfile" 
                                description="Artiefactfactory for Instantiating the Artifact for Verticalprofiles on TimeSeriesPoints"  
                                ttl="300000" 
                                artifact="de.intevation.gnv.profile.vertical.VerticalProfileArtifact">
                  de.intevation.gnv.artifacts.GNVArtifactFactory
              </artifact-factory>
              <parameters>
                  <parameter name="sourceid" 
                             value="VALUEOFSOURCEID"/>
                  <parameter name="fisname" 
                             value="fis\_NEWFISNAME"/>
              </parameters>
          </product>
     </products>
</artifact>
\end{lstlisting}

In this XML-Fragment you have to replace the placeholders NEWFISNAME as before 
and VALUEOFSOURCEID with the value for the new FIS as defined in the Table 
MEDIAN.SOURCEINFO.

\subsubsection{Putting SourceID to specific Artifact}
\subsection{Adding a new Product}
To add a new Product to the System it is necessary that the required 
Artifactrepresentation is Implemented in the SourceCode.
Without doing that step it is not possible to create a new Product.

All Products are configured in separate Files that will be included into the 
Mainconfiguration using Xlink-References.

First Step is to create a new File in the Folder products and there in the 
subfolder where the Product belongs to (timeseries,verticalprofile,
horizontalprofile,horizontalcrosssection,layer,...)

Then you have tor reference this File in the File /conf/conf.xml in the Section 
/artifacts using the following XML-Fragment.

\begin{lstlisting}
<artifact name="timeSeries" 
          xmlns:xlink="http://www.w3.org/1999/xlink" 
          xlink:href="${artifacts.config.dir}/products/PATHTOFILE" /> 
\end{lstlisting}

The placeholder PATHTOFILE has to be replaced with the relative Path and the 
Name of the File starting in the Folder products.  

Then it is possible to add the product to a FIS as explained in the next section.
Please note that the defined Name of the ArtifactFactory has to match to the 
Name of the added Products which is also designed as an Artifact.

\subsection{Adding a additional Product to a FIS}
To add a additional Product to a FIS you only have to add the XML-Fragment which 
represents the product to the Artifact-configuration of the FIS in Section 
/artifacts/artifact/products.

\begin{lstlisting}
 <product name= "timeSeries">
     <artifact-factory name="timeSeries" 
                       description="Artiefactfactory for Instantiating the Artifact for TimeSeries on TimeSeriesPoints"  
                       ttl="300000" 
                       artifact="de.intevation.gnv.timeseries.TimeSeriesArtifact">
          de.intevation.gnv.artifacts.GNVArtifactFactory
     </artifact-factory>
     <parameters>
         <parameter name="sourceid" 
                    value="VALUEOFSOURCEID"/>
         <parameter name="fisname" 
                    value="fis\_NEWFISNAME"/>
     </parameters>
 </product>
 \end{lstlisting}

Please note that you have to replace the Placeholders as explained above.

http://dive4elements.wald.intevation.org