Mercurial > dive4elements > gnv-client
changeset 885:1c3efbd2fc5a
Removes trailing whitespace.
geo-backend/trunk@850 c6561f87-3c4e-4783-a992-168aeb5c3f6f
line wrap: on
line diff
--- a/geo-backend/ChangeLog Fri Mar 26 15:23:03 2010 +0000 +++ b/geo-backend/ChangeLog Mon Mar 29 07:49:16 2010 +0000 @@ -1,3 +1,29 @@ +2009-03-29 Sascha L. Teichmann <sascha.teichmann@intevation.de> + * src/test/java/de/intevation/gnv/geobackend/base/query/QueryExecutorTestCase.java, + src/test/java/de/intevation/gnv/geobackend/base/query/ToCharSample.java, + src/test/java/de/intevation/gnv/geobackend/base/query/GroupBySample.java, + src/test/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEConnectionPoolTestCase.java, + src/main/java/de/intevation/gnv/geobackend/base/DefaultResultDescriptor.java, + src/main/java/de/intevation/gnv/geobackend/base/DefaultResult.java, + src/main/java/de/intevation/gnv/geobackend/base/query/QueryExecutorBase.java, + src/main/java/de/intevation/gnv/geobackend/base/query/container/QueryContainerFactory.java, + src/main/java/de/intevation/gnv/geobackend/base/query/container/QueryContainer.java, + src/main/java/de/intevation/gnv/geobackend/base/query/DefaultQueryExceutor.java, + src/main/java/de/intevation/gnv/geobackend/base/query/QueryExecutorFactory.java, + src/main/java/de/intevation/gnv/geobackend/base/connectionpool/ConnectionPoolFactory.java, + src/main/java/de/intevation/gnv/geobackend/base/connectionpool/ConnectionPool.java, + src/main/java/de/intevation/gnv/geobackend/base/ResultDescriptor.java, + src/main/java/de/intevation/gnv/geobackend/sde/connectionpool/ArcSDEConnectionPool.java, + src/main/java/de/intevation/gnv/geobackend/sde/connectionpool/ArcSDEPoolableObjectFactory.java, + src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEConnection.java, + src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEStatement.java, + src/main/java/de/intevation/gnv/geobackend/sde/datasources/RasterObject.java, + src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEResultSetMetaData.java, + src/main/java/de/intevation/gnv/geobackend/util/BlockCollection.java, + src/main/java/de/intevation/gnv/geobackend/util/RedundancyRemover.java: + Removed trailing whitespace. + find -name \*.java | xargs sed -i 's/[ \t]\+$//' + 2010-03-26 Tim Englich <tim.englich@intevation.de> * src/main/java/de/intevation/gnv/geobackend/util/DateUtils.java,
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/DefaultResult.java Fri Mar 26 15:23:03 2010 +0000 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/DefaultResult.java Mon Mar 29 07:49:16 2010 +0000 @@ -14,8 +14,8 @@ * @author Tim Englich <tim.englich@intevation.de> * */ -public class DefaultResult -implements Result +public class DefaultResult +implements Result { /** * THE UID of this Classe @@ -29,7 +29,7 @@ * The ResultDescriptor which describes the ColumnValues */ private ResultDescriptor resultDescriptor = null; - + /** * Constructor */ @@ -105,7 +105,7 @@ } return (Integer)value; } - + /** * @see de.intevation.gnv.geobackend.base.Result#getResultDescriptor() */
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/DefaultResultDescriptor.java Fri Mar 26 15:23:03 2010 +0000 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/DefaultResultDescriptor.java Mon Mar 29 07:49:16 2010 +0000 @@ -32,7 +32,7 @@ * The Lookup for the Columnindex of the Columnnames */ private Map<String, Integer> columnIndexLookup = new HashMap<String, Integer>(); - + /** * Constructor */ @@ -88,7 +88,7 @@ * @see de.intevation.gnv.geobackend.base.ResultDescriptor#getColumnIndex(java.lang.String) */ public int getColumnIndex(String columnName) { - + Integer value = this.columnIndexLookup.get(columnName); return value != null ? value.intValue() : -1; }
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/ResultDescriptor.java Fri Mar 26 15:23:03 2010 +0000 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/ResultDescriptor.java Mon Mar 29 07:49:16 2010 +0000 @@ -40,10 +40,10 @@ public void addColumn(String name, String className); /** - * Returns the Indices of the Columns which are specified in the + * Returns the Indices of the Columns which are specified in the * param columnNames. * @param columnNames the Name of the Columns for which the Indices should returned. - * @return the Indices of the Columns which are specified in the + * @return the Indices of the Columns which are specified in the * param columnNames. */ public int [] getColumnIndices(String [] columnNames);
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/connectionpool/ConnectionPool.java Fri Mar 26 15:23:03 2010 +0000 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/connectionpool/ConnectionPool.java Mon Mar 29 07:49:16 2010 +0000 @@ -10,10 +10,10 @@ * @author Tim Englich <tim.englich@intevation.de> */ public interface ConnectionPool { - + /** * Delivers the Connection to the Database - * @param connectionID the ID of the Connection + * @param connectionID the ID of the Connection * @return the Connection to the Database * @throws ConnectionException */
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/connectionpool/ConnectionPoolFactory.java Fri Mar 26 15:23:03 2010 +0000 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/connectionpool/ConnectionPoolFactory.java Mon Mar 29 07:49:16 2010 +0000 @@ -1,5 +1,5 @@ /** - * + * */ package de.intevation.gnv.geobackend.base.connectionpool; @@ -21,7 +21,7 @@ */ private static Logger log = Logger.getLogger(ConnectionPoolFactory.class); - + /** * The singleton Instance of this Factory. */ @@ -71,7 +71,7 @@ this.connectionPool.initialize(properties); }else{ log.warn("ConnectionPool already initialized"); - } + } } /**
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/DefaultQueryExceutor.java Fri Mar 26 15:23:03 2010 +0000 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/DefaultQueryExceutor.java Mon Mar 29 07:49:16 2010 +0000 @@ -26,18 +26,18 @@ * */ public class DefaultQueryExceutor extends QueryExecutorBase{ - - + + /** * the logger, used to log exceptions and additonaly information */ private static Logger log = Logger.getLogger(DefaultQueryExceutor.class); - + /** * The ConnectionID identifing the Connection to use executing the Query. */ private String connectionID = "N/N"; - + /** * Constructor */ @@ -57,7 +57,7 @@ //Insert the Filtervalues into the QueryString queryString = super.setFilterValues(queryString, filter); } - + if (log.isDebugEnabled()) { log.debug("############ QUERY ##################"); log.debug(queryString); @@ -79,14 +79,14 @@ Statement stmt = connection.createStatement(); ResultSet rs = stmt.executeQuery(queryString); returnValue = super.createResultCollection(rs); - + }else{ log.error("Could not establish Databaseconnection."); throw new QueryException("Could not establish Databaseconnection."); } cacheResults(queryString, returnValue); - + } catch (ConnectionException e) { log.error(e,e); throw new QueryException("Could not establish Databaseconnection.",e); @@ -107,7 +107,7 @@ log.error("No QueryString defined for "+queryID); throw new QueryException("Cannot get the Querystring"); } - + } catch (QueryContainerException e) { log.error(e,e); throw new QueryException("Cannot get the Querystring",e);
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/QueryExecutorBase.java Fri Mar 26 15:23:03 2010 +0000 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/QueryExecutorBase.java Mon Mar 29 07:49:16 2010 +0000 @@ -29,7 +29,7 @@ public QueryExecutorBase() { super(); } - + /** * This Method puts the Filtervalues into the Querystring * @param queryString the Query which should be manipulated @@ -43,7 +43,7 @@ } return returnValue; } - + /** * This Methods converts the ResultSet into an Collection of Result-objects * @param resultSet the ResultSet which should be converted @@ -52,7 +52,7 @@ */ protected Collection<Result> createResultCollection(ResultSet resultSet) throws SQLException{ Collection<Result> returnValue = new ArrayList<Result>(); - + ResultDescriptor resultDescriptor = null; int columns = -1; @@ -68,9 +68,9 @@ resultDescriptor.addColumn(rsmd.getColumnName(i), rsmd.getColumnClassName(i)); } } - + Result result = convertResult(resultSet, resultDescriptor); - + returnValue.add(result); } return returnValue;
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/QueryExecutorFactory.java Fri Mar 26 15:23:03 2010 +0000 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/QueryExecutorFactory.java Mon Mar 29 07:49:16 2010 +0000 @@ -12,13 +12,13 @@ public class QueryExecutorFactory { public static final String QUERY_EXECUTOR_FACTORY = "query.executor.factory"; - + /** * the logger, used to log exceptions and additonaly information */ private static Logger log = Logger.getLogger(QueryExecutorFactory.class); - + /** * The singleton Instance of this Factory. */ @@ -72,7 +72,7 @@ public void shutdown() { } - + /** * Getting the QueryExecutor * @return the QueryExecutor
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/container/QueryContainer.java Fri Mar 26 15:23:03 2010 +0000 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/container/QueryContainer.java Mon Mar 29 07:49:16 2010 +0000 @@ -12,7 +12,7 @@ * */ public interface QueryContainer { - + /** * Returns the Query specified by the given queryID.
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/container/QueryContainerFactory.java Fri Mar 26 15:23:03 2010 +0000 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/container/QueryContainerFactory.java Mon Mar 29 07:49:16 2010 +0000 @@ -14,13 +14,13 @@ * */ public class QueryContainerFactory { - + /** * the logger, used to log exceptions and additonaly information */ private static Logger log = Logger.getLogger(QueryContainerFactory.class); - + /** * The singleton Instance of this Factory. */ @@ -48,8 +48,8 @@ } return instance; } - - + + /** * Getting the QueryContainer * @return the QueryContainer @@ -62,7 +62,7 @@ * Initializes the QueryContainer. * Should only be called once on system startup * @param properties the Properties for the Individual Configuration of the QueryContainerbb - * @throws QueryContainerException + * @throws QueryContainerException */ public synchronized void initializeQueryContainer(Properties properties) throws QueryContainerException{ log.debug("ConnectionPoolFactory.initializeConnectionPool");
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/connectionpool/ArcSDEConnectionPool.java Fri Mar 26 15:23:03 2010 +0000 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/connectionpool/ArcSDEConnectionPool.java Mon Mar 29 07:49:16 2010 +0000 @@ -12,7 +12,7 @@ /** *This is the ArcSDE specific implementation of the Interface ConnectionPool - * + * * @author Tim Englich <tim.englich@intevation.de> */ public class ArcSDEConnectionPool implements ConnectionPool { @@ -103,7 +103,7 @@ boolean testWhileIdle = Boolean.parseBoolean(properties .getProperty("testWhileIdle", "" + GenericObjectPool.DEFAULT_TEST_WHILE_IDLE)); - + log.info("Maximum Number of active Connections: " + maxActive); log.info("Maximum Number of waiting: " + maxWait); log.info("Maximum Number of idle: " + maxIdle); @@ -114,7 +114,7 @@ log.info("NumTestsPerEvictionRun: " + numTestsPerEvictionRun); log.info("MinEvictableIdleTimeMillis: " + minEvictableIdleTimeMillis); log.info("TestWhileIdle: " + testWhileIdle); - + this.pool = new GenericObjectPool(poolableObjectFactory, maxActive, GenericObjectPool.DEFAULT_WHEN_EXHAUSTED_ACTION, maxWait, maxIdle, minIdle, testOnBorrow, testOnReturn,
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/connectionpool/ArcSDEPoolableObjectFactory.java Fri Mar 26 15:23:03 2010 +0000 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/connectionpool/ArcSDEPoolableObjectFactory.java Mon Mar 29 07:49:16 2010 +0000 @@ -13,7 +13,7 @@ /** * ArcSDE specific Implementation of an PoolableObjectFactory. * This factory instantiate Objects of type ArcSDEConnection. - * + * * @author Tim Englich (tim.englich@intevation.de) * @author Sascha L. Teichmann (sascha.teichmann@intevation.de) */ @@ -28,9 +28,9 @@ /** * The 5 seconds are inspired by GeoTools's testServer() usage. */ - private int serverRoundtripInterval = 5; + private int serverRoundtripInterval = 5; /** - * The value of the maximum Time a Connection is allowed to + * The value of the maximum Time a Connection is allowed to * be inactive without the validation of the Connection. */ private long serverInactiveInterval = 5L*60L*1000L; // 5 minutes @@ -54,7 +54,7 @@ * The Credentials which belongs to the User */ private String credentials = null; - + /** * Constructor of this Class * @param properties the Properties which includes the ConnectionParams to the Database @@ -73,7 +73,7 @@ properties.getProperty("serverRoundtripInterval"); String serverInactiveIntervalValue = properties.getProperty("serverInactiveInterval"); - + try { if (serverRoundtripIntervalValue != null) { serverRoundtripInterval = @@ -93,7 +93,7 @@ catch (NumberFormatException e) { log.error(e,e); } - + log.info("ArcSDEPoolableObjectFactory initialized"); log.info("Server: " + server); log.info("Port: " + port); @@ -130,9 +130,9 @@ Connection con; try { con = new ArcSDEConnection( - server, + server, port, - database, + database, username, credentials, serverRoundtripInterval,
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEConnection.java Fri Mar 26 15:23:03 2010 +0000 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEConnection.java Mon Mar 29 07:49:16 2010 +0000 @@ -30,7 +30,7 @@ import de.intevation.gnv.geobackend.sde.connectionpool.ArcSDEPoolableObjectFactory; /** - * Wrapperclass between an @see java.sql.Connection and an + * Wrapperclass between an @see java.sql.Connection and an * @see com.esri.sde.sdk.client.SeConnection * @author Tim Englich <tim.englich@intevation.de> */ @@ -40,19 +40,19 @@ * the logger, used to log exceptions and additonaly information */ private static Logger log = Logger.getLogger(ArcSDEPoolableObjectFactory.class); - + /** * The Connection to the ArcSDE-backend. */ private SeConnection seConnection = null; /** - * Time that have to be gone until the Server will be requested if + * Time that have to be gone until the Server will be requested if * the Connection is valid. */ private long serverRoundtripInterval ; /** - * The Time which a Connection can be inactive until the Connection + * The Time which a Connection can be inactive until the Connection * will be set to invalid. */ private long inactiveInterval; @@ -61,7 +61,7 @@ * The TimeStamp of the last usage of this Connection. */ private long lastTouch; - + /** * Constructor @@ -81,10 +81,10 @@ String port, String database, String username, - String credentials, + String credentials, long serverRoundtripInterval, long inactiveInterval - ) + ) throws ConnectionException { this.serverRoundtripInterval = serverRoundtripInterval; @@ -402,7 +402,7 @@ */ public void setTypeMap(Map<String, Class<?>> map) throws SQLException { } - + /** * @return the seConnection */ @@ -450,7 +450,7 @@ log.debug("The validation of the Connection has occured an Error. The connection is invalid."); valid = false; } - + return valid; }
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEResultSetMetaData.java Fri Mar 26 15:23:03 2010 +0000 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEResultSetMetaData.java Mon Mar 29 07:49:16 2010 +0000 @@ -19,7 +19,7 @@ * The Columndefinitions which are required to explain the retrieved Data. */ private List<ColDefinition> columnDefinitions = null; - + /** * Constructor */
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEStatement.java Fri Mar 26 15:23:03 2010 +0000 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEStatement.java Mon Mar 29 07:49:16 2010 +0000 @@ -47,12 +47,12 @@ * the logger, used to log exceptions and additonaly information */ private static Logger log = Logger.getLogger(ArcSDEStatement.class); - + /** * The Connection to the ArcSDE-Backend */ private ArcSDEConnection connection = null; - + /** * Constructor * @param connection the Connection to the ArcSDE-Backend. @@ -133,7 +133,7 @@ try { SeQuery query = null; if (statement.toLowerCase().contains("st_astext") || statement.toLowerCase().contains("intersects")){ - + String[] values = statement.toLowerCase().split("where", 2); String where = values.length > 1 ? values[1].trim() : ""; String[] tableNames = values[0].substring(values[0].indexOf("from")).replaceFirst("from", "").toUpperCase().trim().split(", "); @@ -150,7 +150,7 @@ byClause = where.substring(byClausePos); where = where.substring(0,byClausePos); } - + for (int i = 0; i < returnFields.length; i++){ returnFields[i] = returnFields[i].trim(); if (returnFields[i].startsWith("st_astext(")){ @@ -159,11 +159,11 @@ geometryColumnName = returnFields[i]; } } - + for (int i = 0; i < tableNames.length; i++){ tableNames[i] = tableNames[i].trim(); } - + Geometry g = null; int pos = where.indexOf("intersects"); if (pos >= 0 ){ @@ -188,13 +188,13 @@ wkt = intersectsStmt.substring(intersectsStmt.indexOf("\""), intersectsStmt.lastIndexOf("\"")).replace("\"", "").trim(); } g = new WKTReader().read(wkt.toUpperCase()); - + if (geometryColumnName == null){ geometryColumnName = "SHAPE"; // TODO dynamisch aus Intersects auslesen. } - + } - + return this.executeQuery(this.connection.getSeConnection(), tableNames, geometryColumnName, where, g, returnFields,byClause); }else{ query = new SeQuery(this.connection.getSeConnection()); @@ -202,19 +202,19 @@ query.execute(); return this.handleResultSet(query,false,null); } - + } catch (Exception e) { log.error(e,e); throw new SQLException(e.getMessage()); } - - + + } /** * This Methods Executes the ArcSDE Query if Spatial-Restrictions * are given * @param con The Connection to the ArcSDE-Backend. - * @param pLayername The Name of tables which should be used in the Query + * @param pLayername The Name of tables which should be used in the Query * @param pSpatialColumnName the Name of the Spatial Column. * @param pWhere The where-Clause to limit the Data * @param g the Geometry to limit the Data @@ -231,16 +231,16 @@ try { // get the layer for querying boolean isRaster = pSpatialColumnName.equalsIgnoreCase("raster"); - + SeShapeFilter[] filters = null; if (g != null){ if (!isRaster){ SeLayer lLayer = new SeLayer(con, pLayername[0], pSpatialColumnName); SeShape shape = new SeShape(); shape.setCoordRef(lLayer.getCoordRef()); - + SDEPoint[] lPoints = new ArcSDEUtils().createPoints(g); - + int searchMode = SeFilter.METHOD_AI; if (g instanceof Polygon){ shape.generatePolygon(lPoints.length, 1, null, lPoints); @@ -251,7 +251,7 @@ shape.generateLine(lPoints.length, 1, null, lPoints); searchMode = SeFilter.METHOD_LCROSS; } - + SeShapeFilter filter = new SeShapeFilter(pLayername[0], pSpatialColumnName, shape,searchMode); filters = new SeShapeFilter[1]; @@ -262,14 +262,14 @@ SeQuery spatialQuery = null; SeSqlConstruct sqlCons = new SeSqlConstruct(pLayername, pWhere); spatialQuery = new SeQuery(con);//, pReturnFields, sqlCons); - + SeQueryInfo queryInfo = new SeQueryInfo(); queryInfo.setColumns(pReturnFields); - + if (byClause != null){ queryInfo.setByClause(byClause); } - + queryInfo.setConstruct(sqlCons); spatialQuery.prepareQueryInfo(queryInfo); @@ -280,11 +280,11 @@ spatialQuery.setSpatialConstraints(SeQuery.SE_OPTIMIZE, false, filters); } - + if (!isRaster){ spatialQuery.execute(); } - + return this.handleResultSet(spatialQuery,isRaster,g); } catch (Exception e) { @@ -293,7 +293,7 @@ }else{ log.error(e.getMessage(), e); } - + throw new SQLException(e.getMessage()); } } @@ -472,19 +472,19 @@ */ public void setQueryTimeout(int arg0) throws SQLException { } - + /** * This Method fetches all Rows from the SeQuery-Object and convert it into * an @see java.sql.ResultSet. - * + * * @param pSeQuery the Queryobject where the Data should be fetched from. * @param isRaster Flag which indicates if the Result is Rasterdata. * @param geometry The Geometry which might be used to limit the data. * @return an java.sql:ResultSet which contains the Data. * @throws SeException */ - private ResultSet handleResultSet(SeQuery pSeQuery, - boolean isRaster, + private ResultSet handleResultSet(SeQuery pSeQuery, + boolean isRaster, Geometry geometry) throws SeException { boolean debug = log.isDebugEnabled(); @@ -517,7 +517,7 @@ Row lBackingRow = new Row(lNumCols); for (int i = 0; i < lNumCols; i++) { lBackingRow.addObject( - removers[i].filter(row.getObject(i)), + removers[i].filter(row.getObject(i)), i); } lSet.addRow(lBackingRow); @@ -544,18 +544,18 @@ SeRaster raster = attr.getRasterInfo(); SeRasterBand [] bands = raster.getBands(); SeRasterBand rasterBand = bands[0]; - + SeExtent extent = rasterBand.getExtent(); double x = ((Point)geometry).getX(); double y = ((Point)geometry).getY(); boolean isPointInRaster = - x >= extent.getMinX() && x <= extent.getMaxX() + x >= extent.getMinX() && x <= extent.getMaxX() && y >= extent.getMinY() && y <= extent.getMaxY(); - + if (isPointInRaster){ - + if (row == null){ pSeQuery.execute(); row = pSeQuery.fetch(); @@ -566,7 +566,7 @@ SDEPoint origin = rasterBand.getTileOrigin(); - double maxX = origin.getX() < midX + double maxX = origin.getX() < midX ? extent.getMaxX() : extent.getMinX(); @@ -665,6 +665,6 @@ */ public <T> T unwrap(Class<T> iface) throws SQLException { return null; - + } }
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/RasterObject.java Fri Mar 26 15:23:03 2010 +0000 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/RasterObject.java Mon Mar 29 07:49:16 2010 +0000 @@ -19,7 +19,7 @@ * @author Tim Englich (tim.englich@intevation.de) * @author Sascha L. Teichmann (sascha.teichmann@intevation.de) */ -public class RasterObject +public class RasterObject implements Serializable { private static Logger log = Logger.getLogger(RasterObject.class); @@ -50,7 +50,7 @@ public RasterObject( double mx, double bx, double my, double by, - int columnIndex, + int columnIndex, int rowIndex, double [] rasterData, int tileWidth, @@ -92,7 +92,7 @@ public int getRowIndex() { return rowIndex; } - + public double getValue(Coordinate coordinate) { return getValue(coordinate, NEAREST_NEIGHBOR); }
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/util/RedundancyRemover.java Fri Mar 26 15:23:03 2010 +0000 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/util/RedundancyRemover.java Mon Mar 29 07:49:16 2010 +0000 @@ -9,7 +9,7 @@ public final class RedundancyRemover extends LinkedHashMap { - /** ceil(1029 * 1.75) = 1801, which is prime + /** ceil(1029 * 1.75) = 1801, which is prime * -> suitable for a hash map slot size. */ public static final int DEFAULT_LOOKBACK =
--- a/geo-backend/src/test/java/de/intevation/gnv/geobackend/base/query/GroupBySample.java Fri Mar 26 15:23:03 2010 +0000 +++ b/geo-backend/src/test/java/de/intevation/gnv/geobackend/base/query/GroupBySample.java Mon Mar 29 07:49:16 2010 +0000 @@ -15,22 +15,22 @@ public class GroupBySample { - + public void executeQuery(SeConnection con, String[] pLayername, String pSpatialColumnName, String pWhere, SDEPoint[] g, String[] pReturnFields, String byClause) { - + try { // get the layer for querying - + SeShapeFilter[] filters = null; if (g != null){ SeLayer lLayer = new SeLayer(con, pLayername[0], pSpatialColumnName); SeShape shape = new SeShape(); shape.setCoordRef(lLayer.getCoordRef()); - - - + + + shape.generatePolygon(g.length, 1, null, g); SeShapeFilter filter = new SeShapeFilter(pLayername[0], pSpatialColumnName, shape, SeFilter.METHOD_AI); @@ -41,14 +41,14 @@ SeQuery spatialQuery = null; SeSqlConstruct sqlCons = new SeSqlConstruct(pLayername, pWhere); spatialQuery = new SeQuery(con); - + SeQueryInfo queryInfo = new SeQueryInfo(); queryInfo.setColumns(pReturnFields); - + if (byClause != null){ queryInfo.setByClause(byClause); } - + queryInfo.setConstruct(sqlCons); spatialQuery.prepareQueryInfo(queryInfo); @@ -68,29 +68,29 @@ if (lCount == 0) { // analyze cols of result set SeColumnDefinition[] lCols = row.getColumns(); - + } short lNumCols = row.getNumColumns(); - + for (int i = 0; i < lNumCols; i++) { System.out.println(row.getObject(i)); } - + } spatialQuery.close(); - } catch (Exception e){ + } catch (Exception e){ e.printStackTrace(); } - + } - - + + /** * @param args */ public static void main(String[] args) { - + try { String[] layerNames = new String[] { "median.meshpoint", "median.mesh" }; String spatialColumnName = "SHAPE"; @@ -109,13 +109,13 @@ String database = ""; String username = ""; String credentials = ""; - SeConnection con = new SeConnection(server, port, + SeConnection con = new SeConnection(server, port, database, username, credentials); new GroupBySample().executeQuery(con, layerNames, spatialColumnName, where, g, returnFields, byClause); - - + + } catch (SeException e) { e.printStackTrace(); }
--- a/geo-backend/src/test/java/de/intevation/gnv/geobackend/base/query/QueryExecutorTestCase.java Fri Mar 26 15:23:03 2010 +0000 +++ b/geo-backend/src/test/java/de/intevation/gnv/geobackend/base/query/QueryExecutorTestCase.java Mon Mar 29 07:49:16 2010 +0000 @@ -25,18 +25,18 @@ * */ public class QueryExecutorTestCase extends TestCase { - - + + /** * the logger, used to log exceptions and additonaly information */ private static Logger log = null; - + static{ BasicConfigurator.configure(); log = Logger.getLogger(QueryExecutorTestCase.class); } - + /** * Constructor * @param name @@ -44,18 +44,18 @@ public QueryExecutorTestCase(String name) { super(name); } - - + + public void testSpatialQuery(){ try { - + this.testQuery(5, "spatial_query", null); } catch (QueryException e) { log.error(e,e); fail(); } } - + public void testSpatialQueryWithoutIntersects(){ try { // this.testQuery(286, "spatial_query_without_intersects", null); @@ -69,7 +69,7 @@ fail(); } } - + public void testSpatialQueryWithInnerSelect(){ try { this.testQuery(1998, "spatial_query_with_innerselect", null); @@ -78,8 +78,8 @@ fail(); } } - - + + public void testChooseFis(){ try { this.testQuery(1, "choose_fis_query", null); @@ -88,44 +88,44 @@ fail(); } } - - + + /** * Tests if the Databaseconnection can be established and * Data could be read from the Database */ public void testQueryExecutor(){ - + try { - + this.testQuery(6, "mesh", null); - + this.testQuery(1, "mesh_id", new String[]{"5"}); - - - + + + } catch (QueryException e) { log.error(e,e); fail(); } } - + public void testTimeSeriesQueries(){ - + try{ // Test zum initialisieren der umgebung this.testQuery(6, "mesh", null); - - + + this.testQuery(11, "timeseries_stations", new String[]{"4"}); this.testQuery(11, "timeseries_stations_op", new String[]{"4"}); this.testQuery(1, "timeseries_interval", new String[]{"500042 ", "54"}); - + } catch (QueryException e) { log.error(e,e); fail(); } - + } /** @@ -159,7 +159,7 @@ // } log.debug("Query dauerte: "+(System.currentTimeMillis()-start) +"ms"); } - + /** @@ -167,20 +167,20 @@ */ @Override protected void setUp() throws Exception { - + super.setUp(); InputStream inputStream = new FileInputStream("src/test/ressources/ArcSDEConnectionPoolTestCase.properties"); Properties properties = new Properties(); properties.load(inputStream); - + ConnectionPoolFactory cpf = ConnectionPoolFactory.getInstance(); cpf.initializeConnectionPool(properties); - - + + inputStream = new FileInputStream("src/test/ressources/QueryExecutorTestCase.properties"); properties = new Properties(); properties.load(inputStream); - + QueryContainerFactory qcf = QueryContainerFactory.getInstance(); qcf.initializeQueryContainer(properties); }
--- a/geo-backend/src/test/java/de/intevation/gnv/geobackend/base/query/ToCharSample.java Fri Mar 26 15:23:03 2010 +0000 +++ b/geo-backend/src/test/java/de/intevation/gnv/geobackend/base/query/ToCharSample.java Mon Mar 29 07:49:16 2010 +0000 @@ -15,22 +15,22 @@ public class ToCharSample { - + public boolean executeQuery(SeConnection con, String[] pLayername, String pSpatialColumnName, String pWhere, SDEPoint[] g, String[] pReturnFields, String byClause) { - + try { // get the layer for querying - + SeShapeFilter[] filters = null; if (g != null){ SeLayer lLayer = new SeLayer(con, pLayername[0], pSpatialColumnName); SeShape shape = new SeShape(); shape.setCoordRef(lLayer.getCoordRef()); - - - + + + shape.generatePolygon(g.length, 1, null, g); SeShapeFilter filter = new SeShapeFilter(pLayername[0], pSpatialColumnName, shape, SeFilter.METHOD_AI); @@ -41,14 +41,14 @@ SeQuery spatialQuery = null; SeSqlConstruct sqlCons = new SeSqlConstruct(pLayername, pWhere); spatialQuery = new SeQuery(con); - + SeQueryInfo queryInfo = new SeQueryInfo(); queryInfo.setColumns(pReturnFields); - + if (byClause != null){ queryInfo.setByClause(byClause); } - + queryInfo.setConstruct(sqlCons); spatialQuery.prepareQueryInfo(queryInfo); @@ -68,36 +68,36 @@ if (lCount == 0) { // analyze cols of result set SeColumnDefinition[] lCols = row.getColumns(); - + } short lNumCols = row.getNumColumns(); - + for (int i = 0; i < lNumCols; i++) { System.out.println(row.getObject(i)); } - + } spatialQuery.close(); return true; - } catch (Exception e){ + } catch (Exception e){ e.printStackTrace(); return false; } - + } - - + + /** * @param args */ public static void main(String[] args) { - + try { String[] layerNames = new String[] { "MEDIAN.TRACK" }; String spatialColumnName = "SHAPE"; String where = "MEDIAN.TRACK.CRUISEID = 47"; - String[] returnFields = new String[] { "MEDIAN.TRACK.TRACKID KEY", + String[] returnFields = new String[] { "MEDIAN.TRACK.TRACKID KEY", "to_char(STARTDATE,'DD.MM.YYYY HH24:MI') || ' - '|| to_char(ENDDATE,'DD.MM.YYYY HH24:MI') || ' - '|| NAME VALUE", "NAME" }; String byClause = "ORDER BY STARTDATE, ENDDATE, NAME"; @@ -113,13 +113,13 @@ String database = ""; String username = ""; String credentials = ""; - - SeConnection con = new SeConnection(server, port, + + SeConnection con = new SeConnection(server, port, database, username, credentials); boolean success = new ToCharSample().executeQuery(con, layerNames, spatialColumnName, where, g, returnFields, byClause); - + if (success){ System.out.println("Terminated successful."); }else{
--- a/geo-backend/src/test/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEConnectionPoolTestCase.java Fri Mar 26 15:23:03 2010 +0000 +++ b/geo-backend/src/test/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEConnectionPoolTestCase.java Mon Mar 29 07:49:16 2010 +0000 @@ -31,26 +31,26 @@ * the logger, used to log exceptions and additonaly information */ private static Logger log = null; - + static { BasicConfigurator.configure(); log = Logger.getLogger(ArcSDEPoolableObjectFactory.class); } /** - * + * */ public ArcSDEConnectionPoolTestCase() { super(); } - + /** - * + * * @param name */ public ArcSDEConnectionPoolTestCase(String name) { super(name); } - + /** * Test if the ArcSDEConnectionPool can be established * and if a Request could be done. @@ -61,18 +61,18 @@ InputStream inputStream = new FileInputStream("src/test/ressources/ArcSDEConnectionPoolTestCase.properties"); Properties properties = new Properties(); properties.load(inputStream); - + ConnectionPoolFactory cpf = ConnectionPoolFactory.getInstance(); cpf.initializeConnectionPool(properties); - + assertTrue(cpf.isInitialized()); log.debug("ConnectionPoolFactory ist initialisiert."); - + ConnectionPool cp = cpf.getConnectionPool(); assertNotNull(cp); - log.debug("ConnectionPool ist initialisiert."); - - Connection connection = null; + log.debug("ConnectionPool ist initialisiert."); + + Connection connection = null; try{ try { connection = cp.getConnection("N/N"); @@ -82,20 +82,20 @@ log.error("Es traten Probleme bei der Verbinung zur Datenbank auf."); fail(); } - - + + try { Statement stmt = connection.createStatement(); ResultSet rs = stmt.executeQuery("Select MESHID, NAME from MEDIAN.MESH"); - + while (rs.next()){ log.debug(rs.getInt(1)); log.debug(rs.getString(2)); - + log.debug(rs.getInt("MESHID")); log.debug(rs.getString("NAME")); } - + } catch (SQLException e) { log.error(e,e); }