Package org.apache.cayenne.conn

Examples of org.apache.cayenne.conn.DataSourceInfo


            logger.debug("Importer options - namingStrategy: " + parameters.getNamingStrategy());
            logger.debug("Importer options - includeTables: " + parameters.getIncludeTables());
            logger.debug("Importer options - excludeTables: " + parameters.getExcludeTables());
        }

        DataSourceInfo dataSourceInfo = new DataSourceInfo();
        dataSourceInfo.setDataSourceUrl(parameters.getUrl());
        dataSourceInfo.setJdbcDriver(parameters.getDriver());
        dataSourceInfo.setUserName(parameters.getUsername());
        dataSourceInfo.setPassword(parameters.getPassword());

        DataNodeDescriptor nodeDescriptor = new DataNodeDescriptor();
        nodeDescriptor.setAdapterType(parameters.getAdapter());
        nodeDescriptor.setDataSourceDescriptor(dataSourceInfo);
View Full Code Here


    @Inject
    protected JdbcEventLogger jdbcEventLogger;

    public DataSource getDataSource(DataNodeDescriptor nodeDescriptor) throws Exception {

        DataSourceInfo dataSourceDescriptor = nodeDescriptor.getDataSourceDescriptor();

        if (dataSourceDescriptor == null) {
            String message = "Null dataSourceDescriptor for nodeDescriptor '" + nodeDescriptor.getName() + "'";
            logger.info(message);
            throw new ConfigurationException(message);
        }

        try {
            return new PoolManager(dataSourceDescriptor.getJdbcDriver(), dataSourceDescriptor.getDataSourceUrl(),
                    dataSourceDescriptor.getMinConnections(), dataSourceDescriptor.getMaxConnections(),
                    dataSourceDescriptor.getUserName(), dataSourceDescriptor.getPassword(), jdbcEventLogger);
        } catch (Exception e) {
            jdbcEventLogger.logConnectFailure(e);
            throw e;
        }
    }
View Full Code Here

        // use domain name as DataNode base, as node names must be unique across the
        // project...
        DataNode node = createDataNode(domain);

        ProjectDataSource src = new ProjectDataSource(new DataSourceInfo());
        node.setDataSource(src);
        node.setAdapter(new ModelerDbAdapter(src));

        // by default create JDBC Node
        node.setDataSourceFactory(DriverDataSourceFactory.class.getName());
View Full Code Here

                    }
                }

                node.setDataSourceFactory(DriverDataSourceFactory.class.getName());

                DataSourceInfo dsi = ((ProjectDataSource) node.getDataSource())
                        .getDataSourceInfo();
               
               
               
                dsi.setDataSourceUrl(keyAsString(connection, "URL"));
                dsi.setJdbcDriver(keyAsString(connection, "driver"));
                dsi.setPassword(keyAsString(connection, "password"));
                dsi.setUserName(keyAsString(connection, "username"));
            }

            // send events after the node creation is complete
            getProjectController().fireDataNodeEvent(
                    new DataNodeEvent(this, node, MapEvent.ADD));
View Full Code Here

    public void testGetDataSourceFactory_Implicit() throws Exception {

        DataNodeDescriptor nodeDescriptor = new DataNodeDescriptor();
        nodeDescriptor.setName("node1");
        nodeDescriptor.setDataSourceDescriptor(new DataSourceInfo());

        Module testModule = new Module() {

            public void configure(Binder binder) {
                binder.bind(AdhocObjectFactory.class).to(DefaultAdhocObjectFactory.class);
View Full Code Here

        // use domain name as DataNode base, as node names must be unique across the
        // project...
        DataNodeDescriptor node = buildDataNode(domain);

        DataSourceInfo src = new DataSourceInfo();
        node.setDataSourceDescriptor(src);

        // by default create JDBC Node
        node.setDataSourceFactoryType(XMLPoolingDataSourceFactory.class.getName());
        node.setSchemaUpdateStrategyType(SkipSchemaUpdateStrategy.class.getName());
View Full Code Here

                node
                        .setDataSourceFactoryType(XMLPoolingDataSourceFactory.class
                                .getName());

                DataSourceInfo dsi = node.getDataSourceDescriptor();

                dsi.setDataSourceUrl(keyAsString(connection, "URL"));
                dsi.setJdbcDriver(keyAsString(connection, "driver"));
                dsi.setPassword(keyAsString(connection, "password"));
                dsi.setUserName(keyAsString(connection, "username"));
            }

            // send events after the node creation is complete
            getProjectController().fireDataNodeEvent(
                    new DataNodeEvent(this, node, MapEvent.ADD));
View Full Code Here

        if (getNode() == null || getNode().getDataSourceDescriptor() == null) {
            return;
        }

        DataSourceInfo projectDSI = getNode().getDataSourceDescriptor();

        ProjectController parent = (ProjectController) getParent();
        String key = parent.getDataNodePreferences().getLocalDataSource();
        if (key == null) {
            mainController.updateStatus("No Local DataSource selected for node...");
View Full Code Here

        props.setProperty(ConnectionProperties.DRIVER_KEY, "2");
        props.setProperty(ConnectionProperties.PASSWORD_KEY, "3");
        props.setProperty(ConnectionProperties.URL_KEY, "4");
        props.setProperty(ConnectionProperties.USER_NAME_KEY, "5");

        DataSourceInfo dsi = ps.buildDataSourceInfo(props);

        assertEquals("1", dsi.getAdapterClassName());
        assertEquals("2", dsi.getJdbcDriver());
        assertEquals("3", dsi.getPassword());
        assertEquals("4", dsi.getDataSourceUrl());
        assertEquals("5", dsi.getUserName());
    }
View Full Code Here

                    }
                }

                node.setDataSourceFactory(DriverDataSourceFactory.class.getName());

                DataSourceInfo dsi = ((ProjectDataSource) node.getDataSource())
                        .getDataSourceInfo();
               
               
               
                dsi.setDataSourceUrl(keyAsString(connection, "URL"));
                dsi.setJdbcDriver(keyAsString(connection, "driver"));
                dsi.setPassword(keyAsString(connection, "password"));
                dsi.setUserName(keyAsString(connection, "username"));
            }

            // send events after the node creation is complete
            getProjectController().fireDataNodeEvent(
                    new DataNodeEvent(this, node, MapEvent.ADD));
View Full Code Here

TOP

Related Classes of org.apache.cayenne.conn.DataSourceInfo

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.