Class CanvasService


@RequestScope @Component public class CanvasService extends AbstractResourceService
This service provides methods for creating Canvases. There should be a single instance of this service per request. The @RequestScope provides a single instance created and available during complete lifecycle of the HTTP request.
Author:
Michael Spalti mspalti@willamette.edu, Andrea Bollini (andrea.bollini at 4science.it)
  • Field Details

    • BITSTREAM_METADATA_FIELDS

      protected String[] BITSTREAM_METADATA_FIELDS
  • Constructor Details

    • CanvasService

      public CanvasService(org.dspace.services.ConfigurationService configurationService)
      Constructor.
      Parameters:
      configurationService - the DSpace configuration service.
  • Method Details

    • guessCanvasDimensions

      protected void guessCanvasDimensions(Context context, List<Bundle> bundles)
      Checks for "iiif.image.width" metadata in IIIF bundles. When bitstream metadata is not found for the first image in the bundle this method updates the default canvas dimensions for the request based on the actual image dimensions, using the IIIF image service. Called once for each manifest.
      Parameters:
      bundles - IIIF bundles for this item
    • getCanvas

      protected CanvasGenerator getCanvas(Context context, String manifestId, Bitstream bitstream, Bundle bundle, Item item, int count, String mimeType)
      Creates a single CanvasGenerator.
      Parameters:
      context - DSpace Context
      manifestId - manifest id
      bitstream - DSpace bitstream
      bundle - DSpace bundle
      item - DSpace item
      count - the canvas position in the sequence.
      mimeType - bitstream mimetype
      Returns:
      a canvas generator
    • getRangeCanvasReference

      protected CanvasGenerator getRangeCanvasReference(String startCanvas)
      Ranges expect the Canvas object to have only an identifier.
      Parameters:
      startCanvas - the start canvas identifier
      Returns:
      canvas generator