Class AnnotationImageResolver
java.lang.Object
com.levigo.jadice.web.server.annotation.AnnotationImageResolver
The AnnotationImageResolver maps specific AnnotationProfiles onto appropriate
AnnotationImageProvider
s. Therefore providers can be registered and requested by their
annotation profile name.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic com.levigo.jadice.document.io.SeekableInputStream
getAnnotationImage
(String annotationProfileName, String annotationImageID) Obtains a image for a givenAnnotationProfile
and image identifer.static boolean
registerAnnotationImageProvider
(String annotationProfileName, AnnotationImageProvider annotationImageProvider) Registers aAnnotationImageProvider
for a given AnnotationProfile.
-
Constructor Details
-
AnnotationImageResolver
public AnnotationImageResolver()
-
-
Method Details
-
getAnnotationImage
public static com.levigo.jadice.document.io.SeekableInputStream getAnnotationImage(String annotationProfileName, String annotationImageID) throws IllegalStateException, IOException Obtains a image for a givenAnnotationProfile
and image identifer.- Parameters:
annotationProfileName
- the name of the annotation profile.annotationImageID
- the id of the requested image- Returns:
- the appropriate
AnnotationImageProvider
. - Throws:
NullPointerException
- if the argument wasnull
.IllegalStateException
- if no appropriateAnnotationImageProvider
was found.IOException
- if the image couldn't be loaded/obtained.
-
registerAnnotationImageProvider
public static boolean registerAnnotationImageProvider(String annotationProfileName, AnnotationImageProvider annotationImageProvider) throws IllegalArgumentException Registers aAnnotationImageProvider
for a given AnnotationProfile. Multiple registrations for the same profile will result in nothing happening.- Parameters:
annotationProfileName
- the name of the annotation profile.annotationImageProvider
- the appropriate annotation image provider.- Returns:
true
if added successfully, elsefalse
- Throws:
NullPointerException
- if the given profile name or annotation image provider wasnull
.IllegalArgumentException
-