\section{Model of transitions}
\subsection{General principle of model of transitions}
        - FIS -> product -> transitions in data model
The configuration of the provided FIS are devided in three parts.

* Configuration of the Artifactfactories which represents the FIS.
* Configuration of main Artifacts which will be instantiated if an 
  Artifactfactory was called.
* Configuration of the different Artifacts which provides Products which can be 
  served by the FIS.

\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 vonfigured 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.
* name: The Name of the Artifact. Must be unique in one Artifact-Server
* description: Short description which Job the Artifactfactory has to do.
* ttl: The Time to Live: The Time using Milliseconds an Artifact created by this 
       factory can live without any Userinteraction.
* artifact: The Name of the Class of the Artifact which should be created.

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

\subsubsection{Configuration of main Artifact}
To each Artifact-Factory it is necessary to configure one Artifact which will be 
created from the Factory.
This Artifact is the representation of the specific FIS.
It contains the Configuration which product 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 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}
\paragraph{States}
\paragraph{Transitions}
\paragraph{Outputstate}


\subsection{Adding a new FIS}
In this Section it will 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.

