edu.wpi.prc.templates.java.validator
Class ValidatorClient

java.lang.Object
  extended by edu.wpi.prc.templates.java.common.Client
      extended by edu.wpi.prc.templates.java.validator.ValidatorClient

public class ValidatorClient
extends Client

The ValidatorClient is an XML-RPC client with added functionality that is needed by the result validator.


Field Summary
private static ValidatorClient client
           
private static java.lang.String DEFAULT_SERVER_ADDRESS
           
private static java.lang.String GET_ASSOCIATED_WU_RPC_NAME
           
private static java.lang.String GET_RESULT_RPC_NAME
           
private static java.lang.String MARK_INVALID_RPC_NAME
           
private static java.lang.String MARK_VALID_RPC_NAME
           
private static java.lang.String SELECT_CANONICAL_RPC_NAME
           
(package private)  ResultValidator validator
           
 
Constructor Summary
private ValidatorClient()
          Private constructor because the ValidatorClient is a singleton.
 
Method Summary
 byte[] getAssociatedWorkUnit(java.lang.String resultID)
          Gets the associated work unit for the given result.
static ValidatorClient instance()
           
 boolean markResultInvalid(java.lang.String resultID)
          Marks the result with the given ID as valid.
 boolean markResultValid(java.lang.String resultID)
          Marks the result with the given ID as valid.
 boolean selectCanonicalResult(java.lang.String resultID)
          Selects the result with the given ID as the canonical result for a work unit.
 void validateNextResult()
          Gets the next result to be validated from the server, then invokes the appropriate method of the ResultValidator, depending on what type of result needed to be validated.
 
Methods inherited from class edu.wpi.prc.templates.java.common.Client
executeRPC, executeRPCUntilSuccess, setServerAddress
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GET_RESULT_RPC_NAME

private static final java.lang.String GET_RESULT_RPC_NAME
See Also:
Constant Field Values

MARK_VALID_RPC_NAME

private static final java.lang.String MARK_VALID_RPC_NAME
See Also:
Constant Field Values

MARK_INVALID_RPC_NAME

private static final java.lang.String MARK_INVALID_RPC_NAME
See Also:
Constant Field Values

SELECT_CANONICAL_RPC_NAME

private static final java.lang.String SELECT_CANONICAL_RPC_NAME
See Also:
Constant Field Values

GET_ASSOCIATED_WU_RPC_NAME

private static final java.lang.String GET_ASSOCIATED_WU_RPC_NAME
See Also:
Constant Field Values

DEFAULT_SERVER_ADDRESS

private static final java.lang.String DEFAULT_SERVER_ADDRESS
See Also:
Constant Field Values

client

private static ValidatorClient client

validator

ResultValidator validator
Constructor Detail

ValidatorClient

private ValidatorClient()
Private constructor because the ValidatorClient is a singleton.

Method Detail

validateNextResult

public void validateNextResult()
                        throws RPCHandlerException
Gets the next result to be validated from the server, then invokes the appropriate method of the ResultValidator, depending on what type of result needed to be validated. When the ResultValidator has finished validating the result, this method will inform the project server of the outcome.

Throws:
RPCHandlerException

markResultValid

public boolean markResultValid(java.lang.String resultID)
Marks the result with the given ID as valid.

Parameters:
resultID - The ID of the result to mark valid.
Returns:
Returns true if the result was successfully marked valid, false if no result with the given ID was found.

markResultInvalid

public boolean markResultInvalid(java.lang.String resultID)
Marks the result with the given ID as valid.

Parameters:
resultID - The ID of the result to mark valid.
Returns:
Returns true if the result was successfully marked valid, false if no result with the given ID was found.

selectCanonicalResult

public boolean selectCanonicalResult(java.lang.String resultID)
Selects the result with the given ID as the canonical result for a work unit.

Parameters:
resultID - The ID of the result to select.
Returns:
Returns true if the result was successfully selected, false if no result with the given ID was found.

getAssociatedWorkUnit

public byte[] getAssociatedWorkUnit(java.lang.String resultID)
Gets the associated work unit for the given result.

Parameters:
resultID - The result for which to get the associated work unit.
Returns:
Returns the data contained in the associated work unit.

instance

public static ValidatorClient instance()
Returns:
Returns the singleton instance of the ValidatorClient class.