Package org.apache.cayenne.conn

Examples of org.apache.cayenne.conn.DataSourceInfo


     */
    public DataSourceInfo getConnectionInfo(String name) {

        if (EMBEDDED_DATASOURCE.equals(name)) {
            // Create embedded data source instead
            DataSourceInfo connectionInfo = new DataSourceInfo();
            connectionInfo.setAdapterClassName(EMBEDDED_DATASOURCE_DBADAPTER);
            connectionInfo.setUserName(EMBEDDED_DATASOURCE_USERNAME);
            connectionInfo.setPassword(EMBEDDED_DATASOURCE_PASSWORD);
            connectionInfo.setDataSourceUrl(EMBEDDED_DATASOURCE_URL);
            connectionInfo.setJdbcDriver(EMBEDDED_DATASOURCE_JDBC_DRIVER);
            return connectionInfo;
        }

        synchronized (connectionInfos) {
            return connectionInfos.get(name);
View Full Code Here


    /**
     * Creates a DataSourceInfo object from a set of properties.
     */
    public DataSourceInfo buildDataSourceInfo(ExtendedProperties props) {
        DataSourceInfo dsi = new DataSourceInfo();

        String adapter = props.getString(ADAPTER_KEY);

        // try legacy adapter key
        if (adapter == null) {
            adapter = props.getString(ADAPTER20_KEY);
        }

        dsi.setAdapterClassName(adapter);
        dsi.setUserName(props.getString(USER_NAME_KEY));
        dsi.setPassword(props.getString(PASSWORD_KEY));
        dsi.setDataSourceUrl(props.getString(URL_KEY));
        dsi.setJdbcDriver(props.getString(DRIVER_KEY));

        return dsi;
    }
View Full Code Here

        DataNodeDescriptor node = action.buildDataNode(domain);

        assertNotNull(node);
        assertNotNull(node.getName());

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

        assertSame("Project DataNode must not wrap the DataSource", ds1, node
                .getDataSourceDescriptor());
    }
View Full Code Here

                .getProject()
                .getRootNode();

        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"));
            }

            DataChannelDescriptor domain = (DataChannelDescriptor) getProjectController()
                    .getProject()
                    .getRootNode();
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

            throw new NullPointerException("Null configurationSource");
        }

        URL configurationURL = configurationSource.getURL();

        DataSourceInfo dataSourceInfo = new DataSourceInfo();

        InputStream in = null;

        try {
            in = configurationURL.openStream();
View Full Code Here

    public DataSourceInfo get() throws ConfigurationException {

        String connectionKey = System.getProperty(CONNECTION_NAME_KEY);

        DataSourceInfo connectionInfo = ConnectionProperties
                .getInstance()
                .getConnectionInfo(connectionKey);

        // attempt default if invalid key is specified
        if (connectionInfo == null) {
View Full Code Here

        if (configurationResource == null) {
            throw new NullPointerException("Null configurationResource");
        }

        DataSourceInfo dataSourceDescriptor = new DataSourceInfo();

        XMLReader parser = Util.createXmlReader();

        DriverHandler handler = new DriverHandler(dataSourceDescriptor, parser);
        parser.setContentHandler(handler);
View Full Code Here

                String mapName = attributes.getValue("", "name");
                nodeDescriptor.getDataMapNames().add(mapName);
            }
            else if (localName.equals(DATA_SOURCE_TAG)) {

                DataSourceInfo dataSourceDescriptor = new DataSourceInfo();
                nodeDescriptor.setDataSourceDescriptor(dataSourceDescriptor);
                return new DataSourceChildrenHandler(parser, this, dataSourceDescriptor);
            }

            return super.createChildTagHandler(namespaceURI, localName, name, attributes);
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.