Package org.apache.xindice.core.data

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


        assertEquals(1, filer.getRecordCount());

        // Valid key
        filer.deleteRecord(TEST_KEY);
        assertEquals(0, filer.getRecordCount());
        Record result = filer.readRecord(TEST_KEY);
        assertNull(result);
    }
View Full Code Here


        assertEquals(filer.getRecordCount(), THREADS * ITERATIONS);
        for (int i = 0; i < THREADS; i++) {
            for (int ii = 0; ii < ITERATIONS; ii++) {
                Key key = new Key("T" + i + "I" + ii);
                Value value = new Value("<test thread=\"" + i + "\" iteration=\"" + ii + "\"/>");
                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

        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

            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.getData() != null) {
                    try {
                        if (compressed) {
                            Document doc = new DocumentImpl(val.getData(), symbols, new NodeSource(Collection.this, key));
                            return new ColContainer(key, doc);
View Full Code Here

        if (value == null) {
            throw new FilerException(FaultCodes.DBE_CANNOT_CREATE, "Invalid null value");
        }
        checkOpened();
        checkReadOnly();
        hashTable.put(key, new Record(key, value));
        return true;
    }
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

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

                return new Record(key, v, meta);
            }
        } catch (Exception e) {
            if (log.isWarnEnabled()) {
                log.warn("ignored exception", e);
            }
View Full Code Here

                }
            }

            RecordSet rs = collection.getFiler().getRecordSet();
            while (rs.hasMoreRecords()) {
                Record rec = rs.getNextRecord();

                if (rec == null) {
                    continue;
                }

                Key key = rec.getKey();
                // FIXME: What about inline metadata???
                Document doc = new DocumentImpl(rec.getValue().getData(), symbols, new NodeSource(collection, key));
                try {
                    new SAXHandler(key, doc, ACTION_CREATE, list);
                } catch (Exception e) {
                    if (log.isWarnEnabled()) {
                        log.warn("ignored exception", e);
View Full Code Here

        if (value == null) {
            throw new FilerException(FaultCodes.DBE_CANNOT_CREATE, "Invalid null value");
        }
        checkOpened();
        checkReadOnly();
        hashTable.put(key, new Record(key, value));
        return true;
    }
View Full Code Here

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

            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);
        } finally {
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.