Class MongoDbHandleStorage

java.lang.Object
net.handle.server.storage.MongoDbHandleStorage
All Implemented Interfaces:
net.handle.hdllib.HandleStorage

public class MongoDbHandleStorage extends Object implements net.handle.hdllib.HandleStorage
A handle storage class for connecting to MongoDB.

To use this storage module configure your config.dct file with the following options.

 "storage_type" = "CUSTOM"
 "storage_class" = "net.handle.server.storage.MongoDbHandleStorage"
 "storage_config" = {
     "connectionUri" = "mongodb://localhost:27017"
     "databaseName" = "handle"
     "handlesCollectionName" = "handles"
     "nasCollectionName" = "nas"
     "maxTimeMs" = "30000"
     "maxTimeMsLongRunning" = "3600000"
 }
 
The values given in the above example are the default values; "storage_config" can be omitted if no changes are desired.
  • Constructor Details

    • MongoDbHandleStorage

      public MongoDbHandleStorage()
  • Method Details

    • init

      public void init(net.cnri.util.StreamTable config) throws Exception
      Specified by:
      init in interface net.handle.hdllib.HandleStorage
      Throws:
      Exception
    • haveNA

      public boolean haveNA(byte[] authHandle) throws net.handle.hdllib.HandleException
      Specified by:
      haveNA in interface net.handle.hdllib.HandleStorage
      Throws:
      net.handle.hdllib.HandleException
    • setHaveNA

      public void setHaveNA(byte[] authHandle, boolean flag) throws net.handle.hdllib.HandleException
      Specified by:
      setHaveNA in interface net.handle.hdllib.HandleStorage
      Throws:
      net.handle.hdllib.HandleException
    • createHandle

      public void createHandle(byte[] handleBytes, net.handle.hdllib.HandleValue[] values) throws net.handle.hdllib.HandleException
      Specified by:
      createHandle in interface net.handle.hdllib.HandleStorage
      Throws:
      net.handle.hdllib.HandleException
    • deleteHandle

      public boolean deleteHandle(byte[] handleBytes) throws net.handle.hdllib.HandleException
      Specified by:
      deleteHandle in interface net.handle.hdllib.HandleStorage
      Throws:
      net.handle.hdllib.HandleException
    • getRawHandleValues

      public byte[][] getRawHandleValues(byte[] handleBytes, int[] indexList, byte[][] typeList) throws net.handle.hdllib.HandleException
      Specified by:
      getRawHandleValues in interface net.handle.hdllib.HandleStorage
      Throws:
      net.handle.hdllib.HandleException
    • updateValue

      public void updateValue(byte[] handleBytes, net.handle.hdllib.HandleValue[] values) throws net.handle.hdllib.HandleException
      Specified by:
      updateValue in interface net.handle.hdllib.HandleStorage
      Throws:
      net.handle.hdllib.HandleException
    • scanHandles

      public void scanHandles(net.handle.hdllib.ScanCallback callback) throws net.handle.hdllib.HandleException
      Specified by:
      scanHandles in interface net.handle.hdllib.HandleStorage
      Throws:
      net.handle.hdllib.HandleException
    • scanNAs

      public void scanNAs(net.handle.hdllib.ScanCallback callback) throws net.handle.hdllib.HandleException
      Specified by:
      scanNAs in interface net.handle.hdllib.HandleStorage
      Throws:
      net.handle.hdllib.HandleException
    • getHandlesForNA

      public Enumeration<byte[]> getHandlesForNA(byte[] naHdl) throws net.handle.hdllib.HandleException
      Specified by:
      getHandlesForNA in interface net.handle.hdllib.HandleStorage
      Throws:
      net.handle.hdllib.HandleException
    • deleteAllRecords

      public void deleteAllRecords() throws net.handle.hdllib.HandleException
      Specified by:
      deleteAllRecords in interface net.handle.hdllib.HandleStorage
      Throws:
      net.handle.hdllib.HandleException
    • checkpointDatabase

      public void checkpointDatabase() throws net.handle.hdllib.HandleException
      Specified by:
      checkpointDatabase in interface net.handle.hdllib.HandleStorage
      Throws:
      net.handle.hdllib.HandleException
    • shutdown

      public void shutdown()
      Specified by:
      shutdown in interface net.handle.hdllib.HandleStorage