BEA Systems, Inc.

com.beasys.commerce.axiom.document.ref
Class RefDocumentProvider

java.lang.Object
  |
  +--com.beasys.commerce.axiom.document.ref.DefaultDocumentProvider
        |
        +--com.beasys.commerce.axiom.document.ref.RefDocumentProvider

public class RefDocumentProvider
extends 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).

See Also:
StatementParams

Field Summary
protected  java.sql.Connection connection
          Our database connection.
static java.lang.String DOC_MD_TABLE
          The name of the wlcs_document_metadata table.
static java.lang.String DOC_TABLE
          The name of the wlcs_document table.
protected  java.io.File docBase
          The docBase of the document.
protected  int isolationLevel
          Our transaction isolation level.
protected  java.sql.Driver jdbcDriver
          Our JDBC driver to use.
protected  boolean jdbcIsPooled
          Are we using a pooled JDBC driver.
protected  java.util.Properties jdbcProps
          The JDBC connection properties.
protected  java.lang.String jdbcURL
          The JDBC url to use.
static java.lang.String metadataSelectSQL
          The SELECT part to get a DocumentMetadataDef.
protected  java.util.Map schemas
          Our map of schema name to DefaultDocumentSchema
 
Constructor Summary
RefDocumentProvider()
           
 
Method Summary
 void close()
          Close oursevles.
static void close(java.sql.Connection con)
          Safely close a connection, ignoring any exceptions.
static void close(java.sql.ResultSet rs)
          Safely close a result set.
static void close(java.sql.Statement stmt)
          Safely close a statement.
static DocumentException convert(java.sql.SQLException ex)
          Utility method to turn a SQLException into a DocumentException.
protected  void fillInMetadataDefs(java.sql.Connection con, java.util.List list)
          Fill in the remaining document metadata (i.e.
 DocumentIterator findDocumentIds(Search params)
          Return the list of String document ids that match the specified search parameters.
 DocumentIterator findDocumentMetadata(Search params)
          Return the list of DocumentMetadataDefs which match the given search parameters object.
 DocumentIterator findDocuments(Search params)
          Return the list of DocumentDefs that match the specified search parameters.
protected  java.sql.Connection getConnection()
          Get a/the connection to the database.
 java.sql.Timestamp getDocumentModifiedDate(java.lang.String id)
          Get just the last modified date of a document, without brining back all the metadata.
protected  RefDocumentMetadata getMetadataDef(java.sql.ResultSet rs)
          Get a metadata def from the given result set (which should follow the select in metadataSelectSQL).
 DocumentSchemaDef getSchema(java.lang.String name)
          Return the names schema.
 DocumentIterator getSchemaNames()
          Return the list of schema names.
 java.util.Map getSchemas()
          Return the map of schema name to schema.
 int getTransactionIsolation()
          Get the transaction isolation level.
 void init(java.util.Properties p)
          Initialize yourself.
protected  void loadIWSchemas(java.lang.String basePath)
          Load schema information from Interwoven datacapture.cfg files.
protected  void loadSchemas(java.util.Collection col)
          Add the DocumentSchemaDefs found in the collection into our schema map.
protected  void loadSchemas(java.lang.String path)
          Load schema information from doc-schema xml files.
 void reset()
          Reset oursevles.
 void setTransactionIsolation(int level)
          Set the transaction isolation level.
 
Methods inherited from class com.beasys.commerce.axiom.document.ref.DefaultDocumentProvider
getDocument, getDocumentMetadata
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DOC_TABLE

public static final java.lang.String DOC_TABLE
The name of the wlcs_document table.

DOC_MD_TABLE

public static final java.lang.String DOC_MD_TABLE
The name of the wlcs_document_metadata table.

isolationLevel

protected int isolationLevel
Our transaction isolation level.

schemas

protected java.util.Map schemas
Our map of schema name to DefaultDocumentSchema

connection

protected java.sql.Connection connection
Our database connection.

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


jdbcDriver

protected java.sql.Driver jdbcDriver
Our JDBC driver to use.

jdbcURL

protected java.lang.String jdbcURL
The JDBC url to use.

jdbcIsPooled

protected boolean jdbcIsPooled
Are we using a pooled JDBC driver.

jdbcProps

protected java.util.Properties jdbcProps
The JDBC connection properties.

docBase

protected java.io.File docBase
The docBase of the document.

metadataSelectSQL

public static final java.lang.String metadataSelectSQL
The SELECT part to get a DocumentMetadataDef.
Constructor Detail

RefDocumentProvider

public RefDocumentProvider()
Method Detail

init

public void init(java.util.Properties p)
          throws DocumentException
Initialize yourself.
Tags copied from interface: DocumentProvider
Parameters:
properties - the configuration properties
Throws:
DocumentException - thrown on an error.

loadIWSchemas

protected void loadIWSchemas(java.lang.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.

See Also:
RefSchemaGenerator

loadSchemas

protected void loadSchemas(java.lang.String path)
                    throws DocumentException
Load schema information from doc-schema xml files.
See Also:
RefSchemaGenerator

loadSchemas

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

reset

public void reset()
           throws DocumentException
Reset oursevles.
Tags copied from interface: DocumentProvider
Throws:
DocumentException - thrown on an error.

close

public void close()
           throws DocumentException
Close oursevles.
Tags copied from interface: DocumentProvider
Throws:
DocumentException - thrown on an error.

getTransactionIsolation

public int getTransactionIsolation()
Get the transaction isolation level.
Overrides:
getTransactionIsolation in class DefaultDocumentProvider
Returns:
the transaction isolation level

setTransactionIsolation

public void setTransactionIsolation(int level)
                             throws DocumentException
Set the transaction isolation level.
Overrides:
setTransactionIsolation in class DefaultDocumentProvider

getConnection

protected java.sql.Connection getConnection()
                                     throws DocumentException
Get a/the connection to the database.
Returns:
a connection to the database.

findDocumentIds

public DocumentIterator findDocumentIds(Search params)
                                 throws DocumentException
Return the list of String document ids that match the specified search parameters.
Overrides:
findDocumentIds in class DefaultDocumentProvider
Tags copied from interface: DocumentProvider
Parameters:
params - the search parameters.
Returns:
the iterator of String document ids that match.
Throws:
DocumentException - thrown on an error.

findDocuments

public DocumentIterator findDocuments(Search params)
                               throws DocumentException
Return the list of DocumentDefs that match the specified search parameters.
Tags copied from interface: DocumentProvider
Parameters:
params - the search parameters.
Returns:
the iterator of DocumentDefs that match the search.
Throws:
DocumentException - thrown on an error.

findDocumentMetadata

public DocumentIterator findDocumentMetadata(Search params)
                                      throws DocumentException
Return the list of DocumentMetadataDefs which match the given search parameters object.
Tags copied from interface: DocumentProvider
Parameters:
params - the search parameters.
Returns:
the iterator of DocumentMetadataDefs that match the search.
Throws:
DocumentException - thrown on an error.

getDocumentModifiedDate

public java.sql.Timestamp getDocumentModifiedDate(java.lang.String id)
                                           throws DocumentException
Get just the last modified date of a document, without brining back all the metadata.
Overrides:
getDocumentModifiedDate in class DefaultDocumentProvider
Tags copied from interface: DocumentProvider
Parameters:
id - the document id.
Returns:
the timestamp when the doc was last modified, or null if unknown or doesn't exist.

getMetadataDef

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

fillInMetadataDefs

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

getSchemaNames

public DocumentIterator getSchemaNames()
Return the list of schema names.
Tags copied from interface: DocumentProvider
Returns:
the iterator the String schema names.
Throws:
DocumentException - thrown on an error.

getSchema

public DocumentSchemaDef getSchema(java.lang.String name)
Return the names schema.
Tags copied from interface: DocumentProvider
Parameters:
schemaName - the name of the schema to find.
Returns:
the DocumentSchemaDef or null if not found.
Throws:
DocumentException - thrown on an error

getSchemas

public java.util.Map getSchemas()
Return the map of schema name to schema.
Tags copied from interface: DocumentProvider
Returns:
the map of String schema name of DocumentSchemaDef.
Throws:
DocumentException - thrown on an errorj

convert

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

close

public static void close(java.sql.Connection con)
Safely close a connection, ignoring any exceptions.

close

public static void close(java.sql.Statement stmt)
Safely close a statement.

close

public static void close(java.sql.ResultSet rs)
Safely close a result set.

BEA Systems, Inc.

Copyright © 2000 BEA Systems, Inc. All Rights Reserved