/[sdx]/sdx_v2/src/webapp/sdx/oai/harvest.xsp
ViewVC logotype

Contents of /sdx_v2/src/webapp/sdx/oai/harvest.xsp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.7 - (show annotations) (download)
Mon Aug 2 16:24:42 2004 UTC (19 years, 8 months ago) by jlecren
Branch: MAIN
CVS Tags: V_23_BETA1, V_23_FINAL, HEAD
Changes since 1.6: +9 -2 lines
change ComponentManager to ServiceManager

1 <?xml version="1.0" encoding="UTF-8"?>
2 <xsp:page language="java" xmlns:xsp="http://apache.org/xsp" xmlns:util="http://www.apache.org/1999/XSP/Util" xmlns:oai="http://www.culture.gouv.fr/ns/oai/">
3 <xsp:structure>
4 <xsp:include>fr.gouv.culture.oai.*</xsp:include>
5 <xsp:include>fr.gouv.culture.sdx.framework.Framework</xsp:include>
6 <xsp:include>fr.gouv.culture.sdx.framework.FrameworkImpl</xsp:include>
7 <xsp:include>fr.gouv.culture.sdx.application.Application</xsp:include>
8 <xsp:include>fr.gouv.culture.sdx.documentbase.DocumentBase</xsp:include>
9 <xsp:include>fr.gouv.culture.sdx.utils.Utilities</xsp:include>
10 <xsp:include>org.apache.cocoon.xml.IncludeXMLConsumer</xsp:include>
11 <xsp:include>fr.gouv.culture.sdx.exception.SDXException</xsp:include>
12 <xsp:include>fr.gouv.culture.sdx.exception.SDXExceptionCode</xsp:include>
13 <xsp:include>org.apache.avalon.framework.service.ServiceManager</xsp:include>
14 <xsp:include>org.apache.avalon.framework.service.WrapperServiceManager</xsp:include>
15 </xsp:structure>
16 <xsp:init-page>
17 <xsp:logic>
18 ServiceManager cocoon_serviceManager = new WrapperServiceManager(manager);
19 </xsp:logic>
20 </xsp:init-page>
21 <oai:harvest>
22 <xsp:logic>
23 try{
24 FrameworkImpl frame = (FrameworkImpl) cocoon_serviceManager.lookup(Framework.ROLE);
25 OAIComponentImpl oaiComp = (OAIComponentImpl) cocoon_serviceManager.lookup(OAIComponent.ROLE);
26
27 OAIHarvester oaiHarv = null;
28 String harvApp = "sdxtest2";//TODO: allow user input to choose APP to which harvesting xml will be directed
29 String harvBase = "sdxworld";//TODO: allow user input to choose BASE to which harvesting xml will be directed
30 if (Utilities.checkString(harvApp ) &amp;&amp; Utilities.checkString(harvBase ))
31 {
32 Application appli = null;
33 DocumentBase docbase = null;
34
35 if (frame != null)
36 appli = frame.getApplicationByPath(harvApp);
37 //appli = frame.getApplicationById(harvApp);
38
39 if (appli != null)
40 docbase = appli.getDocumentBase(harvBase);
41 if (docbase != null)
42 oaiHarv = docbase.getOAIHarvester();
43
44 if (oaiComp != null)
45 {
46
47 //TODO:the below links could be to any oai repository
48 String requestUrl = null;
49 requestUrl = "http://localhost:8080/sdx/sdx/oai/sdxtest/sdxworld?verb=ListRecords&amp;metadataPrefix=oai_dc";
50 //an external source
51 //requestUrl = "http://memory.loc.gov/cgi-bin/oai2_0?verb=GetRecord&amp;metadataPrefix=oai_dc&amp;identifier=oai%3Alcoa1.loc.gov%3Ahttp%3A%2F%2Fhdl.loc.gov.%2Floc.pnp%2Fppmsca.02282";
52 //an external error generating source
53 //requestUrl = "http://memory.loc.gov/cgi-bin/oai2_0?verb=GetRecord&amp;identifier=oai%3Alcoa1.loc.gov%3Ahttp%3A%2F%2Fhdl.loc.gov.%2Floc.pnp%2Fppmsca.02282";
54 //setting the consumer of the harvester to be this xsp page
55 oaiHarv.setConsumer(new IncludeXMLConsumer(this.contentHandler));
56 //setting up the harvester to receive the events from the requestUrl
57 oaiComp.receiveResponse(requestUrl, oaiHarv, "identifier");//TODO: allow user input here for "identifier" variable
58
59
60 /*TODO:
61 *OAI-PMH harvesters should follow the standard practices for HTTP robotic agents.
62 *In particular, they should supply HTTP User-Agent and From headers. The User-Agent
63 *header field should contain information about the user agent originating the request,
64 *it is described in section 14.43 of the HTTP specification. The From header field
65 *should contain an Internet e-mail address for the human user who controls the harvested,
66 *it is is described in section 14.22 of the HTTP specification. The email address in the
67 *From header will provide a point of contact if there is some problem created by the harvester.
68 */
69
70 /*TODO:
71 *Harvesters wishing to harvest with finer than day granularity must examine the &lt;granularity&gt;
72 *element in the Identify response. Repositories will issue a badGranularity error if from and until
73 *parameters are issued with finer granularity than is supported.
74
75 *Items in a repository may change or be added during a harvest, or after a harvest within the same
76 *datestamp (i.e. the same day if the datestamp is YYYY-MM-DD). This means that to incrementally harvest
77 *from a repository, a harvester should overlap successive incremental harvests by one datestamp increment
78 *(i.e. one day if the granularity is YYYY-MM-DD). Furthermore, since it is repository implementation dependent
79 *whether changes that occur during the harvest will be reflected in the response, the from argument of the next
80 *incremental harvest should be based on the the responseDate returned in the first partial-list response of a sequence.
81 *When harvesting from repositories which use a datestamp granularity of one second, it is advisable to overlap by a small
82 *additional amount to account for any discrepancy between the reported responseDate and the time at the repository when any
83 *search necessary to answer the request was performed.
84 */
85
86 /*TODO: steps
87 *Issue an Identify request to find the finest datestamp granularity supported.
88 *Issue a ListMetadataFormats request to obtain a list of all metadataPrefixes supported.
89 *Harvest using ListRecords requests for each metadataPrefix supported. Knowledge of the
90 datestamp granularity allows for less overlap if granularities finer than a day are supported.
91 *Set structure can be inferred from the setSpec elements in the header blocks of each record
92 returned (consistency checks are possible).
93 *Items may be reconstructed from the constituent records. Local datestamps must be assigned
94 to harvested items.
95 *Provenance and other information in &lt;about&gt; blocks may be re-assembled at the item level if
96 it is the same for all metadata formats harvested. However, this information may be supplied
97 differently for different metadata formats and may thus need to be store separately for each
98 metadata format.
99 */
100 //sending events to the consumer of the harvester, this.contentHandler
101 oaiHarv.sendPastHarvestsSummary();
102 oaiHarv.sendStoredHarvestingRequests();
103 }
104 }
105
106 } catch (SDXException e){
107 e.toSAX(this.contentHandler);
108 } catch (Exception e){
109 String[] args = {"An exception terminated the process"};
110 new SDXException(null, SDXExceptionCode.ERROR_GENERIC, args , e).toSAX(this.contentHandler);
111 }
112 </xsp:logic>
113 </oai:harvest>
114 </xsp:page>

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26