Package org.apache.ojb.broker.metadata

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


        if (platform != null && platform.length() == 0)
        {
            platform = null;
        }
        DataSource ds = null;
        JdbcMetadataUtils jdbcMetadataUtils = new JdbcMetadataUtils ();
        if (jndiName != null)
        {
            // using "preconfigured" data source
            if (connectionFactoryClass == null)
            {
                connectionFactoryClass = ConnectionFactoryManagedImpl.class.getName ();
            }
            Context initialContext = new InitialContext();
            ds = (DataSource) initialContext.lookup(jndiName);
            jcd.setDatasourceName(jndiName);
        }
        else
        {
            // have to get data source ourselves
            if (connectionFactoryClass == null)
            {
                connectionFactoryClass = ConnectionFactoryDBCPImpl.class.getName ();
            }
            jcd.setDriver(driverClassName);
            Map conData = jdbcMetadataUtils.parseConnectionUrl(url);
            jcd.setDbms(platform);
            jcd.setProtocol((String)conData.get(JdbcMetadataUtils.PROPERTY_PROTOCOL));
            jcd.setSubProtocol((String)conData.get(JdbcMetadataUtils.PROPERTY_SUBPROTOCOL));
            jcd.setDbAlias((String)conData.get(JdbcMetadataUtils.PROPERTY_DBALIAS));
            jcd.setUserName(username);
            jcd.setPassWord(password);
            // Wrapping the connection factory in a DataSource introduces a bit
            // of redundancy (url is parsed again and platform determined again).
            // 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);
            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.
            updateOraclePlatform (jcd, ds);
        }
View Full Code Here


        JdbcConnectionDescriptor jcd = findJcd();
        try
        {
            Context initialContext = new InitialContext();
            DataSource ds = (DataSource) initialContext.lookup(jndiName);
            (new JdbcMetadataUtils()).fillJCDFromDataSource(jcd, ds, null, null);
        }
        catch (NamingException e)
        {
            throw (IllegalArgumentException) (new IllegalArgumentException("Data source \"" + jndiName
                    + "\" not found in JNDI: " + e.getMessage())).initCause(e);
View Full Code Here

        if (platform != null && platform.length() == 0)
        {
            platform = null;
        }
        DataSource ds = null;
        JdbcMetadataUtils jdbcMetadataUtils = new JdbcMetadataUtils ();
        if (jndiName != null)
        {
            // using "preconfigured" data source
            if (connectionFactoryClass == null)
            {
                connectionFactoryClass = ConnectionFactoryManagedImpl.class.getName ();
            }
            Context initialContext = new InitialContext();
            ds = (DataSource) initialContext.lookup(jndiName);
            jcd.setDatasourceName(jndiName);
        }
        else
        {
            // have to get data source ourselves
            if (connectionFactoryClass == null)
            {
                connectionFactoryClass = ConnectionFactoryDBCPImpl.class.getName ();
            }
            jcd.setDriver(driverClassName);
            Map conData = jdbcMetadataUtils.parseConnectionUrl(url);
            jcd.setDbms(platform);
            jcd.setProtocol((String)conData.get(JdbcMetadataUtils.PROPERTY_PROTOCOL));
            jcd.setSubProtocol((String)conData.get(JdbcMetadataUtils.PROPERTY_SUBPROTOCOL));
            jcd.setDbAlias((String)conData.get(JdbcMetadataUtils.PROPERTY_DBALIAS));
            jcd.setUserName(username);
            jcd.setPassWord(password);
            // Wrapping the connection factory in a DataSource introduces a bit
            // of redundancy (url is parsed again and platform determined again).
            // 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);
            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.
            updateOraclePlatform (jcd, ds);
        }
View Full Code Here

            jcd = new JdbcConnectionDescriptor();
            jcd.setJcdAlias(jcdAlias);
            cr.addDescriptor(jcd);
        }
       
        JdbcMetadataUtils jdbcMetadataUtils = new JdbcMetadataUtils ();
        jdbcMetadataUtils.fillJCDFromDataSource(jcd, ds, null, null);
        String platform = jcd.getDbms();
        if (JdbcMetadataUtils.PLATFORM_ORACLE.equals(platform))
        {
            // Postprocess to find Oracle version.
                platform = updateOraclePlatform (jcd, ds, platform);
View Full Code Here

        JdbcConnectionDescriptor jcd = findJcd();
        try
        {
            Context initialContext = new InitialContext();
            DataSource ds = (DataSource) initialContext.lookup(jndiName);
            (new JdbcMetadataUtils()).fillJCDFromDataSource(jcd, ds, null, null);
        }
        catch (NamingException e)
        {
            throw (IllegalArgumentException) (new IllegalArgumentException("Data source \"" + jndiName
                    + "\" not found in JNDI: " + e.getMessage())).initCause(e);
View Full Code Here

        if (platform != null && platform.length() == 0)
        {
            platform = null;
        }
        DataSource ds = null;
        JdbcMetadataUtils jdbcMetadataUtils = new JdbcMetadataUtils ();
        if (jndiName != null)
        {
            // using "preconfigured" data source
            if (connectionFactoryClass == null)
            {
                connectionFactoryClass = ConnectionFactoryManagedImpl.class.getName ();
            }
            Context initialContext = new InitialContext();
            ds = (DataSource) initialContext.lookup(jndiName);
            externalDs = ds;
      jcd.setDatasourceName(jndiName);
        }
        else
        {
            // have to get data source ourselves
            if (connectionFactoryClass == null)
            {
                connectionFactoryClass = ConnectionFactoryDBCPImpl.class.getName ();
            }
            jcd.setDriver(driverClassName);
            Map conData = jdbcMetadataUtils.parseConnectionUrl(url);
            jcd.setDbms(platform);
            jcd.setProtocol((String)conData.get(JdbcMetadataUtils.PROPERTY_PROTOCOL));
            jcd.setSubProtocol((String)conData.get(JdbcMetadataUtils.PROPERTY_SUBPROTOCOL));
            jcd.setDbAlias((String)conData.get(JdbcMetadataUtils.PROPERTY_DBALIAS));
            jcd.setUserName(username);
            jcd.setPassWord(password);
            // Wrapping the connection factory in a DataSource introduces a bit
            // of redundancy (url is parsed again and platform determined again).
            // 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);
            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.
            updateOraclePlatform (jcd, ds);
        }
View Full Code Here

            jcd = new JdbcConnectionDescriptor();
            jcd.setJcdAlias(jcdAlias);
            cr.addDescriptor(jcd);
        }
       
        JdbcMetadataUtils jdbcMetadataUtils = new JdbcMetadataUtils ();
        jdbcMetadataUtils.fillJCDFromDataSource(jcd, ds, null, null);
        String platform = jcd.getDbms();
        if (JdbcMetadataUtils.PLATFORM_ORACLE.equals(platform))
        {
            // Postprocess to find Oracle version.
                platform = updateOraclePlatform (jcd, ds, platform);
View Full Code Here

        }
        if (platform != null && platform.length() == 0) {
            platform = null;
        }
        DataSource ds = null;
        JdbcMetadataUtils jdbcMetadataUtils = new JdbcMetadataUtils ();
        if (jndiName != null) {
            // using "preconfigured" data source
            if (connectionFactoryClass == null) {
                connectionFactoryClass = ConnectionFactoryManagedImpl.class.getName ();
            }
            Context initialContext = new InitialContext();
            ds = (DataSource) initialContext.lookup(jndiName);
            jcd.setDatasourceName(jndiName);
        } else {
            // have to get data source ourselves
            if (connectionFactoryClass == null) {
                connectionFactoryClass = ConnectionFactoryDBCPImpl.class.getName ();
            }
            jcd.setDriver(driverClassName);
            HashMap conData = jdbcMetadataUtils.parseConnectionUrl(url);
            jcd.setDbms(platform);
            jcd.setProtocol((String)conData.get(JdbcMetadataUtils.PROPERTY_PROTOCOL));
            jcd.setSubProtocol((String)conData.get(JdbcMetadataUtils.PROPERTY_SUBPROTOCOL));
            jcd.setDbAlias((String)conData.get(JdbcMetadataUtils.PROPERTY_DBALIAS));
            jcd.setUserName(username);
            jcd.setPassWord(password);
            // Wrapping the connection factory in a DataSource introduces a bit
            // of redundancy (url is parsed again and platform determined again).
            // 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.
            updateOraclePlatform (jcd, ds);
        }
View Full Code Here

        if (platform != null && platform.length() == 0)
        {
            platform = null;
        }
        DataSource ds = null;
        JdbcMetadataUtils jdbcMetadataUtils = new JdbcMetadataUtils ();
        if (jndiName != null)
        {
            // using "preconfigured" data source
            if (connectionFactoryClass == null)
            {
                connectionFactoryClass = ConnectionFactoryManagedImpl.class.getName ();
            }
            Context initialContext = new InitialContext();
            ds = (DataSource) initialContext.lookup(jndiName);
            externalDs = ds;
      jcd.setDatasourceName(jndiName);
        }
        else
        {
            // have to get data source ourselves
            if (connectionFactoryClass == null)
            {
                connectionFactoryClass = ConnectionFactoryDBCPImpl.class.getName ();
            }
            jcd.setDriver(driverClassName);
            Map conData = jdbcMetadataUtils.parseConnectionUrl(url);
            jcd.setDbms(platform);
            jcd.setProtocol((String)conData.get(JdbcMetadataUtils.PROPERTY_PROTOCOL));
            jcd.setSubProtocol((String)conData.get(JdbcMetadataUtils.PROPERTY_SUBPROTOCOL));
            jcd.setDbAlias((String)conData.get(JdbcMetadataUtils.PROPERTY_DBALIAS));
            jcd.setUserName(username);
            jcd.setPassWord(password);
            // Wrapping the connection factory in a DataSource introduces a bit
            // of redundancy (url is parsed again and platform determined again).
            // 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);
            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.
            updateOraclePlatform (jcd, ds);
        }
View Full Code Here

            jcd = new JdbcConnectionDescriptor();
            jcd.setJcdAlias(jcdAlias);
            cr.addDescriptor(jcd);
        }
       
        JdbcMetadataUtils jdbcMetadataUtils = new JdbcMetadataUtils ();
        jdbcMetadataUtils.fillJCDFromDataSource(jcd, ds, null, null);
        String platform = jcd.getDbms();
        if (JdbcMetadataUtils.PLATFORM_ORACLE.equals(platform))
        {
            // Postprocess to find Oracle version.
                platform = updateOraclePlatform (jcd, ds, platform);
View Full Code Here

TOP

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

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.