Package org.apache.xindice.xml

Examples of org.apache.xindice.xml.NodeSource


        }

        if (inlineMetaService == null || metaMap.get("type").equals(ResourceTypeReader.XML)) {
            Document document;
            if (compressed) {
                document = new DocumentImpl(value.getData(), symbols, new NodeSource(this, key));
                flushSymbolTable();
                if (log.isTraceEnabled()) {
                    log.trace(localDebugHeader +
                              "Compressed XML document=<" + TextWriter.toString(document) + ">");
                }
View Full Code Here


        try {
            doc = DOMParser.toDocument(xml);

            // Have to move it to Xindice DOM for XMLObject AutoLinking
            byte[] b = DOMCompressor.Compress(doc, symbols);
            doc = new DocumentImpl(b, symbols, new NodeSource(this, key));

            if (documentCache != null) {
                documentCache.putDocument(this, key, b);
            }
        } catch (Exception e) {
View Full Code Here

        if (document instanceof DBDocument) {
            // FIXME: This is a shitty shitty hack... Kill immediately
            DBDocument dbDoc = (DBDocument) document;
            if (dbDoc.getSource() == null) {
                dbDoc.setSource(new NodeSource(this, key));
            }
        }

        /*
         * The possibilities are restricted because only XML
         * is handled by this method.  There are only a few
         * pieces of information that need to be constructed:
         * 1) the xindice DOM document is needed for all XML objects, as
         *         it is handed to the IndexManager and the DBObserver.
         * 2) the packed document, if this is a compressed XML object,
         *        is needed for the cache and the BTree (via the Value object).
         * 3) the string-converted-to-utf-8 bytes, if this is a non-compressed
         *        XML object, is needed for the BTree (via the Value object).
         * 4) A Value object, with a header if headers are enabled, and
         *        otherwise without headers, for the BTree.
         */

        byte[] documentBytes = null;

        if (compressed) {
            try {
                documentBytes = DOMCompressor.Compress(document, symbols);
                if (log.isTraceEnabled()) {
                    log.trace(localDebugHeader + "length=" + documentBytes.length);
                }

                // Why must it be re-created?
                document = new DocumentImpl(documentBytes, symbols, new NodeSource(this, key));
                if (log.isTraceEnabled()) {
                    log.trace(localDebugHeader + "packedDocument: length=" + documentBytes.length +
                              " document=<" + TextWriter.toString(document) + ">");
                }
            } catch (Exception e) {
View Full Code Here

                            continue; // We only have to process it once
                        } else {
                            lastDoc = doc;
                        }

                        NodeSource source = node.getSource();

                        Node contextNode = doc.getDocumentElement();
                        execute(contextNode);

                        col.setDocument(source.getKey(), doc);
                    }
                }
            }
        }
    }
View Full Code Here

        } else if (v instanceof Document) {
            return (Document) v;
        } else if (v instanceof byte[]) {
            try {
                SymbolTable s = col.getSymbols();
                NodeSource ns = new NodeSource(col, key);
                return new DocumentImpl((byte[]) v, s, ns);
            } catch (Exception e) {
                if (log.isWarnEnabled()) {
                    log.warn("ignored exception", e);
                }
View Full Code Here

                Key key = rec.getKey();
                Value val = rec.getValue();
                if (val.getLength() > 0) {
                    try {
                        if (compressed) {
                            Document doc = new DocumentImpl(val.getData(), symbols, new NodeSource(Collection.this, key));
                            return new ColContainer(key, doc);
                        } else {
                            return new ColContainer(key, DOMParser.toDocument(val));
                        }
                    } catch (Exception e) {
View Full Code Here

    /**
     * Add "src" and "col" attributes in {@link NodeSource#SOURCE_NS} namespace.
     */
    public void expandSource() {
        NodeSource src = getSource();
        if (src != null) {
            final String prefix = sourcePrefix("src", NodeSource.SOURCE_NS);

            setAttribute(XMLNS_PREFIX + ":" + prefix, NodeSource.SOURCE_NS);
            setAttribute(prefix + ":" + NodeSource.SOURCE_COL, src.getCollection().getCanonicalName());
            Key k = src.getKey();
            if (k != null) {
                setAttribute(prefix + ":" + NodeSource.SOURCE_KEY, k.toString());
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.xindice.xml.NodeSource

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.