# HG changeset patch # User Tim Englich # Date 1269616983 0 # Node ID 12f88239fb3307946de14639606119c854e1f7a3 # Parent 6d568397740c3f50bc21e6e6d4fef854d4536ed8 Updated Javadocs to the Listed Classes. Also done some Codecleanup and removed unused Methods from the Code. geo-backend/trunk@842 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 6d568397740c -r 12f88239fb33 geo-backend/ChangeLog --- a/geo-backend/ChangeLog Fri Mar 26 11:07:01 2010 +0000 +++ b/geo-backend/ChangeLog Fri Mar 26 15:23:03 2010 +0000 @@ -1,5 +1,17 @@ 2010-03-26 Tim Englich + * src/main/java/de/intevation/gnv/geobackend/util/DateUtils.java, + src/main/java/de/intevation/gnv/geobackend/sde/datasources/exception/*.java, + src/main/java/de/intevation/gnv/geobackend/sde/datasources/*.java, + src/main/java/de/intevation/gnv/geobackend/sde/connectionpool/ArcSDEPoolableObjectFactory.java, + src/main/java/de/intevation/gnv/geobackend/base/query/exception/QueryException.java, + src/main/java/de/intevation/gnv/geobackend/base/query/QueryExecutorFactory.java, + src/main/java/de/intevation/gnv/geobackend/base/connectionpool/exception/ConnectionException.java, + src/main/java/de/intevation/gnv/geobackend/base/connectionpool/ConnectionPoolFactory.java, + src/main/java/de/intevation/gnv/geobackend/base/*.java: + Updated Javadocs to the Listed Classes. + Also done some Codecleanup and removed unused Methods from the Code. + * src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEConnectionParams.java: Removed unused Class ArcSDEConnectionParams. diff -r 6d568397740c -r 12f88239fb33 geo-backend/src/main/java/de/intevation/gnv/geobackend/base/DefaultResult.java --- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/DefaultResult.java Fri Mar 26 11:07:01 2010 +0000 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/DefaultResult.java Fri Mar 26 15:23:03 2010 +0000 @@ -5,7 +5,6 @@ import java.util.Date; import java.util.GregorianCalendar; -import java.util.HashMap; import de.intevation.gnv.geobackend.util.DateUtils; @@ -22,14 +21,10 @@ * THE UID of this Classe */ private static final long serialVersionUID = -6886218808840982766L; - - /** - * HashMap which stores the Columnvalues identified by the unique Columnname + * Array which stores the Columnvalues */ - private Object [] values; - /** * The ResultDescriptor which describes the ColumnValues */ @@ -50,6 +45,9 @@ return getDate(resultDescriptor.getColumnIndex(columnName)); } + /** + * @see de.intevation.gnv.geobackend.base.Result#getDate(int) + */ public Date getDate(int column) { Object o = values[column]; Date d = null; @@ -68,6 +66,9 @@ return getDouble(resultDescriptor.getColumnIndex(columnName)); } + /** + * @see de.intevation.gnv.geobackend.base.Result#getDouble(int) + */ public Double getDouble(int column) { return (Double)values[column]; } @@ -79,6 +80,9 @@ return getFloat(resultDescriptor.getColumnIndex(columnName)); } + /** + * @see de.intevation.gnv.geobackend.base.Result#getFloat(int) + */ public Float getFloat(int column) { return (Float)values[column]; } @@ -88,11 +92,12 @@ */ public Integer getInteger(String columnName) { int idx = resultDescriptor.getColumnIndex(columnName); - return idx > -1 ? getInteger(idx) : -1; - //return getInteger(resultDescriptor.getColumnIndex(columnName)); } + /** + * @see de.intevation.gnv.geobackend.base.Result#getInteger(int) + */ public Integer getInteger(int column) { Object value = values[column]; if (value instanceof Double){ @@ -100,6 +105,7 @@ } return (Integer)value; } + /** * @see de.intevation.gnv.geobackend.base.Result#getResultDescriptor() */ @@ -112,23 +118,21 @@ */ public String getString(String columnName) { int idx = resultDescriptor.getColumnIndex(columnName); - return idx > -1 ? getString(idx) : null; } + /** + * @see de.intevation.gnv.geobackend.base.Result#getString(int) + */ public String getString(int column) { - Object o = values[column]; - if (o instanceof Date){ return DateUtils.getPatternedDateAmer((Date)o); } - if (o instanceof GregorianCalendar){ Date d = ((GregorianCalendar)o).getTime(); return DateUtils.getPatternedDateAmer(d); } - return o != null ? o.toString() : null; } @@ -146,6 +150,9 @@ return getObject(resultDescriptor.getColumnIndex(columnName)); } + /** + * @see de.intevation.gnv.geobackend.base.Result#getObject(int) + */ public Object getObject(int column) { return values[column]; } diff -r 6d568397740c -r 12f88239fb33 geo-backend/src/main/java/de/intevation/gnv/geobackend/base/DefaultResultDescriptor.java --- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/DefaultResultDescriptor.java Fri Mar 26 11:07:01 2010 +0000 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/DefaultResultDescriptor.java Fri Mar 26 15:23:03 2010 +0000 @@ -20,19 +20,16 @@ *The Uid of this Class */ private static final long serialVersionUID = 7016889733270716130L; - /** * The Names of the Columns of one Result */ private List columnNames = new ArrayList(); - /** * The Name of the Classes of the Values of one Result. */ private List columnClassNames = new ArrayList(); - /** - * + * The Lookup for the Columnindex of the Columnnames */ private Map columnIndexLookup = new HashMap(); @@ -80,13 +77,10 @@ if (columnNames == null) { return null; } - int [] indices = new int[columnNames.length]; - for (int i = 0; i < indices.length; ++i) { indices[i] = this.getColumnIndex(columnNames[i]); } - return indices; } @@ -99,6 +93,10 @@ return value != null ? value.intValue() : -1; } + /** + * @see java.lang.Object#toString() + */ + @Override public String toString() { StringBuilder sb = new StringBuilder("["); int N = Math.min(columnNames.size(), columnClassNames.size()); diff -r 6d568397740c -r 12f88239fb33 geo-backend/src/main/java/de/intevation/gnv/geobackend/base/Result.java --- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/Result.java Fri Mar 26 11:07:01 2010 +0000 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/Result.java Fri Mar 26 15:23:03 2010 +0000 @@ -14,14 +14,14 @@ * */ public interface Result extends Serializable{ - + /** * Returns the ResultDescriptor which provides the * ResultMetadatse * @return the ResultDescriptor */ public ResultDescriptor getResultDescriptor(); - + /** * Returns the Columnvalue as a String * @param columnName the Name of the column @@ -29,9 +29,13 @@ */ public String getString(String columnName); + /** + * Returns the Columnvalue as a String + * @param column the Position of the Column that should be returned. + * @return the Columnvalue as a String + */ + public String getString(int column); - public String getString(int column); - /** * Returns the Columnvalue as a Date * @param columnName the Name of the column @@ -39,8 +43,13 @@ */ public Date getDate(String columnName); + /** + * Returns the Columnvalue as a Date + * @param column the Position of the Column that should be returned. + * @return the Columnvalue as a Date + */ public Date getDate(int column); - + /** * Returns the Columnvalue as a Integer * @param columnName the Name of the column @@ -48,6 +57,11 @@ */ public Integer getInteger(String columnName); + /** + * Returns the Columnvalue as a Integer + * @param column the Position of the Column that should be returned. + * @return the Columnvalue as a Integer + */ public Integer getInteger(int column); /** @@ -57,8 +71,13 @@ */ public Float getFloat(String columnName); + /** + * Returns the Columnvalue as a Float + * @param column the Position of the Column that should be returned. + * @return the Columnvalue as a Float + */ public Float getFloat(int column); - + /** * Returns the Columnvalue as a Double * @param columnName the Name of the column @@ -66,8 +85,13 @@ */ public Double getDouble(String columnName); + /** + * Returns the Columnvalue as a Double + * @param column the Position of the Column that should be returned. + * @return the Columnvalue as a Double + */ public Double getDouble(int column); - + /** * Returns the Columnvalue as a Object * @param columnName the Name of the column @@ -75,8 +99,13 @@ */ public Object getObject(String columnName); + /** + * Returns the Columnvalue as a Object + * @param column the Position of the Column that should be returned. + * @return the Columnvalue as a Object + */ public Object getObject(int column); - + /** * Adds an new Coumnvalue to the Result. * @param columnName the Name of the Column diff -r 6d568397740c -r 12f88239fb33 geo-backend/src/main/java/de/intevation/gnv/geobackend/base/ResultDescriptor.java --- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/ResultDescriptor.java Fri Mar 26 11:07:01 2010 +0000 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/ResultDescriptor.java Fri Mar 26 15:23:03 2010 +0000 @@ -18,20 +18,20 @@ * @return the Classname of the Column */ public String getColumnClassName(int column); - + /** * Returns the Number of Columns * @return the Number of Columns */ public int getColumnCount(); - + /** * Returns the Name of the Column which belongs to the given Columnindex * @param column the Index of the Column * @return the Name of the Column */ public String getColumnName(int column); - + /** * Adds a new ColumnDescription into the Descriptor * @param name the Name of the Column (unique) @@ -39,7 +39,19 @@ */ public void addColumn(String name, String className); + /** + * 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 + * param columnNames. + */ public int [] getColumnIndices(String [] columnNames); + /** + * Returns the index of the given columnName + * @param columnName the Name of the Index which should be looked up. + * @return the index of the given columnName + */ public int getColumnIndex(String columnName); } diff -r 6d568397740c -r 12f88239fb33 geo-backend/src/main/java/de/intevation/gnv/geobackend/base/connectionpool/ConnectionPoolFactory.java --- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/connectionpool/ConnectionPoolFactory.java Fri Mar 26 11:07:01 2010 +0000 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/connectionpool/ConnectionPoolFactory.java Fri Mar 26 15:23:03 2010 +0000 @@ -49,8 +49,7 @@ } return instance; } - - + /** * Getting the ConnectionPool * @return the ConnectionPool diff -r 6d568397740c -r 12f88239fb33 geo-backend/src/main/java/de/intevation/gnv/geobackend/base/connectionpool/exception/ConnectionException.java --- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/connectionpool/exception/ConnectionException.java Fri Mar 26 11:07:01 2010 +0000 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/connectionpool/exception/ConnectionException.java Fri Mar 26 15:23:03 2010 +0000 @@ -1,42 +1,29 @@ /** - * Title: lConnectionException, $Header: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/exception/ConnectionException.java,v 1.2 2008/08/18 14:50:33 drewnak Exp $ - * Source: $Source: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/exception/ConnectionException.java,v $ - * created by: Stefan Blume (blume) - * erstellt am: 21.11.2007 - * Copyright: con terra GmbH, 2005 * - * modified by: $Author: drewnak $ - * modified on: $Date: 2008/08/18 14:50:33 $ - * Version: $Revision: 1.2 $ - * TAG: $Name: $ - * locked from: $Locker: $ - * CVS State: $State: Exp $ - * Project: $ProjectName$ */ package de.intevation.gnv.geobackend.base.connectionpool.exception; +import org.apache.log4j.Logger; + import com.esri.sde.sdk.client.SeError; import com.esri.sde.sdk.client.SeException; import de.intevation.gnv.geobackend.sde.datasources.exception.TechnicalException; -import org.apache.log4j.Logger; - /** * The class lConnectionException fulfills the following purposes: - *
    - *
  1. - *
* * @author blume - * @version 1.0 - * @serial 1.0 - * @see - * @since 21.11.2007 08:13:05 + * @author Tim Englich */ public class ConnectionException extends TechnicalException { /** + * The UID of this Class. + */ + private static final long serialVersionUID = 102459262123219617L; + + /** * Default Logging instance */ private static Logger sLogger = Logger.getLogger(ConnectionException.class); @@ -60,6 +47,11 @@ public ConnectionException(String message) { super(message); } + + /** + * Constructor + * @param pCause the Throwable which cause this exception + */ public ConnectionException(Throwable pCause) { super(pCause); } diff -r 6d568397740c -r 12f88239fb33 geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/QueryExecutorFactory.java --- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/QueryExecutorFactory.java Fri Mar 26 11:07:01 2010 +0000 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/QueryExecutorFactory.java Fri Mar 26 15:23:03 2010 +0000 @@ -44,6 +44,7 @@ final QueryExecutorFactory factory = (QueryExecutorFactory)clazz.newInstance(); Runtime.getRuntime().addShutdownHook(new Thread() { + @Override public void run() { factory.shutdown(); } diff -r 6d568397740c -r 12f88239fb33 geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/exception/QueryException.java --- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/exception/QueryException.java Fri Mar 26 11:07:01 2010 +0000 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/exception/QueryException.java Fri Mar 26 15:23:03 2010 +0000 @@ -3,6 +3,8 @@ */ package de.intevation.gnv.geobackend.base.query.exception; /** + * This is a specialized Exceptionclass for Exceptions that occurse during + * querying Data from the Database- * @author Tim Englich * */ diff -r 6d568397740c -r 12f88239fb33 geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/connectionpool/ArcSDEPoolableObjectFactory.java --- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/connectionpool/ArcSDEPoolableObjectFactory.java Fri Mar 26 11:07:01 2010 +0000 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/connectionpool/ArcSDEPoolableObjectFactory.java Fri Mar 26 15:23:03 2010 +0000 @@ -1,19 +1,19 @@ package de.intevation.gnv.geobackend.sde.connectionpool; -import de.intevation.gnv.geobackend.base.connectionpool.exception.ConnectionException; - -import de.intevation.gnv.geobackend.sde.datasources.ArcSDEConnection; - import java.sql.Connection; import java.sql.SQLException; - import java.util.Properties; import org.apache.commons.pool.PoolableObjectFactory; - import org.apache.log4j.Logger; +import de.intevation.gnv.geobackend.base.connectionpool.exception.ConnectionException; +import de.intevation.gnv.geobackend.sde.datasources.ArcSDEConnection; + /** + * 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) */ @@ -25,9 +25,14 @@ private static Logger log = Logger.getLogger( ArcSDEPoolableObjectFactory.class); - // The 5 seconds are inspired by GeoTools's testServer() usage. + /** + * The 5 seconds are inspired by GeoTools's testServer() usage. + */ private int serverRoundtripInterval = 5; - + /** + * 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 /** * The URL to the ArcSDE Server diff -r 6d568397740c -r 12f88239fb33 geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEConnection.java --- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEConnection.java Fri Mar 26 11:07:01 2010 +0000 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEConnection.java Fri Mar 26 15:23:03 2010 +0000 @@ -1,7 +1,7 @@ /** * */ - package de.intevation.gnv.geobackend.sde.datasources; +package de.intevation.gnv.geobackend.sde.datasources; import java.sql.Array; import java.sql.Blob; @@ -30,29 +30,53 @@ import de.intevation.gnv.geobackend.sde.connectionpool.ArcSDEPoolableObjectFactory; /** + * Wrapperclass between an @see java.sql.Connection and an + * @see com.esri.sde.sdk.client.SeConnection * @author Tim Englich - * */ public class ArcSDEConnection implements Connection { - /** + /** * the logger, used to log exceptions and additonaly information */ private static Logger log = Logger.getLogger(ArcSDEPoolableObjectFactory.class); - private SeConnection seConnection = null; - - private long serverRoundtripInterval; + /** + * The Connection to the ArcSDE-backend. + */ + private SeConnection seConnection = null; + /** + * 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 + * will be set to invalid. + */ private long inactiveInterval; + /** + * The TimeStamp of the last usage of this Connection. + */ private long lastTouch; - + - /** - * Constructor - */ - public ArcSDEConnection( + /** + * Constructor + * @param server the URL to the Server + * @param port the Port of the Server + * @param database the Name of the Database + * @param username the Name of the User + * @param credentials the Credentials to the User- + * @param serverRoundtripInterval Time that have to be gone until the Server + * will be requested if the Connection is valid. + * @param inactiveInterval the Time which a Connection can be inactive until + * the Connection will be set to invalid. + * @throws ConnectionException + */ + public ArcSDEConnection( String server, String port, String database, @@ -67,15 +91,19 @@ this.inactiveInterval = inactiveInterval; lastTouch = System.currentTimeMillis(); - try { - seConnection = new SeConnection( server, port, database, username, credentials); + try { + seConnection = new SeConnection( server, port, database, username, credentials); } catch (SeException e) { - log.error(e,e); - throw new ConnectionException(e); + log.error(e,e); + throw new ConnectionException(e); } - } + } + /** + * TODO: DOCUMENT ME. + * @return + */ public boolean isActive() { long current = System.currentTimeMillis(); long last; @@ -85,6 +113,9 @@ return Math.abs(current - last) < inactiveInterval; } + /** + * Sets the last-Usage-Time to the Current-time + */ public void touch() { long time = System.currentTimeMillis(); synchronized (this) { @@ -92,303 +123,291 @@ } } - /** - * @see java.sql.Connection#clearWarnings() - */ - public void clearWarnings() throws SQLException { - } - - /** - * @see java.sql.Connection#close() - */ - public void close() throws SQLException { - try { - this.seConnection.close(); - } catch (SeException e) { - log.error(e,e); - throw new SQLException(e.getMessage()); - } - } - - /** - * @see java.sql.Connection#commit() - */ - public void commit() throws SQLException { - try{ - this.seConnection.commitTransaction(); - } catch (SeException e) { - log.error(e,e); - throw new SQLException(e.getMessage()); - } - } - - /** - * @see java.sql.Connection#createStatement() - */ - public Statement createStatement() throws SQLException { - - return new ArcSDEStatement(this); - } - - /** - * @see java.sql.Connection#createStatement(int, int) - */ - public Statement createStatement(int resultSetType, int resultSetConcurrency) - throws SQLException { - return new ArcSDEStatement(this); - } - - /** - * @see java.sql.Connection#createStatement(int, int, int) - */ - public Statement createStatement(int resultSetType, - int resultSetConcurrency, int resultSetHoldability) - throws SQLException { - return new ArcSDEStatement(this); - } - - /** - * @see java.sql.Connection#getAutoCommit() - */ - public boolean getAutoCommit() throws SQLException { - return false; - } - - /** - * @see java.sql.Connection#getCatalog() - */ - public String getCatalog() throws SQLException { - - return null; - } - - /** - * @see java.sql.Connection#getHoldability() - */ - public int getHoldability() throws SQLException { - - return 0; - } - - /** - * @see java.sql.Connection#getMetaData() - */ - public DatabaseMetaData getMetaData() throws SQLException { - - return null; - } - - /** - * @see java.sql.Connection#getTransactionIsolation() - */ - public int getTransactionIsolation() throws SQLException { - - return 0; - } - - /** - * @see java.sql.Connection#getTypeMap() - */ - public Map> getTypeMap() throws SQLException { - - return null; - } - - /** - * @see java.sql.Connection#getWarnings() - */ - public SQLWarning getWarnings() throws SQLException { - - return null; - } - - /** - * @see java.sql.Connection#isClosed() - */ - public boolean isClosed() throws SQLException { - try{ - return this.seConnection.isClosed(); - } catch (Exception e) { - log.error(e,e); - throw new SQLException(e.getMessage()); - } - } - - /** - * @see java.sql.Connection#isReadOnly() - */ - public boolean isReadOnly() throws SQLException { - return false; - } - - /** - * @see java.sql.Connection#nativeSQL(java.lang.String) - */ - public String nativeSQL(String sql) throws SQLException { - return null; - } - - /** - * @see java.sql.Connection#prepareCall(java.lang.String) - */ - public CallableStatement prepareCall(String sql) throws SQLException { - return null; - } + /** + * @see java.sql.Connection#clearWarnings() + */ + public void clearWarnings() throws SQLException { + } - /** - * @see java.sql.Connection#prepareCall(java.lang.String, int, int) - */ - public CallableStatement prepareCall(String sql, int resultSetType, - int resultSetConcurrency) throws SQLException { - return null; - } - - /** - * @see java.sql.Connection#prepareCall(java.lang.String, int, int, int) - */ - public CallableStatement prepareCall(String sql, int resultSetType, - int resultSetConcurrency, int resultSetHoldability) - throws SQLException { - - return null; - } - - /** - * @see java.sql.Connection#prepareStatement(java.lang.String) - */ - public PreparedStatement prepareStatement(String sql) throws SQLException { - - return null; - } - - /** - * @see java.sql.Connection#prepareStatement(java.lang.String, int) - */ - public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) - throws SQLException { - - return null; - } - - /** - * @see java.sql.Connection#prepareStatement(java.lang.String, int[]) - */ - public PreparedStatement prepareStatement(String sql, int[] columnIndexes) - throws SQLException { - - return null; - } - - /** - * @see java.sql.Connection#prepareStatement(java.lang.String, java.lang.String[]) - */ - public PreparedStatement prepareStatement(String sql, String[] columnNames) - throws SQLException { - - return null; - } - - /** - * @see java.sql.Connection#prepareStatement(java.lang.String, int, int) - */ - public PreparedStatement prepareStatement(String sql, int resultSetType, - int resultSetConcurrency) throws SQLException { - - return null; - } - - /** - * @see java.sql.Connection#prepareStatement(java.lang.String, int, int, int) - */ - public PreparedStatement prepareStatement(String sql, int resultSetType, - int resultSetConcurrency, int resultSetHoldability) - throws SQLException { - - return null; - } + /** + * @see java.sql.Connection#close() + */ + public void close() throws SQLException { + try { + this.seConnection.close(); + } catch (SeException e) { + log.error(e,e); + throw new SQLException(e.getMessage()); + } + } - /** - * @see java.sql.Connection#releaseSavepoint(java.sql.Savepoint) - */ - public void releaseSavepoint(Savepoint savepoint) throws SQLException { - } - - /** - * @see java.sql.Connection#rollback() - */ - public void rollback() throws SQLException { - try { - this.seConnection.rollbackTransaction(); + /** + * @see java.sql.Connection#commit() + */ + public void commit() throws SQLException { + try{ + this.seConnection.commitTransaction(); } catch (SeException e) { - log.error(e,e); - throw new SQLException(e.getMessage()); + log.error(e,e); + throw new SQLException(e.getMessage()); } - } - - /** - * @see java.sql.Connection#rollback(java.sql.Savepoint) - */ - public void rollback(Savepoint savepoint) throws SQLException { - this.rollback(); - } - - /** - * @see java.sql.Connection#setAutoCommit(boolean) - */ - public void setAutoCommit(boolean autoCommit) throws SQLException { - } - - /** - * @see java.sql.Connection#setCatalog(java.lang.String) - */ - public void setCatalog(String catalog) throws SQLException { - } + } - /** - * @see java.sql.Connection#setHoldability(int) - */ - public void setHoldability(int holdability) throws SQLException { - } - - /** - * @see java.sql.Connection#setReadOnly(boolean) - */ - public void setReadOnly(boolean readOnly) throws SQLException { - } - - /** - * @see java.sql.Connection#setSavepoint() - */ - public Savepoint setSavepoint() throws SQLException { - - return null; - } + /** + * @see java.sql.Connection#createStatement() + */ + public Statement createStatement() throws SQLException { + return new ArcSDEStatement(this); + } - /** - * @see java.sql.Connection#setSavepoint(java.lang.String) - */ - public Savepoint setSavepoint(String name) throws SQLException { - - return null; - } + /** + * @see java.sql.Connection#createStatement(int, int) + */ + public Statement createStatement(int resultSetType, int resultSetConcurrency) + throws SQLException { + return new ArcSDEStatement(this); + } - /** - * @see java.sql.Connection#setTransactionIsolation(int) - */ - public void setTransactionIsolation(int level) throws SQLException { - } + /** + * @see java.sql.Connection#createStatement(int, int, int) + */ + public Statement createStatement(int resultSetType, + int resultSetConcurrency, int resultSetHoldability) + throws SQLException { + return new ArcSDEStatement(this); + } - /** - * @see java.sql.Connection#setTypeMap(java.util.Map) - */ - public void setTypeMap(Map> map) throws SQLException { - } - - /** + /** + * @see java.sql.Connection#getAutoCommit() + */ + public boolean getAutoCommit() throws SQLException { + return false; + } + + /** + * @see java.sql.Connection#getCatalog() + */ + public String getCatalog() throws SQLException { + return null; + } + + /** + * @see java.sql.Connection#getHoldability() + */ + public int getHoldability() throws SQLException { + return 0; + } + + /** + * @see java.sql.Connection#getMetaData() + */ + public DatabaseMetaData getMetaData() throws SQLException { + return null; + } + + /** + * @see java.sql.Connection#getTransactionIsolation() + */ + public int getTransactionIsolation() throws SQLException { + return 0; + } + + /** + * @see java.sql.Connection#getTypeMap() + */ + public Map> getTypeMap() throws SQLException { + return null; + } + + /** + * @see java.sql.Connection#getWarnings() + */ + public SQLWarning getWarnings() throws SQLException { + return null; + } + + /** + * @see java.sql.Connection#isClosed() + */ + public boolean isClosed() throws SQLException { + try{ + return this.seConnection.isClosed(); + } catch (Exception e) { + log.error(e,e); + throw new SQLException(e.getMessage()); + } + } + + /** + * @see java.sql.Connection#isReadOnly() + */ + public boolean isReadOnly() throws SQLException { + return false; + } + + /** + * @see java.sql.Connection#nativeSQL(java.lang.String) + */ + public String nativeSQL(String sql) throws SQLException { + return null; + } + + /** + * @see java.sql.Connection#prepareCall(java.lang.String) + */ + public CallableStatement prepareCall(String sql) throws SQLException { + return null; + } + + /** + * @see java.sql.Connection#prepareCall(java.lang.String, int, int) + */ + public CallableStatement prepareCall(String sql, int resultSetType, + int resultSetConcurrency) throws SQLException { + return null; + } + + /** + * @see java.sql.Connection#prepareCall(java.lang.String, int, int, int) + */ + public CallableStatement prepareCall(String sql, int resultSetType, + int resultSetConcurrency, int resultSetHoldability) + throws SQLException { + return null; + } + + /** + * @see java.sql.Connection#prepareStatement(java.lang.String) + */ + public PreparedStatement prepareStatement(String sql) throws SQLException { + + return null; + } + + /** + * @see java.sql.Connection#prepareStatement(java.lang.String, int) + */ + public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) + throws SQLException { + + return null; + } + + /** + * @see java.sql.Connection#prepareStatement(java.lang.String, int[]) + */ + public PreparedStatement prepareStatement(String sql, int[] columnIndexes) + throws SQLException { + + return null; + } + + /** + * @see java.sql.Connection#prepareStatement(java.lang.String, java.lang.String[]) + */ + public PreparedStatement prepareStatement(String sql, String[] columnNames) + throws SQLException { + + return null; + } + + /** + * @see java.sql.Connection#prepareStatement(java.lang.String, int, int) + */ + public PreparedStatement prepareStatement(String sql, int resultSetType, + int resultSetConcurrency) throws SQLException { + return null; + } + + /** + * @see java.sql.Connection#prepareStatement(java.lang.String, int, int, int) + */ + public PreparedStatement prepareStatement(String sql, int resultSetType, + int resultSetConcurrency, int resultSetHoldability) + throws SQLException { + return null; + } + + /** + * @see java.sql.Connection#releaseSavepoint(java.sql.Savepoint) + */ + public void releaseSavepoint(Savepoint savepoint) throws SQLException { + } + + /** + * @see java.sql.Connection#rollback() + */ + public void rollback() throws SQLException { + try { + this.seConnection.rollbackTransaction(); + } catch (SeException e) { + log.error(e,e); + throw new SQLException(e.getMessage()); + } + } + + /** + * @see java.sql.Connection#rollback(java.sql.Savepoint) + */ + public void rollback(Savepoint savepoint) throws SQLException { + this.rollback(); + } + + /** + * @see java.sql.Connection#setAutoCommit(boolean) + */ + public void setAutoCommit(boolean autoCommit) throws SQLException { + } + + /** + * @see java.sql.Connection#setCatalog(java.lang.String) + */ + public void setCatalog(String catalog) throws SQLException { + } + + /** + * @see java.sql.Connection#setHoldability(int) + */ + public void setHoldability(int holdability) throws SQLException { + } + + /** + * @see java.sql.Connection#setReadOnly(boolean) + */ + public void setReadOnly(boolean readOnly) throws SQLException { + } + + /** + * @see java.sql.Connection#setSavepoint() + */ + public Savepoint setSavepoint() throws SQLException { + return null; + } + + /** + * @see java.sql.Connection#setSavepoint(java.lang.String) + */ + public Savepoint setSavepoint(String name) throws SQLException { + return null; + } + + /** + * @see java.sql.Connection#setTransactionIsolation(int) + */ + public void setTransactionIsolation(int level) throws SQLException { + } + + /** + * @see java.sql.Connection#setTypeMap(java.util.Map) + */ + public void setTypeMap(Map> map) throws SQLException { + } + + /** * @return the seConnection */ public SeConnection getSeConnection() { - return seConnection; + return seConnection; } public Array createArrayOf(String arg0, Object[] arg1) throws SQLException { @@ -424,7 +443,6 @@ } public boolean isValid(int arg0) throws SQLException { - boolean valid = true; try { this.seConnection.testServer(serverRoundtripInterval); diff -r 6d568397740c -r 12f88239fb33 geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEResultSetMetaData.java --- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEResultSetMetaData.java Fri Mar 26 11:07:01 2010 +0000 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEResultSetMetaData.java Fri Mar 26 15:23:03 2010 +0000 @@ -8,12 +8,18 @@ import java.util.List; /** + * This Class is an Wrapperclass for the ResultSetMetaData and the + * ColumnDefinitions which are retrieved from the ArcSDE-Backend. * @author Tim Englich * */ public class ArcSDEResultSetMetaData implements ResultSetMetaData { + /** + * The Columndefinitions which are required to explain the retrieved Data. + */ private List columnDefinitions = null; + /** * Constructor */ @@ -25,7 +31,6 @@ * @see java.sql.ResultSetMetaData#getCatalogName(int) */ public String getCatalogName(int column) throws SQLException { - return null; } @@ -33,7 +38,6 @@ * @see java.sql.ResultSetMetaData#getColumnClassName(int) */ public String getColumnClassName(int column) throws SQLException { - int type = this.getColumnType(column); if (type == ColDefinition.INT16){ return "Integer"; @@ -67,7 +71,6 @@ * @see java.sql.ResultSetMetaData#getColumnDisplaySize(int) */ public int getColumnDisplaySize(int column) throws SQLException { - return 0; } @@ -96,7 +99,6 @@ * @see java.sql.ResultSetMetaData#getColumnTypeName(int) */ public String getColumnTypeName(int column) throws SQLException { - return null; } @@ -104,7 +106,6 @@ * @see java.sql.ResultSetMetaData#getPrecision(int) */ public int getPrecision(int column) throws SQLException { - return 0; } @@ -112,7 +113,6 @@ * @see java.sql.ResultSetMetaData#getScale(int) */ public int getScale(int column) throws SQLException { - return 0; } @@ -120,7 +120,6 @@ * @see java.sql.ResultSetMetaData#getSchemaName(int) */ public String getSchemaName(int column) throws SQLException { - return null; } @@ -128,7 +127,6 @@ * @see java.sql.ResultSetMetaData#getTableName(int) */ public String getTableName(int column) throws SQLException { - return null; } @@ -136,7 +134,6 @@ * @see java.sql.ResultSetMetaData#isAutoIncrement(int) */ public boolean isAutoIncrement(int column) throws SQLException { - return false; } @@ -144,7 +141,6 @@ * @see java.sql.ResultSetMetaData#isCaseSensitive(int) */ public boolean isCaseSensitive(int column) throws SQLException { - return false; } @@ -152,7 +148,6 @@ * @see java.sql.ResultSetMetaData#isCurrency(int) */ public boolean isCurrency(int column) throws SQLException { - return false; } @@ -160,7 +155,6 @@ * @see java.sql.ResultSetMetaData#isDefinitelyWritable(int) */ public boolean isDefinitelyWritable(int column) throws SQLException { - return false; } @@ -168,7 +162,6 @@ * @see java.sql.ResultSetMetaData#isNullable(int) */ public int isNullable(int column) throws SQLException { - return 0; } @@ -176,7 +169,6 @@ * @see java.sql.ResultSetMetaData#isReadOnly(int) */ public boolean isReadOnly(int column) throws SQLException { - return true; } @@ -184,7 +176,6 @@ * @see java.sql.ResultSetMetaData#isSearchable(int) */ public boolean isSearchable(int column) throws SQLException { - return true; } @@ -202,10 +193,16 @@ return false; } + /** + * @see java.sql.Wrapper#isWrapperFor(java.lang.Class) + */ public boolean isWrapperFor(Class iface) throws SQLException { return false; } + /** + * @see java.sql.Wrapper#unwrap(java.lang.Class) + */ public T unwrap(Class iface) throws SQLException { return null; } diff -r 6d568397740c -r 12f88239fb33 geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEStatement.java --- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEStatement.java Fri Mar 26 11:07:01 2010 +0000 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEStatement.java Fri Mar 26 15:23:03 2010 +0000 @@ -35,180 +35,194 @@ import de.intevation.gnv.geobackend.util.RedundancyRemover; /** + * This Class wrapps an SDE-Statment to an java.sql.Statement. + * This Class also handles the SDE-Specific -Spatial-Queries and + * RasterQueries. * @author Tim Englich (tim.englich@intevation.de) * @author Sascha L. Teichmann (sascha.teichmann@intevation.de) */ public class ArcSDEStatement implements Statement { - /** + /** * the logger, used to log exceptions and additonaly information */ private static Logger log = Logger.getLogger(ArcSDEStatement.class); - private ArcSDEConnection connection = null; - - /** - * Constructor - */ - public ArcSDEStatement(ArcSDEConnection connection) { - this.connection = connection; - } - - /** - * @see java.sql.Statement#addBatch(java.lang.String) - */ - public void addBatch(String arg0) throws SQLException { - } - - /** - * @see java.sql.Statement#cancel() - */ - public void cancel() throws SQLException { - } - - /** - * @see java.sql.Statement#clearBatch() - */ - public void clearBatch() throws SQLException { - } - - /** - * @see java.sql.Statement#clearWarnings() - */ - public void clearWarnings() throws SQLException { - } - - /** - * @see java.sql.Statement#close() - */ - public void close() throws SQLException { - } - - /** - * @see java.sql.Statement#execute(java.lang.String) - */ - public boolean execute(String arg0) throws SQLException { - - return false; - } - - /** - * @see java.sql.Statement#execute(java.lang.String, int) - */ - public boolean execute(String arg0, int arg1) throws SQLException { - - return false; - } - - /** - * @see java.sql.Statement#execute(java.lang.String, int[]) - */ - public boolean execute(String arg0, int[] arg1) throws SQLException { - - return false; - } - - /** - * @see java.sql.Statement#execute(java.lang.String, java.lang.String[]) - */ - public boolean execute(String arg0, String[] arg1) throws SQLException { - - return false; - } - - /** - * @see java.sql.Statement#executeBatch() - */ - public int[] executeBatch() throws SQLException { - - return null; - } + /** + * The Connection to the ArcSDE-Backend + */ + private ArcSDEConnection connection = null; + + /** + * Constructor + * @param connection the Connection to the ArcSDE-Backend. + */ + public ArcSDEStatement(ArcSDEConnection connection) { + this.connection = connection; + } - /** - * @see java.sql.Statement#executeQuery(java.lang.String) - */ - public ResultSet executeQuery(String statement) throws SQLException { - 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(", "); - String columnValueString = values[0].substring(0, values[0].indexOf("from")).trim(); - columnValueString = columnValueString.replaceFirst("select", "").trim(); - String[] returnFields = columnValueString.split(", "); - String geometryColumnName = null; - String byClause = null; - int byClausePos = where.indexOf("group by"); - if (byClausePos < 0){ - byClausePos = where.indexOf("order by"); - } - if (byClausePos > 0){ - 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(")){ - returnFields[i] = returnFields[i].replaceAll("st_astext", ""); - returnFields[i] = returnFields[i].substring(1, returnFields[i].length()-1); - 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 ){ - String substr = where.substring(pos); - where = where.substring(0,where.lastIndexOf("intersects")); - int andPos = where.lastIndexOf("and"); - if (andPos < 0){ - andPos = 0; - } - where = where.substring(0,andPos); // TODO support or also - String intersectsStmt = substr.substring(0, substr.lastIndexOf(")")); // Spatial-Statment is the last one - String wkt = null; - if (intersectsStmt.contains("select")){ - // Anstelle eines WKT ist ein InnerSelect zum Bestimmen der Comparatorgeometrie gegeben. - String stmt = intersectsStmt.substring(intersectsStmt.indexOf("select"),intersectsStmt.lastIndexOf(")")); - ResultSet resultSet = this.executeQuery(stmt); - if (resultSet != null && resultSet.next()){ - // TODO: Support the selection of more than one Geometry - wkt = resultSet.getString("SHAPE"); - } - }else{ - 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()); - query.prepareSql(statement); - query.execute(); - return this.handleResultSet(query,false,null); - } - - } catch (Exception e) { - log.error(e,e); - throw new SQLException(e.getMessage()); + /** + * @see java.sql.Statement#addBatch(java.lang.String) + */ + public void addBatch(String arg0) throws SQLException { + } + + /** + * @see java.sql.Statement#cancel() + */ + public void cancel() throws SQLException { + } + + /** + * @see java.sql.Statement#clearBatch() + */ + public void clearBatch() throws SQLException { + } + + /** + * @see java.sql.Statement#clearWarnings() + */ + public void clearWarnings() throws SQLException { + } + + /** + * @see java.sql.Statement#close() + */ + public void close() throws SQLException { + } + + /** + * @see java.sql.Statement#execute(java.lang.String) + */ + public boolean execute(String arg0) throws SQLException { + return false; + } + + /** + * @see java.sql.Statement#execute(java.lang.String, int) + */ + public boolean execute(String arg0, int arg1) throws SQLException { + return false; + } + + /** + * @see java.sql.Statement#execute(java.lang.String, int[]) + */ + public boolean execute(String arg0, int[] arg1) throws SQLException { + return false; + } + + /** + * @see java.sql.Statement#execute(java.lang.String, java.lang.String[]) + */ + public boolean execute(String arg0, String[] arg1) throws SQLException { + return false; + } + + /** + * @see java.sql.Statement#executeBatch() + */ + public int[] executeBatch() throws SQLException { + return null; + } + + /** + * @see java.sql.Statement#executeQuery(java.lang.String) + */ + public ResultSet executeQuery(String statement) throws SQLException { + 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(", "); + String columnValueString = values[0].substring(0, values[0].indexOf("from")).trim(); + columnValueString = columnValueString.replaceFirst("select", "").trim(); + String[] returnFields = columnValueString.split(", "); + String geometryColumnName = null; + String byClause = null; + int byClausePos = where.indexOf("group by"); + if (byClausePos < 0){ + byClausePos = where.indexOf("order by"); + } + if (byClausePos > 0){ + 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(")){ + returnFields[i] = returnFields[i].replaceAll("st_astext", ""); + returnFields[i] = returnFields[i].substring(1, returnFields[i].length()-1); + 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 ){ + String substr = where.substring(pos); + where = where.substring(0,where.lastIndexOf("intersects")); + int andPos = where.lastIndexOf("and"); + if (andPos < 0){ + andPos = 0; + } + where = where.substring(0,andPos); // TODO support or also + String intersectsStmt = substr.substring(0, substr.lastIndexOf(")")); // Spatial-Statment is the last one + String wkt = null; + if (intersectsStmt.contains("select")){ + // Anstelle eines WKT ist ein InnerSelect zum Bestimmen der Comparatorgeometrie gegeben. + String stmt = intersectsStmt.substring(intersectsStmt.indexOf("select"),intersectsStmt.lastIndexOf(")")); + ResultSet resultSet = this.executeQuery(stmt); + if (resultSet != null && resultSet.next()){ + // TODO: Support the selection of more than one Geometry + wkt = resultSet.getString("SHAPE"); + } + }else{ + 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()); + query.prepareSql(statement); + 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 pSpatialColumnName the Name of the Spatial Column. + * @param pWhere The where-Clause to limit the Data + * @param g the Geometry to limit the Data + * @param pReturnFields the Fileds that should be fetched from the Database + * @param byClause the byClaus to order the Results. + * @return the @see java.sql.ResultSet with the Data which was retrieved. + * @throws SQLException + */ private ResultSet executeQuery(SeConnection con, String[] pLayername, String pSpatialColumnName, String pWhere, Geometry g, String[] pReturnFields, String byClause) @@ -284,207 +298,194 @@ } } - /** - * @see java.sql.Statement#executeUpdate(java.lang.String) - */ - public int executeUpdate(String arg0) throws SQLException { - - return 0; - } - - /** - * @see java.sql.Statement#executeUpdate(java.lang.String, int) - */ - public int executeUpdate(String arg0, int arg1) throws SQLException { - - return 0; - } - - /** - * @see java.sql.Statement#executeUpdate(java.lang.String, int[]) - */ - public int executeUpdate(String arg0, int[] arg1) throws SQLException { - - return 0; - } - - /** - * @see java.sql.Statement#executeUpdate(java.lang.String, java.lang.String[]) - */ - public int executeUpdate(String arg0, String[] arg1) throws SQLException { - - return 0; - } - - /** - * @see java.sql.Statement#getConnection() - */ - public Connection getConnection() throws SQLException { - return this.connection; - } - - /** - * @see java.sql.Statement#getFetchDirection() - */ - public int getFetchDirection() throws SQLException { - - return 0; - } - - /** - * @see java.sql.Statement#getFetchSize() - */ - public int getFetchSize() throws SQLException { - - return 0; - } - - /** - * @see java.sql.Statement#getGeneratedKeys() - */ - public ResultSet getGeneratedKeys() throws SQLException { - - return null; - } - - /** - * @see java.sql.Statement#getMaxFieldSize() - */ - public int getMaxFieldSize() throws SQLException { - - return 0; - } - - /** - * @see java.sql.Statement#getMaxRows() - */ - public int getMaxRows() throws SQLException { - - return 0; - } - - /** - * @see java.sql.Statement#getMoreResults() - */ - public boolean getMoreResults() throws SQLException { - - return false; - } - - /** - * @see java.sql.Statement#getMoreResults(int) - */ - public boolean getMoreResults(int arg0) throws SQLException { - - return false; - } - - /** - * @see java.sql.Statement#getQueryTimeout() - */ - public int getQueryTimeout() throws SQLException { + /** + * @see java.sql.Statement#executeUpdate(java.lang.String) + */ + public int executeUpdate(String arg0) throws SQLException { + return 0; + } - return 0; - } - - /** - * @see java.sql.Statement#getResultSet() - */ - public ResultSet getResultSet() throws SQLException { - - return null; - } - - /** - * @see java.sql.Statement#getResultSetConcurrency() - */ - public int getResultSetConcurrency() throws SQLException { - - return 0; - } - - /** - * @see java.sql.Statement#getResultSetHoldability() - */ - public int getResultSetHoldability() throws SQLException { - - return 0; - } - - /** - * @see java.sql.Statement#getResultSetType() - */ - public int getResultSetType() throws SQLException { - - return 0; - } - - /** - * @see java.sql.Statement#getUpdateCount() - */ - public int getUpdateCount() throws SQLException { - - return 0; - } - - /** - * @see java.sql.Statement#getWarnings() - */ - public SQLWarning getWarnings() throws SQLException { + /** + * @see java.sql.Statement#executeUpdate(java.lang.String, int) + */ + public int executeUpdate(String arg0, int arg1) throws SQLException { + return 0; + } - return null; - } - - /** - * @see java.sql.Statement#setCursorName(java.lang.String) - */ - public void setCursorName(String arg0) throws SQLException { - } - - /** - * @see java.sql.Statement#setEscapeProcessing(boolean) - */ - public void setEscapeProcessing(boolean arg0) throws SQLException { - } - - /** - * @see java.sql.Statement#setFetchDirection(int) - */ - public void setFetchDirection(int arg0) throws SQLException { - } + /** + * @see java.sql.Statement#executeUpdate(java.lang.String, int[]) + */ + public int executeUpdate(String arg0, int[] arg1) throws SQLException { + return 0; + } - /** - * @see java.sql.Statement#setFetchSize(int) - */ - public void setFetchSize(int arg0) throws SQLException { - } - - /** - * @see java.sql.Statement#setMaxFieldSize(int) - */ - public void setMaxFieldSize(int arg0) throws SQLException { - } + /** + * @see java.sql.Statement#executeUpdate(java.lang.String, java.lang.String[]) + */ + public int executeUpdate(String arg0, String[] arg1) throws SQLException { + return 0; + } - /** - * @see java.sql.Statement#setMaxRows(int) - */ - public void setMaxRows(int arg0) throws SQLException { - } + /** + * @see java.sql.Statement#getConnection() + */ + public Connection getConnection() throws SQLException { + return this.connection; + } - /** - * @see java.sql.Statement#setQueryTimeout(int) - */ - public void setQueryTimeout(int arg0) throws SQLException { - } - - /** - * Copied from de.intevation.gnv.geobackend.sde.datasources.SDEQuery - * @param pSeQuery - * @return - * @throws SeException - */ - private ResultSet handleResultSet(SeQuery pSeQuery, boolean isRaster, Geometry geometry) throws SeException { + /** + * @see java.sql.Statement#getFetchDirection() + */ + public int getFetchDirection() throws SQLException { + return 0; + } + /** + * @see java.sql.Statement#getFetchSize() + */ + public int getFetchSize() throws SQLException { + return 0; + } + + /** + * @see java.sql.Statement#getGeneratedKeys() + */ + public ResultSet getGeneratedKeys() throws SQLException { + return null; + } + + /** + * @see java.sql.Statement#getMaxFieldSize() + */ + public int getMaxFieldSize() throws SQLException { + return 0; + } + + /** + * @see java.sql.Statement#getMaxRows() + */ + public int getMaxRows() throws SQLException { + return 0; + } + + /** + * @see java.sql.Statement#getMoreResults() + */ + public boolean getMoreResults() throws SQLException { + return false; + } + + /** + * @see java.sql.Statement#getMoreResults(int) + */ + public boolean getMoreResults(int arg0) throws SQLException { + return false; + } + + /** + * @see java.sql.Statement#getQueryTimeout() + */ + public int getQueryTimeout() throws SQLException { + return 0; + } + + /** + * @see java.sql.Statement#getResultSet() + */ + public ResultSet getResultSet() throws SQLException { + return null; + } + + /** + * @see java.sql.Statement#getResultSetConcurrency() + */ + public int getResultSetConcurrency() throws SQLException { + return 0; + } + + /** + * @see java.sql.Statement#getResultSetHoldability() + */ + public int getResultSetHoldability() throws SQLException { + return 0; + } + + /** + * @see java.sql.Statement#getResultSetType() + */ + public int getResultSetType() throws SQLException { + return 0; + } + + /** + * @see java.sql.Statement#getUpdateCount() + */ + public int getUpdateCount() throws SQLException { + return 0; + } + + /** + * @see java.sql.Statement#getWarnings() + */ + public SQLWarning getWarnings() throws SQLException { + return null; + } + + /** + * @see java.sql.Statement#setCursorName(java.lang.String) + */ + public void setCursorName(String arg0) throws SQLException { + } + + /** + * @see java.sql.Statement#setEscapeProcessing(boolean) + */ + public void setEscapeProcessing(boolean arg0) throws SQLException { + } + + /** + * @see java.sql.Statement#setFetchDirection(int) + */ + public void setFetchDirection(int arg0) throws SQLException { + } + + /** + * @see java.sql.Statement#setFetchSize(int) + */ + public void setFetchSize(int arg0) throws SQLException { + } + + /** + * @see java.sql.Statement#setMaxFieldSize(int) + */ + public void setMaxFieldSize(int arg0) throws SQLException { + } + + /** + * @see java.sql.Statement#setMaxRows(int) + */ + public void setMaxRows(int arg0) throws SQLException { + } + + /** + * @see java.sql.Statement#setQueryTimeout(int) + */ + 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, + Geometry geometry) throws SeException { boolean debug = log.isDebugEnabled(); if (debug) { @@ -546,15 +547,6 @@ SeExtent extent = rasterBand.getExtent(); - /* - if (debug) { - log.debug("Extent: " + - extent.getMinX() + " " + extent.getMinY() + " "+ - extent.getMaxX() + " " + extent.getMaxY()); - log.debug("Query geometry: "+geometry.toText()); - } - */ - double x = ((Point)geometry).getX(); double y = ((Point)geometry).getY(); @@ -582,13 +574,6 @@ ? extent.getMaxY() : extent.getMinY(); - /* - 0 = origin.getX()*mx + bx - rasterBand.getBandWidth() = maxX + bx - - rasterBand.getBandWidth() = (maxX-origin.getX())*mx - */ - double mx = rasterBand.getBandWidth()/(maxX-origin.getX()); double bx = -origin.getX()*mx; double px = mx*x + bx; @@ -597,12 +582,6 @@ double by = -origin.getY()*my; double py = my*y + by; - /* - if (debug) { - log.debug("p(x, y): " + px + " / " + py); - } - */ - SeRasterConstraint constraint = new SeRasterConstraint(); constraint.setLevel(0); // best resolution constraint.setBands(rasterBand.getBandNumber()); @@ -619,12 +598,6 @@ lSet.addCol(new ColDefinition("tile", ColDefinition.FLOAT64)); Row lBackingRow = new Row(1); - /* - 0 = wx1*mt + bt - tileWidth-EPS = wx2*mt + bt - tileWidth-EPS = mt*(wx2 - wx1) - */ - double wx1 = (rasterBand.getTileWidth()*tx - bx)/mx; double wx2 = (rasterBand.getTileWidth()*(tx+1) - bx)/mx; double mxt = (rasterBand.getTileWidth()-1e-5d)/(wx2 - wx1); @@ -646,28 +619,6 @@ lBackingRow.addObject(ro, 0); lSet.addRow(lBackingRow); - /* - if (debug) { - log.debug("x / y: " + x + " / " + y); - log.debug("wx1: " + wx1); - log.debug("wx1 -> " + (wx1*mxt+bxt)); - log.debug("wx2: " + wx2); - log.debug("wx2 -> " + (wx2*mxt+bxt)); - log.debug("wx2 - wx1: " + Math.abs(wx2-wx1)); - log.debug("wy2 - wy1: " + Math.abs(wy2-wy1)); - log.debug("pix: " + (x*mxt + bxt)+ " " + (y*myt + byt)); - log.debug("requesting tile: " + tx + " / " + ty); - log.debug("got tile: " + tile.getColumnIndex() + " / " + tile.getRowIndex()); - log.debug("tile orig: " + origin.getX() + " / " + origin.getY()); - log.debug("tile width: " + rasterBand.getTileWidth()); - log.debug("tile height: " + rasterBand.getTileHeight()); - log.debug("Rasterdimesion (Pixel) " + - rasterBand.getBandWidth() + " / " + rasterBand.getBandHeight()); - log.debug("BAND-ID "+rasterBand.getId().longValue()); - log.debug("Pixels: "+ tile.getNumPixels()); - log.debug("Column / Row "+tile.getColumnIndex()+" / "+tile.getRowIndex()); - } - */ } } else{ @@ -682,21 +633,36 @@ return lSet; } + /** + * @see java.sql.Statement#isClosed() + */ public boolean isClosed() throws SQLException { return false; } + /** + * @see java.sql.Statement#isPoolable() + */ public boolean isPoolable() throws SQLException { return false; } + /** + * @see java.sql.Statement#setPoolable(boolean) + */ public void setPoolable(boolean arg0) throws SQLException { } + /** + * @see java.sql.Wrapper#isWrapperFor(java.lang.Class) + */ public boolean isWrapperFor(Class iface) throws SQLException { return false; } + /** + * @see java.sql.Wrapper#unwrap(java.lang.Class) + */ public T unwrap(Class iface) throws SQLException { return null; diff -r 6d568397740c -r 12f88239fb33 geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEUtils.java --- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEUtils.java Fri Mar 26 11:07:01 2010 +0000 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEUtils.java Fri Mar 26 15:23:03 2010 +0000 @@ -1,29 +1,13 @@ /** - * Title: ArcSDEUtils, $Header: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/datasources/sde/ArcSDEUtils.java,v 1.7 2007/11/28 14:05:39 blume Exp $ - * Source: $Source: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/datasources/sde/ArcSDEUtils.java,v $ - * created by: Stefan Blume (blume) - * erstellt am: 21.11.2007 - * Copyright: con terra GmbH, 2005 - * - * modified by: $Author: blume $ - * modified on: $Date: 2007/11/28 14:05:39 $ - * Version: $Revision: 1.7 $ - * TAG: $Name: $ - * locked from: $Locker: $ - * CVS State: $State: Exp $ - * Project: $ProjectName$ + * */ package de.intevation.gnv.geobackend.sde.datasources; -import java.util.Vector; - import org.apache.log4j.Logger; import com.esri.sde.sdk.client.SDEPoint; -import com.esri.sde.sdk.client.SeColumnDefinition; import com.esri.sde.sdk.client.SeError; import com.esri.sde.sdk.client.SeException; -import com.esri.sde.sdk.client.SeTable; import com.vividsolutions.jts.geom.Coordinate; import com.vividsolutions.jts.geom.Geometry; import com.vividsolutions.jts.geom.LineString; @@ -32,15 +16,9 @@ /** * The class ArcSDEUtils fulfills the following purposes: - *
    - *
  1. - *
* * @author blume - * @version 1.0 - * @serial 1.0 - * @see - * @since 21.11.2007 08:20:40 + * @author Tim Englich */ public class ArcSDEUtils { @@ -49,76 +27,10 @@ */ private static Logger sLogger = Logger.getLogger(ArcSDEUtils.class); - public void displayStats(SeTable.SeTableStats tableStats) { - - sLogger.debug("\n--> Table Statistics\n"); - if (tableStats != null) { - - sLogger.debug("Average - " + tableStats.getAverage()); - sLogger.debug("No of rows - " + tableStats.getCount()); - sLogger.debug("Maximum Value - " + tableStats.getMax()); - sLogger.debug("Minimum Value - " + tableStats.getMin()); - sLogger.debug("No of distinct values - " - + tableStats.getNumDistinct()); - sLogger.debug("Standard Deviation - " + tableStats.getStdDev()); - - sLogger.debug("Distinct type - " - + ArcSDEUtils.resolveType(tableStats - .getDistinctType())); - - int[] distinctFreq = tableStats.getDistinctValueFrequencies(); - Vector distinctValues = tableStats.getDistinctValues(); - sLogger.debug("Distinct values & their frequencies : "); - for (int i = 0; i < distinctFreq.length; i++) - sLogger.debug(distinctValues.elementAt(i) + " - " - + distinctFreq[i]); - }// End if - - }// End displayStats - /** - * Takes an integer corresponding to an ArcSDE data type and returns a - * string description of the type. - * - * @param type - * SDE data type bit-mask. + * Prints an SEEsception into the Logger of this Class + * @param exception */ - public static String resolveType(int type) { - - String typeName = "Invalid Type"; - switch (type) { - - case SeColumnDefinition.TYPE_SMALLINT: - typeName = "Small Int"; - break; - case SeColumnDefinition.TYPE_INTEGER: - typeName = "Int"; - break; - case SeColumnDefinition.TYPE_FLOAT: - typeName = "Float"; - break; - case SeColumnDefinition.TYPE_DOUBLE: - typeName = "Double"; - break; - case SeColumnDefinition.TYPE_STRING: - typeName = "String"; - break; - case SeColumnDefinition.TYPE_BLOB: - typeName = "Blob"; - break; - case SeColumnDefinition.TYPE_DATE: - typeName = "Date"; - break; - case SeColumnDefinition.TYPE_SHAPE: - typeName = "Shape"; - break; - case SeColumnDefinition.TYPE_RASTER: - typeName = "Raster"; - break; - } - return typeName; - }// End method resolveType - public static void printError(SeException exception) { SeError error = exception.getSeError(); @@ -140,8 +52,14 @@ sLogger.debug(exception); - }// End printError + } + /** + * Generate an SDEPoint-Array from a given Geometry. + * This Method did not put the Holes to the Array. + * @param g The Geometry which should be converted. + * @return an SDEPoint-Array from a given Ggeometry. + */ public SDEPoint[] createPoints(Geometry g) { sLogger.debug("createPoints()"); Coordinate[] coords = null; @@ -154,7 +72,7 @@ }else{ coords = g.getCoordinates(); } - + if (coords != null){ SDEPoint[] lSDEPoints = new SDEPoint[coords.length]; for (int i = 0; i < coords.length; i++) { @@ -164,6 +82,5 @@ }else{ return null; } - } } diff -r 6d568397740c -r 12f88239fb33 geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ColDefinition.java --- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ColDefinition.java Fri Mar 26 11:07:01 2010 +0000 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ColDefinition.java Fri Mar 26 15:23:03 2010 +0000 @@ -1,17 +1,5 @@ /** - * Title: ColDefinition, $Header: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/datasources/ColDefinition.java,v 1.2 2007/12/21 12:31:15 blume Exp $ - * Source: $Source: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/datasources/ColDefinition.java,v $ - * created by: Stefan Blume (blume) - * erstellt am: 21.11.2007 - * Copyright: con terra GmbH, 2005 - * - * modified by: $Author: blume $ - * modified on: $Date: 2007/12/21 12:31:15 $ - * Version: $Revision: 1.2 $ - * TAG: $Name: $ - * locked from: $Locker: $ - * CVS State: $State: Exp $ - * Project: $ProjectName$ + * */ package de.intevation.gnv.geobackend.sde.datasources; @@ -19,15 +7,8 @@ /** * The class ColDefinition fulfills the following purposes: - *
    - *
  1. - *
- * * @author blume - * @version 1.0 - * @serial 1.0 - * @see - * @since 21.11.2007 10:59:45 + * @author Tim Englich */ public class ColDefinition { @@ -71,15 +52,28 @@ private String mName; private int mType; + /** + * Constructor + * @param pName the Name of an Column. + * @param pType the Type of an Column. + */ public ColDefinition(String pName, int pType) { mName = pName; mType = pType; } + /** + * Returns the Name of an Column. + * @return the Name of an Column. + */ public String getName() { return mName; } + /** + * Returns the Type of an Column. + * @return the Type of an Column. + */ public int getType() { return mType; } diff -r 6d568397740c -r 12f88239fb33 geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ResultSet.java --- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ResultSet.java Fri Mar 26 11:07:01 2010 +0000 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ResultSet.java Fri Mar 26 15:23:03 2010 +0000 @@ -1,17 +1,5 @@ /** - * Title: ResultSet, $Header: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/datasources/ResultSet.java,v 1.2 2008/01/30 12:38:34 blume Exp $ - * Source: $Source: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/datasources/ResultSet.java,v $ - * created by: Stefan Blume (blume) - * erstellt am: 21.11.2007 - * Copyright: con terra GmbH, 2005 - * - * modified by: $Author: blume $ - * modified on: $Date: 2008/01/30 12:38:34 $ - * Version: $Revision: 1.2 $ - * TAG: $Name: $ - * locked from: $Locker: $ - * CVS State: $State: Exp $ - * Project: $ProjectName$ + * */ package de.intevation.gnv.geobackend.sde.datasources; @@ -24,10 +12,7 @@ * * * @author blume - * @version 1.0 - * @serial 1.0 - * @see - * @since 21.11.2007 09:26:53 + * @author Tim Englich */ public abstract class ResultSet implements java.sql.ResultSet { @@ -38,14 +23,12 @@ /** * Returns the number of hits. - * * @return count of results. */ public abstract int getCount(); /** * Returns the number of columns returned through the query. - * * @return the number of columns. */ public abstract int getNumberOfColumns(); @@ -53,7 +36,6 @@ /** * A ResultSet can tell about the concrete definition of each column. * This method returns an array of {@link de.conterra.bsh.gdi.gnviewer.datasources.ColDefinition}-Objects. - * * @return the definitions describing the result set. */ public abstract ColDefinition[] getColumnDefinitions(); diff -r 6d568397740c -r 12f88239fb33 geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/Row.java --- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/Row.java Fri Mar 26 11:07:01 2010 +0000 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/Row.java Fri Mar 26 15:23:03 2010 +0000 @@ -1,17 +1,5 @@ /** - * Title: Row, $Header: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/datasources/Row.java,v 1.4 2008/01/30 12:38:34 blume Exp $ - * Source: $Source: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/datasources/Row.java,v $ - * created by: Stefan Blume (blume) - * erstellt am: 21.11.2007 - * Copyright: con terra GmbH, 2005 * - * modified by: $Author: blume $ - * modified on: $Date: 2008/01/30 12:38:34 $ - * Version: $Revision: 1.4 $ - * TAG: $Name: $ - * locked from: $Locker: $ - * CVS State: $State: Exp $ - * Project: $ProjectName$ */ package de.intevation.gnv.geobackend.sde.datasources; @@ -33,10 +21,7 @@ * In a technical manner (e.g. database manner) a row contains all attributes of a single "hit". * * @author blume - * @version 1.0 - * @serial 1.0 - * @see - * @since 21.11.2007 11:00:54 + * @author Tim Englich */ public class Row { /** @@ -51,29 +36,26 @@ /** * Constructor. - * * @param pRowSize the number of attributes contained by this row. */ public Row(int pRowSize) { mObjects = new Object[pRowSize]; } - + /** * Constructor. - * * @param ArrayStr a line from CSV-File. */ public Row (String[] ArrayStr){ - this (ArrayStr.length); - int nLength = ArrayStr.length; - for (int i=0; i < nLength; i++){ - addObject(ArrayStr[i], i); - - } - + this (ArrayStr.length); + int nLength = ArrayStr.length; + for (int i=0; i < nLength; i++){ + addObject(ArrayStr[i], i); + + } + } - - + /** * Adds an attribute value to a specific position of this row. * @@ -105,7 +87,6 @@ } } - /** * This is a covenient method for getting strongly typed objects out of the row. * It has to be ensured, that the type of the requested row position has been resolved out of the ColumnDefinition ({@link ResultSet#getColumnDefinitions()}). @@ -117,23 +98,23 @@ * @see #getValue(int) */ public Date getDateValue(int pPos) throws TechnicalException { - Date date = null; + Date date = null; try { Calendar lCalendar = (Calendar) getValue(pPos); date = lCalendar.getTime(); } catch (ClassCastException e) { - try{ - //SimpleDateFormat formatter = new SimpleDateFormat("dd-MMM-yyyy HH:mm:ss"); - date = DateUtils.getDateFromString ((String)getValue(pPos)); //(Date)formatter.parse((String)getValue(pPos)); - - - } - catch (Exception ex){ - sLogger.error(getValue(pPos) + " " + ex.getMessage(), ex); - throw new TechnicalException("Could not cast this value to the Date Type. Object is of value type: " + getValue(pPos).getClass().getName()); - } - } + try{ + //SimpleDateFormat formatter = new SimpleDateFormat("dd-MMM-yyyy HH:mm:ss"); + date = DateUtils.getDateFromString ((String)getValue(pPos)); //(Date)formatter.parse((String)getValue(pPos)); + + + } + catch (Exception ex){ + sLogger.error(getValue(pPos) + " " + ex.getMessage(), ex); + throw new TechnicalException("Could not cast this value to the Date Type. Object is of value type: " + getValue(pPos).getClass().getName()); + } + } return date; } @@ -195,13 +176,13 @@ try { return (Double) getValue(pPos); } catch (ClassCastException e) { - try{ - return new Double ((String)getValue(pPos)); - } - catch(Exception ex){ - sLogger.error(getValue(pPos) + " " + ex.getMessage(), ex); - throw new TechnicalException("Could not cast this value to the Double Type. Object is of value type: " + getValue(pPos).getClass().getName()); - } + try{ + return new Double ((String)getValue(pPos)); + } + catch(Exception ex){ + sLogger.error(getValue(pPos) + " " + ex.getMessage(), ex); + throw new TechnicalException("Could not cast this value to the Double Type. Object is of value type: " + getValue(pPos).getClass().getName()); + } } } @@ -267,8 +248,6 @@ }else{ returnValue.append("LINESTRING("); } - - for (int i = 0; i< length;i++){ @@ -287,7 +266,7 @@ returnValue.append(" , "); } } - + if(isMultiLineString){ returnValue.append("))"); }else{ diff -r 6d568397740c -r 12f88239fb33 geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/SDEResultSet.java --- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/SDEResultSet.java Fri Mar 26 11:07:01 2010 +0000 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/SDEResultSet.java Fri Mar 26 15:23:03 2010 +0000 @@ -1,17 +1,5 @@ /** - * Title: SDEResultSet, $Header: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/datasources/sde/SDEResultSet.java,v 1.2 2008/01/30 12:38:34 blume Exp $ - * Source: $Source: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/datasources/sde/SDEResultSet.java,v $ - * created by: Stefan Blume (blume) - * erstellt am: 21.11.2007 - * Copyright: con terra GmbH, 2005 * - * modified by: $Author: blume $ - * modified on: $Date: 2008/01/30 12:38:34 $ - * Version: $Revision: 1.2 $ - * TAG: $Name: $ - * locked from: $Locker: $ - * CVS State: $State: Exp $ - * Project: $ProjectName$ */ package de.intevation.gnv.geobackend.sde.datasources; @@ -44,11 +32,11 @@ import de.intevation.gnv.geobackend.sde.datasources.exception.TechnicalException; /** + * SDEResultSet is an Implementation of the Interface @see java.sql.resultSet + * It is an Wrapper between the resultsets whcih are produced using the ArcSDE + * and the Java-Interface for the Representation of ResultSets. * @author blume - * @version 1.0 - * @serial 1.0 - * @see - * @since 21.11.2007 11:01:27 + * @author Tim Englich */ public class SDEResultSet extends ResultSet { @@ -63,33 +51,56 @@ private Row currentRow = null; private int cursor = 0; + /** + * Constructor + */ public SDEResultSet() { } + /** + * @see de.intevation.gnv.geobackend.sde.datasources.ResultSet#getCount() + */ public int getCount() { - return mRows.size(); - } - - public int getNumberOfColumns() { - return mCols.size(); + return mRows.size(); } - public ColDefinition[] getColumnDefinitions() { - ColDefinition[] lColDefinitions = new ColDefinition[mCols.size()]; - return mCols.toArray(lColDefinitions); + /** + * @see de.intevation.gnv.geobackend.sde.datasources.ResultSet#getNumberOfColumns() + */ + public int getNumberOfColumns() { + return mCols.size(); } - public Row[] getResults() { - Row[] lRows = new Row[mRows.size()]; - return mRows.toArray(lRows); + /** + * @see de.intevation.gnv.geobackend.sde.datasources.ResultSet#getColumnDefinitions() + */ + public ColDefinition[] getColumnDefinitions() { + ColDefinition[] lColDefinitions = new ColDefinition[mCols.size()]; + return mCols.toArray(lColDefinitions); } - public void addRow(Row pRow) { - mRows.add(pRow); + /** + * @see de.intevation.gnv.geobackend.sde.datasources.ResultSet#getResults() + */ + public Row[] getResults() { + Row[] lRows = new Row[mRows.size()]; + return mRows.toArray(lRows); } + /** + * Add an Row to the Resultset + * @param pRow The Row that should be added. + */ + public void addRow(Row pRow) { + mRows.add(pRow); + } + + /** + * Adds a Column to the Resultset. + * @param pColDefinition The Definition of the Column + */ public void addCol(ColDefinition pColDefinition) { - mCols.add(pColDefinition); + mCols.add(pColDefinition); } /** @@ -97,7 +108,7 @@ */ public boolean absolute(int row) throws SQLException { - return false; + return false; } /** @@ -141,7 +152,7 @@ */ public int findColumn(String columnName) throws SQLException { - return 0; + return 0; } /** @@ -149,7 +160,7 @@ */ public boolean first() throws SQLException { - return false; + return false; } /** @@ -157,7 +168,7 @@ */ public Array getArray(int i) throws SQLException { - return null; + return null; } /** @@ -165,7 +176,7 @@ */ public Array getArray(String colName) throws SQLException { - return null; + return null; } /** @@ -173,7 +184,7 @@ */ public InputStream getAsciiStream(int columnIndex) throws SQLException { - return null; + return null; } /** @@ -181,7 +192,7 @@ */ public InputStream getAsciiStream(String columnName) throws SQLException { - return null; + return null; } /** @@ -189,7 +200,7 @@ */ public BigDecimal getBigDecimal(int columnIndex) throws SQLException { - return null; + return null; } /** @@ -197,7 +208,7 @@ */ public BigDecimal getBigDecimal(String columnName) throws SQLException { - return null; + return null; } /** @@ -206,7 +217,7 @@ public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException { - return null; + return null; } /** @@ -215,7 +226,7 @@ public BigDecimal getBigDecimal(String columnName, int scale) throws SQLException { - return null; + return null; } /** @@ -223,7 +234,7 @@ */ public InputStream getBinaryStream(int columnIndex) throws SQLException { - return null; + return null; } /** @@ -231,7 +242,7 @@ */ public InputStream getBinaryStream(String columnName) throws SQLException { - return null; + return null; } /** @@ -239,7 +250,7 @@ */ public Blob getBlob(int i) throws SQLException { - return null; + return null; } /** @@ -247,7 +258,7 @@ */ public Blob getBlob(String colName) throws SQLException { - return null; + return null; } /** @@ -255,7 +266,7 @@ */ public boolean getBoolean(int columnIndex) throws SQLException { - return false; + return false; } /** @@ -263,7 +274,7 @@ */ public boolean getBoolean(String columnName) throws SQLException { - return false; + return false; } /** @@ -271,7 +282,7 @@ */ public byte getByte(int columnIndex) throws SQLException { - return 0; + return 0; } /** @@ -279,7 +290,7 @@ */ public byte getByte(String columnName) throws SQLException { - return 0; + return 0; } /** @@ -287,7 +298,7 @@ */ public byte[] getBytes(int columnIndex) throws SQLException { - return null; + return null; } /** @@ -295,7 +306,7 @@ */ public byte[] getBytes(String columnName) throws SQLException { - return null; + return null; } /** @@ -303,7 +314,7 @@ */ public Reader getCharacterStream(int columnIndex) throws SQLException { - return null; + return null; } /** @@ -311,7 +322,7 @@ */ public Reader getCharacterStream(String columnName) throws SQLException { - return null; + return null; } /** @@ -319,7 +330,7 @@ */ public Clob getClob(int i) throws SQLException { - return null; + return null; } /** @@ -327,7 +338,7 @@ */ public Clob getClob(String colName) throws SQLException { - return null; + return null; } /** @@ -335,7 +346,7 @@ */ public int getConcurrency() throws SQLException { - return 0; + return 0; } /** @@ -343,14 +354,14 @@ */ public String getCursorName() throws SQLException { - return null; + return null; } /** * @see java.sql.ResultSet#getDate(int) */ public Date getDate(int columnIndex) throws SQLException { - try { + try { return new java.sql.Date(this.currentRow.getDateValue(columnIndex-1).getTime()); } catch (TechnicalException e) { log.error(e,e); @@ -362,8 +373,8 @@ * @see java.sql.ResultSet#getDate(java.lang.String) */ public Date getDate(String columnName) throws SQLException { - int columnIndex = this.getColumnIndex(columnName); - return this.getDate(columnIndex); + int columnIndex = this.getColumnIndex(columnName); + return this.getDate(columnIndex); } /** @@ -371,7 +382,7 @@ */ public Date getDate(int columnIndex, Calendar cal) throws SQLException { - return null; + return null; } /** @@ -379,14 +390,14 @@ */ public Date getDate(String columnName, Calendar cal) throws SQLException { - return null; + return null; } /** * @see java.sql.ResultSet#getDouble(int) */ public double getDouble(int columnIndex) throws SQLException { - try { + try { return this.currentRow.getDoubleValue(columnIndex-1); } catch (TechnicalException e) { log.error(e,e); @@ -398,8 +409,8 @@ * @see java.sql.ResultSet#getDouble(java.lang.String) */ public double getDouble(String columnName) throws SQLException { - int columnIndex = this.getColumnIndex(columnName); - return this.getDouble(columnIndex); + int columnIndex = this.getColumnIndex(columnName); + return this.getDouble(columnIndex); } /** @@ -407,7 +418,7 @@ */ public int getFetchDirection() throws SQLException { - return 0; + return 0; } /** @@ -415,14 +426,14 @@ */ public int getFetchSize() throws SQLException { - return 0; + return 0; } /** * @see java.sql.ResultSet#getFloat(int) */ public float getFloat(int columnIndex) throws SQLException { - try { + try { return this.currentRow.getFloatValue(columnIndex-1); } catch (TechnicalException e) { log.error(e,e); @@ -434,8 +445,8 @@ * @see java.sql.ResultSet#getFloat(java.lang.String) */ public float getFloat(String columnName) throws SQLException { - int columnIndex = this.getColumnIndex(columnName); - return this.getFloat(columnIndex); + int columnIndex = this.getColumnIndex(columnName); + return this.getFloat(columnIndex); } /** @@ -443,7 +454,7 @@ */ public int getInt(int columnIndex) throws SQLException { - try { + try { return this.currentRow.getIntValue(columnIndex-1); } catch (TechnicalException e) { log.error(e,e); @@ -455,8 +466,8 @@ * @see java.sql.ResultSet#getInt(java.lang.String) */ public int getInt(String columnName) throws SQLException { - int columnIndex = this.getColumnIndex(columnName); - return this.getInt(columnIndex); + int columnIndex = this.getColumnIndex(columnName); + return this.getInt(columnIndex); } /** @@ -464,7 +475,7 @@ */ public long getLong(int columnIndex) throws SQLException { - return 0; + return 0; } /** @@ -472,7 +483,7 @@ */ public long getLong(String columnName) throws SQLException { - return 0; + return 0; } /** @@ -487,7 +498,7 @@ * @see java.sql.ResultSet#getObject(int) */ public Object getObject(int columnIndex) throws SQLException { - try { + try { return this.currentRow.getValue(columnIndex-1); } catch (TechnicalException e) { log.error(e,e); @@ -499,8 +510,8 @@ * @see java.sql.ResultSet#getObject(java.lang.String) */ public Object getObject(String columnName) throws SQLException { - int columnIndex = this.getColumnIndex(columnName); - return this.getObject(columnIndex); + int columnIndex = this.getColumnIndex(columnName); + return this.getObject(columnIndex); } /** @@ -509,7 +520,7 @@ public Object getObject(int i, Map> map) throws SQLException { - return null; + return null; } /** @@ -518,7 +529,7 @@ public Object getObject(String colName, Map> map) throws SQLException { - return null; + return null; } /** @@ -526,7 +537,7 @@ */ public Ref getRef(int i) throws SQLException { - return null; + return null; } /** @@ -534,7 +545,7 @@ */ public Ref getRef(String colName) throws SQLException { - return null; + return null; } /** @@ -542,7 +553,7 @@ */ public int getRow() throws SQLException { - return 0; + return 0; } /** @@ -550,7 +561,7 @@ */ public short getShort(int columnIndex) throws SQLException { - return 0; + return 0; } /** @@ -558,7 +569,7 @@ */ public short getShort(String columnName) throws SQLException { - return 0; + return 0; } /** @@ -566,7 +577,7 @@ */ public Statement getStatement() throws SQLException { - return null; + return null; } /** @@ -574,7 +585,7 @@ */ public String getString(int columnIndex) throws SQLException { - try { + try { return this.currentRow.getStringValue(columnIndex-1); } catch (TechnicalException e) { log.error(e,e); @@ -586,8 +597,8 @@ * @see java.sql.ResultSet#getString(java.lang.String) */ public String getString(String columnName) throws SQLException { - int columnIndex = this.getColumnIndex(columnName); - return this.getString(columnIndex); + int columnIndex = this.getColumnIndex(columnName); + return this.getString(columnIndex); } /** @@ -595,7 +606,7 @@ */ public Time getTime(int columnIndex) throws SQLException { - return null; + return null; } /** @@ -603,7 +614,7 @@ */ public Time getTime(String columnName) throws SQLException { - return null; + return null; } /** @@ -611,7 +622,7 @@ */ public Time getTime(int columnIndex, Calendar cal) throws SQLException { - return null; + return null; } /** @@ -619,7 +630,7 @@ */ public Time getTime(String columnName, Calendar cal) throws SQLException { - return null; + return null; } /** @@ -627,7 +638,7 @@ */ public Timestamp getTimestamp(int columnIndex) throws SQLException { - return null; + return null; } /** @@ -635,7 +646,7 @@ */ public Timestamp getTimestamp(String columnName) throws SQLException { - return null; + return null; } /** @@ -644,7 +655,7 @@ public Timestamp getTimestamp(int columnIndex, Calendar cal) throws SQLException { - return null; + return null; } /** @@ -654,7 +665,7 @@ public Timestamp getTimestamp(String columnName, Calendar cal) throws SQLException { - return null; + return null; } /** @@ -662,7 +673,7 @@ */ public int getType() throws SQLException { - return 0; + return 0; } /** @@ -670,7 +681,7 @@ */ public URL getURL(int columnIndex) throws SQLException { - return null; + return null; } /** @@ -678,7 +689,7 @@ */ public URL getURL(String columnName) throws SQLException { - return null; + return null; } /** @@ -686,7 +697,7 @@ */ public InputStream getUnicodeStream(int columnIndex) throws SQLException { - return null; + return null; } /** @@ -694,7 +705,7 @@ */ public InputStream getUnicodeStream(String columnName) throws SQLException { - return null; + return null; } /** @@ -702,7 +713,7 @@ */ public SQLWarning getWarnings() throws SQLException { - return null; + return null; } /** @@ -716,7 +727,7 @@ */ public boolean isAfterLast() throws SQLException { - return false; + return false; } /** @@ -724,7 +735,7 @@ */ public boolean isBeforeFirst() throws SQLException { - return false; + return false; } /** @@ -732,7 +743,7 @@ */ public boolean isFirst() throws SQLException { - return false; + return false; } /** @@ -740,7 +751,7 @@ */ public boolean isLast() throws SQLException { - return false; + return false; } /** @@ -748,7 +759,7 @@ */ public boolean last() throws SQLException { - return false; + return false; } /** @@ -767,16 +778,16 @@ * @see java.sql.ResultSet#next() */ public boolean next() throws SQLException { - - boolean next = this.mRows.size() > this.cursor; - if (next){ - //log.debug("Zeile "+(cursor+1)+" von "+this.mRows.size()+" wird angesteuert."); - this.currentRow = this.mRows.get(this.cursor); - this.cursor++; - }else{ - this.currentRow = null; - } - return next; + + boolean next = this.mRows.size() > this.cursor; + if (next){ + //log.debug("Zeile "+(cursor+1)+" von "+this.mRows.size()+" wird angesteuert."); + this.currentRow = this.mRows.get(this.cursor); + this.cursor++; + }else{ + this.currentRow = null; + } + return next; } /** @@ -784,7 +795,7 @@ */ public boolean previous() throws SQLException { - return false; + return false; } /** @@ -798,7 +809,7 @@ */ public boolean relative(int rows) throws SQLException { - return false; + return false; } /** @@ -806,7 +817,7 @@ */ public boolean rowDeleted() throws SQLException { - return false; + return false; } /** @@ -814,7 +825,7 @@ */ public boolean rowInserted() throws SQLException { - return false; + return false; } /** @@ -822,7 +833,7 @@ */ public boolean rowUpdated() throws SQLException { - return false; + return false; } /** @@ -1144,174 +1155,297 @@ return false; } - - + + /** + * TODO: DOCUMENT ME + * @param columnName + * @return + * @throws SQLException + */ private int getColumnIndex(String columnName) throws SQLException{ - for (int i = 0 ; i < this.mCols.size();i++){ - if(this.mCols.get(i).getName().equalsIgnoreCase(columnName)){ - return i +1; // PLUS 1 da SQL-Cursor 1 basiert sind + for (int i = 0 ; i < this.mCols.size();i++){ + if(this.mCols.get(i).getName().equalsIgnoreCase(columnName)){ + return i +1; // PLUS 1 da SQL-Cursor 1 basiert sind + } } - } - throw new SQLException("Column "+columnName+" does not exist in ResulSet"); + throw new SQLException("Column "+columnName+" does not exist in ResulSet"); } + /** + * @see java.sql.ResultSet#getHoldability() + */ public int getHoldability() throws SQLException { return 0; } + /** + * @see java.sql.ResultSet#getNCharacterStream(int) + */ public Reader getNCharacterStream(int arg0) throws SQLException { return null; } + /** + * @see java.sql.ResultSet#getNCharacterStream(java.lang.String) + */ public Reader getNCharacterStream(String arg0) throws SQLException { return null; } + /** + * @see java.sql.ResultSet#getNClob(int) + */ public NClob getNClob(int arg0) throws SQLException { return null; } + /** + * @see java.sql.ResultSet#getNClob(java.lang.String) + */ public NClob getNClob(String arg0) throws SQLException { return null; } + /** + * @see java.sql.ResultSet#getNString(int) + */ public String getNString(int arg0) throws SQLException { return null; } + /** + * @see java.sql.ResultSet#getNString(java.lang.String) + */ public String getNString(String arg0) throws SQLException { return null; } + /** + * @see java.sql.ResultSet#getRowId(int) + */ public RowId getRowId(int arg0) throws SQLException { - - return null; - } - - public RowId getRowId(String arg0) throws SQLException { - return null; } - public SQLXML getSQLXML(int arg0) throws SQLException { - + /** + * @see java.sql.ResultSet#getRowId(java.lang.String) + */ + public RowId getRowId(String arg0) throws SQLException { return null; } - public SQLXML getSQLXML(String arg0) throws SQLException { - + /** + * @see java.sql.ResultSet#getSQLXML(int) + */ + public SQLXML getSQLXML(int arg0) throws SQLException { return null; } + /** + * @see java.sql.ResultSet#getSQLXML(java.lang.String) + */ + public SQLXML getSQLXML(String arg0) throws SQLException { + return null; + } + + /** + * @see java.sql.ResultSet#isClosed() + */ public boolean isClosed() throws SQLException { - return false; } + /** + * @see java.sql.ResultSet#updateAsciiStream(int, java.io.InputStream) + */ public void updateAsciiStream(int arg0, InputStream arg1) throws SQLException { } + /** + * @see java.sql.ResultSet#updateAsciiStream(java.lang.String, java.io.InputStream) + */ public void updateAsciiStream(String arg0, InputStream arg1) throws SQLException { } + /** + * @see java.sql.ResultSet#updateAsciiStream(int, java.io.InputStream, long) + */ public void updateAsciiStream(int arg0, InputStream arg1, long arg2) throws SQLException { } + /** + * @see java.sql.ResultSet#updateAsciiStream(java.lang.String, java.io.InputStream, long) + */ public void updateAsciiStream(String arg0, InputStream arg1, long arg2) throws SQLException { } + /** + * @see java.sql.ResultSet#updateBinaryStream(int, java.io.InputStream) + */ public void updateBinaryStream(int arg0, InputStream arg1) throws SQLException { } + /** + * @see java.sql.ResultSet#updateBinaryStream(java.lang.String, java.io.InputStream) + */ public void updateBinaryStream(String arg0, InputStream arg1) throws SQLException { } + /** + * @see java.sql.ResultSet#updateBinaryStream(int, java.io.InputStream, long) + */ public void updateBinaryStream(int arg0, InputStream arg1, long arg2) throws SQLException { } + /** + * @see java.sql.ResultSet#updateBinaryStream(java.lang.String, java.io.InputStream, long) + */ public void updateBinaryStream(String arg0, InputStream arg1, long arg2) throws SQLException { } + /** + * @see java.sql.ResultSet#updateBlob(int, java.io.InputStream) + */ public void updateBlob(int arg0, InputStream arg1) throws SQLException { } + /** + * @see java.sql.ResultSet#updateBlob(java.lang.String, java.io.InputStream) + */ public void updateBlob(String arg0, InputStream arg1) throws SQLException { } + /** + * @see java.sql.ResultSet#updateBlob(int, java.io.InputStream, long) + */ public void updateBlob(int arg0, InputStream arg1, long arg2) throws SQLException { } + /** + * @see java.sql.ResultSet#updateBlob(java.lang.String, java.io.InputStream, long) + */ public void updateBlob(String arg0, InputStream arg1, long arg2) throws SQLException { } + /** + * @see java.sql.ResultSet#updateCharacterStream(int, java.io.Reader) + */ public void updateCharacterStream(int arg0, Reader arg1) throws SQLException { } + /** + * @see java.sql.ResultSet#updateCharacterStream(java.lang.String, java.io.Reader) + */ public void updateCharacterStream(String arg0, Reader arg1) throws SQLException { } + /** + * @see java.sql.ResultSet#updateCharacterStream(int, java.io.Reader, long) + */ public void updateCharacterStream(int arg0, Reader arg1, long arg2) throws SQLException { } + /** + * @see java.sql.ResultSet#updateCharacterStream(java.lang.String, java.io.Reader, long) + */ public void updateCharacterStream(String arg0, Reader arg1, long arg2) throws SQLException { } + /** + * @see java.sql.ResultSet#updateClob(int, java.io.Reader) + */ public void updateClob(int arg0, Reader arg1) throws SQLException { } + /** + * @see java.sql.ResultSet#updateClob(java.lang.String, java.io.Reader) + */ public void updateClob(String arg0, Reader arg1) throws SQLException { } + /** + * @see java.sql.ResultSet#updateClob(int, java.io.Reader, long) + */ public void updateClob(int arg0, Reader arg1, long arg2) throws SQLException { } + /** + * @see java.sql.ResultSet#updateClob(java.lang.String, java.io.Reader, long) + */ public void updateClob(String arg0, Reader arg1, long arg2) throws SQLException { } + /** + * @see java.sql.ResultSet#updateNCharacterStream(int, java.io.Reader) + */ public void updateNCharacterStream(int arg0, Reader arg1) throws SQLException { } + /** + * @see java.sql.ResultSet#updateNCharacterStream(java.lang.String, java.io.Reader) + */ public void updateNCharacterStream(String arg0, Reader arg1) throws SQLException { } + /** + * @see java.sql.ResultSet#updateNCharacterStream(int, java.io.Reader, long) + */ public void updateNCharacterStream(int arg0, Reader arg1, long arg2) throws SQLException { } + /** + * @see java.sql.ResultSet#updateNCharacterStream(java.lang.String, java.io.Reader, long) + */ public void updateNCharacterStream(String arg0, Reader arg1, long arg2) throws SQLException { } + /** + * @see java.sql.ResultSet#updateNClob(int, java.sql.NClob) + */ public void updateNClob(int arg0, NClob arg1) throws SQLException { } + /** + * @see java.sql.ResultSet#updateNClob(java.lang.String, java.sql.NClob) + */ public void updateNClob(String arg0, NClob arg1) throws SQLException { } + /** + * @see java.sql.ResultSet#updateNClob(int, java.io.Reader) + */ public void updateNClob(int arg0, Reader arg1) throws SQLException { } + /** + * @see java.sql.ResultSet#updateNClob(java.lang.String, java.io.Reader) + */ public void updateNClob(String arg0, Reader arg1) throws SQLException { } + /** + * @see java.sql.ResultSet#updateNClob(int, java.io.Reader, long) + */ public void updateNClob(int arg0, Reader arg1, long arg2) throws SQLException { } @@ -1320,31 +1454,53 @@ throws SQLException { } + /** + * @see java.sql.ResultSet#updateNString(int, java.lang.String) + */ public void updateNString(int arg0, String arg1) throws SQLException { } + /** + * @see java.sql.ResultSet#updateNString(java.lang.String, java.lang.String) + */ public void updateNString(String arg0, String arg1) throws SQLException { } + /** + * @see java.sql.ResultSet#updateRowId(int, java.sql.RowId) + */ public void updateRowId(int arg0, RowId arg1) throws SQLException { } + /** + * @see java.sql.ResultSet#updateRowId(java.lang.String, java.sql.RowId) + */ public void updateRowId(String arg0, RowId arg1) throws SQLException { } + /** + * @see java.sql.ResultSet#updateSQLXML(int, java.sql.SQLXML) + */ public void updateSQLXML(int arg0, SQLXML arg1) throws SQLException { } + /** + * @see java.sql.ResultSet#updateSQLXML(java.lang.String, java.sql.SQLXML) + */ public void updateSQLXML(String arg0, SQLXML arg1) throws SQLException { } + /** + * @see java.sql.Wrapper#isWrapperFor(java.lang.Class) + */ public boolean isWrapperFor(Class arg0) throws SQLException { - return false; } + /** + * @see java.sql.Wrapper#unwrap(java.lang.Class) + */ public T unwrap(Class arg0) throws SQLException { - return null; } diff -r 6d568397740c -r 12f88239fb33 geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/exception/DatasourceException.java --- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/exception/DatasourceException.java Fri Mar 26 11:07:01 2010 +0000 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/exception/DatasourceException.java Fri Mar 26 15:23:03 2010 +0000 @@ -1,35 +1,52 @@ -/* Copyright (C) 2007 con terra GmbH (http://www.conterra.de) - * All rights reserved - * - * $Id: DatasourceException.java,v 1.2 2008/01/30 12:38:34 blume Exp $ - * - * created by: drewnak - * created at : 21.11.2007 - * created at : 14:56:32 - * - * modified by: $Author: blume $ - * modified at: $Date: 2008/01/30 12:38:34 $ +/** + * */ package de.intevation.gnv.geobackend.sde.datasources.exception; /** * A Class for encapsulating implementation specific datasource exceptions. - * This exception class can be used for all exceptions occuring in connection to "datasources actions". + * This exception class can be used for all exceptions occuring in connection + * to "datasources actions". + * + * @author blume + * @author drewnak + * @author Tim Englich */ public class DatasourceException extends Exception { + /** + * The UID of this Class. + */ + private static final long serialVersionUID = 2593142889158383466L; + + /** + * Constructor + */ public DatasourceException() { super(); } + /** + * Constructor + * @param pMessage the Exceptionmessage + */ public DatasourceException(String pMessage) { super(pMessage); } + /** + * Constructor + * @param pMessage the Exceptionmessage + * @param pCause the Throwable which cause this exception + */ public DatasourceException(String pMessage, Throwable pCause) { super(pMessage, pCause); } + /** + * Constructor + * @param pCause the Throwable which cause this exception + */ public DatasourceException(Throwable pCause) { super(pCause); } diff -r 6d568397740c -r 12f88239fb33 geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/exception/TechnicalException.java --- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/exception/TechnicalException.java Fri Mar 26 11:07:01 2010 +0000 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/exception/TechnicalException.java Fri Mar 26 15:23:03 2010 +0000 @@ -1,17 +1,5 @@ /** - * Title: TechnicalException, $Header: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/exception/TechnicalException.java,v 1.2 2008/08/18 14:50:33 drewnak Exp $ - * Source: $Source: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/exception/TechnicalException.java,v $ - * created by: Stefan Blume (blume) - * erstellt am: 21.11.2007 - * Copyright: con terra GmbH, 2005 - * - * modified by: $Author: drewnak $ - * modified on: $Date: 2008/08/18 14:50:33 $ - * Version: $Revision: 1.2 $ - * TAG: $Name: $ - * locked from: $Locker: $ - * CVS State: $State: Exp $ - * Project: $ProjectName$ + * */ package de.intevation.gnv.geobackend.sde.datasources.exception; @@ -19,19 +7,18 @@ /** * The class TechnicalException fulfills the following purposes: - *
    - *
  1. - *
* * @author blume - * @version 1.0 - * @serial 1.0 - * @see - * @since 21.11.2007 08:12:08 + * @author Tim Englich */ public class TechnicalException extends Exception{ /** + * The UID of this Class. + */ + private static final long serialVersionUID = -5296559414323169553L; + + /** * Default Logging instance */ private static Logger sLogger = Logger.getLogger(TechnicalException.class); @@ -55,6 +42,11 @@ public TechnicalException(String message) { super(message); } + + /** + * Constructor + * @param pCause the Throwable which cause this exception + */ public TechnicalException(Throwable pCause) { super(pCause); } diff -r 6d568397740c -r 12f88239fb33 geo-backend/src/main/java/de/intevation/gnv/geobackend/util/DateUtils.java --- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/util/DateUtils.java Fri Mar 26 11:07:01 2010 +0000 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/util/DateUtils.java Fri Mar 26 15:23:03 2010 +0000 @@ -15,23 +15,16 @@ */ package de.intevation.gnv.geobackend.util; -import org.apache.log4j.Logger; - import java.text.SimpleDateFormat; import java.util.Date; +import org.apache.log4j.Logger; + /** - * The class DateUtisl fulfills the following purposes: - *
    - *
  1. - *
- * + * The class DateUtils fulfills the following purposes: * @author blume - * @version 1.0 - * @serial 1.0 - * @see - * @since 21.12.2007 10:34:01 + * @author Tim Englich */ public class DateUtils { @@ -39,90 +32,61 @@ * Default Logging instance */ private static Logger sLogger = Logger.getLogger(DateUtils.class); - private static boolean sDebug = sLogger.isDebugEnabled(); - - public static final String DATE_PATTERN = "yyyy.MM.dd HH:mm:ss"; - public static final String DATE_PATTERN1 = "dd-MMM-yyyy HH:mm:ss"; - public static final String TimeRangeFilterPattern = "yyyy-MM-dd'T'HH:mm:ssZ"; - public static final String TimeRangeFilterFormPattern = "dd.MM.yyyy HH:mm"; - public static String getPatternedDateSDF(Date pDate) { - SimpleDateFormat fmt = new SimpleDateFormat(); - fmt.applyPattern(DATE_PATTERN); - return fmt.format(pDate); - } - + /** + * The Dateformat which will be used e.g for Querying the Database + */ + public static final String DATE_PATTERN = "yyyy.MM.dd HH:mm:ss"; + + private static final String DATE_PATTERN1 = "dd-MMM-yyyy HH:mm:ss"; + + /** + * The Method returns a Date using the given pattern as a String + * @param pDate The Date which should be formatted + * @param sPattern The Pattern which should be used. + * @return the Date formatted a a String + */ public static String getPatternedDate(Date pDate, String sPattern) { -// DateTimeZone.setDefault(DateTimeZone.UTC); -// DateTime dtf = new DateTime (pDate); -// String sStr = dtf.toString(sPattern); -// return sStr; - SimpleDateFormat fmt = new SimpleDateFormat(); + SimpleDateFormat fmt = new SimpleDateFormat(); fmt.applyPattern(sPattern); return fmt.format(pDate); } - + + /** + * Returns the Date as a String formated using the + * @see DateUtils.DATE_PATTERN + * @param pDate the Date which should be formatted + * @return the given Data as a String + */ public static String getPatternedDateAmer(Date pDate) { - - String sStr = getPatternedDate(pDate, DATE_PATTERN); - return sStr; - } - - public static String getPatternedDateGerm(Date pDate) { - - String sStr = getPatternedDate(pDate, DATE_PATTERN1); - return sStr; - } - - public static String getPatternedDateTimeRangeFilter(Date pDate) { - - String sStr = getPatternedDate(pDate, TimeRangeFilterPattern); - return sStr; - } - - public static String getPatternedDateTimeRangeFilterForm(Date pDate) { - - String sStr = getPatternedDate(pDate, TimeRangeFilterFormPattern); + String sStr = getPatternedDate(pDate, DATE_PATTERN); return sStr; } - - public synchronized static Date getDateFromStringSDF (String sStr)throws Exception { - SimpleDateFormat formatter = new SimpleDateFormat("dd-MMM-yyyy HH:mm:ss"); - Date date = (Date)formatter.parse(sStr); - return date; - } - - public static Date getDateFromString (String sStr)throws Exception { - - Date date = getDateFromString (sStr, DATE_PATTERN1); - return date; + + /** + * Thismethod decodes a Datevalue from the given String useing the + * @see DateUtils.DATE_PATTERN1 format- + * @param sStr The String which contains the encoded Datevalue + * @return the decoded Datevalue as an Date-object. + * @throws Exception throws all Expetion which occurs during the Process. + */ + public static Date getDateFromString (String sStr)throws Exception { + Date date = getDateFromString (sStr, DATE_PATTERN1); + return date; } - - public static Date getDateFromStringTimeRangeFilter (String sStr)throws Exception { - - Date date = getDateFromString (sStr, TimeRangeFilterPattern); - return date; - } - - public static Date getDateFromStringTimeRangeFilterForm (String sStr)throws Exception { - - Date date = getDateFromString (sStr, TimeRangeFilterFormPattern); - return date; - } - - public static Date getDateFromString (String sStr, String sPattern)throws Exception { -// DateTime dtf = null; -// DateTimeZone.setDefault(DateTimeZone.UTC); -// -// dtf = DateTimeFormat.forPattern(sPattern).parseDateTime(sStr); -// -// Date date = dtf.toDate(); -// -// return date; - SimpleDateFormat fmt = new SimpleDateFormat(); + + /** + * Formats a given Date encoded as a String using the given Pattern + * into a Date Object. + * @param sStr The String with the encoded DateValue + * @param sPattern The pattern which should be used to decode the Date + * @return the given Datevalue as an Date-Object. + * @throws Exception throws all Expetion which occurs during the Process. + */ + public static Date getDateFromString (String sStr, + String sPattern)throws Exception { + SimpleDateFormat fmt = new SimpleDateFormat(); fmt.applyPattern(sPattern); return fmt.parse(sStr); - } - - + } }