UNICORE Resource Broker NJS Plugin
1.5α1

org.eurogrid.broker.server
Class ResourceBroker

java.lang.Object
  |
  +--org.eurogrid.broker.server.AbstractBroker
        |
        +--org.eurogrid.broker.server.ResourceBroker
All Implemented Interfaces:
NamedPlugin, ResourceBroker, ResourceChecker

public class ResourceBroker
extends AbstractBroker

University of Manchester Resource Broker NJS V4 Plugin. Principal class.

Version:
$Revision: 1.28 $, $Date: 2004/02/17 11:32:40 $
Author:
Jon MacLaren, Donal K. Fellows
See Also:
"EUROGRID WorkPackage 5.2", "GRIP WorkPackage 2.4", TicketManager, ExpertBroker, LocalResourceChecker

Nested Class Summary
static interface ResourceBroker.TSIRunEngine
          Passed to LocalResourceCheckers that wish to run scripts on the local TSI.
 
Field Summary
static String VERSION
          The version of the broker engine.
 
Fields inherited from class org.eurogrid.broker.server.AbstractBroker
controlState, isInitialised, localVsiteName, logger
 
Constructor Summary
ResourceBroker()
           
 
Method Summary
protected  void checkQoS(CheckQoS task, IncarnatedUser incedUser, User user, byte[] context, CheckQoS_Outcome outcome)
          Incarnate a CheckQoS, producing an outcome.
protected  void checkResources(CheckResources task, IncarnatedUser incedUser, User user, byte[] context, CheckResources_Outcome outcome)
          Incarnate a CheckResources, producing an outcome.
 String claim(Ticket ticket, ResourceSet resources, IncarnatedUser incUser, User user)
          Claim the ticket.
 boolean fillInEstimate(ResourceSet resSet, Estimate est, IncarnatedUser user)
          Generate a ticket for a resource request.
 String getFormalName()
          Get the formal name of the plugin.
 String getGatewayURL()
          Get the URL for the gateway to access the Usite containing this broker.
 ResourceSet getLocalResources()
          Get the current resource set for the host Vsite.
 String getName()
          Get the name of the plugin.
 ResourceSet getResources(Vsite vsite)
          Get the resources for a particular Vsite.
 String getTextOfElement(Element element, String tag)
          Get the textual content of the given DOM element, complaining if it is anything other than simple text.
 String initialise(Vsite vsite, ResourceSet resources, ResourceChecker.NJS njs, Element configuration)
          Initialise ourselves
 boolean isBrokeringFor(Vsite vsite)
          Test if this broker brokers for the given Vsite.
protected  void logBannerMessage()
          Write the main banner message to the log.
static Vsite makeVsite(String handle, String address)
          Wrapper method that creates a Vsite given a handle and address for it.
 String mapToLocation(Storage storage)
          Get where a particular piece of storage is located.
 boolean resourceSetOKHere(ResourceSet set, IncarnatedUser user)
          Check a single resource set
 
Methods inherited from class org.eurogrid.broker.server.AbstractBroker
apply, getLogger, getLogger, getQoSCheckResource, getResourceCheckResource, getState, incarnateCheckQoS, incarnateCheckResources, initialise, initialiseLogger, nextJobID
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERSION

public static final String VERSION
The version of the broker engine.

See Also:
Constant Field Values
Constructor Detail

ResourceBroker

public ResourceBroker()
Method Detail

checkQoS

protected void checkQoS(CheckQoS task,
                        IncarnatedUser incedUser,
                        User user,
                        byte[] context,
                        CheckQoS_Outcome outcome)
                 throws ResourceCheckerException
Incarnate a CheckQoS, producing an outcome.

Specified by:
checkQoS in class AbstractBroker
Parameters:
task - the request to check resources that requires incarnation
incedUser - the incarnated user performing the check
user - the user performing the check
context - broker context for passing to sub-brokers
outcome - the incarnated user performing the check
ResourceCheckerException

checkResources

protected void checkResources(CheckResources task,
                              IncarnatedUser incedUser,
                              User user,
                              byte[] context,
                              CheckResources_Outcome outcome)
                       throws ResourceCheckerException
Incarnate a CheckResources, producing an outcome.

Specified by:
checkResources in class AbstractBroker
Parameters:
task - the request to check resources that requires incarnation
incedUser - the incarnated user performing the check
user - the User performing the check
context - broker context for passing to sub-brokers
outcome - the incarnated user performing the check
ResourceCheckerException

claim

public String claim(Ticket ticket,
                    ResourceSet resources,
                    IncarnatedUser incUser,
                    User user)
             throws ResourceCheckerException
Claim the ticket. Only partially implemented; we confirm that we issued the ticket, but do not check that the resource set is what we issued the ticket against.

Parameters:
ticket - The ticket being claimed
resources - The resource set that contains the ticket
incUser - The incarnated user
user - The real user
Returns:
Parameter to be passed to the TSI (constant NONE for now)
Throws:
ResourceCheckerException - If the ticket is not valid

fillInEstimate

public boolean fillInEstimate(ResourceSet resSet,
                              Estimate est,
                              IncarnatedUser user)
Generate a ticket for a resource request. This updates the given estimate so that it contains a ticket that promises to deliver the level of service requested in the resource-set for the given incarnated user. Note that the resources must be described in system terms at this point; application level stuff has to be done at an earlier stage.

Parameters:
resSet - The set of resources specifying the requested quality of service.
est - The estimate to fill in.
user - The incarnated user making the request.
Returns:
Whether an estimate has been successfully filled in.

getFormalName

public String getFormalName()
Description copied from interface: NamedPlugin
Get the formal name of the plugin. This should be long enough to allow people who are not experts with the code to understand it, and will be written to the log to associate itself with the shorter name.


getGatewayURL

public String getGatewayURL()
Get the URL for the gateway to access the Usite containing this broker.


getLocalResources

public ResourceSet getLocalResources()
Get the current resource set for the host Vsite.


getName

public String getName()
Description copied from interface: NamedPlugin
Get the name of the plugin. This should be fairly short so that the logging messages aren't too massive.


getResources

public ResourceSet getResources(Vsite vsite)
Get the resources for a particular Vsite. This method caches the values returned for up to an hour, so multiple fetches of a resource set can be expected to be fairly efficient.


getTextOfElement

public String getTextOfElement(Element element,
                               String tag)
Get the textual content of the given DOM element, complaining if it is anything other than simple text.

Parameters:
element - The element to extract the content from.
tag - The tag of the element being extracted (for log messages).
Returns:
The extracted string.

initialise

public String initialise(Vsite vsite,
                         ResourceSet resources,
                         ResourceChecker.NJS njs,
                         Element configuration)
                  throws ResourceCheckerException
Initialise ourselves

Specified by:
initialise in class AbstractBroker
Parameters:
vsite - The Vsite where we are.
resources - The resources at this Vsite.
njs - The hosting NJS.
configuration - The initialisation XML from the IDB.
Returns:
The name of the host Vsite for use in broker-loop detection.
ResourceCheckerException

isBrokeringFor

public boolean isBrokeringFor(Vsite vsite)
Test if this broker brokers for the given Vsite.


logBannerMessage

protected void logBannerMessage()
Description copied from class: AbstractBroker
Write the main banner message to the log. At least one line should be written at level CONFIG and any additional lines should be at level INFO.

Specified by:
logBannerMessage in class AbstractBroker

makeVsite

public static Vsite makeVsite(String handle,
                              String address)
Wrapper method that creates a Vsite given a handle and address for it. For use by plug-in modules only.


mapToLocation

public String mapToLocation(Storage storage)
Get where a particular piece of storage is located. Returned value might include environment variables to be expanded; this is OK as the TSI will do that for us.


resourceSetOKHere

public boolean resourceSetOKHere(ResourceSet set,
                                 IncarnatedUser user)
Check a single resource set

Parameters:
set - The resource set to check
user - The user to perform the check on behalf of
Returns:
true for OK, false for no.

UNICORE Resource Broker NJS Plugin
1.5α1

Submit a bug or feature
Copyright © 2002-2004 University of Manchester, U.K. See license.terms for details.