org.apache.derby.impl.sql.catalog
Class OIDTDCacheable

java.lang.Object
  extended byorg.apache.derby.impl.sql.catalog.TDCacheable
      extended byorg.apache.derby.impl.sql.catalog.OIDTDCacheable
All Implemented Interfaces:
Cacheable

class OIDTDCacheable
extends TDCacheable

This class implements a Cacheable for a DataDictionary cache of table descriptors, with the lookup key being the UUID of the table.


Field Summary
protected  DataDictionaryImpl dd
           
private  UUID identity
           
protected  TableDescriptor td
           
 
Constructor Summary
(package private) OIDTDCacheable(DataDictionaryImpl dd)
           
 
Method Summary
protected  boolean checkConsistency(TableDescriptor uncachedTD, java.lang.Object identity, HeaderPrintWriter reportInconsistent)
          Check the consistency of the table descriptor held by this TDCacheable versus an uncached table descriptor.
 void clean(boolean forRemove)
          Clean the object.
 void clearIdentity()
          Put the object into the No Identity state.
 Cacheable createIdentity(java.lang.Object key, java.lang.Object createParameter)
          Create a new item.
 java.lang.Object getIdentity()
          Get the identity of this object.
 TableDescriptor getTableDescriptor()
          Get the table descriptor that is associated with this Cacheable
 boolean isDirty()
          Returns true of the object is dirty.
 Cacheable setIdentity(java.lang.Object key)
          Set the identity of the object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

identity

private UUID identity

td

protected TableDescriptor td

dd

protected final DataDictionaryImpl dd
Constructor Detail

OIDTDCacheable

OIDTDCacheable(DataDictionaryImpl dd)
Method Detail

clearIdentity

public void clearIdentity()
Description copied from interface: Cacheable
Put the object into the No Identity state.
MT - single thread required - Method must only be called be cache manager and the cache manager will guarantee only one thread can be calling it.

See Also:
Cacheable.clearIdentity()

getIdentity

public java.lang.Object getIdentity()
Description copied from interface: Cacheable
Get the identity of this object.
MT - thread safe.

See Also:
Cacheable.getIdentity()

createIdentity

public Cacheable createIdentity(java.lang.Object key,
                                java.lang.Object createParameter)
Description copied from interface: Cacheable
Create a new item.

Create a new item and set the identity of the object to represent it. The object will be in the No Identity state, ie. it will have just been created or clearIdentity() was just called.
The object must copy the information out of key, not just store a reference to key if the key is not immutable. After this call the expression getIdentity().equals(key) must return true.

If the class of the object needs to change (e.g. to support a different format) then the object should create a new object, call its initParameter() with the parameters the original object was called with, set its identity and return a reference to it. The cache manager will discard the reference to the old object.
If an exception is thrown the object must be left in the no-identity state.
MT - single thread required - Method must only be called be cache manager and the cache manager will guarantee only one thread can be calling it.

Returns:
an object reference if the object can take on the identity, null otherwise.
See Also:
Cacheable.createIdentity(java.lang.Object, java.lang.Object)

setIdentity

public Cacheable setIdentity(java.lang.Object key)
                      throws StandardException
Description copied from interface: Cacheable
Set the identity of the object.

Set the identity of the object to represent an item that already exists, e.g. an existing container. The object will be in the No Identity state, ie. it will have just been created or clearIdentity() was just called.
The object must copy the information out of key, not just store a reference to key. After this call the expression getIdentity().equals(key) must return true.
If the class of the object needs to change (e.g. to support a different format) then the object should create a new object, call its initParameter() with the parameters the original object was called with, set its identity and return a reference to it. The cache manager will discard the reference to the old object.
If an exception is thrown the object must be left in the no-identity state.
MT - single thread required - Method must only be called be cache manager and the cache manager will guarantee only one thread can be calling it.

Returns:
an object reference if the object can take on the identity, null otherwise.
Throws:
StandardException - Thrown on error
See Also:
Cacheable.setIdentity(java.lang.Object)

clean

public void clean(boolean forRemove)
Description copied from interface: Cacheable
Clean the object. It is up to the object to ensure synchronization of the isDirty() and clean() method calls.
If forRemove is true then the object is being removed due to an explict remove request, in this case the cache manager will have called this method regardless of the state of the isDirty()
If an exception is thrown the object must be left in the clean state.
MT - thread safe - Can be called at any time by the cache manager, it is the responsibility of the object implementing Cacheable to ensure any users of the object do not conflict with the clean call.

Specified by:
clean in interface Cacheable
See Also:
Cacheable.clean(boolean)

isDirty

public boolean isDirty()
Description copied from interface: Cacheable
Returns true of the object is dirty. May be called when the object is kept or unkept.
MT - thread safe

Specified by:
isDirty in interface Cacheable
See Also:
Cacheable.isDirty()

getTableDescriptor

public TableDescriptor getTableDescriptor()
Get the table descriptor that is associated with this Cacheable


checkConsistency

protected boolean checkConsistency(TableDescriptor uncachedTD,
                                   java.lang.Object identity,
                                   HeaderPrintWriter reportInconsistent)
                            throws StandardException
Check the consistency of the table descriptor held by this TDCacheable versus an uncached table descriptor.

Parameters:
uncachedTD - The uncached descriptor to compare to
identity - The identity of the table descriptor
reportInconsistent - A HeaderPrintWriter to send complaints to
Returns:
true if the descriptors are the same, false if they're different
Throws:
StandardException - Thrown on error

Built on Mon 2007-06-04 09:58:47+0400, from revision ???

Apache Derby V10.1 Engine Documentation - Copyright © 1997,2005 The Apache Software Foundation or its licensors, as applicable.