Class LayerManagerImpl

java.lang.Object
nl.knaw.dans.layerstore.LayerManagerImpl
All Implemented Interfaces:
LayerManager

public class LayerManagerImpl extends Object implements LayerManager
Default implementation of the LayerManager interface.
  • Constructor Details

    • LayerManagerImpl

      public LayerManagerImpl(@NonNull @NonNull Path stagingRoot, @NonNull @NonNull ArchiveProvider archiveProvider, @NonNull @NonNull LayerArchiver layerArchiver) throws IOException
      Creates a new LayerManagerImpl.
      Parameters:
      stagingRoot - the root directory for staging layers.
      archiveProvider - the archive provider to use.
      layerArchiver - the layer archiver to use.
      Throws:
      IOException - if the staging root directory cannot be created.
  • Method Details

    • newTopLayer

      public Layer newTopLayer() throws IOException
      Description copied from interface: LayerManager
      Closes the current top layer (if present) and creates a new top layer. The old top layer will be scheduled for archiving.
      Specified by:
      newTopLayer in interface LayerManager
      Throws:
      IOException
    • archive

      public void archive(Layer layer)
      Description copied from interface: LayerManager
      Request for the archiving of the given layer. The operation may be performed asynchronously, so the caller should check the layer's status to determine when the archiving is complete.
      Specified by:
      archive in interface LayerManager
      Parameters:
      layer - the layer to archive
    • listLayerIds

      public List<Long> listLayerIds() throws IOException
      Description copied from interface: LayerManager
      Lists all layer IDs that are currently managed.
      Specified by:
      listLayerIds in interface LayerManager
      Returns:
      a list of layer IDs
      Throws:
      IOException - if an I/O error occurs
    • getLayer

      public Layer getLayer(long id)
      Description copied from interface: LayerManager
      Returns the layer with the given id.
      Specified by:
      getLayer in interface LayerManager
      Parameters:
      id - the id of the layer
      Returns:
      the layer
    • getTopLayer

      public Layer getTopLayer()
      Description copied from interface: LayerManager
      Returns the current top layer.
      Specified by:
      getTopLayer in interface LayerManager
      Returns:
      the current top layer