Package org.dspace.app.iiif.service
Class CanvasService
- java.lang.Object
-
- org.dspace.app.iiif.service.AbstractResourceService
-
- org.dspace.app.iiif.service.CanvasService
-
@RequestScope @Component public class CanvasService extends AbstractResourceService
This service provides methods for creatingCanvases. There should be a single instance of this service per request. The@RequestScopeprovides 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 Summary
Fields Modifier and Type Field Description protected String[]BITSTREAM_METADATA_FIELDS-
Fields inherited from class org.dspace.app.iiif.service.AbstractResourceService
BITSTREAM_PATH_PREFIX, CLIENT_URL, DEFAULT_CANVAS_HEIGHT, DEFAULT_CANVAS_WIDTH, defaultCanvasHeightFallback, defaultCanvasWidthFallback, DOCUMENT_VIEWING_HINT, IIIF_ENDPOINT, IIIF_LOGO_IMAGE, IMAGE_PATH, IMAGE_SERVICE, SEARCH_URL, THUMBNAIL_PATH
-
-
Constructor Summary
Constructors Constructor Description CanvasService(org.dspace.services.ConfigurationService configurationService)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected CanvasGeneratorgetCanvas(Context context, String manifestId, Bitstream bitstream, Bundle bundle, Item item, int count, String mimeType)Creates a singleCanvasGenerator.protected CanvasGeneratorgetRangeCanvasReference(String startCanvas)Ranges expect the Canvas object to have only an identifier.protected voidguessCanvasDimensions(Context context, List<Bundle> bundles)Checks for "iiif.image.width" metadata in IIIF bundles.-
Methods inherited from class org.dspace.app.iiif.service.AbstractResourceService
getManifestId, setConfiguration, setDefaultCanvasDimensions
-
-
-
-
Field Detail
-
BITSTREAM_METADATA_FIELDS
protected String[] BITSTREAM_METADATA_FIELDS
-
-
Method Detail
-
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 singleCanvasGenerator.- Parameters:
context- DSpace ContextmanifestId- manifest idbitstream- DSpace bitstreambundle- DSpace bundleitem- DSpace itemcount- 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
-
-