Package org.apache.xindice.core.data

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


        final Value value = new Value("<test/>");

        assertTrue(filer.writeRecord(key, value));

        assertEquals(filer.getRecordCount(), 1);
        Record record = filer.readRecord(key);
        assertNotNull("Record with key '" + key + "' was not found",
                      record);
        assertEquals("Expected record with key '" + key + "', found record with key '" + record.getKey() + "'",
                     key, record.getKey());
        assertEquals("Expected record with value '" + value + "', found record with value '" + record.getValue() + "'",
                     value, record.getValue());
    }
View Full Code Here


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

            return new Record(key, v, meta);
        } catch (BTreeNotFoundException e) {
            if (log.isDebugEnabled()) {
                log.debug("Record '" + key + "' not found: " + e);
            }
        } catch (IOException e) {
View Full Code Here

            flush();

            HashMap meta = new HashMap(3);
            meta.put(Record.CREATED, new Long(ph.getCreated()));
            meta.put(Record.MODIFIED, new Long(t));
            return new Record(key, value, meta);

        } catch (IOException e) {
            // FIXME: cleanup?
            throw new FilerException(FaultCodes.DBE_CANNOT_CREATE,
                                     "Can't write record '" + key + "': " + e.getMessage(), e);
View Full Code Here

                    return entry;
                }
            }

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

            Value value;
            boolean isDocument;
            if (inlineMetaService == null) {
                value = record.getValue();
                isDocument = true;

                if (log.isTraceEnabled()) {
                    log.trace(localDebugHeader + "Type is not available, Length=" + value.getLength());
                }
            } else {
                InlineMetaService.DatabaseEntry databaseEntry = inlineMetaService.readDatabaseEntry(record.getValue());
                Object type = databaseEntry.map.get("type");
                value = databaseEntry.value;
                isDocument = type.equals(ResourceTypeReader.XML);

                if (log.isTraceEnabled()) {
View Full Code Here

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

            // Construct the Value object and store in the filer.
            Record record = writeRecord(key, true, documentBytes);

            // Cache Stuff
            if (cache != null) {
                cache.putEntry(this, key,
                               compressed ? DocumentCache.COMPRESSED : DocumentCache.UNCOMPRESSED,
View Full Code Here

                // binary resources aren't stored in indexes
                indexManager.removeDocument(key, (Document) entry.getValue());
            }

            // Construct the Value object and store in the filer.
            Record record = writeRecord(key, false, bytes);

            if (cache != null) {
                cache.putEntry(this, key, DocumentCache.BINARY, new Value(bytes), Entry.createMetaMap(record));
            }
View Full Code Here

                if (entry != null) {
                    return entry;
                }
            }

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

            Map entryMeta = Entry.createMetaMap(record);
View Full Code Here

            this.set = set;
        }

        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);
View Full Code Here

            HashMap meta = new HashMap(2, 1.5F);
            meta.put(Record.MODIFIED, new Long(file.lastModified()));

            if (metaOnly && file.exists()) {
                return new Record(key, null, meta);
            } else {
                byte[] valueData = cache.getFile(file);
                if (valueData != null) {
                    return new Record(key, new Value(valueData), meta);
                }
            }
        } catch (IOException e) {
            throw new FilerException(FaultCodes.DBE_CANNOT_READ,
                                     "Can't read record '" + key + "': " + e.getMessage(), e);
View Full Code Here

            fos.close();

            HashMap meta = new HashMap(2);
            meta.put(Record.MODIFIED, new Long(file.lastModified()));

            return new Record(key, value, meta);
        } catch (IOException e) {
            throw new FilerException(FaultCodes.DBE_CANNOT_CREATE,
                                     "Can't write record '" + key + "': " + e.getMessage(), e);
        } finally {
            locks.releaseExclusiveLock(file);
View Full Code Here

TOP

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

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.