Overview | Package | Class | Tree | Deprecated | Index | Help
| © 2002 BEA Systems, Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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

    java.lang.Object
      |
      +--com.bea.p13n.content.document.ref.DefaultDocumentProvider
            |
            +--com.bea.p13n.content.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.

- `jdbc.dataSource`: Specifies the JNDI name of the datasource to use to get database connections.
- `jdbc.url`: Specifies the JDBC URL of the database to connect to.
- `jdbc.driver`: Specifies the JDBC driver class to load.
- `jdbc.isPooled`: If "true" or if jdbc.url starts with "jdbc:weblogic:pool" or "jdbc:weblogic:jts", then assumes the connection is pooled and won't cache it. If anything else, assumes the connection is not pooled and will maintain one connection.
- `jdbc.supportsLikeEscapeClause`: Specifies whether the underlying database supports the SQL LIKE ESCAPE clause. If this is not specified, the connection will be queried.
- `jdbc.isolationLevel`: Specifies the isolation level this initialize with. Valid values are "READ_COMMITTED", "SERIALIZABLE", "READ_UNCOMMITTED", "REPEATABLE_READ", and "NONE". Note: This option is only valid if your are specifying a JDBC driver. You cannot specify this option if you are connecting to a data source.
- `jdbc.column.<colName>`: Specifies an additional column to the DOCUMENT table. The value is the comma-separated list of property names that map onto that column. This can be specified multiple times. This should be used in conjunction with the the correct settings to the BulkLoader. If the same property is mapped to more than one column, the result is indeterminate (it might work, it might not, so you probably shouldn't do this).
- `docBase`: Specifies the base directory of where the documents are stored under. Assumes all paths coming from the database are relative to this.
- `iw.schemaBase*`: Specifies the base directories of where the Interwoven datacapture.cfg files live. The provider will, on load, recurse through the file structure and load all datacapture.cfg files. This can be listed multiple times; each property starting with `iw.schemaBase` will be loaded.
- `schemaXML*(`: Specifies the path to the directory containing XML files following the doc-schemas DTD which contain the schema information. This will recurse through the directory, loading all files ening in ".xml". This will be processed after iw.schemaBase. This can be listed multiple times; each property starting with `schemaXML` will be loaded.

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:
  `RefSQLGenerator`

Field Summary
`protected java.util.Map` | `addlColumnMap` The map of additional column name to List of property names.
`protected java.util.List` | `addlColumnNames` The list of additional column names.
`protected java.sql.Connection` | `connection` Our database connection.
`protected javax.sql.DataSource` | `dataSource` Our DataSource to use.
`protected java.lang.String` | `dataSourceJndiName` The DataSource JNDI name.
`static java.lang.String` | `DOC_MD_TABLE` The name of the document_metadata table.
`static java.lang.String` | `DOC_TABLE` The name of the document table.
`protected java.io.File` | `docBase` The docBase of the document.
`static int` | `ISOLATION_LEVEL_UNKNOWN` A non-standard value for the transaction isolation level when it's state is unknown.
`protected int` | `isolationLevel` Our transaction isolation level.
`protected boolean` | `isolationLevelSpecified` Was a transaction isolation level specified during initalization? A transaction isolation level can only be specified if you are connecting directly to a JDBC driver.
`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` Deprecated. No longer used (see `myMetadataSelectSQL`).
`protected java.lang.String` | `myMetadataSelectSQL` The SELECT part of a SQL statement to get a DocumentMetadataDef.
`protected java.util.Map` | `schemas` Our map of schema name to DefaultDocumentSchema
`protected RefSQLGenerator` | `sqlGen` The SQL Generator this uses.
`protected java.lang.Boolean` | `supportsLikeEscapeClause` Does the database support the LIKE ESCAPE clause.

Constructor Summary
`RefDocumentProvider()`

Method Summary
`void` | `close()` Close oursevles.
`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.
`static int` | `getInt(java.sql.ResultSet rs, int index)`
`static long` | `getLong(java.sql.ResultSet rs, int index)`
`protected RefDocumentMetadata` | `getMetadataDef(java.sql.ResultSet rs)` Get a metadata def from the given result set (which should follow the select in `myMetadataSelectSQL`).
`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 this from the specified properties.
`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.
`static java.util.List` | `split(java.lang.String str, java.lang.String on)` Split a delimited list into a List.
`protected boolean` | `supportsLikeEscapeClause(java.sql.Connection con)` Determine whether the specified connection supports the SQL LIKE ESCAPE clause.

Methods inherited from class com.bea.p13n.content.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 document table.

### DOC_MD_TABLE

    public static final java.lang.String DOC_MD_TABLE

  The name of the document_metadata table.

### ISOLATION_LEVEL_UNKNOWN

    public static final int ISOLATION_LEVEL_UNKNOWN

  A non-standard value for the transaction isolation level when it's state is unknown. This will only be used in cases where errors prevent us from determining what the transaction isolation level is.

### isolationLevel

    protected int isolationLevel

  Our transaction isolation level.

### isolationLevelSpecified

    protected boolean isolationLevelSpecified

  Was a transaction isolation level specified during initalization? A transaction isolation level can only be specified if you are connecting directly to a JDBC driver. You cannot specify a transaction isolation level if you are connecting to a WLS data source.

### 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.

### dataSourceJndiName

    protected java.lang.String dataSourceJndiName

  The DataSource JNDI name.

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

### dataSource

    protected javax.sql.DataSource dataSource

  Our DataSource to use.

  This will get lazily initialized.

### 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.

### supportsLikeEscapeClause

    protected java.lang.Boolean supportsLikeEscapeClause

  Does the database support the LIKE ESCAPE clause.

  This will be no null for unknown.

### docBase

    protected java.io.File docBase

  The docBase of the document.

### sqlGen

    protected RefSQLGenerator sqlGen

  The SQL Generator this uses.

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

### addlColumnNames

    protected java.util.List addlColumnNames

  The list of additional column names.

### addlColumnMap

    protected java.util.Map addlColumnMap

  The map of additional column name to List of property names.

### myMetadataSelectSQL

    protected java.lang.String myMetadataSelectSQL

  The SELECT part of a SQL statement to get a DocumentMetadataDef.

  This will be passed to our SQL Generatorand is initialized in `init(java.util.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".

### metadataSelectSQL

    public static final java.lang.String metadataSelectSQL

  Deprecated. No longer used (see `myMetadataSelectSQL`).
  The default SELECT part to get a DocumentMetadataDef.

Constructor Detail

### RefDocumentProvider

    public RefDocumentProvider()

Method Detail

### init

    public void init(java.util.Properties p)
              throws DocumentException

  Initialize this from the specified properties.

  See the class comments for details on the supported properties.

  Throws:
    DocumentException - on an initialization 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.

### close

    public void close()
               throws DocumentException

  Close oursevles.

### getTransactionIsolation

    public int getTransactionIsolation()

  Get the transaction isolation level. If an error occurs while trying to determine the transaction isolation level, the non-standard value `RefDocumentProvider.ISOLATION_LEVEL_UNKOWN` will be returned.

  Returns:
    the transaction isolation level
  Overrides:
    getTransactionIsolation in class DefaultDocumentProvider

### 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.

### supportsLikeEscapeClause

    protected boolean supportsLikeEscapeClause(java.sql.Connection con)

  Determine whether the specified connection supports the SQL LIKE ESCAPE clause.

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

### 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

### findDocuments

    public DocumentIterator findDocuments(Search params)
                                   throws DocumentException

  Return the list of DocumentDefs that match the specified search parameters.

  Overrides:
    findDocuments in class DefaultDocumentProvider

### findDocumentMetadata

    public DocumentIterator findDocumentMetadata(Search params)
                                          throws DocumentException

  Return the list of DocumentMetadataDefs which match the given search parameters object.

  Overrides:
    findDocumentMetadata in class DefaultDocumentProvider

### 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

### 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 `myMetadataSelectSQL`).

### 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.

### getSchema

    public DocumentSchemaDef getSchema(java.lang.String name)

  Return the names schema.

### getSchemas

    public java.util.Map getSchemas()

  Return the map of schema name to schema.

### convert

    public static DocumentException convert(java.sql.SQLException ex)

  Utility method to turn a SQLException into a DocumentException.

### getInt

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

### getLong

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

### split

    public static java.util.List split(java.lang.String str,
                                       java.lang.String on)

  Split a delimited list into a List.

Overview | Package | Class | Tree | Deprecated | Index | Help
| © 2002 BEA Systems, Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002 BEA Systems, Inc. All Rights Reserved