UNICORE Resource Broker Client Plugin
1.5α1

org.eurogrid.broker.client
Class BrokerDefaults

java.lang.Object
  |
  +--java.util.Dictionary
        |
        +--java.util.Hashtable
              |
              +--java.util.Properties
                    |
                    +--org.eurogrid.broker.client.BrokerDefaults
All Implemented Interfaces:
Cloneable, Map, Serializable

public class BrokerDefaults
extends Properties

Helper class for holding, loading and save script plugin default values

Version:
$Revision: 1.8 $, $Date: 2004/02/17 11:32:40 $
Author:
Jon MacLaren, Donal K. Fellows
See Also:
Serialized Form

Field Summary
static String CURRENCY
          String constant defining property key for the preferred cost units
static String ORDERING
          String constant defining property key for the offer ordering rules
static String USITELIST
          String constant defining property key for the list of Usites
static String VERBOSE
          String constant defining property key for the plugin's verbosity
static String VSITELIST
          String constant defining property key for the list of Vsites
 
Fields inherited from class java.util.Properties
defaults
 
Constructor Summary
BrokerDefaults()
          Loads settings from file or generates system defaults if file is not available.
 
Method Summary
 String getCurrency()
          Get the default currency for displaying offer prices in.
 OfferTableModel.Comparison[] getOfferOrdering()
          Get the ordering rules used for sorting offers.
 String getProperty(String prop)
          Overwrite getProperty method to prevent return value null and return "" instead.
 void getUsiteList(List usite_list)
          Gets a list of Usites based on the UsiteList attribute of the BrokerDefaults object
 void getUsiteListAsVsites(List vsiteList, Map v_to_u)
          Gets a list of Vsites based on the UsiteList attribute of the BrokerDefaults object
 boolean getVerbose()
          Gets the verbose setting
 void getVsiteList(List vsiteList, Map v_to_u)
          Gets the VsiteList attribute of the BrokerDefaults object
 boolean loadFromFile()
          Load broker default values from file BrokerDefaults.txt
 void setCurrency(String currency)
          Sets the default currency to display pricings in.
 void setOfferOrdering(OfferTableModel.Comparison[] policy)
          Sets the offer ordering policy in the BrokerDefaults object to the given array of basic policies.
 void setUsiteList(List usites)
          Sets the list of Usites in the BrokerDefaults object
 void setVerbose(boolean b)
          Sets the verbose setting in the defaults
 void setVsiteList(List vsites, Map v_to_u)
          Sets the list of Vsites in the BrokerDefaults object
 boolean writeToFile()
          Try to write script default values to file BrokerDefaults.txt
 
Methods inherited from class java.util.Properties
getProperty, list, list, load, propertyNames, save, setProperty, store
 
Methods inherited from class java.util.Hashtable
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, rehash, remove, size, toString, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

CURRENCY

public static final String CURRENCY
String constant defining property key for the preferred cost units

See Also:
Constant Field Values

ORDERING

public static final String ORDERING
String constant defining property key for the offer ordering rules

See Also:
Constant Field Values

USITELIST

public static final String USITELIST
String constant defining property key for the list of Usites

See Also:
Constant Field Values

VERBOSE

public static final String VERBOSE
String constant defining property key for the plugin's verbosity

See Also:
Constant Field Values

VSITELIST

public static final String VSITELIST
String constant defining property key for the list of Vsites

See Also:
Constant Field Values
Constructor Detail

BrokerDefaults

public BrokerDefaults()
Loads settings from file or generates system defaults if file is not available.

Method Detail

getCurrency

public String getCurrency()
Get the default currency for displaying offer prices in.


getOfferOrdering

public OfferTableModel.Comparison[] getOfferOrdering()
Get the ordering rules used for sorting offers.


getProperty

public String getProperty(String prop)
Overwrite getProperty method to prevent return value null and return "" instead. This is important to prevent null pointer execptions from faulty BrokerDefaults files.

Overrides:
getProperty in class Properties
Parameters:
prop - Property name
Returns:
The Property value

getUsiteList

public void getUsiteList(List usite_list)
Gets a list of Usites based on the UsiteList attribute of the BrokerDefaults object

Parameters:
usite_list - A list into which the Usites are inserted

getUsiteListAsVsites

public void getUsiteListAsVsites(List vsiteList,
                                 Map v_to_u)
Gets a list of Vsites based on the UsiteList attribute of the BrokerDefaults object

Parameters:
vsiteList - A list into which the Vsites are inserted
v_to_u - A map into which entries are inserted mapping Vsites to Usites. The map must already exist.

getVerbose

public boolean getVerbose()
Gets the verbose setting

Returns:
true if verbose output is required

getVsiteList

public void getVsiteList(List vsiteList,
                         Map v_to_u)
Gets the VsiteList attribute of the BrokerDefaults object

Parameters:
vsiteList - A list into which the Vsites are inserted
v_to_u - A map into which entries are inserted mapping Vsites to Usites. The map must already exist.

loadFromFile

public boolean loadFromFile()
Load broker default values from file BrokerDefaults.txt

Returns:
true if loading was successful, else false

setCurrency

public void setCurrency(String currency)
Sets the default currency to display pricings in.

Parameters:
currency - Currency description string, which should match the currency descriptors provided by brokering services.

setOfferOrdering

public void setOfferOrdering(OfferTableModel.Comparison[] policy)
Sets the offer ordering policy in the BrokerDefaults object to the given array of basic policies.


setUsiteList

public void setUsiteList(List usites)
Sets the list of Usites in the BrokerDefaults object

Parameters:
usites - The new list of Usites

setVerbose

public void setVerbose(boolean b)
Sets the verbose setting in the defaults

Parameters:
b - true if verbose output is required

setVsiteList

public void setVsiteList(List vsites,
                         Map v_to_u)
Sets the list of Vsites in the BrokerDefaults object

Parameters:
vsites - The new list of Vsites
v_to_u - A map of Vsites to Usites, used to create full Vsite references

writeToFile

public boolean writeToFile()
Try to write script default values to file BrokerDefaults.txt

Returns:
true if saving was successful, else false

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.