Package eu.clarin.sru.server.fcs
Class SimpleEndpointSearchEngineBase
- java.lang.Object
-
- eu.clarin.sru.server.utils.SRUSearchEngineBase
-
- eu.clarin.sru.server.fcs.SimpleEndpointSearchEngineBase
-
- All Implemented Interfaces:
SRUSearchEngine
,SRUAuthenticationInfoProviderFactory
public abstract class SimpleEndpointSearchEngineBase extends SRUSearchEngineBase implements SRUAuthenticationInfoProviderFactory
A base class for implementing a simple search engine to be used as a CLARIN-FCS endpoint.
-
-
Field Summary
Fields Modifier and Type Field Description protected EndpointDescription
endpointDescription
static String
FCS_AUTHENTICATION_ACCEPT_EXPIRESAT_PARAM
static String
FCS_AUTHENTICATION_ACCEPT_ISSUEDAT_PARAM
static String
FCS_AUTHENTICATION_ACCEPT_NOTBEFORE_PARAM
static String
FCS_AUTHENTICATION_AUDIENCE_PARAM
static String
FCS_AUTHENTICATION_ENABLE_PARAM
static String
FCS_AUTHENTICATION_IGNORE_ISSUEDAT_PARAM
static String
FCS_AUTHENTICATION_PUBLIC_KEY_PARAM_PREFIX
-
Constructor Summary
Constructors Constructor Description SimpleEndpointSearchEngineBase()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description SRUAuthenticationInfoProvider
createAuthenticationInfoProvider(javax.servlet.ServletContext context, Map<String,String> params)
protected abstract EndpointDescription
createEndpointDescription(javax.servlet.ServletContext context, SRUServerConfig config, Map<String,String> params)
void
destroy()
This method should not be overridden.protected void
doDestroy()
Destroy the search engine.protected abstract void
doInit(javax.servlet.ServletContext context, SRUServerConfig config, SRUQueryParserRegistry.Builder queryParsersBuilder, Map<String,String> params)
Initialize the search engine.protected SRUScanResultSet
doScan(SRUServerConfig config, SRURequest request, SRUDiagnosticList diagnostics)
Deprecated.SRUExplainResult
explain(SRUServerConfig config, SRURequest request, SRUDiagnosticList diagnostics)
void
init(javax.servlet.ServletContext context, SRUServerConfig config, SRUQueryParserRegistry.Builder parserReqistryBuilder, Map<String,String> params)
This method should not be overridden.protected static boolean
parseBoolean(String value)
Convince method for parsing a string to boolean.SRUScanResultSet
scan(SRUServerConfig config, SRURequest request, SRUDiagnosticList diagnostics)
Handle a scan operation.-
Methods inherited from class eu.clarin.sru.server.utils.SRUSearchEngineBase
search
-
-
-
-
Field Detail
-
FCS_AUTHENTICATION_ENABLE_PARAM
public static final String FCS_AUTHENTICATION_ENABLE_PARAM
- See Also:
- Constant Field Values
-
FCS_AUTHENTICATION_AUDIENCE_PARAM
public static final String FCS_AUTHENTICATION_AUDIENCE_PARAM
- See Also:
- Constant Field Values
-
FCS_AUTHENTICATION_IGNORE_ISSUEDAT_PARAM
public static final String FCS_AUTHENTICATION_IGNORE_ISSUEDAT_PARAM
- See Also:
- Constant Field Values
-
FCS_AUTHENTICATION_ACCEPT_ISSUEDAT_PARAM
public static final String FCS_AUTHENTICATION_ACCEPT_ISSUEDAT_PARAM
- See Also:
- Constant Field Values
-
FCS_AUTHENTICATION_ACCEPT_EXPIRESAT_PARAM
public static final String FCS_AUTHENTICATION_ACCEPT_EXPIRESAT_PARAM
- See Also:
- Constant Field Values
-
FCS_AUTHENTICATION_ACCEPT_NOTBEFORE_PARAM
public static final String FCS_AUTHENTICATION_ACCEPT_NOTBEFORE_PARAM
- See Also:
- Constant Field Values
-
FCS_AUTHENTICATION_PUBLIC_KEY_PARAM_PREFIX
public static final String FCS_AUTHENTICATION_PUBLIC_KEY_PARAM_PREFIX
- See Also:
- Constant Field Values
-
endpointDescription
protected EndpointDescription endpointDescription
-
-
Method Detail
-
init
public final void init(javax.servlet.ServletContext context, SRUServerConfig config, SRUQueryParserRegistry.Builder parserReqistryBuilder, Map<String,String> params) throws SRUConfigException
This method should not be overridden. Perform your custom initialization in thedoInit(ServletContext, SRUServerConfig, eu.clarin.sru.server.SRUQueryParserRegistry.Builder, Map)
method instead.- Overrides:
init
in classSRUSearchEngineBase
- Throws:
SRUConfigException
- See Also:
doInit(ServletContext, SRUServerConfig, eu.clarin.sru.server.SRUQueryParserRegistry.Builder, Map)
-
destroy
public final void destroy()
This method should not be overridden. Perform you custom cleanup in thedoDestroy()
method.- Overrides:
destroy
in classSRUSearchEngineBase
- See Also:
doDestroy()
-
createAuthenticationInfoProvider
public SRUAuthenticationInfoProvider createAuthenticationInfoProvider(javax.servlet.ServletContext context, Map<String,String> params) throws SRUConfigException
- Specified by:
createAuthenticationInfoProvider
in interfaceSRUAuthenticationInfoProviderFactory
- Throws:
SRUConfigException
-
explain
public final SRUExplainResult explain(SRUServerConfig config, SRURequest request, SRUDiagnosticList diagnostics) throws SRUException
- Specified by:
explain
in interfaceSRUSearchEngine
- Overrides:
explain
in classSRUSearchEngineBase
- Throws:
SRUException
-
scan
public final SRUScanResultSet scan(SRUServerConfig config, SRURequest request, SRUDiagnosticList diagnostics) throws SRUException
Handle a scan operation. This implementation provides support to CLARIN FCS resource enumeration. If you want to provide custom scan behavior for a different index, override thedoScan(SRUServerConfig, SRURequest, SRUDiagnosticList)
method.- Specified by:
scan
in interfaceSRUSearchEngine
- Overrides:
scan
in classSRUSearchEngineBase
- Throws:
SRUException
- See Also:
doScan(SRUServerConfig, SRURequest, SRUDiagnosticList)
-
createEndpointDescription
protected abstract EndpointDescription createEndpointDescription(javax.servlet.ServletContext context, SRUServerConfig config, Map<String,String> params) throws SRUConfigException
- Throws:
SRUConfigException
-
doInit
protected abstract void doInit(javax.servlet.ServletContext context, SRUServerConfig config, SRUQueryParserRegistry.Builder queryParsersBuilder, Map<String,String> params) throws SRUConfigException
Initialize the search engine. This initialization should be tailed towards your environment and needs.- Parameters:
context
- theServletContext
for the Servletconfig
- theSRUServerConfig
object for this search enginequeryParsersBuilder
- theSRUQueryParserRegistry.Builder
object to be used for this search engine. Use to register additional query parsers with theSRUServer
.params
- additional parameters gathered from the Servlet configuration and Servlet context.- Throws:
SRUConfigException
- if an error occurred
-
doDestroy
protected void doDestroy()
Destroy the search engine. Override this method for any cleanup the search engine needs to perform upon termination.
-
doScan
@Deprecated protected SRUScanResultSet doScan(SRUServerConfig config, SRURequest request, SRUDiagnosticList diagnostics) throws SRUException
Deprecated.Handle a scan operation. The default implementation is a no-op. Override this method, if you want to provide a custom behavior.- Parameters:
config
- theSRUEndpointConfig
object that contains the endpoint configurationrequest
- theSRURequest
object that contains the request made to the endpointdiagnostics
- theSRUDiagnosticList
object for storing non-fatal diagnostics- Returns:
- a
SRUScanResultSet
object ornull
if this operation is not supported by this search engine - Throws:
SRUException
- if an fatal error occurred- See Also:
SRUSearchEngine.scan(SRUServerConfig, SRURequest, SRUDiagnosticList)
-
parseBoolean
protected static boolean parseBoolean(String value)
Convince method for parsing a string to boolean. Values1
,true
,yes
yield a true boolean value as a result, all others (includingnull
) a false boolean value.- Parameters:
value
- the string to parse- Returns:
true
if the supplied string was considered something representing a true boolean value,false
otherwise
-
-