Changeset 36996


Ignore:
Timestamp:
2022-12-08T13:02:17+13:00 (12 months ago)
Author:
davidb
Message:

Changes in response to testing out the retrieval of a document sub-section image

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  
    2828/bin/cp ../../build/gutil.jar packages/cantaloupe-$cversion/src/main/webapp/WEB-INF/lib/gutil.jar
    2929
     30echo "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
    3036echo
    3137echo "If first time run, or changes made to:"
  • gs3-extensions/iiif-servlet/trunk/src/README.txt

    r36955 r36996  
    66    ./COMPILE-CANTALOUPE.sh
    77
    8 Bump to cantaloupe 4.03
     8Bump to cantaloupe 4.03 (as some of the URLs of maven dependencies in the older version were no longer available)
    99
    1010
    1111http://localhost:8383/gs-cantaloupe/
    1212http://localhost:8383/gs-cantaloupe/admin
    13 
    1413http://localhost:8383/gs-cantaloupe/iiif/2
    1514
     
    1716http://localhost/gs-cantaloupe/iiif/2/<site>:<col>:<docid>/info.json
    1817
    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
     18http://localhost/gs-cantaloupe/iiif/2/<site>:<col>:<docid.subsection>/info.json
    2719
    2820
    29 =====
     21Add 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
     36Example 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
     42For 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
    3047
    3148
     
    4057     79      79    1405
    4158
     59
     60
     61
     62
     63=====
     64
    4265Might actually turn out to need to be:
    4366
     
    5073cp -i ./packages/tomcat/webapps/gs-cantaloupe/WEB-INF/classes/lib/jdbm.jar ./packages/tomcat/webapps/gs-cantaloupe/WEB-INF/lib/.
    5174popd
     75
     76
     77
     78=====
     79
     80# Deprecated
     81
     82The following is taken care of in ./PREPATE-AND-COMPILE-GSDL.sh
     83
     84cd $GSDL3SRCHOME
     85cp web/WEB-INF/lib/jdbm.jar packages/tomcat/webapps/gs-cantaloupe/WEB-INF/lib/.
     86
     87For 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  
    4545import org.w3c.dom.Node;
    4646
     47
     48
     49import java.io.StringWriter;
     50
     51//import javax.xml.parsers.DocumentBuilder;
     52//import javax.xml.parsers.DocumentBuilderFactory;
     53import javax.xml.transform.OutputKeys;
     54import javax.xml.transform.Transformer;
     55import javax.xml.transform.TransformerException;
     56import javax.xml.transform.TransformerFactory;
     57import javax.xml.transform.dom.DOMSource;
     58import javax.xml.transform.stream.StreamResult;
     59
     60
    4761/** a class the serve as a bridge between the Cantaloupe IIIF image server and
    4862 * Greenstone collections.  Loosely based on OAIServer
     
    159173    } // end of remote_init()
    160174
     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    }
    161190
    162191        public String doGetDocumentMessage(String identifier)
     
    191220        else
    192221        {
    193 
     222            //logger.info("***** DEBUG: xml_result");           
     223            //logger.info(nodeToString(xml_result));
     224             
    194225            //
    195226            // 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  
    187187    }
    188188
    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   
    190204    // ****
    191205    Element get_record_response = doc.createElement(GSXML.RESPONSE_ELEM);
     
    193207    get_record_response.appendChild(get_record);
    194208    Element record = doc.createElement(IIIFXML.RECORD);
     209
    195210    //compose the header element
    196211    record.appendChild(createHeaderElement(doc, oid));     
     212
    197213    //compose the metadata element
    198     record.appendChild(createMetadataElement(doc, info));
     214    record.appendChild(createMetadataElement(doc, info, top_level_info));
    199215    get_record.appendChild(record);
    200216    return get_record_response;
    201217  }
    202 
     218   
    203219   
    204220 /** create the metadata element used when processing GetRecord request
    205221   */
    206222
    207   protected Element createMetadataElement(Document doc, DBInfo info) {
     223  protected Element createMetadataElement(Document doc, DBInfo info, DBInfo top_level_info) {
    208224    // the <metadata> element
    209225    Element metadata_message = doc.createElement(IIIFXML.METADATA);
    210226
    211     addFirstMetadata(metadata_message, "assocfilepath", info);
     227    addFirstMetadata(metadata_message, "assocfilepath", top_level_info);
    212228    addFirstMetadata(metadata_message, "Image", info);
    213229   
Note: See TracChangeset for help on using the changeset viewer.