Package helma.objectmodel.db

Examples of helma.objectmodel.db.Node


                // will start with idBaseValue+1
                idgen = new XmlIDGenerator(idBaseValue);
            }

            // check if we need to set the id generator to a base value
            Node node = null;

            try {
                getNode(txn, "0");
            } catch (ObjectNotFoundException notfound) {
                node = new Node("root", "0", "Root", nmgr.safe);
                node.setDbMapping(app.getDbMapping("root"));
                insertNode(txn, node.getID(), node);
                // register node with nodemanager cache
                // nmgr.registerNode(node);
            }

            try {
                getNode(txn, "1");
            } catch (ObjectNotFoundException notfound) {
                node = new Node("users", "1", null, nmgr.safe);
                node.setDbMapping(app.getDbMapping("__userroot__"));
                insertNode(txn, node.getID(), node);
                // register node with nodemanager cache
                // nmgr.registerNode(node);
            }

            commitTransaction(txn);
View Full Code Here


        return prop;
    }

    private TransientProperty makeVirtualNode(String propname, Relation rel) {
        INode node = new Node(rel.getPropName(), rel.getPrototype(),
                                                   dbmap.getWrappedNodeManager());

        node.setDbMapping(rel.getVirtualMapping());
        setNode(propname, node);

        return (TransientProperty) propMap.get(propname);
    }
View Full Code Here

            throw new ObjectNotFoundException("Object not found for key " + kstr);
        }

       try {
            XmlDatabaseReader reader = new XmlDatabaseReader(nmgr);
            Node node = reader.read(f);

            return node;
        } catch (ParserConfigurationException x) {
            app.logError("Error reading " +f, x);
            throw new IOException(x.toString());
View Full Code Here

    /**
     * loop through the children-array and print them as <hop:child>
     */
    private void writeChildren(INode node, int level) throws IOException {
        if (dbmode && node instanceof Node) {
            Node dbNode = (Node) node;
            DbMapping smap = (dbNode.getDbMapping() == null) ? null
                                                             : dbNode.getDbMapping()
                                                                     .getSubnodeMapping();

            if ((smap != null) && smap.isRelational()) {
                return;
            }
View Full Code Here

            throw new RuntimeException("Missing arguments in Xml.read()");
        }

        if (node == null) {
            // make sure we have a node, even if 2nd arg doesn't exist or is not a node
            node = new Node(null, null, core.getApplication().getWrappedNodeManager());
        }

        try {
            XmlReader reader = new XmlReader(core.app.getWrappedNodeManager());
            INode result = reader.read(new File(file), node);
View Full Code Here

            throw new RuntimeException("Missing arguments in Xml.read()");
        }

        if (node == null) {
            // make sure we have a node, even if 2nd arg doesn't exist or is not a node
            node = new Node(null, null, core.getApplication().getWrappedNodeManager());
        }

        try {
            XmlReader reader = new XmlReader(core.app.getWrappedNodeManager());
            INode result = reader.read(new StringReader(str), node);
View Full Code Here

                converter = new XmlConverter(conversionRules);
            } else {
                converter = new XmlConverter();
            }

            INode node = new Node(null, null,
                    core.getApplication().getWrappedNodeManager());
            INode result = converter.convert(url, node);

            return core.getNodeWrapper(result);
        } catch (NoClassDefFoundError e) {
View Full Code Here

                converter = new XmlConverter(conversionRules);
            } else {
                converter = new XmlConverter();
            }

            INode node = new Node(null, null, core.getApplication().getWrappedNodeManager());
            INode result = converter.convertFromString(str, node);

            return core.getNodeWrapper(result);
        } catch (NoClassDefFoundError e) {
            throw new RuntimeException("Can't load dom-capable xml parser.");
View Full Code Here

    private void prefetchChildren(int start, int length) {
        if (proxy != null) {
            INode node = getNode();
            if (node instanceof Node) {
                Node n = (Node) node;
                if (n.getState() != Node.TRANSIENT && n.getState() != Node.NEW) {
                    n.prefetchChildren(start, length);
                }
            }
        }
    }
View Full Code Here

     * This is called by jsFunction_list() if called with no arguments.
     *
     * @return A JavaScript Array containing all child objects
     */
    private Scriptable list() {
        Node node = (Node) getNode();
        node.loadNodes();
        SubnodeList list = node.getSubnodeList();
        if (list == null) {
            return Context.getCurrentContext().newArray(core.global, 0);
        }
        Object[] array = list.toArray();
        for (int i = 0; i < array.length; i++) {
View Full Code Here

TOP

Related Classes of helma.objectmodel.db.Node

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.