org.syrup.sql
Class QueryFunctions

java.lang.Object
  extended byorg.syrup.sql.Functions
      extended byorg.syrup.sql.QueryFunctions

public class QueryFunctions
extends Functions

Utility functions to query Syrup objects using JDBC.

Author:
Robbert van Dalen

Constructor Summary
QueryFunctions(SQLImpl sqlImpl)
          Constructor for the QueryFunctions object
 
Method Summary
protected  boolean checkDone(java.lang.String key, SyrupConnection con)
          Returns true if a PTask is done by executing SQL statements over a Connection.
protected  boolean checkInDone(java.lang.String key, boolean port, SyrupConnection con)
          Returns true if the input Port of a PTask is done by executing SQL statements over a Connection.
protected  boolean checkInLinkFull(java.lang.String key, boolean port, SyrupConnection con)
          Returns true if the input Link of a PTask is done by executing SQL statements over a Connection.
protected  boolean checkOrType(java.lang.String key, SyrupConnection con)
          Returns true if a PTask is of type OR by executing SQL statements over a Connection.
protected  boolean checkOutDone(java.lang.String key, boolean port, SyrupConnection con)
           
protected  boolean checkOutLinkFull(java.lang.String key, boolean port, SyrupConnection con)
          Returns true if the out Link of a PTask is full by executing SQL statements over a Connection.
protected  boolean checkTargetLink(java.lang.String statement, java.lang.String key, boolean port, SyrupConnection con)
          Returns true if the input Link of a PTask is done by executing SQL statements over a Connection.
protected  Context readContext(PTask p, SyrupConnection con)
          Returns the Context of a PTask by executing SQL statements over a Connection.
protected  Data readData(java.sql.ResultSet result, java.lang.String k)
          Returns the Data contained by a ResultSet.
protected  EndPoint readInEndPoint(java.lang.String key, boolean port, SyrupConnection con)
          Returns the in EndPoint of a PTask by executing SQL statements over a Connection.
protected  java.lang.String readInTask(java.lang.String key, boolean port, SyrupConnection con)
          Returns the in PTask identifier of a PTask by executing SQL statements over a Connection.
protected  LogEntry readLogEntry(java.sql.ResultSet result)
          Returns a LogEntry held by a ResultSet
protected  EndPoint readOutEndPoint(java.lang.String key, boolean port, SyrupConnection con)
          Returns the out EndPoint of a PTask by executing SQL statements over a Connection.
protected  java.lang.String readOutTask(java.lang.String key, boolean port, SyrupConnection con)
          Returns the out PTask identifier of a PTask by executing SQL statements over a Connection.
protected  PTask readPTask(java.sql.ResultSet result)
          Returns a PTask held by a ResultSet
protected  PTask readPTask(java.lang.String key, SyrupConnection con)
          Returns the PTask, given an identifier, by executing SQL statements over a Connection.
protected  EndPoint readTargetEndPoint(java.lang.String st, java.lang.String key, boolean port, SyrupConnection con)
          Returns the in/out EndPoint of a PTask by executing SQL statements over a Connection.
protected  java.lang.String readTargetLinkTask(java.lang.String st, java.lang.String key, boolean port, SyrupConnection con)
          Returns the in/out PTask identifier of a PTask by executing SQL statements over a Connection.
 
Methods inherited from class org.syrup.sql.Functions
sqlImpl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QueryFunctions

public QueryFunctions(SQLImpl sqlImpl)
Constructor for the QueryFunctions object

Parameters:
sqlImpl - The SQLImpl that is held by the Function instance.
Method Detail

checkDone

protected boolean checkDone(java.lang.String key,
                            SyrupConnection con)
                     throws java.lang.Exception
Returns true if a PTask is done by executing SQL statements over a Connection.

Parameters:
key - The PTask identifier that is checked.
con - The SyrupConnection over which SQL statements are executed.
Returns:
True if the Ptask is done.
Throws:
java.lang.Exception

checkInDone

protected boolean checkInDone(java.lang.String key,
                              boolean port,
                              SyrupConnection con)
                       throws java.lang.Exception
Returns true if the input Port of a PTask is done by executing SQL statements over a Connection.

Parameters:
key - The PTask identifier that is checked.
port - The input port number.
con - The SyrupConnection over which SQL statements are executed.
Returns:
True if the input of a PTask is done.
Throws:
java.lang.Exception

checkOutDone

protected boolean checkOutDone(java.lang.String key,
                               boolean port,
                               SyrupConnection con)
                        throws java.lang.Exception
Throws:
java.lang.Exception

checkOrType

protected boolean checkOrType(java.lang.String key,
                              SyrupConnection con)
                       throws java.lang.Exception
Returns true if a PTask is of type OR by executing SQL statements over a Connection.

Parameters:
key - The PTask identifier that is checked.
con - The SyrupConnection over which SQL statements are executed.
Returns:
True if a PTask is of type OR.
Throws:
java.lang.Exception

checkOutLinkFull

protected boolean checkOutLinkFull(java.lang.String key,
                                   boolean port,
                                   SyrupConnection con)
                            throws java.lang.Exception
Returns true if the out Link of a PTask is full by executing SQL statements over a Connection.

Parameters:
key - The PTask identifier that is checked.
port - The Port number of the PTask's output Link that is checked.
con - The SyrupConnection over which SQL statements are executed.
Returns:
True if the Link is full.
Throws:
java.lang.Exception

checkInLinkFull

protected boolean checkInLinkFull(java.lang.String key,
                                  boolean port,
                                  SyrupConnection con)
                           throws java.lang.Exception
Returns true if the input Link of a PTask is done by executing SQL statements over a Connection.

Parameters:
key - The PTask identifier that is checked.
port - The Port number of the PTask's input Link that is checked.
con - The SyrupConnection over which SQL statements are executed.
Returns:
True if the Link is full.
Throws:
java.lang.Exception

checkTargetLink

protected boolean checkTargetLink(java.lang.String statement,
                                  java.lang.String key,
                                  boolean port,
                                  SyrupConnection con)
                           throws java.lang.Exception
Returns true if the input Link of a PTask is done by executing SQL statements over a Connection.

Parameters:
statement - The SQL statement to check the ingoing/outgoing Link.
key - The PTask identifier that is checked.
port - The Port number of the PTask's input Link that is checked.
con - The SyrupConnection over which SQL statements are executed.
Returns:
True if the Link is full.
Throws:
java.lang.Exception

readOutEndPoint

protected EndPoint readOutEndPoint(java.lang.String key,
                                   boolean port,
                                   SyrupConnection con)
                            throws java.lang.Exception
Returns the out EndPoint of a PTask by executing SQL statements over a Connection.

Parameters:
key - The PTask identifier.
port - The port of the PTask.
con - The SyrupConnection over which SQL statements are executed.
Returns:
The out EndPoint of a PTask.
Throws:
java.lang.Exception

readInEndPoint

protected EndPoint readInEndPoint(java.lang.String key,
                                  boolean port,
                                  SyrupConnection con)
                           throws java.lang.Exception
Returns the in EndPoint of a PTask by executing SQL statements over a Connection.

Parameters:
key - The subject PTask identifier.
port - The subject port of the PTask.
con - The SyrupConnection over which SQL statements are executed.
Returns:
The in EndPoint of a PTask.
Throws:
java.lang.Exception

readTargetEndPoint

protected EndPoint readTargetEndPoint(java.lang.String st,
                                      java.lang.String key,
                                      boolean port,
                                      SyrupConnection con)
                               throws java.lang.Exception
Returns the in/out EndPoint of a PTask by executing SQL statements over a Connection.

Parameters:
st - The SQL statement to return the in/out EndPoint.
key - The subject PTask identifier.
port - The subject port of the PTask.
con - The SyrupConnection over which SQL statements are executed.
Returns:
The in/out EndPoint of a PTask.
Throws:
java.lang.Exception

readOutTask

protected java.lang.String readOutTask(java.lang.String key,
                                       boolean port,
                                       SyrupConnection con)
                                throws java.lang.Exception
Returns the out PTask identifier of a PTask by executing SQL statements over a Connection.

Parameters:
key - The subject PTask identifier.
port - The subject port of the PTask.
con - The SyrupConnection over which SQL statements are executed.
Returns:
The out PTask identifier of a PTask.
Throws:
java.lang.Exception

readInTask

protected java.lang.String readInTask(java.lang.String key,
                                      boolean port,
                                      SyrupConnection con)
                               throws java.lang.Exception
Returns the in PTask identifier of a PTask by executing SQL statements over a Connection.

Parameters:
key - The subject PTask identifier.
port - The subject port of the PTask.
con - The SyrupConnection over which SQL statements are executed.
Returns:
The in PTask identifier of a PTask.
Throws:
java.lang.Exception

readTargetLinkTask

protected java.lang.String readTargetLinkTask(java.lang.String st,
                                              java.lang.String key,
                                              boolean port,
                                              SyrupConnection con)
                                       throws java.lang.Exception
Returns the in/out PTask identifier of a PTask by executing SQL statements over a Connection.

Parameters:
st - The SQL statement to return the in/out PTask identifier..
key - The subject PTask identifier.
port - The subject port of the PTask.
con - The SyrupConnection over which SQL statements are executed.
Returns:
The in/out PTask identifier of a PTask.
Throws:
java.lang.Exception

readContext

protected Context readContext(PTask p,
                              SyrupConnection con)
                       throws java.lang.Exception
Returns the Context of a PTask by executing SQL statements over a Connection.

Parameters:
p - The subject PTask.
con - The SyrupConnection over which SQL statements are executed.
Returns:
The Context of a PTask.
Throws:
java.lang.Exception

readData

protected Data readData(java.sql.ResultSet result,
                        java.lang.String k)
                 throws java.lang.Exception
Returns the Data contained by a ResultSet.

Parameters:
result - The ResultSet the contains the raw data.
k - The SQL attribute to fetch.
Returns:
The Data contained by a ResultSet.
Throws:
java.lang.Exception

readPTask

protected PTask readPTask(java.lang.String key,
                          SyrupConnection con)
                   throws java.lang.Exception
Returns the PTask, given an identifier, by executing SQL statements over a Connection.

Parameters:
key - The identifier of a PTask.
con - The SyrupConnection over which SQL statements are executed.
Returns:
The PTask, given an identifier.
Throws:
java.lang.Exception

readPTask

protected PTask readPTask(java.sql.ResultSet result)
                   throws java.lang.Exception
Returns a PTask held by a ResultSet

Parameters:
result - The ResultSet that holds the PTask attributes.
Returns:
The PTask held by a ResultSet.
Throws:
java.lang.Exception

readLogEntry

protected LogEntry readLogEntry(java.sql.ResultSet result)
                         throws java.lang.Exception
Returns a LogEntry held by a ResultSet

Parameters:
result - The ResultSet that holds the LogEntry attributes.
Returns:
The LogEntry held by a ResultSet.
Throws:
java.lang.Exception