dods.servers.sql
Class SSFunique

java.lang.Object
  extended bydods.servers.sql.SSFunique
All Implemented Interfaces:
BoolFunction, ServerSideFunction, SqlBoolFunction

public class SSFunique
extends java.lang.Object
implements SqlBoolFunction

Server side function for the DRDS. invoking this function in the DODS URL will cause the DRDS to only return those rows of the result that are unique. The SQL keyword DISTINCT is added to the SELECT statement to induce this behaviour.

Author:
Nathan David Potter

Constructor Summary
SSFunique()
           
 
Method Summary
 void checkArgs(java.util.List args)
          Checks that the arguments given are acceptable arguments for this function.
 boolean evaluate(java.util.List args)
          Evaluates the function using the argument list given.
 java.lang.String getName()
          Returns the name of the server-side function, as it will appear in constraint expressions.
 java.lang.String getSQLCommand(java.util.List args)
          This methods returns the SQL representation of this function.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SSFunique

public SSFunique()
Method Detail

getSQLCommand

public java.lang.String getSQLCommand(java.util.List args)
This methods returns the SQL representation of this function. If this function cannot produce ansensible SQL representation then this method should return null.

Specified by:
getSQLCommand in interface SqlBoolFunction
Parameters:
args - A list of Clauses containing the arguments specified for this method in the DODS URL.
Returns:
A String containing the SQL respresentation for this Server Side Function. If no such representation exisit, then it shall return null.

evaluate

public boolean evaluate(java.util.List args)
                 throws SDODSException
Evaluates the function using the argument list given.

Specified by:
evaluate in interface BoolFunction
Throws:
SDODSException - Thrown if the function cannot evaluate successfully. The exact type of exception is up to the author of the server-side function.

getName

public java.lang.String getName()
Returns the name of the server-side function, as it will appear in constraint expressions. This must be a valid DODS identifier. All functions must have distinct names.

Specified by:
getName in interface ServerSideFunction

checkArgs

public void checkArgs(java.util.List args)
               throws InvalidParameterException
Checks that the arguments given are acceptable arguments for this function. This method should only use those attributes of a SubClause which do not change over its lifetime - whether it is constant, what class of SubClause it is, what class of BaseType it returns, etc. Thus, the method should not look at the actual value of an argument unless the argument is flagged as constant.

Specified by:
checkArgs in interface ServerSideFunction
Parameters:
args - A list of SubClauses that the caller is considering passing to the evaluate() method of the function.
Returns:
The function should return normally if the arguments appear acceptable, and throw an exception describing the problem otherwise.
Throws:
InvalidParameterException - Thrown if the function will not evaluate successfully using these arguments.