public class OpenSearchServiceImpl extends Object implements OpenSearchService, org.springframework.beans.factory.InitializingBean
OpenSearch is a specification for describing and advertising search-engines and their result formats. Commonly, RSS and Atom formats are used, which the current implementation supports, as is HTML (used directly in browsers). NB: this is baseline OpenSearch, no extensions currently supported.
The value of the "scope" parameter should either be absent (which means no scope restriction), or the handle of a community or collection.
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
enabled |
protected List<String> |
formats |
protected HandleService |
handleService |
protected String |
osNs |
protected String |
svcUrl |
protected String |
uiUrl |
| Modifier | Constructor and Description |
|---|---|
protected |
OpenSearchServiceImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet() |
String |
getContentType(String format)
Returns a mime-type associated with passed format
|
String |
getDescription(String scope)
Returns OpenSearch Servic Document as a string
|
Document |
getDescriptionDoc(String scope)
Returns the OpenSearch service document appropriate for given scope
|
List<String> |
getFormats()
Returns list of supported formats
|
protected SyndicationFeed |
getResults(Context context,
String format,
String query,
int totalResults,
int start,
int pageSize,
DSpaceObject scope,
DSpaceObject[] results,
Map<String,String> labels) |
Document |
getResultsDoc(Context context,
String format,
String query,
int totalResults,
int start,
int pageSize,
DSpaceObject scope,
DSpaceObject[] results,
Map<String,String> labels)
Returns a formatted set of search results as a document
|
String |
getResultsString(Context context,
String format,
String query,
int totalResults,
int start,
int pageSize,
DSpaceObject scope,
DSpaceObject[] results,
Map<String,String> labels)
Returns a formatted set of search results as a string
|
protected org.jdom.Document |
getServiceDocument(String scope)
Returns as a document the OpenSearch service document
|
protected Document |
jDomToW3(org.jdom.Document jdomDoc)
Converts a JDOM document to a W3C one
|
protected com.sun.syndication.feed.module.opensearch.OpenSearchModule |
openSearchMarkup(String query,
int totalResults,
int start,
int pageSize) |
DSpaceObject |
resolveScope(Context context,
String scope) |
protected boolean enabled
protected final String osNs
protected String uiUrl
protected String svcUrl
@Autowired(required=true) protected HandleService handleService
public void afterPropertiesSet()
throws Exception
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanExceptionpublic List<String> getFormats()
OpenSearchServicegetFormats in interface OpenSearchServicepublic String getContentType(String format)
OpenSearchServicegetContentType in interface OpenSearchServiceformat - the results document format (rss, atom, html)public Document getDescriptionDoc(String scope) throws IOException
OpenSearchServicegetDescriptionDoc in interface OpenSearchServicescope - - null for entire repository, or handle or community or collectionIOExceptionpublic String getDescription(String scope)
OpenSearchServicegetDescription in interface OpenSearchServicescope - - null for entire repository, or handle or community or collectionpublic String getResultsString(Context context, String format, String query, int totalResults, int start, int pageSize, DSpaceObject scope, DSpaceObject[] results, Map<String,String> labels) throws IOException
OpenSearchServicegetResultsString in interface OpenSearchServiceformat - results format - html, rss or atomquery - - the search querytotalResults - - the hit countstart - - start result indexpageSize - - page sizescope - - search scope, null or community/collection handleresults - the retreived DSpace objects satisfying searchlabels - labels to apply - format specificIOExceptionpublic Document getResultsDoc(Context context, String format, String query, int totalResults, int start, int pageSize, DSpaceObject scope, DSpaceObject[] results, Map<String,String> labels) throws IOException
OpenSearchServicegetResultsDoc in interface OpenSearchServiceformat - results format - html, rss or atomquery - - the search querytotalResults - - the hit countstart - - start result indexpageSize - - page sizescope - - search scope, null or community/collection handleresults - the retreived DSpace objects satisfying searchlabels - labels to apply - format specificIOExceptionprotected SyndicationFeed getResults(Context context, String format, String query, int totalResults, int start, int pageSize, DSpaceObject scope, DSpaceObject[] results, Map<String,String> labels)
protected com.sun.syndication.feed.module.opensearch.OpenSearchModule openSearchMarkup(String query, int totalResults, int start, int pageSize)
protected org.jdom.Document getServiceDocument(String scope)
scope - - null for the entire repository, or a collection/community handleprotected Document jDomToW3(org.jdom.Document jdomDoc) throws IOException
jdomDoc - IOExceptionpublic DSpaceObject resolveScope(Context context, String scope) throws SQLException
resolveScope in interface OpenSearchServiceSQLExceptionCopyright © 2016 DuraSpace. All Rights Reserved.