@Test public void tmpUsageDao() throws Exception { dao = UsageDao.temporaryDao(10); testDao(); }
public static UsageDao temporaryDao(int mappedMemory, Integer shellPort) { LOG.debug("Create new in memory dao"); DB kvp = DBMaker.memoryDB() .make(); File storeDir = Files.createTempDir(); NeoConfiguration cfg = new NeoConfiguration(); cfg.mappedMemory = mappedMemory; if (shellPort != null) { cfg.shell = true; cfg.port = shellPort; } GraphDatabaseBuilder builder = cfg.newEmbeddedDb(storeDir, false); CleanupUtils.registerCleanupHook(storeDir); return new UsageDao(kvp, storeDir, null, builder, new MetricRegistry()); }
UsageDao implements AutoCloseable { public static UsageDao temporaryDao(int mappedMemory, Integer shellPort) { LOG.debug("Create new in memory dao"); DB kvp = DBMaker.memoryDB() .make(); File storeDir = Files.createTempDir(); NeoConfiguration cfg = new NeoConfiguration(); cfg.mappedMemory = mappedMemory; if (shellPort != null) { cfg.shell = true; cfg.port = shellPort; } GraphDatabaseBuilder builder = cfg.newEmbeddedDb(storeDir, false); CleanupUtils.registerCleanupHook(storeDir); return new UsageDao(kvp, storeDir, null, builder, new MetricRegistry()); } }
UsageDao implements AutoCloseable { public static UsageDao temporaryDao(int mappedMemory, Integer shellPort) { LOG.debug("Create new in memory dao"); DB kvp = DBMaker.memoryDB() .make(); File storeDir = Files.createTempDir(); NeoConfiguration cfg = new NeoConfiguration(); cfg.mappedMemory = mappedMemory; if (shellPort != null) { cfg.shell = true; cfg.port = shellPort; } GraphDatabaseBuilder builder = cfg.newEmbeddedDb(storeDir, false); CleanupUtils.registerCleanupHook(storeDir); return new UsageDao(kvp, storeDir, null, builder, new MetricRegistry()); } private  UsageDao(DB kvp, File neoDir, @Nullable File kvpStore, GraphDatabaseBuilder neoFactory, @Nullable MetricRegistry registry); }
UsageDao implements AutoCloseable { public static UsageDao temporaryDao(int mappedMemory, Integer shellPort) { LOG.debug("Create new in memory dao"); DB kvp = DBMaker.memoryDB() .make(); File storeDir = Files.createTempDir(); NeoConfiguration cfg = new NeoConfiguration(); cfg.mappedMemory = mappedMemory; if (shellPort != null) { cfg.shell = true; cfg.port = shellPort; } GraphDatabaseBuilder builder = cfg.newEmbeddedDb(storeDir, false); CleanupUtils.registerCleanupHook(storeDir); return new UsageDao(kvp, storeDir, null, builder, new MetricRegistry()); } private  UsageDao(DB kvp, File neoDir, @Nullable File kvpStore, GraphDatabaseBuilder neoFactory, @Nullable MetricRegistry registry); static UsageDao temporaryDao(int mappedMemory, Integer shellPort); static UsageDao temporaryDao(int mappedMemory); static UsageDao open(NeoConfiguration cfg, UUID datasetKey); static UsageDao create(NeoConfiguration cfg, UUID datasetKey); static UsageDao persistentDao(NeoConfiguration cfg, UUID datasetKey, MetricRegistry registry, boolean eraseExisting); GraphDatabaseService getNeo(); void logAll(); void printTree(Writer writer, GraphFormat format); void printTree(Writer writer, GraphFormat format, final boolean fullNames, @Nullable Rank lowestRank, @Nullable Node root); void close(); void closeAndDelete(); NeoInserter createBatchInserter(int batchSize); Transaction beginTx(); Collection<Node> findByName(String canonicalName); Node findByNameSingle(String canonicalName); Node findByScientificName(String scientificName); Node createTaxon(); UsageExtensions readExtensions(long key); void store(long key, UsageExtensions ext); UsageFacts readFacts(long key); void store(long key, UsageFacts obj); RankedName readRankedName(Node n); NubUsage readNub(Node n); NubUsage readNub(long id); ParsedName readNubName(long id); ParsedName readName(long key); void store(long key, ParsedName pn); NameUsage readUsage(Node n, boolean readRelations); Node create(NameUsage u); void store(long key, NameUsage u, boolean updateNeo); void store(NameUsageNode nn, boolean updateNeo); void store(long key, VerbatimNameUsage obj); VerbatimNameUsage readVerbatim(long key); void store(NubUsage nub); void update(long nodeId, NubUsage nub); static String canonicalOrScientificName(ParsedName pn); void delete(NubUsage nub); SrcUsage readSourceUsage(Node n); void storeSourceUsage(Node n, SrcUsage u); Map<String, Object> neoProperties(String taxonID, NameUsage u, VerbatimNameUsage v); ResourceIterator<Node> allTaxa(); ResourceIterable<Node> allNodes(); ResourceIterator<Node> allRootTaxa(); ResourceIterator<Node> allFamilies(); ResourceIterator<Node> allGenera(); ResourceIterator<Node> allSpecies(); ResourceIterator<Node> allInfraSpecies(); ResourceIterator<Node> allAutonyms(); ResourceIterator<Node> allBasionyms(); ResourceIterator<Node> allSynonyms(); ResourceIterator<Node> allImplicitNames(); int convertNubUsages(); Iterable<Map.Entry<Long, NubUsage>> nubUsages(); void logStats(); void consistencyNubReport(); ResourceIterator<Relationship> listAllRelationships(RelType type); }
UsageDao implements AutoCloseable { public static UsageDao temporaryDao(int mappedMemory, Integer shellPort) { LOG.debug("Create new in memory dao"); DB kvp = DBMaker.memoryDB() .make(); File storeDir = Files.createTempDir(); NeoConfiguration cfg = new NeoConfiguration(); cfg.mappedMemory = mappedMemory; if (shellPort != null) { cfg.shell = true; cfg.port = shellPort; } GraphDatabaseBuilder builder = cfg.newEmbeddedDb(storeDir, false); CleanupUtils.registerCleanupHook(storeDir); return new UsageDao(kvp, storeDir, null, builder, new MetricRegistry()); } private  UsageDao(DB kvp, File neoDir, @Nullable File kvpStore, GraphDatabaseBuilder neoFactory, @Nullable MetricRegistry registry); static UsageDao temporaryDao(int mappedMemory, Integer shellPort); static UsageDao temporaryDao(int mappedMemory); static UsageDao open(NeoConfiguration cfg, UUID datasetKey); static UsageDao create(NeoConfiguration cfg, UUID datasetKey); static UsageDao persistentDao(NeoConfiguration cfg, UUID datasetKey, MetricRegistry registry, boolean eraseExisting); GraphDatabaseService getNeo(); void logAll(); void printTree(Writer writer, GraphFormat format); void printTree(Writer writer, GraphFormat format, final boolean fullNames, @Nullable Rank lowestRank, @Nullable Node root); void close(); void closeAndDelete(); NeoInserter createBatchInserter(int batchSize); Transaction beginTx(); Collection<Node> findByName(String canonicalName); Node findByNameSingle(String canonicalName); Node findByScientificName(String scientificName); Node createTaxon(); UsageExtensions readExtensions(long key); void store(long key, UsageExtensions ext); UsageFacts readFacts(long key); void store(long key, UsageFacts obj); RankedName readRankedName(Node n); NubUsage readNub(Node n); NubUsage readNub(long id); ParsedName readNubName(long id); ParsedName readName(long key); void store(long key, ParsedName pn); NameUsage readUsage(Node n, boolean readRelations); Node create(NameUsage u); void store(long key, NameUsage u, boolean updateNeo); void store(NameUsageNode nn, boolean updateNeo); void store(long key, VerbatimNameUsage obj); VerbatimNameUsage readVerbatim(long key); void store(NubUsage nub); void update(long nodeId, NubUsage nub); static String canonicalOrScientificName(ParsedName pn); void delete(NubUsage nub); SrcUsage readSourceUsage(Node n); void storeSourceUsage(Node n, SrcUsage u); Map<String, Object> neoProperties(String taxonID, NameUsage u, VerbatimNameUsage v); ResourceIterator<Node> allTaxa(); ResourceIterable<Node> allNodes(); ResourceIterator<Node> allRootTaxa(); ResourceIterator<Node> allFamilies(); ResourceIterator<Node> allGenera(); ResourceIterator<Node> allSpecies(); ResourceIterator<Node> allInfraSpecies(); ResourceIterator<Node> allAutonyms(); ResourceIterator<Node> allBasionyms(); ResourceIterator<Node> allSynonyms(); ResourceIterator<Node> allImplicitNames(); int convertNubUsages(); Iterable<Map.Entry<Long, NubUsage>> nubUsages(); void logStats(); void consistencyNubReport(); ResourceIterator<Relationship> listAllRelationships(RelType type);  }