org.bitrepository.service.contributor
Class AbstractContributorMediator

java.lang.Object
  extended by org.bitrepository.service.contributor.AbstractContributorMediator
All Implemented Interfaces:
ContributorMediator
Direct Known Subclasses:
SimpleContributorMediator

public abstract class AbstractContributorMediator
extends Object
implements ContributorMediator

Defines the general functionality for handling a set of requests. Does this by delegating the handling of the specific request to appropriate RequestHandlers.


Constructor Summary
AbstractContributorMediator(MessageBus messageBus)
          Constructor.
 
Method Summary
 void close()
          Closes the mediator by removing all the message handler.
protected abstract  RequestHandler[] createListOfHandlers()
           
protected abstract  ContributorContext getContext()
           
protected abstract  void handleRequest(MessageRequest request, RequestHandler handler)
          Make the inheriting class create the environment for safely handling the request.
 void start()
          Starts listening for requests.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractContributorMediator

public AbstractContributorMediator(MessageBus messageBus)
Constructor.

Parameters:
messageBus - The messagebus for this mediator.
Method Detail

start

public final void start()
Starts listening for requests. Listens both to the general collection destination and to the local destination for the contributor.

Specified by:
start in interface ContributorMediator

createListOfHandlers

protected abstract RequestHandler[] createListOfHandlers()
Returns:
The set of RequestHandlers used for this contributor.

getContext

protected abstract ContributorContext getContext()
Returns:
The concrete context used for this contributor.

handleRequest

protected abstract void handleRequest(MessageRequest request,
                                      RequestHandler handler)
Make the inheriting class create the environment for safely handling the request. E.g. creating the specific fault barrier.

Parameters:
request - The request to handle.
handler - The handler for the request.

close

public void close()
Closes the mediator by removing all the message handler.

Specified by:
close in interface ContributorMediator


Copyright © 2010-2013 The State and University Library, The Royal Library and The State Archives, Denmark. All Rights Reserved.