UNICORE Resource Broker Client Plugin
1.5α1

org.eurogrid.broker.client
Class BrokerPlugin

java.lang.Object
  |
  +--com.pallas.unicore.client.util.UnicorePlugable
        |
        +--com.pallas.unicore.client.util.ExtensionPlugable
              |
              +--org.eurogrid.broker.client.BrokerPlugin
All Implemented Interfaces:
BrokerAgent, ConsignedMessageHandler

public class BrokerPlugin
extends com.pallas.unicore.client.util.ExtensionPlugable
implements BrokerAgent, ConsignedMessageHandler

Main class for Resource Broker client plugin

Version:
$Revision: 1.16 $, $Date: 2004/03/09 15:38:06 $
Author:
Jon MacLaren, Donal K. Fellows

Field Summary
static String VERSION
          Version number.
 
Constructor Summary
BrokerPlugin()
           
 
Method Summary
 boolean brokerAtVsites(Collection vsites, Map vsitesToUsites, AbstractJob job, ConsignedMessageHandler handler)
          Broker job (current or given) at a given list of vsites
 void brokerCurrentVsite()
          Broker job group at currently selected Vsite
 boolean brokerJob(AbstractJob job, ConsignedMessageHandler handler)
          Broker job (current or given) at user's default vsites.
 void brokerPresetVsite()
          Broker job group at preset Vsites (in plugin settings)
 void consigned(AbstractJob job, int resultCode, String reason, int otherSubmissionErrors, String computedMessage)
          Called to indicate what the result of consigning a job is.
 void consigning(AbstractJob job, Vsite targetVsite)
           
protected static boolean decodeBrokerThis(String brokerThisText)
          Decodes the "broker this" NJS tag to decide whether to broker for the site or not.
protected static void decodeUsites(String usitesList, List list, Map vToU, boolean addVsites, String context)
          Get list of Usites from a String.
protected static void decodeUsiteVsitePairs(String pairsList, List list, Map vToU, String context)
          Get list of Usite and Vsite pairs from a String.
protected static void decodeVsites(String vsitesList, com.pallas.unicore.extensions.Usite usite, List list, Map vToU, String context)
          Get a list of Usites from a String.
 JMenuItem getCustomMenu()
          Return the sub menu for the extension menu
 Component getJPAToolBarComponent()
          Return a button that brokers the current job group at the default Vsites.
protected  Logger getLogger()
          Get the broker plugin logger object
 String getPluginInfo()
          Get a short info message for the plugin
 JMenuItem getSettingsItem()
          Make item for settings menu
 Component getVsiteToolBarComponent()
          Gets the vsiteToolBarComponent attribute of the BrokerPlugin object.
protected static com.pallas.unicore.extensions.Usite lookupUsite(String usiteAddr)
          Return the Usite from the ResourceManager that matches the given URL (passed as a String).
protected static Vsite lookupVsite(com.pallas.unicore.extensions.Usite usite, String vsiteName)
          Return the Vsite from the ResourceManager that matches the given Usite and Vsite name
protected static void setUpVsiteUsiteMap(List vsites, Map vsiteToUsite)
           
 void startPlugin()
          Called to initialize the plugin
 void stopPlugin()
          Called when terminating
 
Methods inherited from class com.pallas.unicore.client.util.ExtensionPlugable
setupSpecialVsiteFeatures
 
Methods inherited from class com.pallas.unicore.client.util.UnicorePlugable
getClient, getHelpSet
 
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
Version number.

See Also:
Constant Field Values
Constructor Detail

BrokerPlugin

public BrokerPlugin()
Method Detail

brokerAtVsites

public boolean brokerAtVsites(Collection vsites,
                              Map vsitesToUsites,
                              AbstractJob job,
                              ConsignedMessageHandler handler)
Broker job (current or given) at a given list of vsites

Specified by:
brokerAtVsites in interface BrokerAgent
Parameters:
vsites - The list of Vsite objects
vsitesToUsites - Mapping from each Vsite to its Usite.
job - The job to submit, or null to submit the current job in the GUI panel.
handler - Callback to allow for notification of the outcome of the job consignment.
Returns:
Whether the brokering actually happened and consignment went ahead.

brokerCurrentVsite

public void brokerCurrentVsite()
Broker job group at currently selected Vsite


brokerJob

public boolean brokerJob(AbstractJob job,
                         ConsignedMessageHandler handler)
Broker job (current or given) at user's default vsites.

Specified by:
brokerJob in interface BrokerAgent
Parameters:
job - The job to submit, or null to submit the current job in the GUI panel.
handler - Callback to allow for notification of the outcome of the job consignment.
Returns:
Whether the brokering actually happened and the consignment went ahead.

brokerPresetVsite

public void brokerPresetVsite()
Broker job group at preset Vsites (in plugin settings)


consigned

public void consigned(AbstractJob job,
                      int resultCode,
                      String reason,
                      int otherSubmissionErrors,
                      String computedMessage)
Description copied from interface: ConsignedMessageHandler
Called to indicate what the result of consigning a job is.

Specified by:
consigned in interface ConsignedMessageHandler
Parameters:
resultCode - The result code. Zero indicates no error.
reason - The reason why the result is the way it is (assuming it isn't success.)
otherSubmissionErrors - Indication whether "other" errors happened during job submission. Zero indicates no error.
computedMessage - A human-readable message that describes the problems.

consigning

public void consigning(AbstractJob job,
                       Vsite targetVsite)
Specified by:
consigning in interface ConsignedMessageHandler

decodeBrokerThis

protected static boolean decodeBrokerThis(String brokerThisText)
Decodes the "broker this" NJS tag to decide whether to broker for the site or not. Returns false if the string has a single token of "no" (case-insensitive), otherwise true.

Parameters:
brokerThisText - The value of the "broker this" tag
Returns:
Value of broker this (true or false)

decodeUsites

protected static void decodeUsites(String usitesList,
                                   List list,
                                   Map vToU,
                                   boolean addVsites,
                                   String context)
Get list of Usites from a String. If addVsites is set, add all Vsites from those Usites to the list, otherwise add the Usites themselves. Used for decoding "Broker usites" NJS tag.

Parameters:
usitesList - The Usites, space separated list
list - The destination list of Usites or Vsites
vToU - Mapping from Vsites to Usites
addVsites - If true, Vsites are added, otherwise Usites
context - Context string for error reporting

decodeUsiteVsitePairs

protected static void decodeUsiteVsitePairs(String pairsList,
                                            List list,
                                            Map vToU,
                                            String context)
Get list of Usite and Vsite pairs from a String. Used for decoding "Broker remote" NJS tag.

Parameters:
pairsList - The Usite and Vsite pairs, space separated list
list - The destination list of Vsites
vToU - Mapping from Vsites to Usites
context - Context string for error reporting

decodeVsites

protected static void decodeVsites(String vsitesList,
                                   com.pallas.unicore.extensions.Usite usite,
                                   List list,
                                   Map vToU,
                                   String context)
Get a list of Usites from a String. If addVsites is set, add all Vsites from those Usites to the list, otherwise add the Usites themselves. Used for decoding "Broker local" NJS tag.

Parameters:
vsitesList - The Vsites, space separated list
usite - The Usite at which the Vsites are
list - The destination list of Vsites
vToU - Mapping from Vsites to Usites
context - Context string for error reporting

getCustomMenu

public JMenuItem getCustomMenu()
Return the sub menu for the extension menu

Overrides:
getCustomMenu in class com.pallas.unicore.client.util.ExtensionPlugable
Returns:
null

getJPAToolBarComponent

public Component getJPAToolBarComponent()
Return a button that brokers the current job group at the default Vsites.

Overrides:
getJPAToolBarComponent in class com.pallas.unicore.client.util.ExtensionPlugable

getLogger

protected Logger getLogger()
Get the broker plugin logger object

Returns:
Logger object

getPluginInfo

public String getPluginInfo()
Get a short info message for the plugin

Specified by:
getPluginInfo in class com.pallas.unicore.client.util.UnicorePlugable
Returns:
String with info message

getSettingsItem

public JMenuItem getSettingsItem()
Make item for settings menu

Overrides:
getSettingsItem in class com.pallas.unicore.client.util.UnicorePlugable
Returns:
The settings menu item

getVsiteToolBarComponent

public Component getVsiteToolBarComponent()
Gets the vsiteToolBarComponent attribute of the BrokerPlugin object. This contains the "broker at this vsite" button.

Overrides:
getVsiteToolBarComponent in class com.pallas.unicore.client.util.ExtensionPlugable
Returns:
The vsiteToolBarComponent value

lookupUsite

protected static com.pallas.unicore.extensions.Usite lookupUsite(String usiteAddr)
                                                          throws MalformedURLException
Return the Usite from the ResourceManager that matches the given URL (passed as a String).

Parameters:
usiteAddr - The String of the Usite's URL
Returns:
The Usite matching the address
Throws:
MalformedURLException

lookupVsite

protected static Vsite lookupVsite(com.pallas.unicore.extensions.Usite usite,
                                   String vsiteName)
Return the Vsite from the ResourceManager that matches the given Usite and Vsite name

Parameters:
usite - The Usite
vsiteName - The name of the Vsite
Returns:
The Vsite matching the name and Usite

setUpVsiteUsiteMap

protected static void setUpVsiteUsiteMap(List vsites,
                                         Map vsiteToUsite)

startPlugin

public void startPlugin()
Called to initialize the plugin

Specified by:
startPlugin in class com.pallas.unicore.client.util.UnicorePlugable

stopPlugin

public void stopPlugin()
Called when terminating

Specified by:
stopPlugin in class com.pallas.unicore.client.util.UnicorePlugable

UNICORE Resource Broker Client Plugin
1.5α1

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