Package org.apache.ojb.broker.metadata

Examples of org.apache.ojb.broker.metadata.ConnectionPoolDescriptor


            // But although JdbcMetadataUtils exposes the methods used in
            // fillJCDFromDataSource as public (and these do not require a DataSource)
            // the method itself does more than is made available by the exposed methods.
            ds = new MinimalDataSource (jcd);
        }
        ConnectionPoolDescriptor cpd = jcd.getConnectionPoolDescriptor();
        if (cpd == null)
        {
            cpd = new ConnectionPoolDescriptor();
            jcd.setConnectionPoolDescriptor(cpd);
        }
        Class conFacCls = ClassHelper.getClass(connectionFactoryClass);
        cpd.setConnectionFactory(conFacCls);

        jdbcMetadataUtils.fillJCDFromDataSource(jcd, ds, null, null);
       
        if (platform == null && JdbcMetadataUtils.PLATFORM_ORACLE.equals(jcd.getDbms())) {
            // Postprocess to find Oracle version.
View Full Code Here


            // fillJCDFromDataSource as public (and these do not require a DataSource)
            // the method itself does more than is made available by the exposed methods.
            // ds = new MinimalDataSource (jcd);
            ds = this;            
        }
        ConnectionPoolDescriptor cpd = jcd.getConnectionPoolDescriptor();
        if (cpd == null)
        {
            cpd = new ConnectionPoolDescriptor();
            jcd.setConnectionPoolDescriptor(cpd);
        }
        Class conFacCls = ClassHelper.getClass(connectionFactoryClass);
        cpd.setConnectionFactory(conFacCls);

        jdbcMetadataUtils.fillJCDFromDataSource(jcd, ds, null, null);
       
        if (platform == null && JdbcMetadataUtils.PLATFORM_ORACLE.equals(jcd.getDbms())) {
            // Postprocess to find Oracle version.
View Full Code Here

     * @return
     */
    private static ConnectionFactory setupConnectionFactory(JdbcConnectionDescriptor jcd)
    {
        ConnectionFactory cf = null;
        ConnectionPoolDescriptor cpd = jcd.getConnectionPoolDescriptor();       
        if (cpd != null && cpd.getConnectionFactory() != null)
        {
            cf = (ConnectionFactory)connectionFactories.get(cpd.getConnectionFactory());
            if ( cf == null )
            {
                try
                {
                    if (Boolean.valueOf(jcd.getAttribute("org.apache.jetspeed.engineScoped", "false")).booleanValue()) {
                        ClassLoader cl = Thread.currentThread().getContextClassLoader();               
                        try
                        {
                            Thread.currentThread().setContextClassLoader(ConnectionManagerImpl.class.getClassLoader());
                            cf = (ConnectionFactory) ClassHelper.newInstance(cpd.getConnectionFactory(), true);
                            connectionFactories.put(cpd.getConnectionFactory(), cf);
                        }
                        finally
                        {
                            Thread.currentThread().setContextClassLoader(cl);
                            cf = (ConnectionFactory) ClassHelper.newInstance(cpd.getConnectionFactory(), true);
                            connectionFactories.put(cpd.getConnectionFactory(), cf);
                        }
                    }
                    else
                    {
                        cf = (ConnectionFactory) ClassHelper.newInstance(cpd.getConnectionFactory(), true);
                    }
                }
                catch (InstantiationException e)
                {
                    String err = "Can't instantiate class " + cpd.getConnectionFactory();
                    throw (IllegalStateException)(new IllegalStateException(err)).initCause(e);
                }
                catch (IllegalAccessException e)
                {
                    String err = "Can't instantiate class " + cpd.getConnectionFactory();
                    throw (IllegalStateException)(new IllegalStateException(err)).initCause(e);
                }
            }
        }
        else
View Full Code Here

TOP

Related Classes of org.apache.ojb.broker.metadata.ConnectionPoolDescriptor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.