public String[] inLinks(String URL) throws DatabaseException { EntityIndex<String, Link> subIndex = inLinkIndex.subIndex(URL); // System.out.println(subIndex.count()); String[] linkList = new String[(int) subIndex.count()]; int i = 0; EntityCursor<Link> cursor = subIndex.entities(); try { for (Link entity : cursor) { linkList[i++] = entity.fromURL; // System.out.println(entity.fromURL); } } finally { cursor.close(); } return linkList; } }
public int size(Object key) { Transaction txn = null; EntityCursor<Ref> cursor = null; try { txn = dbe.beginTransaction (null, null); cursor = sIndex.subIndex(key.toString()).entities(txn, null); int keyCount = 0; for (Ref ref : cursor) if (ref.isActive()) keyCount++; cursor.close(); cursor = null; txn.commit(); txn = null; return keyCount; } catch (IllegalStateException e) { return -1; } finally { if (cursor != null) cursor.close (); if (txn != null) txn.abort(); } }
cursor = sIndex.subIndex(key.toString()).entities(txn, null); for (Ref ref : cursor) { if (ref.isActive()) {