Package org.apache.xindice.core.data

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


        byte[] metadata = new byte[] {
            0x0a, 0x0b, 0x0c};
        byte[] data = new byte[] {
            0x12, 0x11, 0x10, 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01};

        Value value = InlineHeaderBuilder.createValue(12, metadata, data, 2, 7);
        byte[] valueBytes = value.getData();
       
        /*
         * byte 0 is the total header length
         */
        assertEquals(5, valueBytes[0]);
View Full Code Here


            final int threadID = i;
            threads[i] = new Thread() {
                public void run() {
                    for (int ii = 0; ii < ITERATIONS; ii++) {
                        Key key = new Key("T" + threadID + "I" + ii);
                        Value value = new Value("<test thread=\"" + threadID + "\" iteration=\"" + ii + "\"/>");
                        try {
                            filer.writeRecord(key, value);
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                    }
                    // System.out.println(getName() + " done.");
                }
            };
            threads[i].setName("FilerTest" + i);
        }

        // Start all the threads at once
        for (int i = 0; i < THREADS; i++) {
            threads[i].start();
        }
        Thread.sleep(1000);

        for (int i = 0; i < THREADS; i++) {
            threads[i].join();
        }

        filer.flush();

        // Check results
        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());
View Full Code Here

        sb.append("KEY");
        for (int k = 0; k < LARGE_KEY_SIZE - 3; k++) {
            sb.append('0');
        }
        final Key key = new Key(sb.toString());
        final Value value = new Value("<test/>");

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

        assertEquals(filer.getRecordCount(), 1);
        Record record = filer.readRecord(key);
View Full Code Here

                        }

                        IndexPattern pattern = new IndexPattern(symbols, ps, nsMap);

                        XObject obj = (XObject) s;
                        Value val1 = new Value(obj.str());

                        IndexQuery iq = new IndexQuerySW(pattern, val1);
                        return queryIndexes(nk, iq, ps, obj.getType());
                    }
                }
View Full Code Here

        checkOpened();
        try {
            long pos = findValue(key);
            Page startPage = getPage(pos);
            Value v = metaOnly ? null : 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

            }
            p = getPage(nextPage);
        }

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

            // SW and NSW operators are treated as "between" and "not between"
            // where second value is same as first value plus max byte
            byte[] b = new byte[val.getLength() + 1];
            val.copyTo(b, 0);
            b[b.length - 1] = Byte.MAX_VALUE;
            Value val2 = new Value(b);
            this.vals = new Value[]{ val, val2 };
        } else {
            this.vals = new Value[]{ val };
        }
    }
View Full Code Here

    /**
     * Unary operator index query
     */
    public IndexQuery(IndexPattern pattern, int op, String val1) {
        this(pattern, op, new Value(val1));
    }
View Full Code Here

    /**
     * EQ operator index query
     */
    public IndexQuery(IndexPattern pattern, String val1) {
        this(pattern, new Value(val1));
    }
View Full Code Here

    /**
     * Binary operator index query
     */
    public IndexQuery(IndexPattern pattern, int op, String val1, String val2) {
        this(pattern, op, new Value(val1), new Value(val2));
    }
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.