|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.google.enterprise.adaptor.AbstractAdaptor
com.google.enterprise.adaptor.examples.AdaptorWithCrawlTimeMetadataTemplate
public class AdaptorWithCrawlTimeMetadataTemplate
Demonstrates what code is necessary for putting restricted content onto a GSA. The key operations are:
| Constructor Summary | |
|---|---|
AdaptorWithCrawlTimeMetadataTemplate()
|
|
| Method Summary | |
|---|---|
void |
getDocContent(Request req,
Response resp)
Gives the bytes of a document referenced with id. |
void |
getDocIds(DocIdPusher pusher)
Gives list of document ids that you'd like on the GSA. |
void |
init(AdaptorContext context)
Initialize adaptor with the current context. |
Map<DocId,AuthzStatus> |
isUserAuthorized(AuthnIdentity userIdentity,
Collection<DocId> ids)
Determines whether the user identified is allowed to access the DocIds. |
static void |
main(String[] args)
Call default main for adaptors. |
| Methods inherited from class com.google.enterprise.adaptor.AbstractAdaptor |
|---|
destroy, initConfig, main |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AdaptorWithCrawlTimeMetadataTemplate()
| Method Detail |
|---|
public void init(AdaptorContext context)
AbstractAdaptorcontext
points to other useful objects that can be used at any time. For example,
methods on DocIdPusher provided via AdaptorContext.getDocIdPusher() are allowed to be called whenever the
Adaptor wishes. This allows doing event-based incremental pushes at any
time.
The method is called at the end of GsaCommunicationHandler.start().
If you experience a fatal error during initialization, feel free to
throw an Exception to cancel the startup process.
This implementation does nothing.
init in interface Adaptorinit in class AbstractAdaptor
public void getDocIds(DocIdPusher pusher)
throws InterruptedException
getDocIds in interface AdaptorInterruptedException
public void getDocContent(Request req,
Response resp)
throws IOException
getDocContent in interface AdaptorIOExceptionpublic static void main(String[] args)
public Map<DocId,AuthzStatus> isUserAuthorized(AuthnIdentity userIdentity,
Collection<DocId> ids)
throws IOException
AuthzAuthorityDocIds. The user is either anonymous or assumed to be previously
authenticated. If an anonymous user is denied access to a document, then
the caller may prompt the user to go through an authentication process and
then try again.
Returns AuthzStatus.PERMIT for DocIds the user is
allowed to access. Retutrns AuthzStatus.DENY for DocIds the
user is not allowed to access. If the document exists, AuthzStatus.INDETERMINATE will not be returned for that DocId.
If the document doesn't exist, then there are several possibilities. If
the repository is fully-public then it will return PERMIT. This
will allow the caller to provide a cached version of the file to the user
or call Adaptor.getDocContent(com.google.enterprise.adaptor.Request, com.google.enterprise.adaptor.Response) which should call Response.respondNotFound(). If the adaptor is not sensitive to users knowing
that certain documents do not exist, then it will return INDETERMINATE. This will be interpreted as the document does not exist; no
cached copy will be provided to the user but the user may be informed the
document doesn't exist. Highly sensitive repositories may return DENY.
If you experience a fatal error, feel free to throw an IOException or RuntimeException. In the case of an error, the
users will be denied access to the resources.
isUserAuthorized in interface AuthzAuthorityuserIdentity - user to authorize, or null for anonymous
usersids - Collection of DocIds that need to be checked
AuthzStatus for each DocId provided in ids
IOException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||