Changeset 27671

Show
Ignore:
Timestamp:
20.06.2013 13:16:02 (6 years ago)
Author:
kjdon
Message:

added a couple of methods to get soem extra xml for the identify request

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/OAIXML.java

    r26096 r27671  
    7878    public static final String USE_STYLESHEET = "useOAIStylesheet"; 
    7979    public static final String STYLESHEET = "OAIStylesheet"; 
    80     // words used to compose oai responses 
     80   
     81    // words used to compose oai responses and read in OAIConfig.xml 
    8182    public static final String ADMIN_EMAIL = "adminEmail"; 
    8283    public static final String BAD_ARGUMENT = "badArgument"; 
     
    104105    public static final String ILLEGAL_OAI_VERB = "Illegal OAI verb"; 
    105106    public static final String INDEX_STEM = "indexStem"; 
     107  public static final String INFO_METADATA = "Metadata"; // this has capital M 
    106108    public static final String LASTMODIFIED = "lastmodified"; 
    107109    public static final String MAPPING = "mapping"; 
     
    117119    public static final String OAIPMH = "OAIPMH"; 
    118120    public static final String OAI_RESUMPTION_TOKENS = "OAIResumptionTokens"; 
     121    public static final String OAI_INFO = "oaiInfo"; 
    119122    public static final String OAI_SERVICE = "oaiService"; 
    120123    public static final String OAI_SET_LIST = "oaiSetList"; 
     
    127130    public static final String REQUEST = "request"; 
    128131    public static final String REPOSITORY_NAME = "repositoryName"; 
     132    public static final String REPOSITORY_ID = "repositoryId"; 
    129133    public static final String RESPONSE = "response"; 
    130134    public static final String RESPONSE_DATE = "responseDate"; 
     
    620624        return duplicate; 
    621625    } 
    622      
     626 
    623627    public static void copyElement(Element to, Element from, String elem_name) { 
    624628       
     
    633637      } 
    634638    } 
     639 
    635640    public static HashMap<String, String> getParamMap(NodeList params) { 
    636641      HashMap<String, String> map = new HashMap<String, String>(); 
     
    643648      return map; 
    644649    } 
     650 
     651 
    645652    /** Parse an XML document from a given file */ 
    646653    static public Document parseXMLFile (File xml_file) { 
     
    678685        return document; 
    679686    } 
    680      
     687 
    681688    /** Parse an XML document from a given reader */ 
    682689    static public Document parseXML (Reader xml_reader) { 
     
    733740     
    734741 
     742  public static Element createOAIIdentifierXML(String repository_id, String sample_collection, String sample_doc_id) { 
     743    String xml = "<oai-identifier xmlns=\"http://www.openarchives.org/OAI/2.0/oai-identifier\"\n xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n xsi:schemaLocation=\"http://www.openarchives.org/OAI/2.0/oai-identifier\n http://www.openarchives.org/OAI/2.0/oai-identifier.xsd\">\n <scheme>oai</scheme>\n<repositoryIdentifier>" + repository_id + "</repositoryIdentifier>\n<delimiter>:</delimiter>\n<sampleIdentifier>oai:"+repository_id+":"+sample_collection+":"+sample_doc_id+"</sampleIdentifier>\n</oai-identifier>"; 
     744 
     745    Document xml_doc = new XMLConverter().getDOM(xml); 
     746    return (Element)response_doc.importNode(xml_doc.getDocumentElement(), true); 
     747     
     748 
     749  } 
     750 
     751  public static Element createGSDLElement() { 
     752    String xml = "<gsdl xmlns=\"http://www.greenstone.org/namespace/gsdl_oaiinfo/1.0/gsdl_oaiinfo\"\n xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n xsi:schemaLocation=\"http://www.greenstone.org/namespace/gsdl_oaiinfo/1.0/gsdl_oaiinfo\n   http://www.greenstone.org/namespace/gsdl_oaiinfo/1.0/gsdl_oaiinfo.xsd\"></gsdl>"; 
     753    Document xml_doc = new XMLConverter().getDOM(xml); 
     754    return (Element)response_doc.importNode(xml_doc.getDocumentElement(), true); 
     755     
     756 
     757  } 
    735758} 
    736759