public class UnsupportedAdaptorContext extends Object implements AdaptorContext
AdaptorContext
that throws an
UnsupportedOperationException
if any method is called.
This class is intended to be extended for unit testing, rather
than implementing the AdaptorContext
interface directly.
Constructor and Description |
---|
UnsupportedAdaptorContext() |
Modifier and Type | Method and Description |
---|---|
void |
addStatusSource(StatusSource source)
Add a status source to the dashboard.
|
HttpContext |
createHttpContext(String path,
HttpHandler handler)
Registers a handler with the library's
HttpServer in similar fashion to HttpServer.createContext(java.lang.String, com.sun.net.httpserver.HttpHandler) . |
AsyncDocIdPusher |
getAsyncDocIdPusher()
Callback object for asynchronously pushing
DocId s to the GSA
at any time. |
Config |
getConfig()
Configuration instance for the adaptor and all things within the adaptor
library.
|
DocIdEncoder |
getDocIdEncoder()
A way to construct URIs from DocIds.
|
DocIdPusher |
getDocIdPusher()
Callback object for pushing
DocId s to the GSA at any time. |
ExceptionHandler |
getGetDocIdsFullErrorHandler()
Retrieve the current
ExceptionHandler for full push. |
ExceptionHandler |
getGetDocIdsIncrementalErrorHandler()
Retrieve the current
ExceptionHandler for incremental push. |
SensitiveValueDecoder |
getSensitiveValueDecoder()
Retrieve decoder for sensitive values, like passwords.
|
Session |
getUserSession(HttpExchange ex,
boolean create)
Get the session for the user communicating via
ex . |
void |
setAuthnAuthority(AuthnAuthority authnAuthority)
Register an authentication provider, so it can authenticate users for the
GSA.
|
void |
setAuthzAuthority(AuthzAuthority authzAuthority)
Register an authorization provider, so it can check authorization of users
for the GSA.
|
void |
setGetDocIdsFullErrorHandler(ExceptionHandler handler)
Override the default
ExceptionHandler for full push. |
void |
setGetDocIdsIncrementalErrorHandler(ExceptionHandler handler)
Override the default
ExceptionHandler for incremental push. |
void |
setPollingIncrementalLister(PollingIncrementalLister lister)
Register a polling incremental lister, so that it can be called when
appropriate.
|
public Config getConfig()
AdaptorContext
getConfig
in interface AdaptorContext
UnsupportedOperationException
- alwayspublic DocIdPusher getDocIdPusher()
AdaptorContext
DocId
s to the GSA at any time.getDocIdPusher
in interface AdaptorContext
UnsupportedOperationException
- alwayspublic AsyncDocIdPusher getAsyncDocIdPusher()
AdaptorContext
DocId
s to the GSA
at any time.getAsyncDocIdPusher
in interface AdaptorContext
UnsupportedOperationException
- alwayspublic DocIdEncoder getDocIdEncoder()
AdaptorContext
getDocIdEncoder
in interface AdaptorContext
UnsupportedOperationException
- alwayspublic void addStatusSource(StatusSource source)
AdaptorContext
Adaptor.destroy()
. Source registration should
occur during Adaptor.init(com.google.enterprise.adaptor.AdaptorContext)
.addStatusSource
in interface AdaptorContext
source
- gives data to dashboardUnsupportedOperationException
- alwayspublic void setGetDocIdsFullErrorHandler(ExceptionHandler handler)
AdaptorContext
ExceptionHandler
for full push.setGetDocIdsFullErrorHandler
in interface AdaptorContext
handler
- for dealing with errors sending doc ids to GSAUnsupportedOperationException
- alwayspublic ExceptionHandler getGetDocIdsFullErrorHandler()
AdaptorContext
ExceptionHandler
for full push.getGetDocIdsFullErrorHandler
in interface AdaptorContext
UnsupportedOperationException
- alwayspublic void setGetDocIdsIncrementalErrorHandler(ExceptionHandler handler)
AdaptorContext
ExceptionHandler
for incremental push.setGetDocIdsIncrementalErrorHandler
in interface AdaptorContext
handler
- for dealing with errors sending doc ids to GSAUnsupportedOperationException
- alwayspublic ExceptionHandler getGetDocIdsIncrementalErrorHandler()
AdaptorContext
ExceptionHandler
for incremental push.getGetDocIdsIncrementalErrorHandler
in interface AdaptorContext
UnsupportedOperationException
- alwayspublic SensitiveValueDecoder getSensitiveValueDecoder()
AdaptorContext
getSensitiveValueDecoder
in interface AdaptorContext
UnsupportedOperationException
- alwayspublic HttpContext createHttpContext(String path, HttpHandler handler)
AdaptorContext
HttpServer
in similar fashion to HttpServer.createContext(java.lang.String, com.sun.net.httpserver.HttpHandler)
. The handler will
automatically be removed during adaptor shutdown. Handler registration
should occur during Adaptor.init(com.google.enterprise.adaptor.AdaptorContext)
.
Although path
may be passed directly to the underlying HttpServer
, that is not necessarily the case. Thus, implementations should
use the returned context's path when forming URLs to the handler. In
addition, the handler and context may be modified before being returned;
this is primarily to allow adding commonly-needed filters for error
handling and logging, but also available for implementation-specific needs.
createHttpContext
in interface AdaptorContext
path
- on the serverhandler
- of requests for pathUnsupportedOperationException
- alwayspublic Session getUserSession(HttpExchange ex, boolean create)
AdaptorContext
ex
. If a session
does not already exist, then create
determines if one should be
created.getUserSession
in interface AdaptorContext
ex
- exchange which user issued requestcreate
- whether a new session should be created if one does not
already exist for this usernull
if session did not already exist
and create = false
UnsupportedOperationException
- alwayspublic void setPollingIncrementalLister(PollingIncrementalLister lister)
AdaptorContext
Adaptor.init(com.google.enterprise.adaptor.AdaptorContext)
.setPollingIncrementalLister
in interface AdaptorContext
lister
- provides updated idsUnsupportedOperationException
- alwayspublic void setAuthnAuthority(AuthnAuthority authnAuthority)
AdaptorContext
Adaptor.init(com.google.enterprise.adaptor.AdaptorContext)
.setAuthnAuthority
in interface AdaptorContext
authnAuthority
- identifies usersUnsupportedOperationException
- alwayspublic void setAuthzAuthority(AuthzAuthority authzAuthority)
AdaptorContext
Adaptor.init(com.google.enterprise.adaptor.AdaptorContext)
.setAuthzAuthority
in interface AdaptorContext
authzAuthority
- makes access decisionsUnsupportedOperationException
- always