org.apache.derby.iapi.sql.dictionary
Class ViewDescriptor

java.lang.Object
  extended byorg.apache.derby.iapi.sql.dictionary.TupleDescriptor
      extended byorg.apache.derby.iapi.sql.dictionary.ViewDescriptor
All Implemented Interfaces:
Dependable, Dependent, Provider, UniqueTupleDescriptor

public class ViewDescriptor
extends TupleDescriptor
implements UniqueTupleDescriptor, Dependent, Provider

This is the implementation of ViewDescriptor. Users of View descriptors should only use the following methods:

  1. getUUID
  2. setUUID
  3. getViewText
  4. setViewName
  5. getCheckOptionType
  6. getCompSchemaId

Version:
0.1
Author:
Jeff Lichtman

Field Summary
private  int checkOption
           
private  UUID compSchemaId
           
static int NO_CHECK_OPTION
           
private  UUID uuid
           
private  java.lang.String viewName
           
private  java.lang.String viewText
           
 
Fields inherited from class org.apache.derby.iapi.sql.dictionary.TupleDescriptor
COLUMN_LIST, CONGLOMERATE_LIST, CONSTRAINT_LIST, TRIGGER_LIST
 
Fields inherited from interface org.apache.derby.catalog.Dependable
ALIAS, COLUMNS_IN_TABLE, CONGLOMERATE, CONSTRAINT, DEFAULT, FILE, HEAP, INDEX, PREPARED_STATEMENT, SCHEMA, STORED_PREPARED_STATEMENT, TABLE, TRIGGER, VIEW
 
Constructor Summary
ViewDescriptor(DataDictionary dataDictionary, UUID viewID, java.lang.String viewName, java.lang.String viewText, int checkOption, UUID compSchemaId)
          Constructor for a ViewDescriptor.
 
Method Summary
private  void dropViewCascade(LanguageConnectionContext lcc)
          Drops the dependent view as part of a drop table cascade
 void dropViewWork(DataDictionary dd, DependencyManager dm, LanguageConnectionContext lcc, TransactionController tc, SchemaDescriptor sd, TableDescriptor td, boolean cascade)
           
 int getCheckOptionType()
          Gets an identifier telling what type of check option is on this view.
 java.lang.String getClassType()
          Get the provider's type.
 UUID getCompSchemaId()
          Get the compilation type schema id when this view was first bound.
 DependableFinder getDependableFinder()
          Get an object which can be written to disk and which, when read from disk, will find or reconstruct this in-memory Dependable.
 UUID getObjectID()
          Get the provider's UUID
 java.lang.String getObjectName()
          Return the name of this Provider.
 UUID getUUID()
          Gets the UUID of the view.
 java.lang.String getViewText()
          Gets the text of the view definition.
 boolean isValid()
          Check that all of the dependent's dependencies are valid.
 void makeInvalid(int action, LanguageConnectionContext lcc)
          Mark the dependent as invalid (due to at least one of its dependencies being invalid).
 void makeValid(LanguageConnectionContext lcc)
          Attempt to revalidate the dependent.
 void prepareToInvalidate(Provider p, int action, LanguageConnectionContext lcc)
          Prepare to mark the dependent as invalid (due to at least one of its dependencies being invalid).
 void setUUID(UUID uuid)
          Sets the UUID of the view.
 void setViewName(java.lang.String name)
          Sets the name of the view.
 java.lang.String toString()
          Prints the contents of the ViewDescriptor
 
Methods inherited from class org.apache.derby.iapi.sql.dictionary.TupleDescriptor
getColumnDependableFinder, getDataDictionary, getDependableFinder, getDescriptorName, getDescriptorType, isPersistent, setDataDictionary
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.derby.catalog.Dependable
isPersistent
 

Field Detail

checkOption

private int checkOption

viewName

private java.lang.String viewName

viewText

private java.lang.String viewText

uuid

private UUID uuid

compSchemaId

private UUID compSchemaId

NO_CHECK_OPTION

public static final int NO_CHECK_OPTION
See Also:
Constant Field Values
Constructor Detail

ViewDescriptor

public ViewDescriptor(DataDictionary dataDictionary,
                      UUID viewID,
                      java.lang.String viewName,
                      java.lang.String viewText,
                      int checkOption,
                      UUID compSchemaId)
Constructor for a ViewDescriptor.

Parameters:
dataDictionary - The data dictionary that this descriptor lives in
viewID - The UUID for the view
viewName - The name of the view
viewText - The text of the query expression from the view definition.
checkOption - int check option type
compSchemaId - the schemaid to compile in
Method Detail

getUUID

public UUID getUUID()
Gets the UUID of the view.

Specified by:
getUUID in interface UniqueTupleDescriptor
Returns:
The UUID of the view.

setUUID

public void setUUID(UUID uuid)
Sets the UUID of the view.

Parameters:
uuid - The UUID of the view.
Returns:
Nothing.

getViewText

public java.lang.String getViewText()
Gets the text of the view definition.

Returns:
A String containing the text of the CREATE VIEW statement that created the view

setViewName

public void setViewName(java.lang.String name)
Sets the name of the view.

Parameters:
name - The name of the view.
Returns:
Nothing.

getCheckOptionType

public int getCheckOptionType()
Gets an identifier telling what type of check option is on this view.

Returns:
An identifier telling what type of check option is on the view.

getCompSchemaId

public UUID getCompSchemaId()
Get the compilation type schema id when this view was first bound.

Returns:
the schema UUID

getDependableFinder

public DependableFinder getDependableFinder()
Description copied from interface: Dependable
Get an object which can be written to disk and which, when read from disk, will find or reconstruct this in-memory Dependable.

Specified by:
getDependableFinder in interface Dependable
Returns:
the stored form of this provider
See Also:
Dependable.getDependableFinder()

getObjectName

public java.lang.String getObjectName()
Return the name of this Provider. (Useful for errors.)

Specified by:
getObjectName in interface Dependable
Returns:
String The name of this provider.

getObjectID

public UUID getObjectID()
Get the provider's UUID

Specified by:
getObjectID in interface Dependable
Returns:
String The provider's UUID

getClassType

public java.lang.String getClassType()
Get the provider's type.

Specified by:
getClassType in interface Dependable
Returns:
String The provider's type.

isValid

public boolean isValid()
Check that all of the dependent's dependencies are valid.

Specified by:
isValid in interface Dependent
Returns:
true if the dependent is currently valid

prepareToInvalidate

public void prepareToInvalidate(Provider p,
                                int action,
                                LanguageConnectionContext lcc)
                         throws StandardException
Prepare to mark the dependent as invalid (due to at least one of its dependencies being invalid).

Specified by:
prepareToInvalidate in interface Dependent
Parameters:
action - The action causing the invalidation
p - the provider
lcc - The LanguageConnectionContext
Throws:
StandardException - thrown if unable to make it invalid

makeInvalid

public void makeInvalid(int action,
                        LanguageConnectionContext lcc)
                 throws StandardException
Mark the dependent as invalid (due to at least one of its dependencies being invalid).

Specified by:
makeInvalid in interface Dependent
Parameters:
action - The action causing the invalidation
lcc - The LanguageConnectionContext
Throws:
StandardException - thrown if unable to make it invalid

makeValid

public void makeValid(LanguageConnectionContext lcc)
               throws StandardException
Attempt to revalidate the dependent. For prepared statements, this could go through its dependencies and check that they are up to date; if not, it would recompile the statement. Any failure during this attempt should throw StandardException.unableToRevalidate().

Specified by:
makeValid in interface Dependent
Parameters:
lcc - The LanguageConnectionContext
Throws:
StandardException - thrown if unable to make it valid

toString

public java.lang.String toString()
Prints the contents of the ViewDescriptor

Returns:
The contents as a String

dropViewCascade

private void dropViewCascade(LanguageConnectionContext lcc)
                      throws StandardException
Drops the dependent view as part of a drop table cascade

Throws:
StandardException - thrown if failure occurs in dropping view

dropViewWork

public void dropViewWork(DataDictionary dd,
                         DependencyManager dm,
                         LanguageConnectionContext lcc,
                         TransactionController tc,
                         SchemaDescriptor sd,
                         TableDescriptor td,
                         boolean cascade)
                  throws StandardException
Throws:
StandardException

Built on Tue 2006-10-10 19:23:47+0200, from revision exported

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