Package org.apache.ojb.broker.metadata

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


            // 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


        if (jcd == null)
        {
            // JCD not found, initialize
            jcd = new JdbcConnectionDescriptor();
            jcd.setJcdAlias(JCD_ALIAS);
            ConnectionPoolDescriptor cpd = new ConnectionPoolDescriptor();
            cpd.setConnectionFactory(ConnectionFactoryManagedImpl.class);
            jcd.setConnectionPoolDescriptor(cpd);
            ConnectionRepository cr = MetadataManager.getInstance().connectionRepository();
            cr.addDescriptor(jcd);
        }
        // Instatiating application
View Full Code Here

    public ConnectionManagerImpl(PersistenceBroker broker)
    {
        this.broker = broker;
        this.pbKey = broker.getPBKey();
        this.jcd = MetadataManager.getInstance().connectionRepository().getDescriptor(pbKey);       
        ConnectionPoolDescriptor cpd = jcd.getConnectionPoolDescriptor();       
        if (cpd != null && cpd.getConnectionFactory() != null)
        {
            connectionFactory = (ConnectionFactory)connectionFactories.get(cpd.getConnectionFactory());
            if ( connectionFactory == null )
            {
                try
                {
                    if (Boolean.valueOf(this.jcd.getAttribute("org.apache.jetspeed.engineScoped", "false")).booleanValue()) {
                        ClassLoader cl = Thread.currentThread().getContextClassLoader();               
                        try
                        {
                            Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
                            connectionFactory = (ConnectionFactory)
                                ClassHelper.newInstance (cpd.getConnectionFactory(), true);
                            connectionFactories.put(cpd.getConnectionFactory(), connectionFactory);
                        }
                        finally
                        {
                            Thread.currentThread().setContextClassLoader(cl);
                            connectionFactories.put(cpd.getConnectionFactory(), connectionFactory);
                        }
                    }
                    else
                    {
                        connectionFactory = (ConnectionFactory)
                        ClassHelper.newInstance (cpd.getConnectionFactory(), true);
                    }
                }
                catch (InstantiationException e)
                {
                    String err = "Can't instantiate class " + cpd.getConnectionFactory();
                    log.error(err, e);
                    throw (IllegalStateException)(new IllegalStateException(err)).initCause(e);
                }
                catch (IllegalAccessException e)
                {
                    String err = "Can't instantiate class " + cpd.getConnectionFactory();
                    log.error(err, e);
                    throw (IllegalStateException)(new IllegalStateException(err)).initCause(e);
                }
            }
        }
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

        if (jcd == null)
        {
            // JCD not found, initialize
            jcd = new JdbcConnectionDescriptor();
            jcd.setJcdAlias(JCD_ALIAS);
            ConnectionPoolDescriptor cpd = new ConnectionPoolDescriptor();
            cpd.setConnectionFactory(ConnectionFactoryManagedImpl.class);
            jcd.setConnectionPoolDescriptor(cpd);
            ConnectionRepository cr = MetadataManager.getInstance().connectionRepository();
            cr.addDescriptor(jcd);
        }
        // Instatiating application
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

    public ConnectionManagerImpl(PersistenceBroker broker)
    {
        this.broker = broker;
        this.pbKey = broker.getPBKey();
        this.jcd = MetadataManager.getInstance().connectionRepository().getDescriptor(pbKey);       
        ConnectionPoolDescriptor cpd = jcd.getConnectionPoolDescriptor();       
        if (cpd != null && cpd.getConnectionFactory() != null)
        {
            connectionFactory = (ConnectionFactory)connectionFactories.get(cpd.getConnectionFactory());
            if ( connectionFactory == null )
            {
                try
                {
                    if (Boolean.valueOf(this.jcd.getAttribute("org.apache.jetspeed.engineScoped", "false")).booleanValue()) {
                        ClassLoader cl = Thread.currentThread().getContextClassLoader();               
                        try
                        {
                            Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
                            connectionFactory = (ConnectionFactory)
                                ClassHelper.newInstance (cpd.getConnectionFactory(), true);
                            connectionFactories.put(cpd.getConnectionFactory(), connectionFactory);
                        }
                        finally
                        {
                            Thread.currentThread().setContextClassLoader(cl);
                            connectionFactories.put(cpd.getConnectionFactory(), connectionFactory);
                        }
                    }
                    else
                    {
                        connectionFactory = (ConnectionFactory)
                        ClassHelper.newInstance (cpd.getConnectionFactory(), true);
                    }
                }
                catch (InstantiationException e)
                {
                    String err = "Can't instantiate class " + cpd.getConnectionFactory();
                    log.error(err, e);
                    throw (IllegalStateException)(new IllegalStateException(err)).initCause(e);
                }
                catch (IllegalAccessException e)
                {
                    String err = "Can't instantiate class " + cpd.getConnectionFactory();
                    log.error(err, e);
                    throw (IllegalStateException)(new IllegalStateException(err)).initCause(e);
                }
            }
        }
View Full Code Here

        /*
        mkalen: Note from the Oracle documentation:
            Do not mix the JDBC 2.0 fetch size API and the Oracle row prefetching API
            in your application. You can use one or the other, but not both.
        */
        final ConnectionPoolDescriptor cpd = jcd.getConnectionPoolDescriptor();
        final int cpdFetchSizeHint = cpd.getFetchSize();
        if (cpdFetchSizeHint == 0 && ORA_ROW_PREFETCH_AVAILABLE)
        {
            try
            {
                final String prefetchFromJcd;
                prefetchFromJcd = cpd.getJdbcProperties().getProperty("defaultRowPrefetch");
                if (prefetchFromJcd == null)
                {
                    METHOD_SET_ROW_PREFETCH.invoke(oraConn, PARAM_ROW_PREFETCH_SIZE);
                }
                // Else, number of prefetched rows were set via Properties on Connection
View Full Code Here

        this.classDescriptor = classDescriptor;
        clazz = classDescriptor.getClassOfObject();
        platform = PlatformFactory.getPlatformFor(jcd);
        sqlGenerator = SqlGeneratorFactory.getInstance().createSqlGenerator(platform);

        final ConnectionPoolDescriptor cpd = jcd.getConnectionPoolDescriptor();
        fetchSize = cpd.getFetchSize();

        // detect JDBC level
        double level = jcd.getJdbcLevel();
        FORCEJDBC1_0 = level == 1.0;
    }
View Full Code Here

    public ConnectionManagerImpl(PersistenceBroker broker)
    {
        this.broker = broker;
        this.pbKey = broker.getPBKey();
        this.jcd = MetadataManager.getInstance().connectionRepository().getDescriptor(pbKey);       
        ConnectionPoolDescriptor cpd = jcd.getConnectionPoolDescriptor();       
        if (cpd != null && cpd.getConnectionFactory() != null)
        {
            connectionFactory = (ConnectionFactory)connectionFactories.get(cpd.getConnectionFactory());
            if ( connectionFactory == null )
            {
                try
                {
                    if (Boolean.valueOf(this.jcd.getAttribute("org.apache.jetspeed.engineScoped", "false")).booleanValue()) {
                        ClassLoader cl = Thread.currentThread().getContextClassLoader();               
                        try
                        {
                            Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
                            connectionFactory = (ConnectionFactory)
                                ClassHelper.newInstance (cpd.getConnectionFactory(), true);
                            connectionFactories.put(cpd.getConnectionFactory(), connectionFactory);
                        }
                        finally
                        {
                            Thread.currentThread().setContextClassLoader(cl);
                            connectionFactories.put(cpd.getConnectionFactory(), connectionFactory);
                        }
                    }
                    else
                    {
                        connectionFactory = (ConnectionFactory)
                        ClassHelper.newInstance (cpd.getConnectionFactory(), true);
                    }
                }
                catch (InstantiationException e)
                {
                    String err = "Can't instantiate class " + cpd.getConnectionFactory();
                    log.error(err, e);
                    throw (IllegalStateException)(new IllegalStateException(err)).initCause(e);
                }
                catch (IllegalAccessException e)
                {
                    String err = "Can't instantiate class " + cpd.getConnectionFactory();
                    log.error(err, e);
                    throw (IllegalStateException)(new IllegalStateException(err)).initCause(e);
                }
            }
        }
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.