BEA Systems, Inc.

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

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

public class RefCleanupHelper
extends java.lang.Object

A helper class which can cleanup a reference implementation database.

See Also:
cleanup(java.sql.Connection, java.lang.String, boolean)

Field Summary
static java.lang.String addEmptyDocSql
          The sql to insert a document into the document table with default values.
static java.lang.String DEF_MIME_TYPE
          A default mime type the cleaner uses when adding to the document table.
static java.lang.String DOC_MD_TABLE
          The wlcs_document_metadata table name.
static java.lang.String DOC_TABLE
          The wlcs_document table name.
static java.lang.String getDocsSql
          The sql to pull the ids and mime types from the document table.
static java.lang.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.
static java.lang.String updateDocSql
          The sql to update a row in the document table.
 
Constructor Summary
RefCleanupHelper()
           
 
Method Summary
static void cleanup(java.sql.Connection con, java.lang.String docBase, boolean deleteMissing)
          Clean up a reference implementation document and document_metadata table based only upon what's in the database.
static void cleanupDocs(java.sql.Connection con, java.lang.String docBase, boolean deleteMissing)
          Cleans up the document table.
static void deleteDoc(java.sql.Connection con, java.lang.String path)
           
static void fixMissingDocs(java.sql.Connection con)
          Cleanup the document table based upon what's in the document_metadata table.
 
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 wlcs_document table name.
See Also:
RefDocumentProvider.DOC_TABLE

DOC_MD_TABLE

public static final java.lang.String DOC_MD_TABLE
The wlcs_document_metadata table name.
See Also:
RefDocumentProvider.DOC_MD_TABLE

DEF_MIME_TYPE

public static final java.lang.String DEF_MIME_TYPE
A default mime type the cleaner uses when adding to the document table.

missingDocSql

public static final java.lang.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.

addEmptyDocSql

public static final java.lang.String addEmptyDocSql
The sql to insert a document into the document table with default values.

getDocsSql

public static final java.lang.String getDocsSql
The sql to pull the ids and mime types from the document table.

updateDocSql

public static final java.lang.String updateDocSql
The sql to update a row in the document table.
Constructor Detail

RefCleanupHelper

public RefCleanupHelper()
Method Detail

cleanup

public static void cleanup(java.sql.Connection con,
                           java.lang.String docBase,
                           boolean deleteMissing)
                    throws java.sql.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.
Throws:
java.sql.SQLException - thrown on a database error.
See Also:
fixMissingDocs(java.sql.Connection), cleanupDocs(java.sql.Connection, java.lang.String, boolean)

fixMissingDocs

public static void fixMissingDocs(java.sql.Connection con)
                           throws java.sql.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.


cleanupDocs

public static void cleanupDocs(java.sql.Connection con,
                               java.lang.String docBase,
                               boolean deleteMissing)
                        throws java.sql.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.

deleteDoc

public static void deleteDoc(java.sql.Connection con,
                             java.lang.String path)
                      throws java.sql.SQLException

BEA Systems, Inc.

Copyright © 2000 BEA Systems, Inc. All Rights Reserved