public class

JDBCPropertySet

extends AbstractPropertySet
java.lang.Object
   ↳ com.opensymphony.module.propertyset.AbstractPropertySet
     ↳ com.opensymphony.module.propertyset.database.JDBCPropertySet

Class Overview

This is an implementation of a property set manager for JDBC. It relies on one table, called "os_propertyset" that has four columns: "type" (integer), "keyValue" (string), "globalKey" (string), and "value" (string). This is not likely to be enough for people who store BLOBS as properties. Of course, those people need to get a life.

For Postgres(?):
CREATE TABLE OS_PROPERTYENTRY (GLOBAL_KEY varchar(255), ITEM_KEY varchar(255), ITEM_TYPE smallint, STRING_VALUE varchar(255), DATE_VALUE timestamp, DATA_VALUE oid, FLOAT_VALUE float8, NUMBER_VALUE numeric, primary key (GLOBAL_KEY, ITEM_KEY));

For Oracle (Thanks to Michael G. Slack!):
CREATE TABLE OS_PROPERTYENTRY (GLOBAL_KEY varchar(255), ITEM_KEY varchar(255), ITEM_TYPE smallint, STRING_VALUE varchar(255), DATE_VALUE date, DATA_VALUE long raw, FLOAT_VALUE float, NUMBER_VALUE numeric, primary key (GLOBAL_KEY, ITEM_KEY));

Other databases may require small tweaks to the table creation scripts!

Required Args

  • globalKey - the globalKey to use with this PropertySet

Required Configuration

  • datasource - JNDI path for the DataSource
  • table.name - the table name
  • col.globalKey - column name for the globalKey
  • col.itemKey - column name for the itemKey
  • col.itemType - column name for the itemType
  • col.string - column name for the string value
  • col.date - column name for the date value
  • col.data - column name for the data value
  • col.float - column name for the float value
  • col.number - column name for the number value

Summary

[Expand]
Inherited Constants
From interface com.opensymphony.module.propertyset.PropertySet
Fields
protected boolean closeConnWhenDone
protected String colData
protected String colDate
protected String colFloat
protected String colGlobalKey
protected String colItemKey
protected String colItemType
protected String colNumber
protected String colString
protected DataSource ds
protected String globalKey
protected String tableName
[Expand]
Inherited Fields
From class com.opensymphony.module.propertyset.AbstractPropertySet
Public Constructors
JDBCPropertySet()
Public Methods
boolean exists(String key)
Collection getKeys(String prefix, int type)
int getType(String key)
void init(Map config, Map args)
void remove()
void remove(String key)
boolean supportsType(int type)
Returns true.
Protected Methods
void cleanup(Connection connection, Statement statement, ResultSet result)
Object get(int type, String key)
Connection getConnection()
void setImpl(int type, String key, Object value)
[Expand]
Inherited Methods
From class com.opensymphony.module.propertyset.AbstractPropertySet
From class java.lang.Object
From interface com.opensymphony.module.propertyset.PropertySet

Fields

protected boolean closeConnWhenDone

protected String colData

protected String colDate

protected String colFloat

protected String colGlobalKey

protected String colItemKey

protected String colItemType

protected String colNumber

protected String colString

protected DataSource ds

protected String globalKey

protected String tableName

Public Constructors

public JDBCPropertySet ()

Public Methods

public boolean exists (String key)

public Collection getKeys (String prefix, int type)

public int getType (String key)

public void init (Map config, Map args)

public void remove ()

public void remove (String key)

public boolean supportsType (int type)

Returns true.

Protected Methods

protected void cleanup (Connection connection, Statement statement, ResultSet result)

protected Object get (int type, String key)

protected Connection getConnection ()

Throws
SQLException

protected void setImpl (int type, String key, Object value)