Update of /cvsroot/squirrel-sql/sql12/app/src/net/sourceforge/squirrel_sql/client/gui/db
In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv1839/app/src/net/sourceforge/squirrel_sql/client/gui/db
Modified Files:
ISQLAliasExt.java SQLAlias.java SQLAliasBeanInfo.java
Added Files:
SQLAliasConnectionProperties.java
Log Message:
Aliases now have the ability to setup keep-alive SQL statement and sleep time (in seconds) to prevent a connection from being disconnected while appearing to be idle.
Index: SQLAliasBeanInfo.java
===================================================================
RCS file: /cvsroot/squirrel-sql/sql12/app/src/net/sourceforge/squirrel_sql/client/gui/db/SQLAliasBeanInfo.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** SQLAliasBeanInfo.java 28 Nov 2009 20:14:51 -0000 1.5
--- SQLAliasBeanInfo.java 19 Dec 2009 21:33:51 -0000 1.6
***************
*** 69,73 ****
"setSchemaProperties"),
new PropertyDescriptor(IPropNames.COLOR_PROPERTIES, SQLAlias.class, "getColorProperties",
! "setColorProperties") };
return result;
}
--- 69,75 ----
"setSchemaProperties"),
new PropertyDescriptor(IPropNames.COLOR_PROPERTIES, SQLAlias.class, "getColorProperties",
! "setColorProperties"),
! new PropertyDescriptor(IPropNames.CONNECTION_PROPERTIES, SQLAlias.class, "getConnectionProperties",
! "setConnectionProperties")};
return result;
}
--- NEW FILE: SQLAliasConnectionProperties.java ---
package net.sourceforge.squirrel_sql.client.gui.db;
/*
* Copyright (C) 2009 Rob Manning
* man...@us...
*
* Based on initial work from Colin Bell
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
import java.io.Serializable;
public class SQLAliasConnectionProperties implements Serializable
{
private static final long serialVersionUID = 1L;
/** Whether or not to enable connection keep alives */
private boolean enableConnectionKeepAlive = false;
/** time between executing the keep alive sql statement; Default = 2 minutes */
private int keepAliveSleepTimeSeconds = 120;
/** the statement to execute to keep the connection alive */
private String keepAliveSqlStatement = "";
/**
* @return the isEnableConnectionKeepAlive
*/
public boolean isEnableConnectionKeepAlive()
{
return enableConnectionKeepAlive;
}
/**
* @param enableConnectionKeepAlive the enableConnectionKeepAlive to set
*/
public void setEnableConnectionKeepAlive(boolean enableConnectionKeepAlive)
{
this.enableConnectionKeepAlive = enableConnectionKeepAlive;
}
/**
* @return the keepAliveSleepTimeSeconds
*/
public int getKeepAliveSleepTimeSeconds()
{
return keepAliveSleepTimeSeconds;
}
/**
* @param keepAliveSleepTimeMillis the keepAliveSleepTimeSeconds to set
*/
public void setKeepAliveSleepTimeSeconds(int keepAliveSleepTimeSeconds)
{
this.keepAliveSleepTimeSeconds = keepAliveSleepTimeSeconds;
}
/**
* @return the keepAliveSqlStatement
*/
public String getKeepAliveSqlStatement()
{
return keepAliveSqlStatement;
}
/**
* @param keepAliveSqlStatement the keepAliveSqlStatement to set
*/
public void setKeepAliveSqlStatement(String keepAliveSqlStatement)
{
this.keepAliveSqlStatement = keepAliveSqlStatement;
}
}
Index: SQLAlias.java
===================================================================
RCS file: /cvsroot/squirrel-sql/sql12/app/src/net/sourceforge/squirrel_sql/client/gui/db/SQLAlias.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** SQLAlias.java 28 Nov 2009 20:14:51 -0000 1.8
--- SQLAlias.java 19 Dec 2009 21:33:51 -0000 1.9
***************
*** 98,101 ****
--- 98,103 ----
private SQLAliasColorProperties _colorProperties = new SQLAliasColorProperties();
+ private SQLAliasConnectionProperties _connectionProperties = new SQLAliasConnectionProperties();
+
/**
* Default ctor.
***************
*** 153,156 ****
--- 155,164 ----
_colorProperties =
(SQLAliasColorProperties) Utilities.cloneObject(rhs._colorProperties, getClass().getClassLoader());
+
+ _connectionProperties = new SQLAliasConnectionProperties();
+ SQLAliasConnectionProperties rhsConnProps = rhs.getConnectionProperties();
+ _connectionProperties.setEnableConnectionKeepAlive(rhsConnProps.isEnableConnectionKeepAlive());
+ _connectionProperties.setKeepAliveSleepTimeSeconds(rhsConnProps.getKeepAliveSleepTimeSeconds());
+ _connectionProperties.setKeepAliveSqlStatement(rhsConnProps.getKeepAliveSqlStatement());
}
***************
*** 170,192 ****
}
- // /**
- // * Return a clone of this object.
- // */
- // public Object clone()
- // {
- // try
- // {
- // final SQLAlias alias = (SQLAlias)super.clone();
- // alias._propChgReporter = null;
- // alias.setDriverProperties(getDriverPropertiesClone());
- // alias._schemaProperties = (SQLAliasSchemaProperties) Utilities.cloneObject(alias._schemaProperties, getClass().getClassLoader());
- // return alias;
- // }
- // catch (CloneNotSupportedException ex)
- // {
- // throw new InternalError(ex.getMessage()); // Impossible.
- // }
- // }
-
/**
* Returns a hash code value for this object.
--- 178,181 ----
***************
*** 507,509 ****
--- 496,510 ----
}
+ @Override
+ public SQLAliasConnectionProperties getConnectionProperties()
+ {
+ return _connectionProperties;
+ }
+
+ @Override
+ public void setConnectionProperties(SQLAliasConnectionProperties connectionProperties)
+ {
+ _connectionProperties = connectionProperties;
+ }
+
}
Index: ISQLAliasExt.java
===================================================================
RCS file: /cvsroot/squirrel-sql/sql12/app/src/net/sourceforge/squirrel_sql/client/gui/db/ISQLAliasExt.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** ISQLAliasExt.java 28 Nov 2009 20:14:51 -0000 1.2
--- ISQLAliasExt.java 19 Dec 2009 21:33:51 -0000 1.3
***************
*** 10,12 ****
--- 10,16 ----
SQLAliasColorProperties getColorProperties();
void setColorProperties(SQLAliasColorProperties colorProperties);
+
+ SQLAliasConnectionProperties getConnectionProperties();
+ void setConnectionProperties(SQLAliasConnectionProperties connectionProperties);
+
}
|