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

java.lang.Object
  extended by org.apache.derby.iapi.sql.dictionary.TupleDescriptor
      extended by org.apache.derby.iapi.sql.dictionary.SequenceDescriptor
All Implemented Interfaces:
Dependable, Dependent, Provider, PrivilegedSQLObject, UniqueSQLObjectDescriptor, UniqueTupleDescriptor

public class SequenceDescriptor
extends TupleDescriptor
implements Provider, Dependent, PrivilegedSQLObject

This class is used by rows in the SYS.SYSSEQUENCES system table. See the header comment of SYSSEQUENCESRowFactory for the contract of that table. In particular, if the CURRENTVALUE column is null, then the sequence has been exhausted and no more values can be generated from it.


Field Summary
private  boolean canCycle
           
private  java.lang.Long currentValue
           
private  DataTypeDescriptor dataType
           
private  long increment
           
private  long maximumValue
           
private  long minimumValue
           
private  SchemaDescriptor schemaDescriptor
           
private  UUID schemaId
           
private  java.lang.String sequenceName
           
private  UUID sequenceUUID
           
private  long startValue
           
 
Fields inherited from interface org.apache.derby.catalog.Dependable
ACTIVATION, ALIAS, COLUMNS_IN_TABLE, COLUMNS_PERMISSION, CONGLOMERATE, CONSTRAINT, DEFAULT, FILE, HEAP, INDEX, PERM, PREPARED_STATEMENT, ROLE_GRANT, ROUTINE_PERMISSION, SCHEMA, SEQUENCE, STORED_PREPARED_STATEMENT, TABLE, TABLE_PERMISSION, TRIGGER, VIEW
 
Constructor Summary
SequenceDescriptor(DataDictionary dataDictionary, SchemaDescriptor sd, UUID sequenceUUID, java.lang.String sequenceName, DataTypeDescriptor dataType, java.lang.Long currentValue, long startValue, long minimumValue, long maximumValue, long increment, boolean canCycle)
          Constructor
 
Method Summary
 boolean canCycle()
           
 void drop(LanguageConnectionContext lcc)
          Drop this sequence descriptor.
 java.lang.String getClassType()
          Get the provider's type.
 java.lang.Long getCurrentValue()
           
 DataTypeDescriptor getDataType()
           
 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.
 java.lang.String getDescriptorName()
           
 java.lang.String getDescriptorType()
          Each descriptor must identify itself with its type; i.e index, check constraint whatever.
 long getIncrement()
           
 long getMaximumValue()
           
 long getMinimumValue()
           
 java.lang.String getName()
          Get the name of this object.
 UUID getObjectID()
          Get the provider's UUID
 java.lang.String getObjectName()
          Return the name of this Provider.
 java.lang.String getObjectTypeName()
          Get the type of the object for storage in SYS.SYSPERMS
 SchemaDescriptor getSchemaDescriptor()
          Get the objects schema descriptor
 UUID getSchemaId()
           
 java.lang.String getSequenceName()
           
 long getStartValue()
           
 UUID getUUID()
          Return the UUID for this Descriptor
 boolean isPersistent()
          Is this provider persistent?
 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 prepareToInvalidate(Provider p, int action, LanguageConnectionContext lcc)
          Prepare to mark the dependent as invalid (due to at least one of its dependencies being invalid).
 java.lang.String toString()
           
 
Methods inherited from class org.apache.derby.iapi.sql.dictionary.TupleDescriptor
getColumnDependableFinder, getDataDictionary, getDependableFinder, setDataDictionary
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

sequenceUUID

private UUID sequenceUUID

sequenceName

private java.lang.String sequenceName

schemaDescriptor

private final SchemaDescriptor schemaDescriptor

schemaId

private UUID schemaId

dataType

private DataTypeDescriptor dataType

currentValue

private java.lang.Long currentValue

startValue

private long startValue

minimumValue

private long minimumValue

maximumValue

private long maximumValue

increment

private long increment

canCycle

private boolean canCycle
Constructor Detail

SequenceDescriptor

public SequenceDescriptor(DataDictionary dataDictionary,
                          SchemaDescriptor sd,
                          UUID sequenceUUID,
                          java.lang.String sequenceName,
                          DataTypeDescriptor dataType,
                          java.lang.Long currentValue,
                          long startValue,
                          long minimumValue,
                          long maximumValue,
                          long increment,
                          boolean canCycle)
Constructor

Parameters:
dataDictionary - data dictionary
sequenceUUID - unique identification in time and space of this sequence descriptor
sequenceName -
Method Detail

getUUID

public UUID getUUID()
Description copied from interface: UniqueTupleDescriptor
Return the UUID for this Descriptor

Specified by:
getUUID in interface UniqueTupleDescriptor
Returns:
the uuid
See Also:
UniqueTupleDescriptor.getUUID()

getObjectTypeName

public java.lang.String getObjectTypeName()
Description copied from interface: PrivilegedSQLObject
Get the type of the object for storage in SYS.SYSPERMS

Specified by:
getObjectTypeName in interface PrivilegedSQLObject
See Also:
PrivilegedSQLObject.getObjectTypeName()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

drop

public void drop(LanguageConnectionContext lcc)
          throws StandardException
Drop this sequence descriptor. Only restricted drops allowed right now.

Throws:
StandardException - Could not be dropped.

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 language connection context
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:
lcc - the language connection context
action - The action causing the invalidation
Throws:
StandardException - thrown if called in sanity mode

getName

public java.lang.String getName()
Description copied from interface: UniqueSQLObjectDescriptor
Get the name of this object. E.g. for a table descriptor, this will be the table name.

Specified by:
getName in interface UniqueSQLObjectDescriptor
Returns:
the name

getSchemaDescriptor

public SchemaDescriptor getSchemaDescriptor()
                                     throws StandardException
Description copied from interface: UniqueSQLObjectDescriptor
Get the objects schema descriptor

Specified by:
getSchemaDescriptor in interface UniqueSQLObjectDescriptor
Returns:
the schema descriptor
Throws:
StandardException - on error

getDescriptorType

public java.lang.String getDescriptorType()
Description copied from class: TupleDescriptor
Each descriptor must identify itself with its type; i.e index, check constraint whatever.

Overrides:
getDescriptorType in class TupleDescriptor
See Also:
TupleDescriptor.getDescriptorType()

getDescriptorName

public java.lang.String getDescriptorName()
Overrides:
getDescriptorName in class TupleDescriptor
See Also:
TupleDescriptor.getDescriptorName()

getObjectID

public UUID getObjectID()
Get the provider's UUID

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

isPersistent

public boolean isPersistent()
Is this provider persistent? A stored dependency will be required if both the dependent and provider are persistent.

Specified by:
isPersistent in interface Dependable
Overrides:
isPersistent in class TupleDescriptor
Returns:
boolean Whether or not this provider is persistent.

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.

getClassType

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

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

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()

getSequenceName

public java.lang.String getSequenceName()

getSchemaId

public UUID getSchemaId()

getDataType

public DataTypeDescriptor getDataType()

getCurrentValue

public java.lang.Long getCurrentValue()

getStartValue

public long getStartValue()

getMinimumValue

public long getMinimumValue()

getMaximumValue

public long getMaximumValue()

getIncrement

public long getIncrement()

canCycle

public boolean canCycle()

Built on Thu 2010-12-23 20:49:13+0000, from revision ???

Apache Derby V10.6 Internals - Copyright © 2004,2007 The Apache Software Foundation. All Rights Reserved.