Examples of INode


Examples of helma.objectmodel.INode

                    // set the property.
                    int dot = helmaKey.indexOf(".");

                    if (dot > -1) {
                        String prototype = helmaKey.substring(0, dot);
                        INode node = (INode) nodeCache.get(prototype);

                        helmaKey = helmaKey.substring(dot + 1);

                        if ((node != null) && (node.getString(helmaKey) == null)) {
                            node.setString(helmaKey, XmlUtil.getTextContent(childNode));
                        }
                    } else if (helmaNode.getString(helmaKey) == null) {
                        helmaNode.setString(helmaKey, XmlUtil.getTextContent(childNode));

                        if (DEBUG) {
                            debug("childtext-2-property mapping, setting " + helmaKey +
                                  " as string");
                        }
                    }

                    continue;
                }

                // is there a simple child-2-property mapping?
                // (lets the user define to use only one element and make this a property
                // and simply ignore other elements of the same name)
                if ((props != null) && props.containsKey(domKey + "._property")) {
                    helmaKey = props.getProperty(domKey + "._property");

                    // if property is set but without value, read elementname for this mapping:
                    if (helmaKey.equals("")) {
                        helmaKey = childElement.getNodeName().replace(':',
                                                                      defaultSeparator);
                    }

                    if (DEBUG) {
                        debug("child-2-property mapping, helmaKey " + helmaKey +
                              " for domKey " + domKey);
                    }

                    // get the node on which to opererate, depending on the helmaKey
                    // value from the properties file.
                    INode node = helmaNode;
                    int dot = helmaKey.indexOf(".");

                    if (dot > -1) {
                        String prototype = helmaKey.substring(0, dot);

                        if (!prototype.equalsIgnoreCase(node.getPrototype())) {
                            node = (INode) nodeCache.get(prototype);
                        }

                        helmaKey = helmaKey.substring(dot + 1);
                    }

                    if (node == null) {
                        continue;
                    }

                    if (node.getNode(helmaKey) == null) {
                        convert(childElement, node.createNode(helmaKey), nodeCache);

                        if (DEBUG) {
                            debug("read " + childElement.toString() +
                                  node.getNode(helmaKey).toString());
                        }
                    }

                    continue;
                }

                // map it to one of the children-lists
                helma.objectmodel.INode newHelmaNode = null;
                String childrenMapping = props.getProperty(element.getNodeName() +
                                                           "._children");

                // do we need a mapping directly among _children of helmaNode?
                // can either be through property elname._children=_all or elname._children=childname
                if ((childrenMapping != null) &&
                        (childrenMapping.equals("_all") ||
                        childrenMapping.equals(childElement.getNodeName()))) {
                    newHelmaNode = convert(childElement, helmaNode.createNode(null),
                                           nodeCache);
                }

                // in which virtual subnode collection should objects of this type be stored?
                helmaKey = props.getProperty(domKey);

                if ((helmaKey == null) && !sparse) {
                    helmaKey = childElement.getNodeName().replace(':', defaultSeparator);
                }

                if (helmaKey == null) {
                    // we don't map this child element itself since we do
                    // sparse parsing, but there may be something of interest
                    // in the child's attributes and child elements.
                    attributes(childElement, helmaNode, nodeCache);
                    children(childElement, helmaNode, nodeCache);

                    continue;
                }

                // get the node on which to opererate, depending on the helmaKey
                // value from the properties file.
                INode node = helmaNode;
                int dot = helmaKey.indexOf(".");

                if (dot > -1) {
                    String prototype = helmaKey.substring(0, dot);

                    if (!prototype.equalsIgnoreCase(node.getPrototype())) {
                        node = (INode) nodeCache.get(prototype);
                    }

                    helmaKey = helmaKey.substring(dot + 1);
                }

                if (node == null) {
                    continue;
                }

                // try to get the virtual node
                INode worknode = null;

                if ("_children".equals(helmaKey)) {
                    worknode = node;
                } else {
                    worknode = node.getNode(helmaKey);

                    if (worknode == null) {
                        // if virtual node doesn't exist, create it
                        worknode = helmaNode.createNode(helmaKey);
                    }
                }

                if (DEBUG) {
                    debug("mounting child " + childElement.getNodeName() +
                          " at worknode " + worknode.toString());
                }

                // now mount it, possibly re-using the helmaNode that's been created before
                if (newHelmaNode != null) {
                    worknode.addNode(newHelmaNode);
                } else {
                    convert(childElement, worknode.createNode(null), nodeCache);
                }
            }

            // forget about other types (comments etc)
            continue;
View Full Code Here

Examples of helma.objectmodel.INode

                // the property should be applied
                int dot = helmaKey.indexOf(".");

                if (dot > -1) {
                    String prototype = helmaKey.substring(0, dot);
                    INode node = (INode) nodeCache.get(prototype);

                    if (node != null) {
                        node.setString(helmaKey.substring(dot + 1), attr.getNodeValue());
                    }
                } else if (helmaNode.getPrototype() != null) {
                    helmaNode.setString(helmaKey, attr.getNodeValue());
                }
            }
View Full Code Here

Examples of helma.objectmodel.INode

            node = new Node(null, null, core.getApplication().getWrappedNodeManager());
        }

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

            return core.getNodeWrapper(result);
        } catch (NoClassDefFoundError e) {
            throw new RuntimeException("Can't load XML parser:" + e);
        } catch (Exception f) {
View Full Code Here

Examples of helma.objectmodel.INode

            node = new Node(null, null, core.getApplication().getWrappedNodeManager());
        }

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

            return core.getNodeWrapper(result);
        } catch (NoClassDefFoundError e) {
            throw new RuntimeException("Can't load XML parser:" + e);
        } catch (Exception f) {
View Full Code Here

Examples of helma.objectmodel.INode

                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) {
            throw new RuntimeException("Can't load dom-capable xml parser.");
        }
View Full Code Here

Examples of helma.objectmodel.INode

                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

Examples of helma.objectmodel.INode

class HopObjectProxy implements SerializationProxy {
    Object ref;
    boolean wrapped = false;

    HopObjectProxy(HopObject obj) {
        INode n = obj.getNode();
        if (n == null) {
            ref = obj.getClassName();
        } else {
            if (n instanceof Node) {
                ref = ((Node) n).getHandle();
View Full Code Here

Examples of helma.objectmodel.INode

            Session s = (Session) e.nextElement();

            if (s != null && s.isLoggedIn()) {
                // returns a session if it is logged in and has not been
                // returned before (so for each logged-in user is only added once)
                INode node = s.getUserNode();

                // we check again because user may have been logged out between the first check
                if (node != null && !list.contains(node)) {
                    list.add(node);
                }
View Full Code Here

Examples of helma.objectmodel.INode

        }

        // check if the skinset object is a HopObject (db based skin)
        // or a String (file based skin)
        if (skinset instanceof INode) {
            INode n = (INode) ((INode) skinset).getChildElement(prototype);

            if (n != null) {
                n = (INode) n.getChildElement(skinname);

                if (n != null) {
                    String skin = n.getString(skinProperty);

                    if (skin != null) {
                        return new Skin(skin, app);
                    }
                }
View Full Code Here

Examples of helma.objectmodel.INode

            } catch (Exception x) {
                System.err.println("Error in Java constructor: "+x);
                throw new EvaluatorException(x.toString());
            }
        } else {
            INode node = new Node(protoname, protoname,
                    core.app.getWrappedNodeManager());
            Scriptable proto = core.getPrototype(protoname);
            HopObject hobj = new HopObject(protoname, core, node, proto);

            if (proto != null) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.