ZetaGrid v1.9

zeta.util
Class Parameter

java.lang.Object
  |
  +--zeta.util.Parameter

public class Parameter
extends java.lang.Object

Gets global parameters from the database.


Field Summary
static int GLOBAL_PARAMETER
           
private static java.util.Map mapValue
          Cache for parameters.
private static long[] serverMaxWorkUnitId
          Values which are returned from the method getServerMaxWorkUnitId.
private static java.lang.Boolean updateServerMaxWorkUnitId
          true if the attribute serverMaxWorkUnitId has to retrieve from the database.
 
Constructor Summary
Parameter()
           
 
Method Summary
static long[] getServerMaxWorkUnitId(ZetaServlet servlet, java.sql.Statement stmt, int serverId, int taskId)
          Returns the maximal possible work unit ID (result[0]+result[1] = work_unit_id+range) for the specified server.
static long getValue(java.sql.Statement stmt, java.lang.String parameter, int taskId, long defaultValue, long cachingTime)
          Returns the value of the specified task parameter.
static java.lang.String getValue(java.sql.Statement stmt, java.lang.String parameter, int taskId, java.lang.String defaultValue)
          Returns the value of the specified task parameter.
static java.lang.String getValue(java.sql.Statement stmt, java.lang.String parameter, int taskId, java.lang.String defaultValue, long cachingTime)
          Returns the value of the specified task parameter.
static java.lang.String getValue(java.sql.Statement stmt, java.lang.String parameter, java.lang.String defaultValue)
          Returns the value of the specified global parameter.
static long newServerMaxWorkUnitId(ZetaServlet servlet, java.sql.Statement stmt, int serverId, int taskId)
          Inserts a new reservation of work units in the database for the specified server.
static void setValue(int serverId, java.sql.Statement stmt, int taskId, java.lang.String parameter, java.lang.String value, boolean synchronizeWithOtherServers)
          Set the value of the specified global parameter.
static void setValue(java.sql.Statement stmt, int taskId, java.lang.String parameter, java.lang.String value)
          Set the value of the specified task parameter.
static void setValue(java.sql.Statement stmt, java.lang.String parameter, java.lang.String value)
          Set the value of the specified global parameter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GLOBAL_PARAMETER

public static final int GLOBAL_PARAMETER
See Also:
Constant Field Values

mapValue

private static java.util.Map mapValue
Cache for parameters.


updateServerMaxWorkUnitId

private static java.lang.Boolean updateServerMaxWorkUnitId
true if the attribute serverMaxWorkUnitId has to retrieve from the database.


serverMaxWorkUnitId

private static long[] serverMaxWorkUnitId
Values which are returned from the method getServerMaxWorkUnitId.

Constructor Detail

Parameter

public Parameter()
Method Detail

getValue

public static java.lang.String getValue(java.sql.Statement stmt,
                                        java.lang.String parameter,
                                        java.lang.String defaultValue)
                                 throws java.sql.SQLException
Returns the value of the specified global parameter.

Parameters:
stmt - statement object's database
parameter - global parameter
defaultValue - default value
Returns:
the value of the specified global parameter.
Throws:
java.sql.SQLException - if a database access error occurs.

getValue

public static java.lang.String getValue(java.sql.Statement stmt,
                                        java.lang.String parameter,
                                        int taskId,
                                        java.lang.String defaultValue)
                                 throws java.sql.SQLException
Returns the value of the specified task parameter.

Parameters:
stmt - statement object's database
parameter - global parameter
taskId - ID of the task
defaultValue - default value
Returns:
the value of the specified global parameter.
Throws:
java.sql.SQLException - if a database access error occurs.

getValue

public static long getValue(java.sql.Statement stmt,
                            java.lang.String parameter,
                            int taskId,
                            long defaultValue,
                            long cachingTime)
                     throws java.sql.SQLException
Returns the value of the specified task parameter.

Parameters:
stmt - statement object's database
parameter - global parameter
taskId - ID of the task
defaultValue - default value
cachingTime - caching the value for milli seconds
Returns:
the value of the specified global parameter.
Throws:
java.sql.SQLException - if a database access error occurs.

getValue

public static java.lang.String getValue(java.sql.Statement stmt,
                                        java.lang.String parameter,
                                        int taskId,
                                        java.lang.String defaultValue,
                                        long cachingTime)
                                 throws java.sql.SQLException
Returns the value of the specified task parameter.

Parameters:
stmt - statement object's database
parameter - task parameter
taskId - ID of the task
defaultValue - default value
cachingTime - caching the value for milli seconds
Returns:
the value of the specified global parameter.
Throws:
java.sql.SQLException - if a database access error occurs.

setValue

public static void setValue(java.sql.Statement stmt,
                            java.lang.String parameter,
                            java.lang.String value)
                     throws java.sql.SQLException
Set the value of the specified global parameter. This parameter will not be synchronized with other servers.

Parameters:
stmt - statement object's database
parameter - global parameter
value - value of the parameter
Throws:
java.sql.SQLException - if a database access error occurs.

setValue

public static void setValue(java.sql.Statement stmt,
                            int taskId,
                            java.lang.String parameter,
                            java.lang.String value)
                     throws java.sql.SQLException
Set the value of the specified task parameter. This parameter will not be synchronized with other servers.

Parameters:
stmt - statement object's database
taskId - ID of the task
parameter - task parameter
value - value of the parameter
Throws:
java.sql.SQLException - if a database access error occurs.

setValue

public static void setValue(int serverId,
                            java.sql.Statement stmt,
                            int taskId,
                            java.lang.String parameter,
                            java.lang.String value,
                            boolean synchronizeWithOtherServers)
                     throws java.sql.SQLException
Set the value of the specified global parameter.

Parameters:
serverId - ID of the server
taskId - ID of the task
stmt - statement object's database
parameter - global parameter
value - value of the parameter
synchronizeWithOtherServers - the parameter will be synchronized with other servers.
Throws:
java.sql.SQLException - if a database access error occurs.

getServerMaxWorkUnitId

public static long[] getServerMaxWorkUnitId(ZetaServlet servlet,
                                            java.sql.Statement stmt,
                                            int serverId,
                                            int taskId)
                                     throws java.sql.SQLException,
                                            javax.servlet.ServletException
Returns the maximal possible work unit ID (result[0]+result[1] = work_unit_id+range) for the specified server.

Parameters:
servlet - servlet which has a connection to the server database.
stmt - statement object's database
serverId - ID of the server
taskId - ID of the task
Returns:
the maximal possible work unit ID (result[0]+result[1] = work_unit_id+range) for the specified server.
Throws:
java.sql.SQLException - if a database access error occurs.
javax.servlet.ServletException

newServerMaxWorkUnitId

public static long newServerMaxWorkUnitId(ZetaServlet servlet,
                                          java.sql.Statement stmt,
                                          int serverId,
                                          int taskId)
                                   throws java.sql.SQLException,
                                          javax.servlet.ServletException
Inserts a new reservation of work units in the database for the specified server.

Parameters:
servlet - servlet which has a connection to the server database.
stmt - statement object's database
serverId - ID of the server
taskId - ID of the task
Throws:
java.sql.SQLException - if a database access error occurs or the table 'zeta.server' is not defined.
javax.servlet.ServletException

ZetaGrid v1.9

For further technical papers, see ZetaGrid Technical Documentation.
 
Copyright © 2001,2002 Sebastian Wedeniwski. All Rights Reserved.