Package org.openbel.framework.core.indexer

Examples of org.openbel.framework.core.indexer.JDBMEquivalenceLookup


            IndexingFailure, IOException {
        final Iterator<JDBMEquivalenceLookup> equivalenceIndexIt =
                openEquivalences.values().iterator();

        while (equivalenceIndexIt.hasNext()) {
            final JDBMEquivalenceLookup jdbmLookup = equivalenceIndexIt.next();

            // close the JDBM lookup
            jdbmLookup.close();

            // remove from open equivalences map
            equivalenceIndexIt.remove();
        }
    }
View Full Code Here


    @Override
    public SkinnyUUID getUUID(Parameter param) throws ResourceDownloadError,
            IndexingFailure, IOException {
        String srl = param.getNamespace().getResourceLocation();
        openEquivalence(srl);
        JDBMEquivalenceLookup lookup = openEquivalences.get(srl);
        return lookup.lookup(param.getValue());
    }
View Full Code Here

     * @param sourceValue
     * @return equivalent value, may be null.
     */
    private String doFindEquivalence(final String sourceNamespace,
            final String destinationNamespace, final String sourceValue) {
        JDBMEquivalenceLookup sourceLookup =
                openEquivalences.get(sourceNamespace);
        if (sourceLookup == null) {
            return null;
        }
        final SkinnyUUID sourceUUID = sourceLookup.lookup(sourceValue);

        if (sourceUUID == null) {
            return null;
        }
        return doFindEquivalence(destinationNamespace, sourceUUID);
View Full Code Here

     * @param sourceUUID
     * @return equivalent value, may be null
     */
    private String doFindEquivalence(final String destinationNamespace,
            final SkinnyUUID sourceUUID) {
        JDBMEquivalenceLookup destinationLookup = openEquivalences
                .get(destinationNamespace);

        return destinationLookup.reverseLookup(sourceUUID);
    }
View Full Code Here

            final EquivalenceDataIndex dataIndex = new EquivalenceDataIndex(
                    equivalence.getNamespaceResourceLocation()
                            .getResourceLocation(), equivalenceIndex);

            JDBMEquivalenceLookup jdbmLookup =
                    new JDBMEquivalenceLookup(dataIndex.getEquivalenceIndex()
                            .getIndexPath());
            jdbmLookup.open();

            openEquivalences.put(equivalence.getNamespaceResourceLocation()
                    .getResourceLocation(),
                    jdbmLookup);
        }
View Full Code Here

        lookupMap = sizedHashMap(set.size());
        for (final EquivalenceDataIndex edi : set) {
            String key = edi.getNamespaceResourceLocation();
            DataFileIndex dfi = edi.getEquivalenceIndex();
            lookupMap.put(key, new JDBMEquivalenceLookup(dfi.getIndexPath()));
        }
    }
View Full Code Here

    }

    @Test
    public void testLookupSuccess() {
        try {
            JDBMEquivalenceLookup jdbmLookup =
                    new JDBMEquivalenceLookup(indexPath.getAbsolutePath());
            jdbmLookup.open();

            assertEquals(1, jdbmLookup.getRecordCount());
            assertEquals(value, jdbmLookup.lookup(key));

            jdbmLookup.close();
        } catch (Exception e) {
            e.printStackTrace();
            fail(e.getMessage());
        }
    }
View Full Code Here

    }

    @Test
    public void testLookupFailure() {
        try {
            JDBMEquivalenceLookup jdbmLookup =
                    new JDBMEquivalenceLookup(indexPath.getAbsolutePath());
            jdbmLookup.open();

            assertEquals(1, jdbmLookup.getRecordCount());
            assertNull(jdbmLookup.lookup("0"));

            jdbmLookup.close();
        } catch (Exception e) {
            e.printStackTrace();
            fail(e.getMessage());
        }
    }
View Full Code Here

    }

    @Test
    public void testInverseLookupSuccess() {
        try {
            JDBMEquivalenceLookup jdbmLookup =
                    new JDBMEquivalenceLookup(indexPath.getAbsolutePath());
            jdbmLookup.open();

            assertEquals(1, jdbmLookup.getRecordCount());
            assertEquals(key, jdbmLookup.reverseLookup(value));

            jdbmLookup.close();
        } catch (Exception e) {
            e.printStackTrace();
            fail(e.getMessage());
        }
    }
View Full Code Here

    }

    @Test
    public void testInverseLookupFailure() {
        try {
            JDBMEquivalenceLookup jdbmLookup =
                    new JDBMEquivalenceLookup(indexPath.getAbsolutePath());
            jdbmLookup.open();

            assertEquals(1, jdbmLookup.getRecordCount());
            assertNull(jdbmLookup.reverseLookup(new SkinnyUUID(UUID
                    .randomUUID())));

            jdbmLookup.close();
        } catch (Exception e) {
            e.printStackTrace();
            fail(e.getMessage());
        }
    }
View Full Code Here

TOP

Related Classes of org.openbel.framework.core.indexer.JDBMEquivalenceLookup

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.