public class HsqldbJob extends Object
<oddjob id="this"> <job> <sequential id="top" name="Run in Sequence"> <jobs> <hsql:hsqldb name="Hsqldb Server" xmlns:hsql="http://rgordon.co.uk/oddjob/hsql"> <database> <value key="mydb" value="${work.dir}/mydb"/> </database> <properties> <properties> <values> <value key="server.port" value="11001"/> <value key="server.silent" value="false"/> </values> </properties> </properties> </hsql:hsqldb> <variables id="vars"> <connection> <hsql:connection url="jdbc:hsqldb:hsql://localhost:11001/mydb" username="sa" xmlns:hsql="http://rgordon.co.uk/oddjob/hsql"/> </connection> </variables> <folder name="Setup Sql"> <jobs> <sequential id="setup" name="All"> <jobs> <sql name="Create table"> <connection> <value value="${vars.connection}"/> </connection> <input> <buffer>create table greetings ( style varchar(20), greeting varchar(30),constraint greetings_pk primary key (style))</buffer> </input> </sql> <sql name="Insert1"> <connection> <value value="${vars.connection}"/> </connection> <input> <buffer>insert into greetings values ('nice', 'hello')</buffer> </input> </sql> <sql name="Insert1"> <connection> <value value="${vars.connection}"/> </connection> <input> <buffer>insert into greetings values ('grumpy', 'bah humbug')</buffer> </input> </sql> </jobs> </sequential> </jobs> </folder> <folder name="Query Sql"> <jobs> <sequential id="single-query" name="All"> <jobs> <sql id="query" name="Query"> <connection> <value value="${vars.connection}"/> </connection> <input> <buffer>select greeting from greetings where style='nice'</buffer> </input> <results> <sql-results-bean/> </results> </sql> <echo id="result">${query.results.row.GREETING}</echo> <echo id="resultindexed">${query.results.rows[0].GREETING}</echo> </jobs> </sequential> </jobs> </folder> <folder name="Query All"> <jobs> <sequential id="all-query" name="All"> <jobs> <sql id="queryall" name="Query"> <connection> <value value="${vars.connection}"/> </connection> <input> <buffer>select style, greeting from greetings</buffer> </input> <results> <sql-results-bean/> </results> </sql> <foreach id="for"> <values> <value value="${queryall.results.rows}"/> </values> <configuration> <xml> <foreach id="for"> <job> <echo>${for.current.STYLE} is ${for.current.GREETING}</echo> </job> </foreach> </xml> </configuration> </foreach> </jobs> </sequential> </jobs> </folder> <folder name="Cleanup Sql"> <jobs> <sql id="clean-up" name="Sql Job"> <connection> <value value="${vars.connection}"/> </connection> <input> <buffer>drop table greetings</buffer> </input> </sql> </jobs> </folder> </jobs> </sequential> </job> </oddjob>
SQLPersisterService
.
<oddjob> <job> <sequential name="Sql Persister Example"> <jobs> <hsql:hsqldb name="Database Server" xmlns:hsql="http://rgordon.co.uk/oddjob/hsql"> <database> <value key="ojdb" value="${work.dir}/ojdb"/> </database> <properties> <properties> <values> <value key="server.port" value="11002"/> <value key="server.silent" value="false"/> </values> </properties> </properties> </hsql:hsqldb> <variables id="vars"> <persisterConnection> <hsql:connection url="jdbc:hsqldb:hsql://localhost:11002/ojdb" username="sa" xmlns:hsql="http://rgordon.co.uk/oddjob/hsql"/> </persisterConnection> </variables> <sql name="Create table"> <connection> <value value="${vars.persisterConnection}"/> </connection> <input> <buffer>CREATE TABLE oddjob( path VARCHAR(32), id VARCHAR(32), job BLOB, CONSTRAINT oddjob_pk PRIMARY KEY (path, id))</buffer> </input> </sql> <sql-persister-service id="persister-service"> <connection> <value value="${vars.persisterConnection}"/> </connection> </sql-persister-service> <oddjob id="database-persist-example" name="A Database Persisted Oddjob"> <configuration> <arooa:configuration resource="org/oddjob/hsql/OddjobToPersist.xml" xmlns:arooa="http://rgordon.co.uk/oddjob/arooa"/> </configuration> <persister> <value value="${persister-service.persister(example)}"/> </persister> </oddjob> <folder name="Cleanup Sql"> <jobs> <sql id="clean-up" name="Sql Job"> <connection> <value value="${vars.persisterConnection}"/> </connection> <input> <buffer>drop table oddjob</buffer> </input> </sql> </jobs> </folder> </jobs> </sequential> </job> </oddjob>
Constructor and Description |
---|
HsqldbJob() |
Modifier and Type | Method and Description |
---|---|
String |
getDatabase(String name)
Get the database path for a give name.
|
String |
getName()
Get the name.
|
Properties |
getProperties()
Getter for properties.
|
Integer |
getServerState() |
void |
setDatabase(String name,
String path)
Set the database name.
|
void |
setName(String name)
Set the name.
|
void |
setProperties(Properties properties)
Setter for server properties.
|
void |
start()
Start the server.
|
void |
stop()
Stop the server.
|
String |
toString() |
public String getName()
public void setName(String name)
name
- The name.public String getDatabase(String name)
name
- The database path.public void setDatabase(String name, String path)
name
- The database name.public void setProperties(Properties properties)
properties
- The property name.value
- The property value.public Properties getProperties()
name
- The property name.public void start() throws IOException, org.hsqldb.server.ServerAcl.AclFormatException
org.hsqldb.server.ServerAcl.AclFormatException
IOException
public void stop()
public Integer getServerState()
Property: serverState
Description: The current state of this server in numerically coded form.
Typically, this will be one of:
Required: Read Only.