Package org.apache.cayenne.access

Examples of org.apache.cayenne.access.DataNode


     * @see org.apache.cayenne.project.ProjectFile#canHandle(Object)
     */
    @Override
    public boolean canHandle(Object obj) {
        if (obj instanceof DataNode) {
            DataNode node = (DataNode) obj;

            // only driver datasource factory requires a file
            if (DriverDataSourceFactory
                .class
                .getName()
                .equals(node.getDataSourceFactory())) {
                return true;
            }
        }

        return false;
View Full Code Here


        super();
    }

    @Override
    public void validateObject(ProjectPath path, Validator validator) {
        DataNode node = (DataNode) path.getObject();
        validateName(node, path, validator);
        validateConnection(node, path, validator);
    }
View Full Code Here

        return obj instanceof DataMap;
    }

    protected boolean requiresNodeFile(Object obj) {
        if (obj instanceof DataNode) {
            DataNode node = (DataNode) obj;

            // only driver datasource factory requires a file
            if (DriverDataSourceFactory.class.getName().equals(
                    node.getDataSourceFactory())) {
                return true;
            }
        }

        return false;
View Full Code Here

        return domain;
    }

    protected DataNode findNode(String domainName, String nodeName) {
        DataDomain domain = findDomain(domainName);
        DataNode node = domain.getNode(nodeName);
        if (node == null) {
            throw new IllegalArgumentException("Can't find DataNode: "
                    + domainName
                    + "."
                    + nodeName);
View Full Code Here

            return "UntitledDataNode";
        }

        @Override
        protected Object create(String name, Object namingContext) {
            return new DataNode(name);
        }
View Full Code Here

        return map;
    }

    protected DataNode findNode(String domainName, String nodeName) throws FindException {
        DataDomain domain = findDomain(domainName);
        DataNode node = domain.getNode(nodeName);
        if (node == null) {
            throw new FindException("Can't find DataNode: " + nodeName);
        }

        return node;
View Full Code Here

     * node class.
     *
     * @since 1.
     */
    protected DataNode createDataNode(String nodeName) {
        return new DataNode(nodeName);
    }
View Full Code Here

                        + nodeName
                        + "' without 'factory'.");
            }
        }

        DataNode node = createDataNode(nodeName);

        node.setDataSourceFactory(factory);
        node.setDataSourceLocation(dataSource);

        // load DataSource
        try {
            // use DomainHelper factory if it exists, if not - use factory specified
            // in configuration data
            DataSourceFactory confFactory = config.getDataSourceFactory();
            DataSourceFactory localFactory = (confFactory != null)
                    ? confFactory
                    : (DataSourceFactory) Class.forName(factory).newInstance();

            logger.info("using factory: " + localFactory.getClass().getName());

            localFactory.initializeWithParentConfiguration(config);
            DataSource ds = localFactory.getDataSource(dataSource);
            if (ds != null) {
                logger.info("loaded datasource.");
                node.setDataSource(ds);
            }
            else {
                logger.info("Warning: null datasource.");
                getStatus().getFailedDataSources().put(nodeName, dataSource);
            }
View Full Code Here

                        + jta
                        + " DataSource returned from PersistenceUnitInfo");
            }

            DbAdapter adapter = createCustomAdapter(loader.getContext(), unit);
            DataNode node = new DataNode(name);
            if (adapter == null) {
                adapter = new AutoAdapter(new NodeDataSource(node));
            }

            node.setAdapter(adapter);
            node.setDataSource(dataSource);
            node.addDataMap(cayenneMap);

            domain.addNode(node);

            // note that for now we do not apply object layer defaults, as that would
            // require extra enhancement for runtime relationships...
View Full Code Here

            // set back to original ClassLoader
            Thread.currentThread().setContextClassLoader(threadContextClassLoader);
        }

        // perform project validation
        DataNode source = findNode(configuration, srcNode);
        if (source == null) {
            throw new BuildException("srcNode not found in the project: " + srcNode);
        }

        DataNode destination = findNode(configuration, destNode);
        if (destination == null) {
            throw new BuildException("destNode not found in the project: " + destNode);
        }

        log("Porting from '" + srcNode + "' to '" + destNode + "'.");
View Full Code Here

TOP

Related Classes of org.apache.cayenne.access.DataNode

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.