RefDocumentProvider Class

DEPRECATED

com.bea.p13n.content.document.ref
RefDocumentProvider Class

public class RefDocumentProvider

    extends com.bea.p13n.content.document.ref.DefaultDocumentProvider

The reference implementation DocumentProvider.

This document provider utilizes a database to maintain the document metadata attributes, while the documents are kept on the filesystem and the metadata is kept in XML files on the filesystem.

It understands the following initializion properties.

All other configuration properties will be sent when a database connection is opened (e.g. user and password can be specified as well).

Related Topics

RefSQLGenerator


Hierarchy
Object
  com.bea.p13n.content.document.ref.DefaultDocumentProvider
    RefDocumentProvider
All Implemented Interfaces

com.bea.p13n.content.document.spi.DocumentProvider

Field Summary

protected Map
addlColumnMap
The map of additional column name to List of property names.
protected List
addlColumnNames
The list of additional column names.
protected Connection
connection
Our database connection.
protected DataSource
dataSource
Our DataSource to use.
protected String
dataSourceJndiName
The DataSource JNDI name.
public static final String
DOC_MD_TABLE
The name of the document_metadata table.
public static final String
DOC_TABLE
The name of the document table.
protected File
docBase
The docBase of the document.
protected int
isolationLevel
Our transaction isolation level.
protected Driver
jdbcDriver
Our JDBC driver to use.
protected boolean
jdbcIsPooled
Are we using a pooled JDBC driver.
protected Properties
jdbcProps
The JDBC connection properties.
protected String
jdbcURL
The JDBC url to use.
protected long
maxWaitTime
The maximum amount of time in milliseconds this should wait for a connection to come available.
public static final String
metadataSelectSQL
The default SELECT part to get a DocumentMetadataDef.
protected String
myMetadataSelectSQL
The SELECT part of a SQL statement to get a DocumentMetadataDef.
protected Map
schemas
Our map of schema name to DefaultDocumentSchema
protected com.bea.p13n.content.document.ref.RefSQLGenerator
sqlGen
The SQL Generator this uses.
protected Boolean
supportsLikeEscapeClause
Does the database support the LIKE ESCAPE clause.
 

Constructor Summary

RefDocumentProvider()

 

Method Summary

public void
close()
Close oursevles.
public static DocumentException
convert(SQLException ex)
Utility method to turn a SQLException into a DocumentException.
protected void
fillInMetadataDefs(Connection con, List list)
Fill in the remaining document metadata (i.e. the implicit attributes).
public DocumentIterator
findDocumentIds(Search params)
Return the list of String document ids that match the specified search parameters.
public DocumentIterator
findDocumentMetadata(Search params)
Return the list of DocumentMetadataDefs which match the given search parameters object.
public DocumentIterator
findDocuments(Search params)
Return the list of DocumentDefs that match the specified search parameters.
protected Connection
getConnection()
Get a/the connection to the database.
public Timestamp
getDocumentModifiedDate(String id)
Get just the last modified date of a document, without brining back all the metadata.
public static int
getInt(ResultSet rs, int index)
public static long
getLong(ResultSet rs, int index)
protected RefDocumentMetadata
getMetadataDef(ResultSet rs)
Get a metadata def from the given result set (which should follow the select in RefDocumentProvider.myMetadataSelectSQL).
public DocumentSchemaDef
getSchema(String name)
Return the names schema.
public DocumentIterator
getSchemaNames()
Return the list of schema names.
public Map
getSchemas()
Return the map of schema name to schema.
public int
getTransactionIsolation()
Get the transaction isolation level.
public void
init(Properties p)
Initialize this from the specified properties.
protected void
loadIWSchemas(String basePath)
Load schema information from Interwoven datacapture.cfg files.
protected void
loadSchemas(String path)
Load schema information from doc-schema xml files.
protected void
loadSchemas(Collection col)
Add the DocumentSchemaDefs found in the collection into our schema map.
public void
reset()
Reset oursevles.
public void
setTransactionIsolation(int level)
Set the transaction isolation level.
public static List
split(String str, String on)
Split a delimited list into a List.
protected boolean
supportsLikeEscapeClause(Connection con)
Determine whether the specified connection supports the SQL LIKE ESCAPE clause.
 
Methods from  com.bea.p13n.content.document.ref.com.bea.p13n.content.document.ref.DefaultDocumentProvider
getDocument, getDocumentMetadata,
 
Methods from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
   
Methods from interface com.bea.p13n.content.document.spi.com.bea.p13n.content.document.spi.DocumentProvider
close, findDocumentIds, findDocumentMetadata, findDocuments, getDocument, getDocumentMetadata, getDocumentModifiedDate, getSchema, getSchemaNames, getSchemas, getTransactionIsolation, init, reset, setTransactionIsolation
 

Field Detail

addlColumnMap

protected Map addlColumnMap
The map of additional column name to List of property names.


addlColumnNames

protected List addlColumnNames
The list of additional column names.


connection

protected Connection connection
Our database connection.

This will be null if we're using a pooled connection.


dataSource

protected DataSource dataSource
Our DataSource to use.

This will get lazily initialized.


dataSourceJndiName

protected String dataSourceJndiName
The DataSource JNDI name.

This will be null if we're using the driver/url.


DOC_MD_TABLE

public static final String DOC_MD_TABLE
The name of the document_metadata table.


DOC_TABLE

public static final String DOC_TABLE
The name of the document table.


docBase

protected File docBase
The docBase of the document.


isolationLevel

protected int isolationLevel
Our transaction isolation level.


jdbcDriver

protected Driver jdbcDriver
Our JDBC driver to use.


jdbcIsPooled

protected boolean jdbcIsPooled
Are we using a pooled JDBC driver.


jdbcProps

protected Properties jdbcProps
The JDBC connection properties.


jdbcURL

protected String jdbcURL
The JDBC url to use.


maxWaitTime

protected long maxWaitTime
The maximum amount of time in milliseconds this should wait for a connection to come available.

Use less than 0 for wait forever.


metadataSelectSQL

public static final String metadataSelectSQL
The default SELECT part to get a DocumentMetadataDef.


myMetadataSelectSQL

protected String myMetadataSelectSQL
The SELECT part of a SQL statement to get a DocumentMetadataDef.

This will be passed to our SQL Generatorand is initialized in RefDocumentProvider.init(Properties) from the "jdbc.column.<colName>" properties.

This will always start with "SELECT ID, DOCUMENT_SIZE, VERSION, AUTHOR, CREATION_DATE, LOCKED_BY, MODIFIED_DATE, MODIFIED_BY, DESCRIPTION, COMMENTS, MIME_TYPE".


schemas

protected Map schemas
Our map of schema name to DefaultDocumentSchema


sqlGen

protected com.bea.p13n.content.document.ref.RefSQLGenerator sqlGen
The SQL Generator this uses.

This will be initialized in RefDocumentProvider.init(Properties) from the "jdbc.column.<colName>" properties.


supportsLikeEscapeClause

protected Boolean supportsLikeEscapeClause
Does the database support the LIKE ESCAPE clause.

This will be no null for unknown.

 

Constructor Detail

RefDocumentProvider

public RefDocumentProvider()
 

Method Detail

close() Method

public void close()
throws DocumentException
Close oursevles.

Exceptions

DocumentException

convert(SQLException) Method

public static DocumentException convert(SQLException ex)
Utility method to turn a SQLException into a DocumentException.


fillInMetadataDefs(Connection, List) Method

protected void fillInMetadataDefs(Connection con, 
                                  List list)
throws SQLException
Fill in the remaining document metadata (i.e. the implicit attributes).

Exceptions

SQLException

findDocumentIds(Search) Method

public DocumentIterator findDocumentIds(Search params)
throws DocumentException
Return the list of String document ids that match the specified search parameters.

Overrides
DefaultDocumentProvider.findDocumentIds(Search)

Parameters

params
the search parameters.

Exceptions

DocumentException

findDocumentMetadata(Search) Method

public DocumentIterator findDocumentMetadata(Search params)
throws DocumentException
Return the list of DocumentMetadataDefs which match the given search parameters object.

Overrides
DefaultDocumentProvider.findDocumentMetadata(Search)

Parameters

params
the search parameters.

Exceptions

DocumentException

findDocuments(Search) Method

public DocumentIterator findDocuments(Search params)
throws DocumentException
Return the list of DocumentDefs that match the specified search parameters.

Overrides
DefaultDocumentProvider.findDocuments(Search)

Parameters

params
the search parameters.

Exceptions

DocumentException

getConnection() Method

protected Connection getConnection()
throws DocumentException
Get a/the connection to the database.

Returns

a connection to the database.

Exceptions

DocumentException

getDocumentModifiedDate(String) Method

public Timestamp getDocumentModifiedDate(String id)
throws DocumentException
Get just the last modified date of a document, without brining back all the metadata.

Overrides
DefaultDocumentProvider.getDocumentModifiedDate(String)

Parameters

id
the document id.

Exceptions

DocumentException

getInt(ResultSet, int) Method

public static int getInt(ResultSet rs, 
                         int index)
throws SQLException

Exceptions

SQLException

getLong(ResultSet, int) Method

public static long getLong(ResultSet rs, 
                           int index)
throws SQLException

Exceptions

SQLException

getMetadataDef(ResultSet) Method

protected RefDocumentMetadata getMetadataDef(ResultSet rs)
throws SQLException
Get a metadata def from the given result set (which should follow the select in RefDocumentProvider.myMetadataSelectSQL).

Exceptions

SQLException

getSchema(String) Method

public DocumentSchemaDef getSchema(String name)
Return the names schema.

Parameters

name
the name of the schema to find.

Returns

the DocumentSchemaDef or null if not found.

getSchemaNames() Method

public DocumentIterator getSchemaNames()
Return the list of schema names.

Returns

the iterator the String schema names.

getSchemas() Method

public Map getSchemas()
Return the map of schema name to schema.

Returns

the map of String schema name of DocumentSchemaDef.

getTransactionIsolation() Method

public int getTransactionIsolation()
Get the transaction isolation level.

Overrides
DefaultDocumentProvider.getTransactionIsolation()

Returns

the transaction isolation level

init(Properties) Method

public void init(Properties p)
throws DocumentException
Initialize this from the specified properties.

See the class comments for details on the supported properties.

Parameters

p
the configuration properties

Exceptions

DocumentException
on an initialization error.

loadIWSchemas(String) Method

protected void loadIWSchemas(String basePath)
throws DocumentException
Load schema information from Interwoven datacapture.cfg files.

If basePath points to a directory, this will recurse into the directory, looking for "datacapture.cfg" files. If basePath is a file that exists and can be read, it will be loaded.

Exceptions

DocumentException

Related Topics

RefSchemaGenerator


loadSchemas(String) Method

protected void loadSchemas(String path)
throws DocumentException
Load schema information from doc-schema xml files.

Exceptions

DocumentException

Related Topics

RefSchemaGenerator


loadSchemas(Collection) Method

protected void loadSchemas(Collection col)
throws DocumentException
Add the DocumentSchemaDefs found in the collection into our schema map.

Exceptions

DocumentException

reset() Method

public void reset()
throws DocumentException
Reset oursevles.

Exceptions

DocumentException

setTransactionIsolation(int) Method

public void setTransactionIsolation(int level)
throws DocumentException
Set the transaction isolation level.

Overrides
DefaultDocumentProvider.setTransactionIsolation(int)

Exceptions

DocumentException

split(String, String) Method

public static List split(String str, 
                         String on)
Split a delimited list into a List.


supportsLikeEscapeClause(Connection) Method

protected boolean supportsLikeEscapeClause(Connection con)
Determine whether the specified connection supports the SQL LIKE ESCAPE clause.

This will first check our RefDocumentProvider.supportsLikeEscapeClause setting, then defer to the Connection's DatabaseMetaData.