changeset 105:beb991dc4827

Added a first stub of an WINFO artifact. flys-artifacts/trunk@1287 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 02 Feb 2011 14:56:22 +0000
parents b3792346cb10
children 5864c41219db
files flys-artifacts/ChangeLog flys-artifacts/doc/conf/artifacts/winfo.xml flys-artifacts/doc/conf/conf.xml flys-artifacts/pom.xml flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java
diffstat 5 files changed, 226 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Tue Feb 01 17:56:29 2011 +0000
+++ b/flys-artifacts/ChangeLog	Wed Feb 02 14:56:22 2011 +0000
@@ -1,3 +1,16 @@
+2011-02-02  Ingo Weinzierl <ingo@intevation.de>
+
+	* doc/conf/conf.xml: An initial configuration file for the FLYS artifact
+	  server.
+
+	* doc/conf/artifacts/winfo.xml: An initial transition configuration of an
+	  WINFO artifact.
+
+	* src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java: A stub of
+	  an artifact for a WINFO parameterization.
+
+	* pom.xml: Set the source code version to 1.5.
+
 2011-02-01	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	* src/**, pom.xml: Added initial maven project.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/doc/conf/artifacts/winfo.xml	Wed Feb 02 14:56:22 2011 +0000
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<artifact name="winfo">
+    <states>
+
+        <state id="winfo_gauge" description="winfo_gauge" state="de.intevation.flys.artifacts.state.GaugeState">
+            <!--
+            <inputvalues>
+                <inputvalue name="sourceid" type="Integer" multiselect="false" usedinquery="0"/>
+                <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+            </inputvalues>
+            -->
+        </state>
+
+        <transition transition="de.intevation.gnv.transition.DefaultTransition">
+            <from state="winfo_gauge"/>
+            <to state="winfo_calculation_type"/>
+        </transition>
+
+        <state id="winfo_calculation_type" description="winfo_calculation_type" state="de.intevation.gnv.state.timeseries.TimeSeriesOutputState">
+            <!--
+            <inputvalues>
+                <inputvalue name="maxvalue" type="Date" multiselect="false"/>
+            </inputvalues>
+            -->
+            <outputsModes>
+                <outputsMode name="discharge_curve" description="Chartrepresentation of a discharge curve" mime-type="image/png">
+                    <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>
+            </outputsModes>
+        </state>
+
+    </states>
+</artifact>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/doc/conf/conf.xml	Wed Feb 02 14:56:22 2011 +0000
@@ -0,0 +1,34 @@
+<artifact-database>
+    <export-secret>YOUR_SECRET</export-secret>
+    <factories>
+        <artifact-factories>
+            <!-- All Artifactfactories which are available in this Database.
+                 Each Artifactfactory represents one river. -->
+            <artifact-factory name="winfo" description="Factory to create an artifact to be used in WINFO"
+                ttl="3600000"
+                artifact="de.intevation.flys.artifacts.WINFOArtifact">de.intevation.artifactdatabase.DefaultArtifactFactory</artifact-factory>
+        </artifact-factories>
+    </factories>
+
+    <artifacts>
+        <artifact name="winfo" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="${artifacts.config.dir}/artifacts/winfo.xml" />
+    </artifacts>
+
+    <rest-server>
+        <!--  at this Point it is possible to Change the Port the ArtifactDatabase will bind to.-->
+        <port>8181</port>
+        <listen>localhost</listen>
+    </rest-server>
+    <!-- garbage collection of outdated artifacts -->
+    <cleaner>
+        <sleep-time>60000</sleep-time>
+    </cleaner>
+    <database>
+        <!-- This Section configures the Settings for connecting to the 
+             Artifact-Database instance. e.g. SQLite -->
+        <user>SA</user>
+        <password></password>
+        <url>jdbc:h2:${artifacts.config.dir}/../artifactdb/artifacts.db</url>
+    </database>
+
+</artifact-database>
--- a/flys-artifacts/pom.xml	Tue Feb 01 17:56:29 2011 +0000
+++ b/flys-artifacts/pom.xml	Wed Feb 02 14:56:22 2011 +0000
@@ -14,6 +14,20 @@
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
   </properties>
 
+  <build>
+    <plugins>
+      <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-compiler-plugin</artifactId>
+          <version>2.0.2</version>
+          <configuration>
+              <source>1.5</source>
+              <target>1.5</target>
+          </configuration>
+      </plugin>
+     </plugins>
+  </build>
+
   <dependencies>
     <dependency>
       <groupId>junit</groupId>
@@ -21,5 +35,10 @@
       <version>3.8.1</version>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>de.intevation.bsh.artifact-database</groupId>
+      <artifactId>artifact-database</artifactId>
+      <version>1.0-SNAPSHOT</version>
+    </dependency>
   </dependencies>
 </project>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java	Wed Feb 02 14:56:22 2011 +0000
@@ -0,0 +1,123 @@
+package de.intevation.flys.artifacts;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+import org.w3c.dom.Document;
+
+import org.apache.log4j.Logger;
+
+import de.intevation.artifacts.ArtifactFactory;
+import de.intevation.artifacts.CallContext;
+
+import de.intevation.artifactdatabase.DefaultArtifact;
+
+
+/**
+ * The default WINFO artifact.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class WINFOArtifact extends DefaultArtifact {
+
+    /** The logger for this class */
+    private static Logger logger = Logger.getLogger(WINFOArtifact.class);
+
+
+    /**
+     * The default constructor.
+     */
+    public WINFOArtifact() {
+        super();
+    }
+
+
+    /**
+     * Initialize the artifact and insert new data if <code>data</code> contains
+     * information necessary for this artifact.
+     *
+     * @param identifier The UUID.
+     * @param factory The factory that is used to create this artifact.
+     * @param context The CallContext.
+     * @param data Some optional data.
+     */
+    @Override
+    public void setup(
+        String          identifier,
+        ArtifactFactory factory,
+        Object          context,
+        Document        data)
+    {
+        logger.debug("Setup this artifact with the uuid: " + identifier);
+
+        super.setup(identifier, factory, context, data);
+    }
+
+
+    /**
+     * This method handles requests for changing the current state of an
+     * artifact.
+     *
+     * @param target The target of the advance action.
+     * @param context The CallContext.
+     *
+     * @return the result of the advance action.
+     */
+    @Override
+    public Document advance(Document target, CallContext context) {
+        logger.debug("Advance to another state.");
+
+        return super.advance(target, context);
+    }
+
+
+    /**
+     * This methods introduces new data to the current artifact.
+     *
+     * @param data A document containing the new data.
+     * @param context The CallContext.
+     *
+     * @return the result of the feed action.
+     */
+    @Override
+    public Document feed(Document data, CallContext context) {
+        logger.debug("Feed the artifact with new data.");
+
+        return super.feed(data, context);
+    }
+
+
+    /**
+     * This method returns a description of this artifact.
+     *
+     * @param data Some data.
+     * @param CallContext The CallContext.
+     *
+     * @return the description of this artifact.
+     */
+    public Document describe(Document data, CallContext context) {
+        logger.debug("Describe the artifact.");
+
+        return super.describe(data, context);
+    }
+
+
+    /**
+     * Call an output target.
+     *
+     * @param format The format for the output.
+     * @param outStream The output stream.
+     * @param context The CallContext.
+     * @throws IOException if an error occured while writing the result to the
+     * output stream.
+     */
+    public void out(
+        Document format, OutputStream outStream, CallContext context)
+    throws IOException
+    {
+        logger.debug("Call an out target.");
+
+        super.out(format, outStream, context);
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org