Package net.ontopia.infoset.content
Class JDBCContentStore
- java.lang.Object
-
- net.ontopia.infoset.content.JDBCContentStore
-
- All Implemented Interfaces:
ContentStoreIF
public class JDBCContentStore extends Object implements ContentStoreIF
INTERNAL: Content store implementation on top of JDBC that uses a non-native sequence generator to generate keys.
-
-
Field Summary
Fields Modifier and Type Field Description protected Connection
conn
protected KeyGeneratorIF
keygen
protected String
sql_get
protected String
sql_put
protected String
sql_remove
-
Constructor Summary
Constructors Constructor Description JDBCContentStore(Connection conn, ConnectionFactoryIF connfactory)
JDBCContentStore(Connection conn, ConnectionFactoryIF connfactory, String tblname, String keyname, String valname)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
add(InputStream data, int length)
INTERNAL: Creates an entry for the specified data value.int
add(ContentInputStream data)
INTERNAL: Creates an entry for the specified data value.void
close()
INTERNAL: Closes the content store.boolean
containsKey(int key)
INTERNAL: Returns true if the content store contains an entry with the specified key.protected int
generateId()
ContentInputStream
get(int key)
INTERNAL: Gets the data value associated with the specified key.static ContentStoreIF
getInstance(TopicMapIF topicmap)
protected void
init(String tblname, String keyname, String valname)
protected int
readLength(InputStream stream)
boolean
remove(int key)
INTERNAL: Removes the entry associated with the key.
-
-
-
Field Detail
-
conn
protected Connection conn
-
keygen
protected KeyGeneratorIF keygen
-
sql_get
protected String sql_get
-
sql_put
protected String sql_put
-
sql_remove
protected String sql_remove
-
-
Constructor Detail
-
JDBCContentStore
public JDBCContentStore(Connection conn, ConnectionFactoryIF connfactory)
-
JDBCContentStore
public JDBCContentStore(Connection conn, ConnectionFactoryIF connfactory, String tblname, String keyname, String valname)
-
-
Method Detail
-
getInstance
public static ContentStoreIF getInstance(TopicMapIF topicmap)
-
containsKey
public boolean containsKey(int key) throws ContentStoreException
Description copied from interface:ContentStoreIF
INTERNAL: Returns true if the content store contains an entry with the specified key.- Specified by:
containsKey
in interfaceContentStoreIF
- Throws:
ContentStoreException
-
get
public ContentInputStream get(int key) throws ContentStoreException
Description copied from interface:ContentStoreIF
INTERNAL: Gets the data value associated with the specified key.- Specified by:
get
in interfaceContentStoreIF
- Throws:
ContentStoreException
-
readLength
protected int readLength(InputStream stream) throws IOException
- Throws:
IOException
-
generateId
protected int generateId()
-
add
public int add(ContentInputStream data) throws ContentStoreException
Description copied from interface:ContentStoreIF
INTERNAL: Creates an entry for the specified data value.- Specified by:
add
in interfaceContentStoreIF
- Throws:
ContentStoreException
-
add
public int add(InputStream data, int length) throws ContentStoreException
Description copied from interface:ContentStoreIF
INTERNAL: Creates an entry for the specified data value.- Specified by:
add
in interfaceContentStoreIF
- Throws:
ContentStoreException
-
remove
public boolean remove(int key) throws ContentStoreException
Description copied from interface:ContentStoreIF
INTERNAL: Removes the entry associated with the key. If the key is not present the call has no effect.- Specified by:
remove
in interfaceContentStoreIF
- Returns:
- true if the key was present; false otherwise
- Throws:
ContentStoreException
-
close
public void close() throws ContentStoreException
Description copied from interface:ContentStoreIF
INTERNAL: Closes the content store. This allows all internal resources to be released.- Specified by:
close
in interfaceContentStoreIF
- Throws:
ContentStoreException
-
-