wt.pds
Class BlobRewriter

java.lang.Object
  extended bywt.pds.BlobRewriter

public class BlobRewriter
extends Object

Manages rewriting of blobs and smallblobs.


Field Summary
private static String BLOB_REWRITE_ENABMED_MC_PROP
           
private static DMLGenerator DMLGENERATOR
           
static String DO_BLOB_REWRITE_METHOD_CONTEXT_PROP
           
private static String EQUAL_PLACEHOLDER
          Duplicate of SQLBuilder.EQUAL_PLACEHOLDER.
 
Constructor Summary
BlobRewriter()
           
 
Method Summary
private static WTConnection getConnection()
           
private static WTPreparedStatement getWTPreparedStatement()
           
static boolean isRewriteEnabledForCurrentMethodContext()
          Returns the current setting for whether blob rewriting is enabled in the current MethodContext.
(package private) static boolean isRewriteNeeded()
          Check immediately after using PDSEncoder to decode a blob or smallblob into a Java object.
(package private) static void preBlobDecode()
          Always invoke before using PDSEncoder to decode a blob or smallblob that may contain serialized Java objects.
(package private) static void recordEncounteredGoodLvInstance()
          Invoked from PDSEncoder when an instance of wt.meta.LocalizedValues from R6.0- or wnc.6.2.2+.
(package private) static void recordEncounteredPjl60LvInstance()
          Invoked from PDSEncoder when an instance of wt.meta.LocalizedValues from wnc.6.2.0 and wnc.6.2.1 is encountered during(small)blob decoding.
(package private) static void recordEncounteredWnc620LvInstance()
          Invoked from PDSEncoder when an instance of wt.meta.LocalizedValues from wnc.6.2.0 and wnc.6.2.1 is encountered during(small)blob decoding.
static void requestRewriteOfEvolvedBlobbedObject()
          Invoke from readOldVersion methods to request that the PDS rewrite the containing(small)blob to the database at the soonest convenience.
(package private) static Serializable rewrite(LobLocator lob_locator, Serializable serializable, Persistable containing_object)
          Store the serializable as a blob using the lob locator as the pointer to the blob.
(package private) static Serializable rewrite(String attribute_name, Serializable serializable, Persistable containing_object)
          Store the serializable as a smallblob using the attribute_name to identify the smallblob column.
(package private) static Serializable rewrite(String attribute_name, String blob_attribute_name, Serializable serializable, Persistable containing_object)
          Store the serializable as a smallblob using the attribute_name to identify the smallblob column.
static void setRewriteEnabledForCurrentMethodContext(boolean enabled)
          Override the value of the db.property wt.pom.blobRewrite.enabled for the current MethodContext.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BLOB_REWRITE_ENABMED_MC_PROP

private static final String BLOB_REWRITE_ENABMED_MC_PROP
See Also:
Constant Field Values

DO_BLOB_REWRITE_METHOD_CONTEXT_PROP

public static final String DO_BLOB_REWRITE_METHOD_CONTEXT_PROP
See Also:
Constant Field Values

DMLGENERATOR

private static final DMLGenerator DMLGENERATOR

EQUAL_PLACEHOLDER

private static final String EQUAL_PLACEHOLDER
Duplicate of SQLBuilder.EQUAL_PLACEHOLDER. Didn't want to change SQLBuilder for this fix. Should move SQL generation into SQLBuilder in R7

See Also:
Constant Field Values
Constructor Detail

BlobRewriter

public BlobRewriter()
Method Detail

preBlobDecode

static final void preBlobDecode()
Always invoke before using PDSEncoder to decode a blob or smallblob that may contain serialized Java objects.


requestRewriteOfEvolvedBlobbedObject

public static final void requestRewriteOfEvolvedBlobbedObject()
Invoke from readOldVersion methods to request that the PDS rewrite the containing(small)blob to the database at the soonest convenience.


recordEncounteredWnc620LvInstance

static final void recordEncounteredWnc620LvInstance()
Invoked from PDSEncoder when an instance of wt.meta.LocalizedValues from wnc.6.2.0 and wnc.6.2.1 is encountered during(small)blob decoding. Once called, the containing(small)blob will be rewritten.


recordEncounteredPjl60LvInstance

static final void recordEncounteredPjl60LvInstance()
Invoked from PDSEncoder when an instance of wt.meta.LocalizedValues from wnc.6.2.0 and wnc.6.2.1 is encountered during(small)blob decoding. Once called, the containing(small)blob will be rewritten.


recordEncounteredGoodLvInstance

static final void recordEncounteredGoodLvInstance()
Invoked from PDSEncoder when an instance of wt.meta.LocalizedValues from R6.0- or wnc.6.2.2+.


isRewriteEnabledForCurrentMethodContext

public static final boolean isRewriteEnabledForCurrentMethodContext()
Returns the current setting for whether blob rewriting is enabled in the current MethodContext. By default, this setting will take on the value specified in db.properties by wt.pom.blobRewrite.enabled. However, this setting may be overridden in individual MethodContexts using #setRewriteEnabledForCurrentThread(boolean). Thus callers should not assume that this value is constant.

See Also:
#setRewriteEnabledForCurrentThread

setRewriteEnabledForCurrentMethodContext

public static final void setRewriteEnabledForCurrentMethodContext(boolean enabled)
Override the value of the db.property wt.pom.blobRewrite.enabled for the current MethodContext. This will affect whether or not blob rewriting is enabled for results queried later on this thread.

See Also:
#isRewriteEnabledForCurrentThread

isRewriteNeeded

static final boolean isRewriteNeeded()
Check immediately after using PDSEncoder to decode a blob or smallblob into a Java object. If it returns true, then use one of the rewrite methods to immediately store the object back into the BLOB or SMALLBLOB in the database

This method will return true if a serialized object was encountered during deserialization in the PDSEncoder that will be a continued problem unless stored back to the database.

Returns:
true if the object should be written back to the database

rewrite

static final Serializable rewrite(LobLocator lob_locator,
                                  Serializable serializable,
                                  Persistable containing_object)
                           throws DatastoreException
Store the serializable as a blob using the lob locator as the pointer to the blob. The contained object is assumed to be the one containing the blob columns.

This method creates a new transaction, locks the referencing object, and stores the blob.

Returns:
an object that may differ from the passed-in serializable(i.e. the object may be requeried after storage)
Throws:
DatastoreException

rewrite

static final Serializable rewrite(String attribute_name,
                                  Serializable serializable,
                                  Persistable containing_object)
                           throws DatastoreException
Store the serializable as a smallblob using the attribute_name to identify the smallblob column. The contained object is assumed to be the one containing the blob columns.

This method creates a new transaction, locks the perstable object, and stores the smallblob.

Returns:
an object that may differ from the passed-in serializable(i.e. the object may be requeried after storage)
Throws:
DatastoreException

rewrite

static final Serializable rewrite(String attribute_name,
                                  String blob_attribute_name,
                                  Serializable serializable,
                                  Persistable containing_object)
                           throws DatastoreException
Store the serializable as a smallblob using the attribute_name to identify the smallblob column. The contained object is assumed to be the one containing the blob columns.

This method creates a new transaction, locks the perstable object, and stores the smallblob.

Returns:
an object that may differ from the passed-in serializable(i.e. the object may be requeried after storage)
Throws:
DatastoreException

getConnection

private static final WTConnection getConnection()
                                         throws DatastoreException
Throws:
DatastoreException

getWTPreparedStatement

private static final WTPreparedStatement getWTPreparedStatement()