db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mka...@apache.org
Subject cvs commit: db-ojb/src/java/org/apache/ojb/broker/platforms PlatformOracle9iImpl.java
Date Thu, 17 Mar 2005 23:57:01 GMT
mkalen      2005/03/17 15:57:01

  Modified:    src/java/org/apache/ojb/broker/platforms
                        PlatformOracle9iImpl.java
  Log:
  Merge with OJB_1_0_RELEASE branch: After user-report from Don Lyon: add JBoss wrapper class
as known "no-no" for tweaking Oracle-extensions.
  
  Revision  Changes    Path
  1.20      +28 -3     db-ojb/src/java/org/apache/ojb/broker/platforms/PlatformOracle9iImpl.java
  
  Index: PlatformOracle9iImpl.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/platforms/PlatformOracle9iImpl.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- PlatformOracle9iImpl.java	17 Mar 2005 09:57:06 -0000	1.19
  +++ PlatformOracle9iImpl.java	17 Mar 2005 23:57:00 -0000	1.20
  @@ -98,6 +98,10 @@
       protected static final Object[] PARAM_STATEMENT_BATCH_SIZE = new Object[]{new Integer(STATEMENTS_PER_BATCH)};
       protected static final Object[] PARAM_BOOLEAN_TRUE = new Object[]{Boolean.TRUE};
   
  +    protected static final String JBOSS_CONN_NAME =
  +            "org.jboss.resource.adapter.jdbc.WrappedConnection";
  +    protected static Class JBOSS_CONN_CLASS = null;
  +
       protected static Class ORA_CONN_CLASS;
       protected static Class ORA_PS_CLASS;
       protected static Class ORA_CLOB_CLASS;
  @@ -184,6 +188,18 @@
           // Do all the generic initialization in PlatformDefaultImpl first
           super.initializeJdbcConnection(jcd, conn);
   
  +        // Check for managed environments known to reject Oracle extension at this level
  +        // (saves us from trying to unwrap just to catch exceptions next)
  +        final Class connClass = conn.getClass();
  +        if (JBOSS_CONN_CLASS != null && JBOSS_CONN_CLASS.isAssignableFrom(connClass))
  +        {
  +            if (logger.isDebugEnabled())
  +            {
  +                logger.debug("JBoss detected, Oracle Connection tuning left to J2EE container.");
  +            }
  +            return;
  +        }
  +
           // Check if this is a wrapped connection and if so unwrap it
           final Connection oraConn = unwrapConnection(conn);
           if (oraConn == null)
  @@ -207,7 +223,7 @@
                   {
                       logger.debug("PlatformOracle9iImpl could not enable Oracle statement
caching."
                                    + " Original/unwrapped connection classes="
  -                                 + conn.getClass().getName() + "/" + oraConn.getClass().getName());
  +                                 + connClass.getName() + "/" + oraConn.getClass().getName());
                   }
               }
           }
  @@ -225,7 +241,7 @@
                   {
                       logger.debug("PlatformOracle9iImpl could not enable Oracle row pre-fetching."
                                    + "Original/unwrapped connection classes="
  -                                 + conn.getClass().getName() + "/" + oraConn.getClass().getName());
  +                                 + connClass.getName() + "/" + oraConn.getClass().getName());
                   }
               }
           }
  @@ -563,6 +579,15 @@
           {
               // ignore (we tried...)
           }
  +        // Isolated checks for other connection classes (OK when not found)
  +        try
  +        {
  +            JBOSS_CONN_CLASS = ClassHelper.getClass(JBOSS_CONN_NAME, false);
  +        }
  +        catch (ClassNotFoundException e)
  +        {
  +            // ignore (no problem)
  +        }
       }
   
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message