Changeset 36996
- Timestamp:
- 2022-12-08T13:02:17+13:00 (12 months ago)
- Location:
- gs3-extensions/iiif-servlet/trunk/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
gs3-extensions/iiif-servlet/trunk/src/PREPARE-GSDL-AND-COMPILE-CORE.sh
r36955 r36996 28 28 /bin/cp ../../build/gutil.jar packages/cantaloupe-$cversion/src/main/webapp/WEB-INF/lib/gutil.jar 29 29 30 echo "Topping up with jdbm.jar, xalan.jar and serializer.jar into Cantaloupe's webapps/WEB-INF/lib/ directory" 31 /bin/cp ../../web/WEB-INF/lib/jdbm.jar packages/cantaloupe-$cversion/src/main/webapp/WEB-INF/lib/. 32 # The follow two JAR files are only needed if debugging by serializing an XML Node to a string 33 /bin/cp ../../web/WEB-INF/lib/xalan.jar packages/cantaloupe-$cversion/src/main/webapp/WEB-INF/lib/. 34 /bin/cp ../../web/WEB-INF/lib/serializer.jar packages/cantaloupe-$cversion/src/main/webapp/WEB-INF/lib/. 35 30 36 echo 31 37 echo "If first time run, or changes made to:" -
gs3-extensions/iiif-servlet/trunk/src/README.txt
r36955 r36996 6 6 ./COMPILE-CANTALOUPE.sh 7 7 8 Bump to cantaloupe 4.03 8 Bump to cantaloupe 4.03 (as some of the URLs of maven dependencies in the older version were no longer available) 9 9 10 10 11 11 http://localhost:8383/gs-cantaloupe/ 12 12 http://localhost:8383/gs-cantaloupe/admin 13 14 13 http://localhost:8383/gs-cantaloupe/iiif/2 15 14 … … 17 16 http://localhost/gs-cantaloupe/iiif/2/<site>:<col>:<docid>/info.json 18 17 19 20 Add IIIFPMH service to collection 21 22 cp web/WEB-INF/lib/jdbm.jar packages/tomcat/webapps/gs-cantaloupe/WEB-INF/lib/. 23 24 http://atea.space:4343/gs-cantaloupe/iiif/2/intermuse:programmes:HASHc5edd00c6c45cc68ce9532/info.js 25 26 http://atea.space:4343/gs-cantaloupe/iiif/2/intermuse:programmes:HASHc5edd00c6c45cc68ce9532/full/full/0/default.jpg 18 http://localhost/gs-cantaloupe/iiif/2/<site>:<col>:<docid.subsection>/info.json 27 19 28 20 29 ===== 21 Add IIIFPMH service to collectionConfig.xml: 22 23 <serviceRack name="IIIFPMH"> 24 <setName>intermuseprogammes</setName> 25 <setDescription/><!-- uncomment the following and set the name attribute if 26 you want this collection to be part of a super set. --><!--<oaiSuperSet name="xxx"/>--> 27 <ListMetadataFormats><!--What metadata sets to support for this collection. You can select any set that is specified in OAIConfig.xml. To use a new set, you need to add a set definition in OAIConfig.xml, then reference it here, like: 28 <metadataFormat metadataPrefix="prefix"/> --> 29 <metadataFormat metadataPrefix="oai_dc"><!-- you can customize the mappings by adding elements in here. See resources/oai/OAIConfig.xml for the format--></metadataFormat> 30 </ListMetadataFormats> 31 </serviceRack> 32 33 (Note: the IIIF service was strongly based off OAIPMH) 34 35 36 Example IIIF image server requests: 37 38 http://localhost:8383/gs-cantaloupe/iiif/2/intermuse:programmes:HASHc5edd00c6c45cc68ce9532/info.js 39 http://localhost:8383/gs-cantaloupe/iiif/2/intermuse:programmes:HASHc5edd00c6c45cc68ce9532/full/full/0/default.jpg 40 41 42 For an image that is a sub-section: 43 44 http://localhost:8383/gs-cantaloupe/iiif/2/intermuse:programmes:HASHc5edd00c6c45cc68ce9532.1/info.js 45 46 http://localhost:8383/gs-cantaloupe/iiif/2/intermuse:programmes:HASHc5edd00c6c45cc68ce9532.1/full/full/0/default.jpg 30 47 31 48 … … 40 57 79 79 1405 41 58 59 60 61 62 63 ===== 64 42 65 Might actually turn out to need to be: 43 66 … … 50 73 cp -i ./packages/tomcat/webapps/gs-cantaloupe/WEB-INF/classes/lib/jdbm.jar ./packages/tomcat/webapps/gs-cantaloupe/WEB-INF/lib/. 51 74 popd 75 76 77 78 ===== 79 80 # Deprecated 81 82 The following is taken care of in ./PREPATE-AND-COMPILE-GSDL.sh 83 84 cd $GSDL3SRCHOME 85 cp web/WEB-INF/lib/jdbm.jar packages/tomcat/webapps/gs-cantaloupe/WEB-INF/lib/. 86 87 For debugging XML output as String: 88 89 cp web/WEB-INF/lib/xalan.jar packages/tomcat/webapps/gs-cantaloupe/WEB-INF/lib/. 90 91 cp web/WEB-INF/lib/serialeizer.jar packages/tomcat/webapps/gs-cantaloupe/WEB-INF/lib/. 92 93 94 ======= -
gs3-extensions/iiif-servlet/trunk/src/gsdl-src/java/org/greenstone/gsdl3/IIIFServerBridge.java
r32891 r36996 45 45 import org.w3c.dom.Node; 46 46 47 48 49 import java.io.StringWriter; 50 51 //import javax.xml.parsers.DocumentBuilder; 52 //import javax.xml.parsers.DocumentBuilderFactory; 53 import javax.xml.transform.OutputKeys; 54 import javax.xml.transform.Transformer; 55 import javax.xml.transform.TransformerException; 56 import javax.xml.transform.TransformerFactory; 57 import javax.xml.transform.dom.DOMSource; 58 import javax.xml.transform.stream.StreamResult; 59 60 47 61 /** a class the serve as a bridge between the Cantaloupe IIIF image server and 48 62 * Greenstone collections. Loosely based on OAIServer … … 159 173 } // end of remote_init() 160 174 175 // Based on: 176 // https://stackoverflow.com/questions/4412848/xml-node-to-string-in-java 177 178 private static String nodeToString(Node node) { 179 StringWriter sw = new StringWriter(); 180 try { 181 Transformer t = TransformerFactory.newInstance().newTransformer(); 182 t.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); 183 t.setOutputProperty(OutputKeys.INDENT, "yes"); 184 t.transform(new DOMSource(node), new StreamResult(sw)); 185 } catch (TransformerException te) { 186 System.out.println("nodeToString Transformer Exception"); 187 } 188 return sw.toString(); 189 } 161 190 162 191 public String doGetDocumentMessage(String identifier) … … 191 220 else 192 221 { 193 222 //logger.info("***** DEBUG: xml_result"); 223 //logger.info(nodeToString(xml_result)); 224 194 225 // 195 226 // All response elements are in the form (with a corresponding verb -
gs3-extensions/iiif-servlet/trunk/src/gsdl-src/java/org/greenstone/gsdl3/service/IIIFPMH.java
r32883 r36996 187 187 } 188 188 189 189 DBInfo top_level_info = null; 190 191 int subsection_dot = oid.indexOf("."); 192 193 if (subsection_dot > 0) { 194 // OID specifies document sub-section 195 // => Need to work out the top-level OID, as this is needed to retrieve assocfilepath 196 String root_oid = oid.substring(0,subsection_dot); 197 top_level_info = this.coll_db.getInfo(root_oid); 198 } 199 else { 200 top_level_info = info; 201 } 202 203 190 204 // **** 191 205 Element get_record_response = doc.createElement(GSXML.RESPONSE_ELEM); … … 193 207 get_record_response.appendChild(get_record); 194 208 Element record = doc.createElement(IIIFXML.RECORD); 209 195 210 //compose the header element 196 211 record.appendChild(createHeaderElement(doc, oid)); 212 197 213 //compose the metadata element 198 record.appendChild(createMetadataElement(doc, info ));214 record.appendChild(createMetadataElement(doc, info, top_level_info)); 199 215 get_record.appendChild(record); 200 216 return get_record_response; 201 217 } 202 218 203 219 204 220 /** create the metadata element used when processing GetRecord request 205 221 */ 206 222 207 protected Element createMetadataElement(Document doc, DBInfo info ) {223 protected Element createMetadataElement(Document doc, DBInfo info, DBInfo top_level_info) { 208 224 // the <metadata> element 209 225 Element metadata_message = doc.createElement(IIIFXML.METADATA); 210 226 211 addFirstMetadata(metadata_message, "assocfilepath", info);227 addFirstMetadata(metadata_message, "assocfilepath", top_level_info); 212 228 addFirstMetadata(metadata_message, "Image", info); 213 229
Note:
See TracChangeset
for help on using the changeset viewer.