本文整理匯總了Java中com.sleepycat.je.OperationStatus.NOTFOUND屬性的典型用法代碼示例。如果您正苦於以下問題:Java OperationStatus.NOTFOUND屬性的具體用法?Java OperationStatus.NOTFOUND怎麽用?Java OperationStatus.NOTFOUND使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類com.sleepycat.je.OperationStatus
的用法示例。
在下文中一共展示了OperationStatus.NOTFOUND屬性的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getChildren
public Set<String> getChildren(String parentHash)
{
try
{
// Instantiate class catalog
StoredClassCatalog neighborCatalog = new StoredClassCatalog(neighborDatabase);
// Create the binding
EntryBinding<Neighbors> neighborBinding = new SerialBinding<>(neighborCatalog, Neighbors.class);
// Create DatabaseEntry for the key
DatabaseEntry key = new DatabaseEntry(parentHash.getBytes("UTF-8"));
// Create the DatabaseEntry for the data.
DatabaseEntry data = new DatabaseEntry();
// query database to get the key-value
OperationStatus operationStatus = scaffoldDatabase.get(null, key, data, LockMode.DEFAULT);
if(operationStatus != OperationStatus.NOTFOUND)
{
Neighbors neighbors = neighborBinding.entryToObject(data);
return neighbors.children;
}
}
catch (UnsupportedEncodingException ex)
{
Logger.getLogger(Scaffold.class.getName()).log(Level.SEVERE, "Scaffold entry insertion error!", ex);
}
return null;
}
示例2: getParents
public Set<String> getParents(String childHash)
{
try
{
// Instantiate class catalog
StoredClassCatalog neighborCatalog = new StoredClassCatalog(neighborDatabase);
// Create the binding
EntryBinding<Neighbors> neighborBinding = new SerialBinding<>(neighborCatalog, Neighbors.class);
// Create DatabaseEntry for the key
DatabaseEntry key = new DatabaseEntry(childHash.getBytes("UTF-8"));
// Create the DatabaseEntry for the data.
DatabaseEntry data = new DatabaseEntry();
// query database to get the key-value
OperationStatus operationStatus = scaffoldDatabase.get(null, key, data, LockMode.DEFAULT);
if(operationStatus != OperationStatus.NOTFOUND)
{
Neighbors neighbors = neighborBinding.entryToObject(data);
return neighbors.parents;
}
}
catch (UnsupportedEncodingException ex)
{
Logger.getLogger(Scaffold.class.getName()).log(Level.SEVERE, "Scaffold entry insertion error!", ex);
}
return null;
}
示例3: getIncidenceResultSet
@SuppressWarnings("unchecked")
public HGRandomAccessResult<HGPersistentHandle> getIncidenceResultSet(HGPersistentHandle handle)
{
if (handle == null)
throw new NullPointerException("HGStore.getIncidenceSet called with a null handle.");
Cursor cursor = null;
try
{
DatabaseEntry key = new DatabaseEntry(handle.toByteArray());
DatabaseEntry value = new DatabaseEntry();
TransactionBJEImpl tx = txn();
cursor = incidence_db.openCursor(tx.getBJETransaction(), cursorConfig);
OperationStatus status = cursor.getSearchKey(key, value, LockMode.DEFAULT);
if (status == OperationStatus.NOTFOUND)
{
cursor.close();
return (HGRandomAccessResult<HGPersistentHandle>) HGSearchResult.EMPTY;
}
else
return new SingleKeyResultSet<HGPersistentHandle>(tx.attachCursor(cursor), key,
BAtoHandle.getInstance(handleFactory));
}
catch (Throwable ex)
{
if (cursor != null)
try
{
cursor.close();
}
catch (Throwable t)
{
}
throw new HGException("Failed to retrieve incidence set for handle " + handle + ": " + ex.toString(), ex);
}
}
示例4: getIncidenceSetCardinality
public long getIncidenceSetCardinality(HGPersistentHandle handle)
{
if (handle == null)
throw new NullPointerException("HGStore.getIncidenceSetCardinality called with a null handle.");
Cursor cursor = null;
try
{
DatabaseEntry key = new DatabaseEntry(handle.toByteArray());
DatabaseEntry value = new DatabaseEntry();
cursor = incidence_db.openCursor(txn().getBJETransaction(), cursorConfig);
OperationStatus status = cursor.getSearchKey(key, value, LockMode.DEFAULT);
if (status == OperationStatus.NOTFOUND)
return 0;
else
return cursor.count();
}
catch (Exception ex)
{
throw new HGException("Failed to retrieve incidence set for handle " + handle + ": " + ex.toString(), ex);
}
finally
{
try
{
cursor.close();
}
catch (Throwable t)
{
}
}
}
示例5: getLineage
public Map<String, Set<String>> getLineage(String hash, String direction, int maxDepth)
{
try
{
// Instantiate class catalog
StoredClassCatalog neighborCatalog = new StoredClassCatalog(neighborDatabase);
// Create the binding
EntryBinding<Neighbors> neighborBinding = new SerialBinding<>(neighborCatalog, Neighbors.class);
// Create DatabaseEntry for the key
DatabaseEntry key = new DatabaseEntry(hash.getBytes("UTF-8"));
// Create the DatabaseEntry for the data.
DatabaseEntry data = new DatabaseEntry();
// query database to get the key-value
OperationStatus operationStatus = scaffoldDatabase.get(null, key, data, LockMode.DEFAULT);
if(operationStatus != OperationStatus.NOTFOUND)
{
Set<String> remainingVertices = new HashSet<>();
Set<String> visitedVertices = new HashSet<>();
Map<String, Set<String>> lineageMap = new HashMap<>();
remainingVertices.add(hash);
int current_depth = 0;
while(!remainingVertices.isEmpty() && current_depth < maxDepth)
{
visitedVertices.addAll(remainingVertices);
Set<String> currentSet = new HashSet<>();
for(String current_hash: remainingVertices)
{
Set<String> neighbors = null;
if(DIRECTION_ANCESTORS.startsWith(direction.toLowerCase()))
neighbors = getParents(current_hash);
else if(DIRECTION_DESCENDANTS.startsWith(direction.toLowerCase()))
neighbors = getChildren(current_hash);
if(neighbors != null)
{
lineageMap.put(current_hash, neighbors);
for(String vertexHash: neighbors)
{
if(!visitedVertices.contains(vertexHash))
{
currentSet.addAll(neighbors);
}
}
}
}
remainingVertices.clear();
remainingVertices.addAll(currentSet);
current_depth++;
}
return lineageMap;
}
}
catch(UnsupportedEncodingException ex)
{
Logger.getLogger(Scaffold.class.getName()).log(Level.SEVERE, "Scaffold Get Lineage error!", ex);
}
return null;
}