Package org.apache.cayenne.access

Examples of org.apache.cayenne.access.DataNode


                        + 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();

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

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


            throw new ConfigurationException("<map-ref> has no 'name'.");
        }

        logObj.info("loaded map-ref: " + mapName + ".");
        DataMap map = null;
        DataNode node = null;

        try {
            map = findMap(domainName, mapName);
        }
        catch (FindException ex) {
            logObj.info("Error: unknown map: " + mapName);
            getStatus().addFailedMapRefs(mapName, "unknown map: " + mapName);
            return;
        }

        try {
            node = findNode(domainName, nodeName);
        }
        catch (FindException ex) {
            logObj.info("Error: unknown node: " + nodeName);
            getStatus().addFailedMapRefs(mapName, "unknown node: " + nodeName);
            return;
        }

        node.addDataMap(map);
    }
View Full Code Here

        protected String nameBase() {
            return "UntitledDataNode";
        }

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

        if (objEntity == null) {
            throw new CayenneRuntimeException(
                    "No ObjEntity mapping found for DataObject " + getClass().getName());
        }

        DataNode node = getDataContext().getParentDataDomain().lookupDataNode(
                objEntity.getDataMap());
        if (node == null) {
            throw new CayenneRuntimeException("No DataNode found for objEntity: "
                    + objEntity.getName());
        }

        ExtendedTypeMap types = node.getAdapter().getExtendedTypes();

        // validate mandatory attributes

        // handling a special case - meaningful mandatory FK... defer failures until
        // relationship validation is done... This is just a temporary solution, as
View Full Code Here

        for (Iterator it = Configuration
                .getSharedConfiguration()
                .getDomain()
                .getDataNodes()
                .iterator(); it.hasNext();) {
            DataNode dn = (DataNode) it.next();

            EntityResolver er = dn.getEntityResolver();
            object = er.lookupObjEntity(getClass());

            if (null != object) {
                break;
            }
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 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

                        + 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);
            domain.setUsingExternalTransactions(isJTA);

            if ("true".equalsIgnoreCase(unit.getProperties().getProperty(
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

        protected String nameBase() {
            return "UntitledDataNode";
        }

        protected Object create(String name, Object namingContext) {
            return new DataNode(name);
        }
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.