1 | package edu.illinois.library.cantaloupe.resource.iiif.v2;
|
---|
2 |
|
---|
3 | import edu.illinois.library.cantaloupe.RestletApplication;
|
---|
4 | import edu.illinois.library.cantaloupe.cache.CacheFacade;
|
---|
5 | import edu.illinois.library.cantaloupe.config.Configuration;
|
---|
6 | import edu.illinois.library.cantaloupe.config.Key;
|
---|
7 | import edu.illinois.library.cantaloupe.image.Format;
|
---|
8 | import edu.illinois.library.cantaloupe.image.Identifier;
|
---|
9 | import edu.illinois.library.cantaloupe.image.Info;
|
---|
10 | import edu.illinois.library.cantaloupe.image.MediaType;
|
---|
11 | import edu.illinois.library.cantaloupe.operation.OperationList;
|
---|
12 | import edu.illinois.library.cantaloupe.processor.Processor;
|
---|
13 | import edu.illinois.library.cantaloupe.processor.ProcessorFactory;
|
---|
14 | import edu.illinois.library.cantaloupe.processor.UnsupportedOutputFormatException;
|
---|
15 | import edu.illinois.library.cantaloupe.processor.UnsupportedSourceFormatException;
|
---|
16 | import edu.illinois.library.cantaloupe.source.Source;
|
---|
17 | import edu.illinois.library.cantaloupe.source.SourceFactory;
|
---|
18 | import edu.illinois.library.cantaloupe.processor.ProcessorConnector;
|
---|
19 | import edu.illinois.library.cantaloupe.resource.CachedImageRepresentation;
|
---|
20 | import edu.illinois.library.cantaloupe.resource.IllegalClientArgumentException;
|
---|
21 | import edu.illinois.library.cantaloupe.resource.ImageRepresentation;
|
---|
22 | import edu.illinois.library.cantaloupe.resource.iiif.SizeRestrictedException;
|
---|
23 | import org.restlet.data.Disposition;
|
---|
24 | import org.restlet.representation.Representation;
|
---|
25 | import org.restlet.representation.StringRepresentation;
|
---|
26 | import org.restlet.resource.Get;
|
---|
27 |
|
---|
28 | import java.awt.Dimension;
|
---|
29 | import java.io.IOException;
|
---|
30 | import java.io.InputStream;
|
---|
31 | import java.nio.file.Files;
|
---|
32 | import java.nio.file.NoSuchFileException;
|
---|
33 | import java.nio.file.Path;
|
---|
34 | import java.util.List;
|
---|
35 | import java.util.Map;
|
---|
36 | import java.util.Set;
|
---|
37 |
|
---|
38 | import org.greenstone.gsdl3.IIIFServerBridge;
|
---|
39 |
|
---|
40 |
|
---|
41 | public class IdentifierToGSAssocfile {
|
---|
42 |
|
---|
43 | public static Identifier createIdentifierImage(Identifier identifier) throws Exception
|
---|
44 | {
|
---|
45 | String identifier_str = identifier.toString();
|
---|
46 | String[] strs = identifier_str.split(":", 3);
|
---|
47 | if(strs == null || strs.length < 3) {
|
---|
48 | System.err.println("identifier is not in the form site:coll:id" + identifier_str);
|
---|
49 | return null;
|
---|
50 | }
|
---|
51 | String site_name = strs[0];
|
---|
52 | String coll_name = strs[1];
|
---|
53 | String doc_id = strs[2];
|
---|
54 |
|
---|
55 | // Move into Constructor ???
|
---|
56 | IIIFServerBridge gs_iiif_bridge = new IIIFServerBridge();
|
---|
57 | // and keep cache of of bridges in hashmap, keyed on sitename??
|
---|
58 | gs_iiif_bridge.init(site_name);
|
---|
59 |
|
---|
60 | String collect_image_filename = gs_iiif_bridge.doGetDocumentMessage(coll_name + ":" + doc_id);
|
---|
61 | String site_image_filename = site_name + "/collect/" + coll_name + "/index/assoc/" + collect_image_filename;
|
---|
62 |
|
---|
63 | //System.err.println("**** Greenstone site image filename = " + site_image_filename);
|
---|
64 |
|
---|
65 | final Identifier identifier_image = new Identifier(site_image_filename);
|
---|
66 | //System.err.println("***** identifier_image = " + identifier_image);
|
---|
67 |
|
---|
68 |
|
---|
69 | return identifier_image;
|
---|
70 | }
|
---|
71 |
|
---|
72 |
|
---|
73 | }
|
---|