de.unidu.is.util
Class DBPropertyMap

java.lang.Object
  extended byde.unidu.is.util.PropertyMap
      extended byde.unidu.is.util.DBPropertyMap
All Implemented Interfaces:
java.util.Map

public class DBPropertyMap
extends PropertyMap

A property map backed by a RDBMS table.

This class uses a table with two columns (the default names are "propkey" and "propvalue", but these can be changed) with the SQL type "text" for storing the property map. This means that this set can only be used with strings, or with objects for which the string representation is sufficient.

Since:
2003-06-22
Version:
$Revision: 1.8 $, $Date: 2005/02/28 22:27:55 $
Author:
Henrik Nottelmann

Nested Class Summary
 
Nested classes inherited from class java.util.Map
java.util.Map.Entry
 
Field Summary
protected  DB db
          The DB which is used for backing this map.
protected  java.lang.String keyCol
          The column name for the keys used for this map.
protected  java.lang.String tableName
          The table used for backing this map.
protected  java.lang.String valueCol
          The column name for the values used for this map.
 
Fields inherited from class de.unidu.is.util.PropertyMap
multipleValues
 
Constructor Summary
DBPropertyMap(DB db, java.lang.String tableName)
          Creates a new instance (and the corresponding table, if it does not exists), and sets the columns to "propkey" and "propvalue".
DBPropertyMap(DB db, java.lang.String tableName, boolean multiple)
          Creates a new instance (and the corresponding table, if it does not exists), and sets the columns to "propkey" and "propvalue".
DBPropertyMap(DB db, java.lang.String tableName, java.lang.String keyCol, java.lang.String valueCol)
          Creates a new instance (and the corresponding table, if it does not exists), and sets the column names.
DBPropertyMap(DB db, java.lang.String tableName, java.lang.String keyCol, java.lang.String valueCol, boolean multiple)
          Creates a new instance (and the corresponding table, if it does not exists), and sets the column names.
 
Method Summary
 void clear()
           
 boolean containsKey(java.lang.Object key)
           
 boolean containsValue(java.lang.Object value)
           
 void delete()
          Deletes the corresponding table.
 java.util.Set entrySet()
           
 boolean equals(java.lang.Object obj)
           
 java.lang.Object get(java.lang.Object key)
           
 java.util.List getAll(java.lang.Object key)
          Returns a list with all values stored for the specified key.
 int hashCode()
           
 boolean isEmpty()
           
 java.util.Set keySet()
           
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
           
 void putAll(java.util.Map t)
           
 java.lang.Object remove(java.lang.Object key)
           
 void remove(java.lang.Object key, java.lang.Object value)
          Removes the specified value for the specified key.
 int size()
           
 java.lang.String toString()
           
 java.util.Collection values()
           
 
Methods inherited from class de.unidu.is.util.PropertyMap
addDouble, addDouble, addDouble, addInt, addInt, addInt, apply, convertString, divDouble, divDouble, divDouble, divInt, divInt, divInt, getBoolean, getDouble, getInt, getLength, getLong, getMaxDouble, getMaxKey, getMinDouble, getString, getString, getSum, hasMultipleValues, inc, initDouble, isMultipleValues, multDouble, multDouble, multDouble, multDouble, multInt, multInt, multInt, normalizeLength, removeCloseToZero, removeZero, set, setBoolean, setDouble, setInt, setLong, setMultipleValues, setString, subDouble, subDouble, subDouble, subInt, subInt, subInt
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

db

protected DB db
The DB which is used for backing this map.


tableName

protected java.lang.String tableName
The table used for backing this map.


keyCol

protected java.lang.String keyCol
The column name for the keys used for this map.


valueCol

protected java.lang.String valueCol
The column name for the values used for this map.

Constructor Detail

DBPropertyMap

public DBPropertyMap(DB db,
                     java.lang.String tableName)
Creates a new instance (and the corresponding table, if it does not exists), and sets the columns to "propkey" and "propvalue".

Parameters:
db - DB used by this set
tableName - name of the table used by this set

DBPropertyMap

public DBPropertyMap(DB db,
                     java.lang.String tableName,
                     java.lang.String keyCol,
                     java.lang.String valueCol,
                     boolean multiple)
Creates a new instance (and the corresponding table, if it does not exists), and sets the column names.

Parameters:
db - DB used by this set
tableName - name of the table used by this set
keyCol - column name for keys
valueCol - column name for values
multiple - values if true, multiple values can be hold for a key

DBPropertyMap

public DBPropertyMap(DB db,
                     java.lang.String tableName,
                     boolean multiple)
Creates a new instance (and the corresponding table, if it does not exists), and sets the columns to "propkey" and "propvalue".

Parameters:
db - DB used by this set
tableName - name of the table used by this set
multiple - values if true, multiple values can be hold for a key

DBPropertyMap

public DBPropertyMap(DB db,
                     java.lang.String tableName,
                     java.lang.String keyCol,
                     java.lang.String valueCol)
Creates a new instance (and the corresponding table, if it does not exists), and sets the column names.

Parameters:
db - DB used by this set
tableName - name of the table used by this set
keyCol - column name for keys
valueCol - column name for values
Method Detail

clear

public void clear()

delete

public void delete()
Deletes the corresponding table.


containsKey

public boolean containsKey(java.lang.Object key)

containsValue

public boolean containsValue(java.lang.Object value)

entrySet

public java.util.Set entrySet()

get

public java.lang.Object get(java.lang.Object key)

isEmpty

public boolean isEmpty()

keySet

public java.util.Set keySet()

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)

putAll

public void putAll(java.util.Map t)

remove

public java.lang.Object remove(java.lang.Object key)

size

public int size()

values

public java.util.Collection values()

equals

public boolean equals(java.lang.Object obj)

hashCode

public int hashCode()

toString

public java.lang.String toString()

getAll

public java.util.List getAll(java.lang.Object key)
Description copied from class: PropertyMap
Returns a list with all values stored for the specified key.

Specified by:
getAll in class PropertyMap
Parameters:
key - property key
Returns:
list with all values stored for the specified key

remove

public void remove(java.lang.Object key,
                   java.lang.Object value)
Description copied from class: PropertyMap
Removes the specified value for the specified key.

Specified by:
remove in class PropertyMap
Parameters:
key - property key
value - value to be removed