org.syrup.sql
Class SQLWorkSpace

java.lang.Object
  extended byorg.syrup.sql.SQLWorkSpace
All Implemented Interfaces:
javax.naming.Referenceable, java.io.Serializable, WorkSpace

public class SQLWorkSpace
extends java.lang.Object
implements WorkSpace, java.io.Serializable, javax.naming.Referenceable

Provides a JDBC implementation of a WorkSpace.

Author:
Robbert van Dalen
See Also:
Serialized Form

Field Summary
static long serialVersionUID
           
 
Constructor Summary
SQLWorkSpace()
           
 
Method Summary
protected  java.sql.Connection connection()
          Returns the JDBC Connection that is used internally.
protected  javax.sql.DataSource dataSource()
          Returns the DataSource to create JDBC connections from.
 PTask execute(PTask pt)
          Executes a single Task.
 Data get_out_1()
          Get the first output.
 Data get_out_2()
          Get the second output.
 Context[] get(PTaskTemplate t)
          Get the Contexts of PTasks that match the PTaskTemplate.
 javax.naming.Reference getReference()
           
 LogEntry[] match(LogEntryTemplate template)
           
 PTask[] match(PTaskTemplate template)
          Get PTasks matching the PTaskTemplate.
protected  SyrupConnection readConnection()
          Returns the read-only SyrupConnection that is used internally.
 PTask[] remove(PTask[] tasks)
          Remove PTasks that are done.
 void reset()
          Resets the WorkSpace to the initial state.
 void set_in_1(Data data)
          Set the first input.
 void set_in_2(Data data)
          Set the second input.
 SQLImpl sqlImpl()
          Returns an instance of a SQLImpl.
 PTask stop(PTask task)
          Stop the possible non-progressing execution of a PTask.
protected  SyrupConnection syrupConnection()
          Return the SyrupConnection that is used to optimize SQL commands.
protected  SyrupConnection writeConnection()
          Returns the read-write SyrupConnection that is used internally.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

public static final long serialVersionUID
See Also:
Constant Field Values
Constructor Detail

SQLWorkSpace

public SQLWorkSpace()
Method Detail

getReference

public javax.naming.Reference getReference()
                                    throws javax.naming.NamingException
Specified by:
getReference in interface javax.naming.Referenceable
Throws:
javax.naming.NamingException

dataSource

protected javax.sql.DataSource dataSource()
                                   throws java.lang.Exception
Returns the DataSource to create JDBC connections from.

Returns:
the Datasource to create JDBC connections from.
Throws:
java.lang.Exception

connection

protected java.sql.Connection connection()
                                  throws java.lang.Exception
Returns the JDBC Connection that is used internally.

Returns:
The JDBC Connection.
Throws:
java.lang.Exception

syrupConnection

protected SyrupConnection syrupConnection()
                                   throws java.lang.Exception
Return the SyrupConnection that is used to optimize SQL commands.

Returns:
the SyrupConnection
Throws:
java.lang.Exception

sqlImpl

public SQLImpl sqlImpl()
Returns an instance of a SQLImpl. The implementation is fetched using the JDNI initial context with key 'syrupSQLImpl'.

Returns:
an instance of a SQLImpl.

readConnection

protected SyrupConnection readConnection()
                                  throws java.lang.Exception
Returns the read-only SyrupConnection that is used internally.

Returns:
The read-only SyrupConnection.
Throws:
java.lang.Exception

writeConnection

protected SyrupConnection writeConnection()
                                   throws java.lang.Exception
Returns the read-write SyrupConnection that is used internally.

Returns:
The read-write SyrupConnection Connection.
Throws:
java.lang.Exception

reset

public void reset()
           throws java.lang.Exception
Description copied from interface: WorkSpace
Resets the WorkSpace to the initial state.

Specified by:
reset in interface WorkSpace
Throws:
java.lang.Exception

set_in_1

public void set_in_1(Data data)
              throws java.lang.Exception
Description copied from interface: WorkSpace
Set the first input.

Specified by:
set_in_1 in interface WorkSpace
Parameters:
data - The Data that is set on the first input.
Throws:
java.lang.Exception

set_in_2

public void set_in_2(Data data)
              throws java.lang.Exception
Description copied from interface: WorkSpace
Set the second input.

Specified by:
set_in_2 in interface WorkSpace
Parameters:
data - The Data that is set on the second input.
Throws:
java.lang.Exception

get_out_1

public Data get_out_1()
               throws java.lang.Exception
Description copied from interface: WorkSpace
Get the first output.

Specified by:
get_out_1 in interface WorkSpace
Returns:
The Data removed from the first output.
Throws:
java.lang.Exception

get_out_2

public Data get_out_2()
               throws java.lang.Exception
Description copied from interface: WorkSpace
Get the second output.

Specified by:
get_out_2 in interface WorkSpace
Returns:
The Data removed from the second output.
Throws:
java.lang.Exception

match

public PTask[] match(PTaskTemplate template)
              throws java.lang.Exception
Description copied from interface: WorkSpace
Get PTasks matching the PTaskTemplate.

Specified by:
match in interface WorkSpace
Parameters:
template - The PTaskTemplate to be matched.
Returns:
An array of PTasks that match the PTaskTemplate.
Throws:
java.lang.Exception

get

public Context[] get(PTaskTemplate t)
              throws java.lang.Exception
Description copied from interface: WorkSpace
Get the Contexts of PTasks that match the PTaskTemplate.

Specified by:
get in interface WorkSpace
Parameters:
t - The PTaskTemplate to be matched.
Returns:
An array of Contexts surrounding the PTasks that match the PTaskTemplate.
Throws:
java.lang.Exception

stop

public PTask stop(PTask task)
           throws java.lang.Exception
Description copied from interface: WorkSpace
Stop the possible non-progressing execution of a PTask.

Specified by:
stop in interface WorkSpace
Parameters:
task - The PTask to be stopped.
Returns:
The stopped PTask.
Throws:
java.lang.Exception

remove

public PTask[] remove(PTask[] tasks)
               throws java.lang.Exception
Description copied from interface: WorkSpace
Remove PTasks that are done.

Specified by:
remove in interface WorkSpace
Parameters:
tasks - The array of PTasks to remove.
Returns:
The array of PTasks that are removed.
Throws:
java.lang.Exception

execute

public PTask execute(PTask pt)
              throws java.lang.Exception
Description copied from interface: WorkSpace
Executes a single Task.

Specified by:
execute in interface WorkSpace
Parameters:
pt - The PTask to be executed.
Returns:
The PTask that has been executed.
Throws:
java.lang.Exception

match

public LogEntry[] match(LogEntryTemplate template)
                 throws java.lang.Exception
Specified by:
match in interface WorkSpace
Parameters:
template - The LogEntryTemplate to be matched.
Returns:
An array of LogEntries that match the template.
Throws:
java.lang.Exception