edu.ucsb.adl.middleware
Class CombinationGatekeeper

java.lang.Object
  |
  +--edu.ucsb.adl.middleware.CombinationGatekeeper
All Implemented Interfaces:
CancelServiceGatekeeper, CollectionDriverGatekeeper, CollectionServiceGatekeeper, ConfigurationServiceGatekeeper, GenericGatekeeper, IdentifiersDriverGatekeeper, IdentifiersServiceGatekeeper, MetadataDriverGatekeeper, MetadataServiceGatekeeper, QueryDriverGatekeeper, QueryServiceGatekeeper, ReferenceServiceGatekeeper, ResultsServiceGatekeeper, StatusServiceGatekeeper, UnloadServiceGatekeeper, UnreferenceServiceGatekeeper

public final class CombinationGatekeeper
extends java.lang.Object
implements MetadataServiceGatekeeper, MetadataDriverGatekeeper, QueryServiceGatekeeper, QueryDriverGatekeeper, ResultsServiceGatekeeper, StatusServiceGatekeeper, CancelServiceGatekeeper, ConfigurationServiceGatekeeper, CollectionServiceGatekeeper, CollectionDriverGatekeeper, GenericGatekeeper, UnloadServiceGatekeeper, ReferenceServiceGatekeeper, UnreferenceServiceGatekeeper, IdentifiersServiceGatekeeper, IdentifiersDriverGatekeeper

A gatekeeper that implements all gatekeeper interfaces and that bases authorization on a boolean combination of one or more other gatekeepers.

Version:
$Header: /export/home/gjanee/middleware/edu/ucsb/adl/middleware/RCS/CombinationGatekeeper.java,v 1.7 2006/06/22 18:49:45 gjanee Exp $

$Log: CombinationGatekeeper.java,v $ Revision 1.7 2006/06/22 18:49:45 gjanee
Added support for the identifiers service.

Revision 1.6 2004/09/21 22:37:14 gjanee
Rewrite to use class ExtendedProperties.

Revision 1.5 2003/05/09 22:52:59 gjanee
Added support for arbitrary, per-collection and per-holding metadata views. Specifically, changed the view argument data type from an enumeration to a string. Added methods viewsServiceAllowed and viewsDriverAllowed.

Revision 1.4 2001/09/05 04:00:23 gjanee
Changed the type of the baseUrl argument of method referenceServiceAllowed from URL to String to support the rmi pseudo-protocol.

Revision 1.3 2001/09/04 18:53:57 gjanee
Added support for UnloadServiceGatekeeper, ReferenceServiceGatekeeper, and UnreferenceServiceGatekeeper.

Revision 1.2 2000/05/19 21:05:36 gjanee
Added support for GenericGatekeeper.

Revision 1.1 2000/04/04 18:13:57 gjanee
Initial revision

Author:
Greg Janée
Alexandria Digital Library

Method Summary
 boolean cancelServiceAllowed(javax.servlet.ServletRequest request, edu.ucsb.adl.middleware.ResultAccumulator accumulator)
          Returns true if the request is authorized, that is, if the client is allowed to destroy the given result accumulator.
 boolean collectionDriverAllowed(javax.servlet.ServletRequest request, java.lang.String collection)
          Returns true if the request is authorized, that is, if the client is allowed to view the collection-level metadata for a collection.
 boolean collectionServiceAllowed(javax.servlet.ServletRequest request)
          Returns true if the request is authorized, that is, if the client is allowed to view collection-level metadata.
 boolean configurationServiceAllowed(javax.servlet.ServletRequest request)
          Returns true if the request is authorized, that is, if the client is allowed to view the configuration of the ADL middleware server.
static edu.ucsb.adl.middleware.CombinationGatekeeper createGatekeeper(edu.ucsb.adl.middleware.ExtendedProperties propertyList, java.lang.String expression)
          Creates a CombinationGatekeeper.
 void destroy()
          Frees all resources held by the gatekeeper.
 boolean genericAccessAllowed(javax.servlet.ServletRequest request)
          Returns true if access is allowed irrespective of the service being invoked or the collection being operated upon.
 boolean identifiersDriverAllowed(javax.servlet.ServletRequest request, java.lang.String collection)
          Returns true if the request is authorized, that is, if the client is allowed to obtain the identifiers of all items in the collection.
 boolean identifiersServiceAllowed(javax.servlet.ServletRequest request)
          Returns true if the request is authorized, that is, if the client is allowed to obtain the identifiers of all items in collections.
 boolean metadataDriverAllowed(javax.servlet.ServletRequest request, java.lang.String view, java.lang.String collection, java.lang.String holding)
          Returns true if the request is authorized, that is, if the client is allowed to view the requested view of the metadata for the requested holding.
 boolean metadataServiceAllowed(javax.servlet.ServletRequest request, java.lang.String view)
          Returns true if the request is authorized, that is, if the client is allowed to view metadata reports of type view irrespective of collection and holding.
 boolean queryDriverAllowed(javax.servlet.ServletRequest request, java.lang.String collection, edu.ucsb.adl.middleware.Query query)
          Returns true if the request is authorized, that is, if the client is allowed to submit the given query to the given collection.
 boolean queryServiceAllowed(javax.servlet.ServletRequest request, edu.ucsb.adl.middleware.Query query)
          Returns true if the request is authorized, that is, if the client is allowed to submit the given query.
 boolean referenceServiceAllowed(javax.servlet.ServletRequest request, java.lang.String baseUrl, java.lang.String collection)
          Returns true if the request is authorized, that is, if the client is allowed to reference the specified remote collection.
 boolean resultsServiceAllowed(javax.servlet.ServletRequest request, edu.ucsb.adl.middleware.ResultSet set)
          Returns true if the request is authorized, that is, if the client is allowed to access the specified result set.
 boolean statusServiceAllowed(javax.servlet.ServletRequest request)
          Returns true if the request is authorized, that is, if the client is allowed to view the status of the ADL middleware server.
 boolean unloadServiceAllowed(javax.servlet.ServletRequest request, java.lang.String collection)
          Returns true if the request is authorized, that is, if the client is allowed to unload the specified collection from the middleware.
 boolean unreferenceServiceAllowed(javax.servlet.ServletRequest request, java.lang.String collection)
          Returns true if the request is authorized, that is, if the client is allowed to unreference the specified remote collection.
 boolean viewsDriverAllowed(javax.servlet.ServletRequest request, java.lang.String collection, java.lang.String holding)
          Returns true if the request is authorized, that is, if the client is allowed to retrieve the supported view list for the requested holding.
 boolean viewsServiceAllowed(javax.servlet.ServletRequest request)
          Returns true if the request is authorized, that is, if the client is allowed to retrieve supported view lists irrespective of collection and holding.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createGatekeeper

public static edu.ucsb.adl.middleware.CombinationGatekeeper createGatekeeper(edu.ucsb.adl.middleware.ExtendedProperties propertyList,
                                                                             java.lang.String expression)
                                                                      throws InternalErrorException
Creates a CombinationGatekeeper.

Parameters:
propertyList - A property list.
expression - A postfix expression that describes a boolean combination of one or more other gatekeepers. Syntactically, the expression should consist of tokens separated by white space. A token may be either a boolean operator (AND, OR, or NOT) or an operand indicated by a property name prefix, P. In the latter case, property P.class in propertyList should be the fully-qualified name of a gatekeeper class and property P.argument should be the gatekeeper's startup parameter. The specified gatekeeper(s) are created by this method.
Returns:
A CombinationGatekeeper.
Throws:
InternalErrorException - If any error is encountered.

metadataServiceAllowed

public boolean metadataServiceAllowed(javax.servlet.ServletRequest request,
                                      java.lang.String view)
                               throws MiddlewareException
Returns true if the request is authorized, that is, if the client is allowed to view metadata reports of type view irrespective of collection and holding.

Specified by:
metadataServiceAllowed in interface MetadataServiceGatekeeper
Parameters:
request - The full request.
view - The metadata view requested, e.g., "adl:bucket".
Returns:
true if the request is authorized.
Throws:
BadRequestException - If request is not valid.
InternalErrorException - If the authorization cannot otherwise be determined.
MiddlewareException
See Also:
MetadataService

viewsServiceAllowed

public boolean viewsServiceAllowed(javax.servlet.ServletRequest request)
                            throws MiddlewareException
Returns true if the request is authorized, that is, if the client is allowed to retrieve supported view lists irrespective of collection and holding.

Specified by:
viewsServiceAllowed in interface MetadataServiceGatekeeper
Parameters:
request - The full request.
Returns:
true if the request is authorized.
Throws:
BadRequestException - If request is not valid.
InternalErrorException - If the authorization cannot otherwise be determined.
MiddlewareException
See Also:
MetadataService

metadataDriverAllowed

public boolean metadataDriverAllowed(javax.servlet.ServletRequest request,
                                     java.lang.String view,
                                     java.lang.String collection,
                                     java.lang.String holding)
                              throws MiddlewareException
Returns true if the request is authorized, that is, if the client is allowed to view the requested view of the metadata for the requested holding.

Specified by:
metadataDriverAllowed in interface MetadataDriverGatekeeper
Parameters:
request - The full request.
view - The metadata view requested, e.g., "adl:bucket".
collection - The collection name, e.g., "adl_catalog".
holding - The holding identifier.
Returns:
true if the request is authorized.
Throws:
BadRequestException - If request or holding are not valid.
InternalErrorException - If the authorization cannot otherwise be determined.
MiddlewareException
See Also:
MetadataService

viewsDriverAllowed

public boolean viewsDriverAllowed(javax.servlet.ServletRequest request,
                                  java.lang.String collection,
                                  java.lang.String holding)
                           throws MiddlewareException
Returns true if the request is authorized, that is, if the client is allowed to retrieve the supported view list for the requested holding.

Specified by:
viewsDriverAllowed in interface MetadataDriverGatekeeper
Parameters:
request - The full request.
collection - The collection name, e.g., "adl_catalog".
holding - The holding identifier.
Returns:
true if the request is authorized.
Throws:
BadRequestException - If request or holding are not valid.
InternalErrorException - If the authorization cannot otherwise be determined.
MiddlewareException
See Also:
MetadataService

queryServiceAllowed

public boolean queryServiceAllowed(javax.servlet.ServletRequest request,
                                   edu.ucsb.adl.middleware.Query query)
                            throws MiddlewareException
Returns true if the request is authorized, that is, if the client is allowed to submit the given query.

Specified by:
queryServiceAllowed in interface QueryServiceGatekeeper
Parameters:
request - The full request.
query - The query.
Returns:
true if the request is authorized.
Throws:
BadRequestException - If request is not valid.
InternalErrorException - If the authorization cannot otherwise be determined.
MiddlewareException
See Also:
QueryService

queryDriverAllowed

public boolean queryDriverAllowed(javax.servlet.ServletRequest request,
                                  java.lang.String collection,
                                  edu.ucsb.adl.middleware.Query query)
                           throws MiddlewareException
Returns true if the request is authorized, that is, if the client is allowed to submit the given query to the given collection.

Specified by:
queryDriverAllowed in interface QueryDriverGatekeeper
Parameters:
request - The full request.
collection - The collection name, e.g., "adl_catalog".
query - The query.
Returns:
true if the request is authorized.
Throws:
BadRequestException - If request is not valid.
InternalErrorException - If the authorization cannot otherwise be determined.
MiddlewareException
See Also:
QueryService

resultsServiceAllowed

public boolean resultsServiceAllowed(javax.servlet.ServletRequest request,
                                     edu.ucsb.adl.middleware.ResultSet set)
                              throws MiddlewareException
Returns true if the request is authorized, that is, if the client is allowed to access the specified result set.

Specified by:
resultsServiceAllowed in interface ResultsServiceGatekeeper
Parameters:
request - The full request.
set - The result set in question.
Returns:
true if the request is authorized.
Throws:
BadRequestException - If request is not valid.
InternalErrorException - If the authorization cannot otherwise be determined.
MiddlewareException
See Also:
ResultsService

statusServiceAllowed

public boolean statusServiceAllowed(javax.servlet.ServletRequest request)
                             throws MiddlewareException
Returns true if the request is authorized, that is, if the client is allowed to view the status of the ADL middleware server.

Specified by:
statusServiceAllowed in interface StatusServiceGatekeeper
Parameters:
request - The full request.
Returns:
true if the request is authorized.
Throws:
BadRequestException - If request is not valid.
InternalErrorException - If the authorization cannot otherwise be determined.
MiddlewareException
See Also:
StatusService

cancelServiceAllowed

public boolean cancelServiceAllowed(javax.servlet.ServletRequest request,
                                    edu.ucsb.adl.middleware.ResultAccumulator accumulator)
                             throws MiddlewareException
Returns true if the request is authorized, that is, if the client is allowed to destroy the given result accumulator.

Specified by:
cancelServiceAllowed in interface CancelServiceGatekeeper
Parameters:
request - The full request.
accumulator - The result accumulator in question.
Returns:
true if the request is authorized.
Throws:
BadRequestException - If request is not valid.
InternalErrorException - If the authorization cannot otherwise be determined.
MiddlewareException
See Also:
CancelService

configurationServiceAllowed

public boolean configurationServiceAllowed(javax.servlet.ServletRequest request)
                                    throws MiddlewareException
Returns true if the request is authorized, that is, if the client is allowed to view the configuration of the ADL middleware server.

Specified by:
configurationServiceAllowed in interface ConfigurationServiceGatekeeper
Parameters:
request - The full request.
Returns:
true if the request is authorized.
Throws:
BadRequestException - If request is not valid.
InternalErrorException - If the authorization cannot otherwise be determined.
MiddlewareException
See Also:
ConfigurationService

collectionServiceAllowed

public boolean collectionServiceAllowed(javax.servlet.ServletRequest request)
                                 throws MiddlewareException
Returns true if the request is authorized, that is, if the client is allowed to view collection-level metadata.

Specified by:
collectionServiceAllowed in interface CollectionServiceGatekeeper
Parameters:
request - The full request.
Returns:
true if the request is authorized.
Throws:
BadRequestException - If request is not valid.
InternalErrorException - If the authorization cannot otherwise be determined.
MiddlewareException
See Also:
CollectionService

collectionDriverAllowed

public boolean collectionDriverAllowed(javax.servlet.ServletRequest request,
                                       java.lang.String collection)
                                throws MiddlewareException
Returns true if the request is authorized, that is, if the client is allowed to view the collection-level metadata for a collection.

Specified by:
collectionDriverAllowed in interface CollectionDriverGatekeeper
Parameters:
request - The full request.
collection - The collection name, e.g., "adl_catalog".
Returns:
true if the request is authorized.
Throws:
BadRequestException - If request is not valid.
InternalErrorException - If the authorization cannot otherwise be determined.
MiddlewareException
See Also:
CollectionService

genericAccessAllowed

public boolean genericAccessAllowed(javax.servlet.ServletRequest request)
                             throws MiddlewareException
Returns true if access is allowed irrespective of the service being invoked or the collection being operated upon.

Specified by:
genericAccessAllowed in interface GenericGatekeeper
Parameters:
request - The full request.
Returns:
true if access is allowed.
Throws:
BadRequestException - If request is not valid.
InternalErrorException - If the authorization cannot otherwise be determined.
MiddlewareException

unloadServiceAllowed

public boolean unloadServiceAllowed(javax.servlet.ServletRequest request,
                                    java.lang.String collection)
                             throws MiddlewareException
Returns true if the request is authorized, that is, if the client is allowed to unload the specified collection from the middleware.

Specified by:
unloadServiceAllowed in interface UnloadServiceGatekeeper
Parameters:
request - The full request.
collection - The collection name, e.g., "adl_catalog".
Returns:
true if the request is authorized.
Throws:
BadRequestException - If request is not valid.
InternalErrorException - If the authorization cannot otherwise be determined.
MiddlewareException
See Also:
UnloadService

referenceServiceAllowed

public boolean referenceServiceAllowed(javax.servlet.ServletRequest request,
                                       java.lang.String baseUrl,
                                       java.lang.String collection)
                                throws MiddlewareException
Returns true if the request is authorized, that is, if the client is allowed to reference the specified remote collection.

Specified by:
referenceServiceAllowed in interface ReferenceServiceGatekeeper
Parameters:
request - The full request.
baseUrl - The remote middleware server's base URL, e.g., "rmi://host.com/edu/ucsb/adl/middleware/" or "http://host.com/servlet/".
collection - The remote collection name, e.g., "adl_catalog".
Returns:
true if the request is authorized.
Throws:
BadRequestException - If request is not valid.
InternalErrorException - If the authorization cannot otherwise be determined.
MiddlewareException
See Also:
ReferenceService

unreferenceServiceAllowed

public boolean unreferenceServiceAllowed(javax.servlet.ServletRequest request,
                                         java.lang.String collection)
                                  throws MiddlewareException
Returns true if the request is authorized, that is, if the client is allowed to unreference the specified remote collection.

Specified by:
unreferenceServiceAllowed in interface UnreferenceServiceGatekeeper
Parameters:
request - The full request.
collection - The local collection name, e.g., "adl_catalog".
Returns:
true if the request is authorized.
Throws:
BadRequestException - If request is not valid.
InternalErrorException - If the authorization cannot otherwise be determined.
MiddlewareException
See Also:
UnreferenceService

identifiersServiceAllowed

public boolean identifiersServiceAllowed(javax.servlet.ServletRequest request)
                                  throws MiddlewareException
Returns true if the request is authorized, that is, if the client is allowed to obtain the identifiers of all items in collections.

Specified by:
identifiersServiceAllowed in interface IdentifiersServiceGatekeeper
Parameters:
request - The full request.
Returns:
true if the request is authorized.
Throws:
BadRequestException - If request is not valid.
InternalErrorException - If the authorization cannot otherwise be determined.
MiddlewareException
See Also:
IdentifiersService

identifiersDriverAllowed

public boolean identifiersDriverAllowed(javax.servlet.ServletRequest request,
                                        java.lang.String collection)
                                 throws MiddlewareException
Returns true if the request is authorized, that is, if the client is allowed to obtain the identifiers of all items in the collection.

Specified by:
identifiersDriverAllowed in interface IdentifiersDriverGatekeeper
Parameters:
request - The full request.
collection - The collection name, e.g., "adl_catalog".
Returns:
true if the request is authorized.
Throws:
BadRequestException - If request is not valid.
InternalErrorException - If the authorization cannot otherwise be determined.
MiddlewareException
See Also:
IdentifiersService

destroy

public void destroy()
Frees all resources held by the gatekeeper.

Specified by:
destroy in interface MetadataServiceGatekeeper