Mercurial > hg > eSciDocMPIWGServicesRestlet
changeset 4:938e45fabd7c default tip
version f?r escidoc produktionsversion
author | dwinter |
---|---|
date | Wed, 25 Jul 2012 12:36:25 +0200 |
parents | 498b68667ff3 |
children | |
files | src/de/mpiwg/itgroup/escidoc/MPIWGServices/Restlet/RestServer.java src/de/mpiwg/itgroup/escidoc/MPIWGServices/Restlet/services/redirect/DisplayRedirector.java src/de/mpiwg/itgroup/escidoc/MPIWGServices/Restlet/services/redirect/DocuviewerRedirector.java src/de/mpiwg/itgroup/escidoc/MPIWGServices/Restlet/services/redirect/ECHORedirector.java src/de/mpiwg/itgroup/escidoc/MPIWGServices/Restlet/services/search/SimpleSearch.java src/de/mpiwg/itgroup/escidoc/MPIWGServices/Restlet/staticPages/searchResult.xsl |
diffstat | 6 files changed, 81 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/src/de/mpiwg/itgroup/escidoc/MPIWGServices/Restlet/RestServer.java Fri Apr 20 15:55:51 2012 +0200 +++ b/src/de/mpiwg/itgroup/escidoc/MPIWGServices/Restlet/RestServer.java Wed Jul 25 12:36:25 2012 +0200 @@ -41,13 +41,13 @@ router.attach("/container/{escidocId}",DisplayContainer.class); router.attach("/resultOverview.css",ResultOverviewCSS.class); router.attach("/docuview/{flavour}/{escidocId}",DocuviewerRedirector.class); // redirected zur ECHO Seite, diese redirected eventuell, direct wieder - router.attach("/echo/{escidocId}",ECHORedirector.class); // redirected zur ECHO Seite, diese redirected eventuell, direct wieder + router.attach("/echo/{escidocId}",ECHORedirector.class); // redirected zur ECHO Seite, diese redirected eventuell, direct wieder, deprecated should use DocuviewerRedirector router.attach("/display/{escidocId}",DisplayRedirector.class); // redirected zur display_url die in ECHO angegeben ist, wenn dort keine steht dann wird der image ordner im generischen viewer angezeigt router.attach("/metadata/{escidocId}",IndexMetaRedirector.class); // zeigt die in ESCIDOC abegespeicherten index_meta an router.attach("/metadata/{escidocId}/origRef",OrigRefRedirector.class); // zeigt die original Quelle der Metadaten an, in der Regel das IndexMeta file auf der Foxridge //router.attach("/{escidocId}",ECHORedirector.class); // redirected zur webseite die in echo angebeben ist router.attach("/{escidocId}",EScidocRedirector.class); // redirected zur webseite die in echo angebeben ist - router.attach("/{escidocId}/images",DigilibRedirector.class); // zeigt den image ordner im digilib standard display an + //router.attach("/{escidocId}/images",DigilibRedirector.class); // zeigt den image ordner im digilib standard display an return router; } }
--- a/src/de/mpiwg/itgroup/escidoc/MPIWGServices/Restlet/services/redirect/DisplayRedirector.java Fri Apr 20 15:55:51 2012 +0200 +++ b/src/de/mpiwg/itgroup/escidoc/MPIWGServices/Restlet/services/redirect/DisplayRedirector.java Wed Jul 25 12:36:25 2012 +0200 @@ -2,7 +2,10 @@ import java.io.IOException; - +@Deprecated +/* + * Should used DocuviewerRedirector + */ public class DisplayRedirector extends ComponentURLRedirector { public DisplayRedirector() throws IOException {
--- a/src/de/mpiwg/itgroup/escidoc/MPIWGServices/Restlet/services/redirect/DocuviewerRedirector.java Fri Apr 20 15:55:51 2012 +0200 +++ b/src/de/mpiwg/itgroup/escidoc/MPIWGServices/Restlet/services/redirect/DocuviewerRedirector.java Wed Jul 25 12:36:25 2012 +0200 @@ -162,6 +162,13 @@ Element item = (Element)xp.selectSingleNode(doc); String path = item.getTextTrim(); path= ECHORessource.correct(path); // nur pfad nach online + if (path.equals("")){ + xp= EScidocTools.getESciDocXpath("//metadataRecords:md-record[@xlink:title='mpiwg-admin']/mpiwg:admin/mpiwg:archivePath"); + item = (Element)xp.selectSingleNode(doc); + path = item.getTextTrim(); + path= ECHORessource.correct(path); // nur pfad nach online + path=path+"/pageimg"; + } viewerUrl=String.format(viewerWithImagePathFormatString, path); } catch (Exception e) { setStatus(Status.SERVER_ERROR_INTERNAL);
--- a/src/de/mpiwg/itgroup/escidoc/MPIWGServices/Restlet/services/redirect/ECHORedirector.java Fri Apr 20 15:55:51 2012 +0200 +++ b/src/de/mpiwg/itgroup/escidoc/MPIWGServices/Restlet/services/redirect/ECHORedirector.java Wed Jul 25 12:36:25 2012 +0200 @@ -3,7 +3,10 @@ import java.io.IOException; - +@Deprecated +/* + * Should used DocuviewerRedirector + */ public class ECHORedirector extends ComponentURLRedirector{ public ECHORedirector() throws IOException {
--- a/src/de/mpiwg/itgroup/escidoc/MPIWGServices/Restlet/services/search/SimpleSearch.java Fri Apr 20 15:55:51 2012 +0200 +++ b/src/de/mpiwg/itgroup/escidoc/MPIWGServices/Restlet/services/search/SimpleSearch.java Wed Jul 25 12:36:25 2012 +0200 @@ -43,11 +43,14 @@ public class SimpleSearch extends ServerResource{ + private String eScidocServer; private String eScidocPort; private Logger logger= Logger.getRootLogger(); private String eScidocUser; private String eScidocUserPW; + + private String SEARCH_CMM="escidoc:131281"; //TODO: make this configurable, also a list of CMM should be possible public SimpleSearch() throws IOException{ InputStream is = getClass().getResourceAsStream("/de/mpiwg/itgroup/escidoc/MPIWGServices/Restlet/config/eScidocServer.config"); @@ -113,20 +116,24 @@ String queryString =""; Boolean isSearch=false; if (searchAll!=null && !searchAll.equals("")){ - queryString="escidoc.metadata="+searchAll; + queryString="metadata="+searchAll; isSearch=true; } else if (searchTitle!=null && !searchTitle.equals("")){ - queryString="escidoc.any-title="+searchTitle; + queryString="any-title="+searchTitle; + queryString+=" or meta.archimedes.title="+searchTitle; + queryString+=" or meta.bib.title="+searchTitle; isSearch=true; } else if (searchAuthor!=null && !searchAuthor.equals("")){ - queryString="escidoc.creator="+searchAuthor; + queryString="dc-md.creator="+searchAuthor; + queryString+=" or meta.archimedes.author="+searchAuthor; + queryString+=" or meta.bib.author="+searchAuthor; isSearch=true; } if (!isSearch) return null; String query; try { - query = "/srw/search/escidoc_all?maximumRecords=1000&query="+URLEncoder.encode(queryString,"utf-8"); + query = "/srw/search/escidoc_all?maximumRecords=1000&query="+URLEncoder.encode("content-model.objid="+SEARCH_CMM+" and "+ queryString,"utf-8"); } catch (UnsupportedEncodingException e) { logger.error("do Search, cannot encode:"+queryString); setStatus(Status.SERVER_ERROR_INTERNAL); @@ -179,8 +186,14 @@ //logger.debug(printXML(doc)); Document docresult = out.getDocument(); + + + return new StringRepresentation(printXML(docresult),MediaType.TEXT_HTML); + + + } catch (Exception e) { logger.trace(e); return new StringRepresentation("<error>error</error>");
--- a/src/de/mpiwg/itgroup/escidoc/MPIWGServices/Restlet/staticPages/searchResult.xsl Fri Apr 20 15:55:51 2012 +0200 +++ b/src/de/mpiwg/itgroup/escidoc/MPIWGServices/Restlet/staticPages/searchResult.xsl Wed Jul 25 12:36:25 2012 +0200 @@ -27,35 +27,51 @@ <xsl:template match="search-result:search-result-record"> <div class="searchResultRecord"> <div class="result escidocId"> + <a><xsl:attribute name="href"> + ./<xsl:value-of select=".//prop:latest-version/@objid"/> + </xsl:attribute> <xsl:value-of select=".//prop:latest-version/@objid"/> + </a> </div> <xsl:apply-templates select=".//srel:context"/> <xsl:apply-templates select=".//search-result:text-fragment-data"/> - <xsl:apply-templates select="(escidocItem:item[escidocItem:properties/srel:content-model[@objid='escidoc:11003']]) | (container:container)" mode="content"/> + <!-- <xsl:apply-templates select="(escidocItem:item[escidocItem:properties/srel:content-model[@objid='escidoc:11003']]) | (container:container)" mode="content"/> <xsl:apply-templates select="(escidocItem:item[escidocItem:properties/srel:content-model[@objid='escidoc:13001']]) | (container:container)" mode="content"/> + --> + <xsl:apply-templates select="(escidocItem:item) | (container:container)" mode="content"/> </div> </xsl:template> <xsl:template match="escidocItem:item" mode="content"> <div class="result displayType">Item</div> <xsl:apply-templates select=".//dc-md" mode="dc"/> + <xsl:apply-templates select=".//bib" mode="bib"/> + <xsl:apply-templates select=".//archimedes" mode="archimedes"/> + <div class="result showEntry"><a><xsl:attribute name="href"><xsl:value-of select=".//escidocComponents:component[escidocComponents:properties/prop:content-category[text()='web_page']]/escidocComponents:content/@xlink:href"/> </xsl:attribute>web</a></div> <div class="result showEntry"> <a><xsl:attribute name="href"> - ./<xsl:value-of select=".//prop:latest-version/@objid"/>/indexMeta - </xsl:attribute>metaData</a><br/> + ./metadata/<xsl:value-of select=".//prop:latest-version/@objid"/> + </xsl:attribute>metaData</a> + </div> + <div class="result showEntry"> <a><xsl:attribute name="href"> - ./<xsl:value-of select=".//prop:latest-version/@objid"/>/origRef - </xsl:attribute>md-fox</a><a><xsl:attribute name="href"> - ./<xsl:value-of select=".//prop:latest-version/@objid"/>/origRef?mode=html - </xsl:attribute>(html)</a> + ./docuview/echo/<xsl:value-of select=".//prop:latest-version/@objid"/> + </xsl:attribute>echoViewer</a> </div> - <div class="result showEntry"><a><xsl:attribute name="href"> - ./<xsl:value-of select=".//prop:latest-version/@objid"/>/display - </xsl:attribute>display</a></div> + <div class="result showEntry"> + <a><xsl:attribute name="href"> + ./docuview/libcoll/<xsl:value-of select=".//prop:latest-version/@objid"/> + </xsl:attribute>libcollViewer</a> + </div> + <div class="result showEntry"> + <a><xsl:attribute name="href"> + ./docuview/digilib/<xsl:value-of select=".//prop:latest-version/@objid"/> + </xsl:attribute>digilib</a> + </div> <xsl:apply-templates select=".//dc-md/dc:description" mode="dc"/> </xsl:template> @@ -74,7 +90,7 @@ <xsl:template match="srel:context"> <xsl:if test="@objid='escidoc:1001'"><div class="result searchLogo"><img height="40px" src="http://echo.mpiwg-berlin.mpg.de/home/img/echo_sm.gif"/></div></xsl:if> - <xsl:if test="@objid='escidoc:12001'"><div class="result searchLogo"><img height="40px" src="http://www.mpiwg-berlin.mpg.de/en/images/logo.png"/></div></xsl:if> + <xsl:if test="@objid='escidoc:130375'"><div class="result searchLogo"><img alt="index.meta" height="40px" src="http://www.mpiwg-berlin.mpg.de/en/images/logo.png"/></div></xsl:if> <xsl:if test="@objid='escidoc:40001'"><div class="result searchLogo"><img height="40px" src="http://libcoll.mpiwg-berlin.mpg.de/lib_coll_image"/></div></xsl:if> </xsl:template> <xsl:template match="dc-md" mode="dc"> @@ -87,6 +103,26 @@ <!-- <div class="result resultDescription"><xsl:value-of select="dc:description"/> </div>--> </xsl:template> + <xsl:template match="bib" mode="bib"> + + <div class="result resultTitle"><xsl:value-of select="title"/> </div> + <div class="result resultAuthor"><xsl:value-of select="author"/> </div> + <!-- <div class="result resultYear"><xsl:value-of select="dc:year"/> </div> + <div class="result resultDate"><xsl:value-of select="dc:date"/> </div>--> + <div class="result resultYear"><xsl:value-of select="year"/> </div> + <!-- <div class="result resultDescription"><xsl:value-of select="dc:description"/> </div>--> + </xsl:template> + + <xsl:template match="archimedes" mode="archimedes"> + + <div class="result resultTitle"><xsl:value-of select="title"/> </div> + <div class="result resultAuthor"><xsl:value-of select="author"/> </div> + <!-- <div class="result resultYear"><xsl:value-of select="dc:year"/> </div> + <div class="result resultDate"><xsl:value-of select="dc:date"/> </div>--> + <div class="result resultYear"><xsl:value-of select="year"/> </div> + <!-- <div class="result resultDescription"><xsl:value-of select="dc:description"/> </div>--> + </xsl:template> + <xsl:template match="dc:description" mode="dc"> <div class="result resultDescription"><xsl:value-of select="."/> </div> </xsl:template>