Package org.apache.xindice.core.data

Examples of org.apache.xindice.core.data.Value


        }
        checkOpened();
        try {
            Page startPage = seekRecordPage(key);
            if (startPage != null) {
                Value v = metaOnly ? null: readValue(startPage);
                HashPageHeader sph = (HashPageHeader) startPage.getPageHeader();

                HashMap meta = new HashMap(3);
                meta.put(Record.CREATED, new Long(sph.getCreated()));
                meta.put(Record.MODIFIED, new Long(sph.getModified()));
View Full Code Here


            }
            p = getPage(nextPage);
        }

        // Return a Value with the collected contents of all pages.
        return new Value(bos.toByteArray());
    }
View Full Code Here

                while (true) {
                    HashPageHeader ph = (HashPageHeader) page.getPageHeader();

                    if (ph.getStatus() == RECORD) {
                        Value value = readValue(page);
                        newFiler.writeRecord(page.getKey(), value);

                        long next = ph.getNextCollision();
                        if (next != NO_PAGE) {
                            page = getPage(ph.getNextCollision());
View Full Code Here

            this.newFiler = newFiler;
        }

        public boolean indexInfo(Value value, long pointer) {
            try {
                Value v = filer.getValue(pointer);
                newFiler.writeRecord(new Key(value), v);
            } catch (Exception e) {
                log.error(e);
            }
View Full Code Here

            Record record = filer.readRecord(key);
            if (record == null) {
                return null;
            }

            Value value;
            InlineMetaMap metaMap = null;
            if (inlineMetaService == null) {
                value = record.getValue();

                if (log.isTraceEnabled()) {
                    log.trace(localDebugHeader + "Type is not available, Length=" + value.getLength());
                }
            } else {
                InlineMetaService.DatabaseEntry databaseEntry = inlineMetaService.readDatabaseEntry(record.getValue());
                metaMap = databaseEntry.map;
                value = databaseEntry.value;

                if (log.isTraceEnabled()) {
                    log.trace(localDebugHeader + "Type=" + metaMap.get("type") + ", Length=" + value.getLength());
                }
            }

            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) + ">");
                    }

                    if (documentCache != null) {
                        documentCache.putDocument(this, key, value.getData());
                    }
                } else {
                    String documentChars = value.toString();
                    if (log.isTraceEnabled()) {
                        log.trace(localDebugHeader + "Pre parseDocument(): value=<" + documentChars + ">");
                    }

                    // FIXME These should be no reason here to re-compress the document & flush symbols table?
                    document = parseDocument(key, documentChars);
                    flushSymbolTable();

                    if (documentCache != null) {
                        documentCache.putDocument(this, key, documentChars);
                    }
                }

                DBObserver.getInstance().loadDocument(this, record, document);
                return document;
            } else {
                if (log.isTraceEnabled()) {
                    log.trace(localDebugHeader + "Binary document");
                }

                return value.getData();
            }
        }
    }
View Full Code Here

                indexManager.removeDocument(key, (Document) entry);
            }

            InlineMetaMap map = inlineMetaService.getEmptyMap();
            map.put("type", ResourceTypeReader.BINARY);
            Value value = inlineMetaService.createValue(map, bytes, 0, bytes.length);
            filer.writeRecord(key, value);

            // update the meta for this document
            updateDocumentMeta(key.toString());
        }
View Full Code Here

                indexManager.removeDocument(key, (Document) oldDoc);
            }
            indexManager.addDocument(key, document);

            // Construct the Value object that is stored in the BTree.
            Value value;
            if (inlineMetaService == null) {
                value = new Value(documentBytes);
            } else {
                InlineMetaMap map = inlineMetaService.getEmptyMap();
                map.put("type", ResourceTypeReader.XML);
                value = inlineMetaService.createValue(map, documentBytes, 0, documentBytes.length);
            }
View Full Code Here

        /*
         * Exract the data into a Value object.
         */

        Value value = rawValue.getSubvalue(headerLen, rawValue.getLength() - headerLen);
        // FIXME: May be Record should be used instead? new Record(null, value, map);
        return new DatabaseEntry(map, value);
    }
View Full Code Here

        public Container getNextContainer() throws DBException {
            if (set.hasMoreRecords()) {
                Record rec = set.getNextRecord();
                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

        checkOpened();
        try {
            long pos = findValue(key);
            Page startPage = getPage(pos);
            Value v = readValue(startPage);
            BTreeFilerPageHeader sph = (BTreeFilerPageHeader) startPage.getPageHeader();

            HashMap meta = new HashMap(2, 1.5F);
            meta.put(Record.CREATED, new Long(sph.getCreated()));
            meta.put(Record.MODIFIED, new Long(sph.getModified()));
View Full Code Here

TOP

Related Classes of org.apache.xindice.core.data.Value

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.