Mercurial > dive4elements > gnv-client
diff geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/connectionpool/ArcSDEPoolableObjectFactory.java @ 274:ff1b7967e6b9
General CodecCleanup:
Remove deprecated TODOS.
Replaced Tabs against whitespaces
Organize some Imports
geo-backend/trunk@280 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Tim Englich <tim.englich@intevation.de> |
---|---|
date | Mon, 02 Nov 2009 10:53:06 +0000 |
parents | e5379e129799 |
children | 1f6e2b256247 |
line wrap: on
line diff
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/connectionpool/ArcSDEPoolableObjectFactory.java Fri Oct 30 11:11:55 2009 +0000 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/connectionpool/ArcSDEPoolableObjectFactory.java Mon Nov 02 10:53:06 2009 +0000 @@ -19,108 +19,103 @@ */ public class ArcSDEPoolableObjectFactory implements PoolableObjectFactory { - /** + /** * the logger, used to log exceptions and additonaly information */ private static Logger log = Logger.getLogger(ArcSDEPoolableObjectFactory.class); - - /** - * The URL to the ArcSDE Server - */ - private String server = null; - /** - * The Port the ArcSDE Server is connected to. - */ - private String port = null; - /** - * The Name of the Database - */ - private String database = null; - /** - * The Username for the Authentication - */ - private String username = null; - /** - * The Credentials which belongs to the User - */ - private String credentials = null; + /** + * The URL to the ArcSDE Server + */ + private String server = null; + /** + * The Port the ArcSDE Server is connected to. + */ + private String port = null; + /** + * The Name of the Database + */ + private String database = null; + /** + * The Username for the Authentication + */ + private String username = null; + /** + * The Credentials which belongs to the User + */ + private String credentials = null; - - /** - * Constructor of this Class - * @param properties the Properties which includes the ConnectionParams to the Database - */ - public ArcSDEPoolableObjectFactory(Properties properties) { - - this.server = properties.getProperty("server"); - this.port = properties.getProperty("port"); - this.database = properties.getProperty("database"); - this.username = properties.getProperty("username"); - this.credentials = properties.getProperty("credentials"); - - log.info("ArcSDEPoolableObjectFactory initialized"); - log.info("Server: "+this.server); - log.info("Port: "+this.port); - log.info("Database: "+this.database); - log.info("User: "+this.username); - } + /** + * Constructor of this Class + * @param properties the Properties which includes the ConnectionParams to the Database + */ + public ArcSDEPoolableObjectFactory(Properties properties) { + log.debug("ArcSDEPoolableObjectFactory.Constructor"); + this.server = properties.getProperty("server"); + this.port = properties.getProperty("port"); + this.database = properties.getProperty("database"); + this.username = properties.getProperty("username"); + this.credentials = properties.getProperty("credentials"); + + log.info("ArcSDEPoolableObjectFactory initialized"); + log.info("Server: "+this.server); + log.info("Port: "+this.port); + log.info("Database: "+this.database); + log.info("User: "+this.username); + } - /** - * @see org.apache.commons.pool.PoolableObjectFactory#activateObject(java.lang.Object) - */ - public void activateObject(Object arg0) throws Exception { - log.debug("ArcSDEPoolableObjectFactory.activateObject"); - // TODO Was muss hier passieren? - } + /** + * @see org.apache.commons.pool.PoolableObjectFactory#activateObject(java.lang.Object) + */ + public void activateObject(Object arg0) throws Exception { + log.debug("ArcSDEPoolableObjectFactory.activateObject"); + } - /** - * @see org.apache.commons.pool.PoolableObjectFactory#destroyObject(java.lang.Object) - */ - public void destroyObject(Object arg0) throws Exception { - log.debug("ArcSDEPoolableObjectFactory.destroyObjectb"); - if (arg0 instanceof ArcSDEConnection) { - ((ArcSDEConnection)arg0).close(); - }else{ - log.warn("Object cannot be handled"); - } - } + /** + * @see org.apache.commons.pool.PoolableObjectFactory#destroyObject(java.lang.Object) + */ + public void destroyObject(Object arg0) throws Exception { + log.debug("ArcSDEPoolableObjectFactory.destroyObjectb"); + if (arg0 instanceof ArcSDEConnection) { + ((ArcSDEConnection)arg0).close(); + }else{ + log.warn("Object cannot be handled"); + } + } - /** - * @see org.apache.commons.pool.PoolableObjectFactory#makeObject() - */ - public Object makeObject() throws Exception { - log.debug("ArcSDEPoolableObjectFactory.makeObject"); - Connection con; - try { + /** + * @see org.apache.commons.pool.PoolableObjectFactory#makeObject() + */ + public Object makeObject() throws Exception { + log.debug("ArcSDEPoolableObjectFactory.makeObject"); + Connection con; + try { con = new ArcSDEConnection(this.server, this.port, this.database, this.username, this.credentials); } catch (ConnectionException e) { throw new ConnectionException("Establishing a connection to database failed: " + e.toString(), e); } return con; - } + } - /** - * @see org.apache.commons.pool.PoolableObjectFactory#passivateObject(java.lang.Object) - */ - public void passivateObject(Object arg0) throws Exception { - log.debug("ArcSDEPoolableObjectFactory.passivateObject"); - // TODO Was muss hier passieren? - } + /** + * @see org.apache.commons.pool.PoolableObjectFactory#passivateObject(java.lang.Object) + */ + public void passivateObject(Object arg0) throws Exception { + log.debug("ArcSDEPoolableObjectFactory.passivateObject"); + } - /** - * @see org.apache.commons.pool.PoolableObjectFactory#validateObject(java.lang.Object) - */ - public boolean validateObject(Object arg0) { - // TODO Was muss hier passieren? - log.debug("ArcSDEPoolableObjectFactory.validateObject"); + /** + * @see org.apache.commons.pool.PoolableObjectFactory#validateObject(java.lang.Object) + */ + public boolean validateObject(Object arg0) { + log.debug("ArcSDEPoolableObjectFactory.validateObject"); boolean returnValue = false; - try { - returnValue = arg0 instanceof ArcSDEConnection + try { + returnValue = arg0 instanceof ArcSDEConnection ? !((ArcSDEConnection)arg0).isClosed() : false; } catch (SQLException sqle) {} return returnValue; - } + } }