Mercurial > dive4elements > gnv-client
changeset 813:79c1db3ca7cc
Added some more javadocs.
gnv-artifacts/trunk@897 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Fri, 09 Apr 2010 13:09:25 +0000 (2010-04-09) |
parents | 41a7c49b5cb4 |
children | 9d427dd2a96a |
files | gnv-artifacts/ChangeLog gnv-artifacts/src/main/java/de/intevation/gnv/state/exception/StateException.java gnv-artifacts/src/main/java/de/intevation/gnv/state/layer/LayerOutputState.java gnv-artifacts/src/main/java/de/intevation/gnv/transition/DefaultTransition.java gnv-artifacts/src/main/java/de/intevation/gnv/transition/PresettingsValueCompareTransition.java gnv-artifacts/src/main/java/de/intevation/gnv/transition/Transition.java gnv-artifacts/src/main/java/de/intevation/gnv/transition/TransitionBase.java gnv-artifacts/src/main/java/de/intevation/gnv/transition/TransitionFactory.java gnv-artifacts/src/main/java/de/intevation/gnv/transition/ValueCompareTransition.java |
diffstat | 9 files changed, 122 insertions(+), 36 deletions(-) [+] |
line wrap: on
line diff
--- a/gnv-artifacts/ChangeLog Fri Apr 09 13:00:38 2010 +0000 +++ b/gnv-artifacts/ChangeLog Fri Apr 09 13:09:25 2010 +0000 @@ -1,3 +1,15 @@ +2010-04-09 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/state/exception/StateException.java, + src/main/java/de/intevation/gnv/state/layer/LayerOutputState.java, + src/main/java/de/intevation/gnv/transition/DefaultTransition.java, + src/main/java/de/intevation/gnv/transition/TransitionFactory.java, + src/main/java/de/intevation/gnv/transition/TransitionBase.java, + src/main/java/de/intevation/gnv/transition/PresettingsValueCompareTransition.java, + src/main/java/de/intevation/gnv/transition/Transition.java, + src/main/java/de/intevation/gnv/transition/ValueCompareTransition.java: + Added Javadoc. + 2010-04-09 Tim Englich <tim.englich@intevation.de> ISSUE 215 msg1170
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/exception/StateException.java Fri Apr 09 13:00:38 2010 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/exception/StateException.java Fri Apr 09 13:09:25 2010 +0000 @@ -47,3 +47,4 @@ } } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : \ No newline at end of file
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/layer/LayerOutputState.java Fri Apr 09 13:00:38 2010 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/layer/LayerOutputState.java Fri Apr 09 13:09:25 2010 +0000 @@ -89,11 +89,7 @@ super(); } - /** - * @see de.intevation.gnv.state.OutputState#out(org.w3c.dom.Document, - * java.util.Collection, java.io.OutputStream, - * java.lang.String, de.intevation.artifacts.CallContext) - */ + public void out(Document format, Collection<InputData> inputData, OutputStream outputStream, String uuid, CallContext callContext) throws StateException { @@ -123,19 +119,23 @@ } /** - * @param outputStream + * Writes an exception to an output stream. + * + * @param outputStream The output stream used to write the exception to. */ + @SuppressWarnings("static-access") private void writeExceptionReport2Stream(OutputStream outputStream) { Document document = XMLUtils.newDocument(); - new ArtifactXMLUtilities(). + ArtifactXMLUtilities. createExceptionReport("No Data to Export", document); XMLUtils.toStream(document,outputStream); } /** - * Fetches the Data from the Databasebackend - * @return + * Fetches the Data from the Databasebackend. + * + * @return the resulting data. */ protected Collection<Result> fetchData(){ log.debug("LayerOutputState.fetchData"); @@ -246,6 +246,14 @@ return data; } + + /** + * This method determines the geometry type on basis of a table name. + * + * @param tableName Name of the table in the database. + * @param queryExecutor The QueryExecutor. + * @return the geometry type as string (e.g. MultiPolygon, Polygon, etc). + */ private String getGeometryType(String tableName, QueryExecutor queryExecutor){ String returnValue = null; @@ -286,6 +294,14 @@ return returnValue; } + + + /** + * Fetch the columns of a specific table. + * + * @param tableName The name of the table. + * @return the columns as string. + */ private String fetchColumns(String tableName){ String returnValue = null; try { @@ -318,6 +334,8 @@ } return returnValue; } + + @Override public void setup(Node configuration) { log.debug("LayerOutputState.setup"); @@ -334,6 +352,16 @@ this.geometryTypeQueryID = "geometry_type"; } + + /** + * Write the resulting data to shapefiles. + * + * @param uuid The UUID of the current artifact. + * @param data The finalized data used for shapefile creation. + * @param callContext The CallContext object. + * @param geometryType The geometry type. + * @return the shapefile path. + */ protected String writeToShapeFile( String uuid, Collection<Result> data, @@ -382,6 +410,18 @@ } } + + /** + * Create a zip archive with the shapefiles of the given shapefiles path and + * write it to <code>output</code>. + * + * @param uuid The UUID of the current artifact. + * @param callContext The CallContext object. + * @param output The output stream. + * @param data The data to be written to shapefile. + * @param geometryType The geometry type. + * @throws StateException if an error occured while zipfile creation. + */ protected void writeZip( String uuid, CallContext callContext, @@ -411,12 +451,18 @@ } } + /** + * Returns the shapefile path. + * + * @return the shapefile path. + */ public String getShapeFilePath() { synchronized (shapeFileLock) { return shapeFilePath; } } + private static File shapefileDirectory(CallContext callContext) { // TODO: Refactoring nessessary it should be used only one Shapefilepath // for alle Modes. Code was taken from HorizontalCrossSectionMeshOutputState @@ -429,15 +475,14 @@ : GNVArtifactContext.DEFAULT_HORIZONTAL_CROSS_SECTION_PROFILE_SHAPEFILE_PATH; } - /** - * @see de.intevation.gnv.state.StateBase#endOfLife(java.lang.Object) - */ + @Override public void endOfLife(Object globalContext) { super.endOfLife(globalContext); // do it in background new Thread() { + @Override public void run() { // TODO: Do the un-publishing WMS stuff. String path = resetShapeFilePath(); @@ -466,6 +511,7 @@ }.start(); } + public String resetShapeFilePath() { synchronized (shapeFileLock) { String path = shapeFilePath; @@ -474,6 +520,21 @@ return path; } } + + + /** + * Write data to shapefiles and feed a map service with information about + * these shapefiles. The map service can be queried for displaying + * corresponding layers as WMS. + * + * @param uuid The UUID of the current artifact. + * @param callContext The CallContext object. + * @param data A collection with some input data. + * @param geometryType The geometry type. + * @return a document with some meta information (shapefile path, geometry + * type, time to live of the current artifact, etc). + * @throws StateException if an error occured while shapefile writing. + */ protected Document getWMS(String uuid, CallContext callContext, Collection<Result> data, @@ -518,6 +579,14 @@ return document; } + + /** + * Turns the geometry type into a form used for the templating mechanism + * while mapfile generation. + * + * @param geometryType The original geometry type. + * @return a valid geometry type fpr the template mechanism. + */ private String determineGeometryType(String geometryType){ String returnValue = geometryType.toLowerCase(); @@ -532,6 +601,14 @@ return returnValue; } + + /** + * Determine the default template name if no special template is existing + * for this layer. + * + * @param geometryType The geometry type. + * @return a default geometry fitting to the original geometry type. + */ private String determineDefaultTemplateName(String geometryType){ String returnValue = geometryType.toLowerCase(); @@ -546,3 +623,4 @@ return returnValue; } } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : \ No newline at end of file
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/transition/DefaultTransition.java Fri Apr 09 13:00:38 2010 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/transition/DefaultTransition.java Fri Apr 09 13:09:25 2010 +0000 @@ -3,6 +3,8 @@ import de.intevation.gnv.state.State; /** + * The default implementation of a <code>Transition</code>. + * * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> * */ @@ -20,11 +22,10 @@ super(); } - /** - * @see de.intevation.gnv.transition.Transition#isValid(de.intevation.gnv.state.State) - */ + public boolean isValid(State state) { return true; } } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : \ No newline at end of file
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/transition/PresettingsValueCompareTransition.java Fri Apr 09 13:00:38 2010 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/transition/PresettingsValueCompareTransition.java Fri Apr 09 13:09:25 2010 +0000 @@ -38,9 +38,7 @@ super(); } - /** - * @see de.intevation.gnv.transition.Transition#isValid(de.intevation.gnv.state.State) - */ + public boolean isValid(State state) { Map<String, InputData> preSettings = state.getPreSettings(); if (preSettings != null){ @@ -59,6 +57,7 @@ return false; } + @Override public void setup(Node configuration) { super.setup(configuration); @@ -66,6 +65,5 @@ this.dataValue = Config.getStringXPath(configuration,"condition/@value"); this.operator = Config.getStringXPath(configuration,"condition/@operator"); } - - } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/transition/Transition.java Fri Apr 09 13:00:38 2010 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/transition/Transition.java Fri Apr 09 13:09:25 2010 +0000 @@ -7,6 +7,7 @@ import org.w3c.dom.Node; /** + * This interface describes basic methods necessary for a transition model. * * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> * @@ -39,3 +40,4 @@ public void setup(Node configuration); } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : \ No newline at end of file
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/transition/TransitionBase.java Fri Apr 09 13:00:38 2010 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/transition/TransitionBase.java Fri Apr 09 13:09:25 2010 +0000 @@ -5,6 +5,8 @@ import org.w3c.dom.Node; /** + * An abstract implementation of <code>Transition</code>. + * * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> * */ @@ -24,26 +26,20 @@ public TransitionBase() { } - /** - * @see de.intevation.gnv.transition.Transition#getFrom() - */ + public String getFrom() { return this.from; } - /** - * @see de.intevation.gnv.transition.Transition#getTo() - */ + public String getTo() { return this.to; } - /** - * @see de.intevation.gnv.transition.Transition#setup(org.w3c.dom.Node) - */ + public void setup(Node configuration) { this.from = Config.getStringXPath(configuration,"from/@state"); this.to = Config.getStringXPath(configuration,"to/@state"); } - } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : \ No newline at end of file
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/transition/TransitionFactory.java Fri Apr 09 13:00:38 2010 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/transition/TransitionFactory.java Fri Apr 09 13:09:25 2010 +0000 @@ -49,5 +49,5 @@ } return state; } - } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : \ No newline at end of file
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/transition/ValueCompareTransition.java Fri Apr 09 13:00:38 2010 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/transition/ValueCompareTransition.java Fri Apr 09 13:09:25 2010 +0000 @@ -40,9 +40,7 @@ super(); } - /** - * @see de.intevation.gnv.transition.Transition#isValid(de.intevation.gnv.state.State) - */ + public boolean isValid(State state) { try { @@ -70,6 +68,7 @@ return false; } + @Override public void setup(Node configuration) { super.setup(configuration); @@ -77,6 +76,5 @@ this.dataValue = Config.getStringXPath(configuration,"condition/@value"); this.operator = Config.getStringXPath(configuration,"condition/@operator"); } - - } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : \ No newline at end of file