|
From: <pe...@us...> - 2003-12-14 20:52:57
|
Update of /cvsroot/neuclear/neuclear-commons/src/java/org/neuclear/commons/sql
In directory sc8-pr-cvs1:/tmp/cvs-serv18566/src/java/org/neuclear/commons/sql
Modified Files:
SQLContext.java
Log Message:
Added ServletPassPhraseAgent which uses ThreadLocal to transfer the passphrase to the signer.
Added ServletSignerFactory, which builds Signers for use within servlets based on parameters in the Servlets
Init parameters in web.xml
Updated SQLContext to use ThreadLocal
Added jakarta cactus unit tests to neuclear-commons to test the 2 new features above.
Added use of the new features in neuclear-commons to the servilets within neuclear-id and added
configuration parameters in web.xml
Index: SQLContext.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-commons/src/java/org/neuclear/commons/sql/SQLContext.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** SQLContext.java 1 Dec 2003 15:44:53 -0000 1.1
--- SQLContext.java 14 Dec 2003 20:52:54 -0000 1.2
***************
*** 27,30 ****
--- 27,39 ----
$Id$
$Log$
+ Revision 1.2 2003/12/14 20:52:54 pelle
+ Added ServletPassPhraseAgent which uses ThreadLocal to transfer the passphrase to the signer.
+ Added ServletSignerFactory, which builds Signers for use within servlets based on parameters in the Servlets
+ Init parameters in web.xml
+ Updated SQLContext to use ThreadLocal
+ Added jakarta cactus unit tests to neuclear-commons to test the 2 new features above.
+ Added use of the new features in neuclear-commons to the servilets within neuclear-id and added
+ configuration parameters in web.xml
+
Revision 1.1 2003/12/01 15:44:53 pelle
Added XAConnectionSources and Transaction capability through jotm.
***************
*** 37,44 ****
* The threads connection can be specifically closed with close()
*/
! public class SQLContext implements ConnectionSource{
public SQLContext(ConnectionSource source) {
this.source = source;
- this.map=new HashMap();
}
--- 46,52 ----
* The threads connection can be specifically closed with close()
*/
! public class SQLContext extends ThreadLocal implements ConnectionSource{
public SQLContext(ConnectionSource source) {
this.source = source;
}
***************
*** 50,59 ****
*/
public Connection getConnection() throws SQLException, IOException {
! Connection con= (Connection)map.get(Thread.currentThread());
! if (con==null||con.isClosed()){
! con=source.getConnection();
! map.put(Thread.currentThread(),con);
! }
! return con;
}
/**
--- 58,62 ----
*/
public Connection getConnection() throws SQLException, IOException {
! return (Connection)get();
}
/**
***************
*** 61,72 ****
* @throws SQLException
*/
! public void close() throws SQLException {
! Connection con= (Connection)map.get(Thread.currentThread());
! if (con!=null||!con.isClosed())
! map.remove(Thread.currentThread());
! con.close();
}
private final ConnectionSource source;
! private final Map map;
}
--- 64,82 ----
* @throws SQLException
*/
! public void close() throws SQLException, IOException {
! getConnection().close();
! set(null);
}
private final ConnectionSource source;
!
! protected Object initialValue() {
! try {
! return source.getConnection(); //To change body of overriden methods use Options | File Templates.
! } catch (SQLException e) {
! throw new org.neuclear.commons.LowLevelException(e);
! } catch (IOException e) {
! throw new org.neuclear.commons.LowLevelException(e);
! }
! }
}
|