[Proxool-cvs] proxool/src/java/org/logicalcobwebs/proxool ConnectionPoolDefinition.java,1.31,1.32 Co
UNMAINTAINED!
Brought to you by:
billhorsman
|
From: <bil...@us...> - 2004-06-02 20:19:23
|
Update of /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12645/src/java/org/logicalcobwebs/proxool Modified Files: ConnectionPoolDefinition.java ConnectionPoolDefinitionIF.java Log Message: Added injectable interface properties Index: ConnectionPoolDefinition.java =================================================================== RCS file: /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool/ConnectionPoolDefinition.java,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** ConnectionPoolDefinition.java 18 Mar 2004 17:08:14 -0000 1.31 --- ConnectionPoolDefinition.java 2 Jun 2004 20:19:14 -0000 1.32 *************** *** 17,20 **** --- 17,21 ---- import java.util.Set; import java.util.StringTokenizer; + import java.lang.reflect.Modifier; /** *************** *** 114,119 **** --- 115,129 ---- private boolean jmx; + private String jmxAgentId; + private Class injectableConnectionInterface; + + private Class injectableStatementInterface; + + private Class injectablePreparedStatementInterface; + + private Class injectableCallableStatementInterface; + /** * So we can set the values one by one if we want *************** *** 261,264 **** --- 271,275 ---- changed = changed || setHouseKeeperProperty(key, value, pretend); changed = changed || setLoggingProperty(key, value, pretend); + changed = changed || setInjectableProperty(key, value, pretend); changed = changed || setJndiProperty(key, value, pretend); *************** *** 447,450 **** --- 458,499 ---- /** + * Subset of {@link #setAnyProperty} to avoid overly long method + * @see #setAnyProperty + */ + private boolean setInjectableProperty(String key, String value, boolean pretend) { + boolean changed = false; + if (key.equals(ProxoolConstants.INJECTABLE_CONNECTION_INTERFACE_NAME_PROPERTY)) { + if (isChanged(getInjectableConnectionInterfaceName(), value)) { + changed = true; + if (!pretend) { + setInjectableConnectionInterfaceName(value.length() > 0 ? value : null); + } + } + } else if (key.equals(ProxoolConstants.INJECTABLE_STATEMENT_INTERFACE_NAME_PROPERTY)) { + if (isChanged(getInjectableStatementInterfaceName(), value)) { + changed = true; + if (!pretend) { + setInjectableStatementInterfaceName(value.length() > 0 ? value : null); + } + } + } else if (key.equals(ProxoolConstants.INJECTABLE_PREPARED_STATEMENT_INTERFACE_NAME_PROPERTY)) { + if (isChanged(getInjectablePreparedStatementInterfaceName(), value)) { + changed = true; + if (!pretend) { + setInjectablePreparedStatementInterfaceName(value.length() > 0 ? value : null); + } + } + } else if (key.equals(ProxoolConstants.INJECTABLE_CALLABLE_STATEMENT_INTERFACE_NAME_PROPERTY)) { + if (isChanged(getInjectableCallableStatememtInterfaceName(), value)) { + changed = true; + if (!pretend) { + setInjectableCallableStatementInterfaceName(value.length() > 0 ? value : null); + } + } + } + return changed; + } + + /** * Subset of {@link #setAnyProperty} to avoid overly long method. * @see #setAnyProperty *************** *** 1089,1092 **** --- 1138,1263 ---- /** + * @see ConnectionPoolDefinitionIF#getInjectableConnectionInterface() + */ + public Class getInjectableConnectionInterface() { + return injectableConnectionInterface; + } + + /** + * @see ConnectionPoolDefinitionIF#getInjectableConnectionInterface() + */ + public String getInjectableConnectionInterfaceName() { + if (getInjectableConnectionInterface() != null) { + return getInjectableConnectionInterface().getName(); + } else { + return null; + } + } + + /** + * @param injectableConnectionInterfaceName the fully qualified class name + * @see ConnectionPoolDefinitionIF#getInjectableConnectionInterface() + */ + public void setInjectableConnectionInterfaceName(String injectableConnectionInterfaceName) { + this.injectableConnectionInterface = getInterface(injectableConnectionInterfaceName); + } + + /** + * @see ConnectionPoolDefinitionIF#getInjectableStatementInterface() + */ + public Class getInjectableStatementInterface() { + return injectableStatementInterface; + } + + /** + * @see ConnectionPoolDefinitionIF#getInjectableStatementInterface() + */ + public String getInjectableStatementInterfaceName() { + if (getInjectableStatementInterface() != null) { + return getInjectableStatementInterface().getName(); + } else { + return null; + } + } + + /** + * @param injectableStatementInterfaceName the fully qualified class name + * @see ConnectionPoolDefinitionIF#getInjectableStatementInterface() + */ + public void setInjectableStatementInterfaceName(String injectableStatementInterfaceName) { + this.injectableStatementInterface = getInterface(injectableStatementInterfaceName); + } + + /** + * @see ConnectionPoolDefinitionIF#getInjectablePreparedStatementInterface() + */ + public Class getInjectablePreparedStatementInterface() { + return injectablePreparedStatementInterface; + } + + /** + * @see ConnectionPoolDefinitionIF#getInjectablePreparedStatementInterface() + */ + public String getInjectablePreparedStatementInterfaceName() { + if (getInjectablePreparedStatementInterface() != null) { + return getInjectablePreparedStatementInterface().getName(); + } else { + return null; + } + } + + /** + * @param injectablePreparedStatementInterfaceName the fully qualified class name + * @see ConnectionPoolDefinitionIF#getInjectablePreparedStatementInterface() + */ + public void setInjectablePreparedStatementInterfaceName(String injectablePreparedStatementInterfaceName) { + this.injectablePreparedStatementInterface = getInterface(injectablePreparedStatementInterfaceName); + } + + /** + * @see ConnectionPoolDefinitionIF#getInjectableCallableStatementInterface() + */ + public String getInjectableCallableStatememtInterfaceName() { + if (getInjectableCallableStatementInterface() != null) { + return getInjectableCallableStatementInterface().getName(); + } else { + return null; + } + } + + /** + * @see ConnectionPoolDefinitionIF#getInjectableCallableStatementInterface() + */ + public Class getInjectableCallableStatementInterface() { + return injectableCallableStatementInterface; + } + + /** + * @param injectableCallableStatementInterfaceName the fully qualified class name + * @see ConnectionPoolDefinitionIF#getInjectableCallableStatementInterface() + */ + public void setInjectableCallableStatementInterfaceName(String injectableCallableStatementInterfaceName) { + this.injectableCallableStatementInterface = getInterface(injectableCallableStatementInterfaceName); + } + + private Class getInterface(String className) { + try { + Class clazz = null; + if (className != null && className.length() > 0) { + clazz = Class.forName(className); + if (!clazz.isInterface()) { + throw new IllegalArgumentException(className + " is a class. It must be an interface."); + } + if (!Modifier.isPublic(clazz.getModifiers())) { + throw new IllegalArgumentException(className + " is a protected interface. It must be public."); + } + } + return clazz; + } catch (ClassNotFoundException e) { + throw new IllegalArgumentException(className + " couldn't be found"); + } + } + + /** * Returns true if {@link #redefine redefining} the pool using * these parameters would not change the definition. You can *************** *** 1127,1130 **** --- 1298,1304 ---- Revision history: $Log$ + Revision 1.32 2004/06/02 20:19:14 billhorsman + Added injectable interface properties + Revision 1.31 2004/03/18 17:08:14 chr32 Added jmx* properties. Index: ConnectionPoolDefinitionIF.java =================================================================== RCS file: /cvsroot/proxool/proxool/src/java/org/logicalcobwebs/proxool/ConnectionPoolDefinitionIF.java,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** ConnectionPoolDefinitionIF.java 18 Mar 2004 17:08:14 -0000 1.21 --- ConnectionPoolDefinitionIF.java 2 Jun 2004 20:19:14 -0000 1.22 *************** *** 303,306 **** --- 303,347 ---- */ String getJmxAgentId(); + + /** + * The class name of an interface that should be injected everytime we make a Connection. + * Use this when you want to access methods on a concrete class in the vendor's Connection + * object that aren't declared in a public interface. Without this, the connection that + * gets served will only give you access to public interfaces (like Connection and any + * other vendor provided ones) + * @return the interface + */ + Class getInjectableConnectionInterface(); + + /** + * The class name of an interface that should be injected everytime we make a Statement. + * Use this when you want to access methods on a concrete class in the vendor's Statement + * object that aren't declared in a public interface. Without this, the statement that + * is provided will only give you access to public interfaces (like Statement and any + * other vendor provided ones) + * @return the interface + */ + Class getInjectableStatementInterface(); + + /** + * The class name of an interface that should be injected everytime we make a PreparedStatement. + * Use this when you want to access methods on a concrete class in the vendor's PreparedStatement + * object that aren't declared in a public interface. Without this, the PreparedStatement that + * is provided will only give you access to public interfaces (like PreparedStatement and any + * other vendor provided ones) + * @return the interface + */ + Class getInjectablePreparedStatementInterface(); + + /** + * The class name of an interface that should be injected everytime we make a CallableStatement. + * Use this when you want to access methods on a concrete class in the vendor's CallableStatement + * object that aren't declared in a public interface. Without this, the CallableStatement that + * is provided will only give you access to public interfaces (like CallableStatement and any + * other vendor provided ones) + * @return the interface + */ + Class getInjectableCallableStatementInterface(); + } *************** *** 308,311 **** --- 349,355 ---- Revision history: $Log$ + Revision 1.22 2004/06/02 20:19:14 billhorsman + Added injectable interface properties + Revision 1.21 2004/03/18 17:08:14 chr32 Added jmx* properties. |