|
ModeShape Distribution 3.0.0.Beta3 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.modeshape.jcr.value.binary.Database
public class Database
Helper class for manipulation with database.
| Nested Class Summary | |
|---|---|
class |
Database.SQLBuilder
Database specific SQL query builder. |
static class |
Database.Type
|
| Field Summary | |
|---|---|
protected Connection |
connection
|
protected Database.Type |
databaseType
|
| Constructor Summary | |
|---|---|
Database(Connection connection)
Creates new instance of the database. |
|
| Method Summary | |
|---|---|
static InputStream |
asStream(ResultSet rs)
Provides access to query data |
static String |
asString(ResultSet rs)
Provides access to query data |
void |
createTable()
Creates table for storage. |
void |
disconnect()
Closes connection with database. |
static void |
execute(PreparedStatement sql)
Executes specifies statement. |
static ResultSet |
executeQuery(PreparedStatement sql)
Runs SQL statement |
static void |
executeUpdate(PreparedStatement sql)
Executes specifies update statement. |
Database.Type |
getDatabaseType()
Shows type of this database. |
PreparedStatement |
insertContentSQL(BinaryKey key,
InputStream stream)
Create statement for store content. |
PreparedStatement |
markUnusedSQL(BinaryKey key)
Generates SQL statement which marks content as not used. |
PreparedStatement |
removeExpiredContentSQL(long deadline)
Generates SQL statement which removes expired content. |
PreparedStatement |
retrieveBinaryKeys(Set<BinaryKey> keys)
Generates SQL statement for retrieving the binary keys in the store. |
PreparedStatement |
retrieveContentSQL(BinaryKey key)
Generates SQL statement for content retrieve. |
PreparedStatement |
retrieveExtTextSQL(BinaryKey key)
Generate SQL statement which returns extracted text. |
PreparedStatement |
retrieveMimeTypeSQL(BinaryKey key)
Generates SQL statement for mime type retrieve. |
protected void |
setDatabaseType(Database.Type databaseType)
Modifies database type. |
void |
setPrefix(String prefix)
Configures table name prefix. |
boolean |
tableExists()
Checks database for CONTENT_STORE table |
PreparedStatement |
updateExtTextSQL(BinaryKey key,
String text)
Generates SQL statement which updates extracted text field. |
PreparedStatement |
updateMimeTypeSQL(BinaryKey key,
String mimeType)
Generates SQL statement which modifies mime type value. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final Connection connection
protected Database.Type databaseType
| Constructor Detail |
|---|
public Database(Connection connection)
throws BinaryStoreException
connection - connection to a database
BinaryStoreException - if the database type cannot be determined| Method Detail |
|---|
public Database.Type getDatabaseType()
protected void setDatabaseType(Database.Type databaseType)
databaseType - new database type identifier.public void setPrefix(String prefix)
prefix - table name prefix.
public PreparedStatement insertContentSQL(BinaryKey key,
InputStream stream)
throws BinaryStoreException
key - unique content identifierstream - content to store
BinaryStoreException
public PreparedStatement retrieveContentSQL(BinaryKey key)
throws BinaryStoreException
key - content id
BinaryStoreException
public PreparedStatement markUnusedSQL(BinaryKey key)
throws BinaryStoreException
key - the content id.
BinaryStoreException
public PreparedStatement removeExpiredContentSQL(long deadline)
throws BinaryStoreException
deadline - expire time
BinaryStoreException
public PreparedStatement retrieveMimeTypeSQL(BinaryKey key)
throws BinaryStoreException
key - content id
BinaryStoreException
public PreparedStatement updateMimeTypeSQL(BinaryKey key,
String mimeType)
throws BinaryStoreException
key - content idmimeType - the new value for mime type
BinaryStoreException
public PreparedStatement retrieveExtTextSQL(BinaryKey key)
throws BinaryStoreException
key - content id
BinaryStoreException
public PreparedStatement updateExtTextSQL(BinaryKey key,
String text)
throws BinaryStoreException
key - content idtext - new value for the extracted text
BinaryStoreException
public PreparedStatement retrieveBinaryKeys(Set<BinaryKey> keys)
throws BinaryStoreException
keys - the container into which the keys should be placed
BinaryStoreException
public static void execute(PreparedStatement sql)
throws BinaryStoreException
sql - the statement to execute
BinaryStoreException
public static ResultSet executeQuery(PreparedStatement sql)
throws BinaryStoreException
sql - SQL statement
BinaryStoreException
public static void executeUpdate(PreparedStatement sql)
throws BinaryStoreException
sql - the statement to execute
BinaryStoreException
public static InputStream asStream(ResultSet rs)
throws BinaryStoreException
rs - retrieved single value
BinaryStoreException
public static String asString(ResultSet rs)
throws BinaryStoreException
rs - retrieved query result
BinaryStoreException
public boolean tableExists()
throws BinaryStoreException
BinaryStoreException
public void createTable()
throws BinaryStoreException
BinaryStoreExceptionpublic void disconnect()
|
ModeShape Distribution 3.0.0.Beta3 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||