DEPRECATED

# com.bea.p13n.content.document.ref.loader
RefCleanupHelper Class

public class RefCleanupHelper
extends `Object`

A helper class which can cleanup a reference implementation database.

Related Topics

``RefCleanupHelper.cleanup(Connection, String, boolean)``

Hierarchy
  `Object`
  `RefCleanupHelper`

## Field Summary

`public static final `String`` | `addEmptyDocSql` The sql to insert a document into the document table with default values.
`public static final `String`` | `DEF_MIME_TYPE` A default mime type the cleaner uses when adding to the document table.
`public static final `String`` | `DOC_MD_TABLE` The document_metadata table name.
`public static final `String`` | `DOC_TABLE` The document table name.
`public static final `String`` | `getDocsSql` The sql to pull the ids and mime types from the document table.
`public static final `String`` | `missingDocSql` The sql to pull document ids of document that don't exist in the document table, but have entries in the document_metadata table.
`public static final `String`` | `updateDocSql` The sql to update a row in the document table.

## Constructor Summary

RefCleanupHelper()

## Method Summary

`public static void` | `cleanup`(`Connection` con, `String` docBase, boolean deleteMissing) Clean up a reference implementation document and document_metadata table based only upon what's in the database.
`public static void` | `cleanupDocs`(`Connection` con, `String` docBase, boolean deleteMissing) Cleans up the document table.
`public static void` | `deleteDoc`(`Connection` con, `String` path)
`public static void` | `fixMissingDocs`(`Connection` con) Cleanup the document table based upon what's in the document_metadata table.

Methods from class `java.lang.`Object``
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Detail

### addEmptyDocSql

    public static final String addEmptyDocSql

  The sql to insert a document into the document table with default values.

### DEF_MIME_TYPE

    public static final String DEF_MIME_TYPE

  A default mime type the cleaner uses when adding to the document table.

### DOC_MD_TABLE

    public static final String DOC_MD_TABLE

  The document_metadata table name.

Related Topics

``BulkLoader.DOC_MD_TABLE``

### DOC_TABLE

    public static final String DOC_TABLE

  The document table name.

Related Topics

``BulkLoader.DOC_TABLE``

### getDocsSql

    public static final String getDocsSql

  The sql to pull the ids and mime types from the document table.

### missingDocSql

    public static final String missingDocSql

  The sql to pull document ids of document that don't exist in the document table, but have entries in the document_metadata table.

### updateDocSql

    public static final String updateDocSql

  The sql to update a row in the document table.

## Constructor Detail

### RefCleanupHelper

    public RefCleanupHelper()

## Method Detail

### cleanup(Connection, String, boolean) Method

    public static void cleanup(Connection con,
                               String docBase,
                               boolean deleteMissing)
         throws SQLException

Clean up a reference implementation document and document_metadata table based only upon what's in the database.

This will not investigate the contents of the docBase except to gather file information about a file already in the database.

#### Parameters

con
  the database connection.

docBase
  the document base.

deleteMissing
  true to delete documents which are missing from the docBase, false to set their size to 0.

#### Exceptions

``SQLException``
  thrown on a database error.

Related Topics

``RefCleanupHelper.fixMissingDocs(Connection)``
``RefCleanupHelper.cleanupDocs(Connection, String, boolean)``

### cleanupDocs(Connection, String, boolean) Method

    public static void cleanupDocs(Connection con,
                                   String docBase,
                                   boolean deleteMissing)
         throws SQLException

Cleans up the document table.

This will update the document_size based upon the files under docBase and update the modified_date to now. Additionally, this will attempt to fix up invalid or empty mimeTypes.

#### Parameters

con
  the database connection.

docBase
  the document base.

deleteMissing
  true to delete documents which are missing from the docBase, false to set their size to 0.

#### Exceptions

``SQLException``

### deleteDoc(Connection, String) Method

    public static void deleteDoc(Connection con,
                                 String path)
         throws SQLException

#### Exceptions

``SQLException``

### fixMissingDocs(Connection) Method

    public static void fixMissingDocs(Connection con)
         throws SQLException

Cleanup the document table based upon what's in the document_metadata table.

This will add entries in the document table that don't exist from those in the document_metadata table.

#### Exceptions

``SQLException``