Class SequenceDescriptor
- java.lang.Object
-
- org.apache.derby.iapi.sql.dictionary.TupleDescriptor
-
- org.apache.derby.iapi.sql.dictionary.UniqueTupleDescriptor
-
- org.apache.derby.iapi.sql.dictionary.UniqueSQLObjectDescriptor
-
- org.apache.derby.iapi.sql.dictionary.PrivilegedSQLObject
-
- org.apache.derby.iapi.sql.dictionary.SequenceDescriptor
-
- All Implemented Interfaces:
Dependable
,Dependent
,Provider
public class SequenceDescriptor extends PrivilegedSQLObject implements Provider, Dependent
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
Fields Modifier and Type Field Description 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
Constructors Constructor Description 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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 UUIDjava.lang.String
getObjectName()
Return the name of this Provider.java.lang.String
getObjectTypeName()
Get the type of the object for storage in SYS.SYSPERMSSchemaDescriptor
getSchemaDescriptor()
Get the objects schema descriptorUUID
getSchemaId()
java.lang.String
getSequenceName()
long
getStartValue()
UUID
getUUID()
Return the UUID for this Descriptorboolean
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
-
-
-
-
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 dictionarysequenceUUID
- unique identification in time and space of this sequence descriptorsequenceName
-
-
-
Method Detail
-
getUUID
public UUID getUUID()
Description copied from class:UniqueTupleDescriptor
Return the UUID for this Descriptor- Specified by:
getUUID
in classUniqueTupleDescriptor
- Returns:
- the uuid
- See Also:
UniqueTupleDescriptor.getUUID()
-
getObjectTypeName
public java.lang.String getObjectTypeName()
Description copied from class:PrivilegedSQLObject
Get the type of the object for storage in SYS.SYSPERMS- Specified by:
getObjectTypeName
in classPrivilegedSQLObject
- See Also:
PrivilegedSQLObject.getObjectTypeName()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.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.
-
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 interfaceDependent
- Parameters:
action
- The action causing the invalidationp
- the providerlcc
- 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 interfaceDependent
- Parameters:
lcc
- the language connection contextaction
- The action causing the invalidation- Throws:
StandardException
- thrown if called in sanity mode
-
getName
public java.lang.String getName()
Description copied from class:UniqueSQLObjectDescriptor
Get the name of this object. E.g. for a table descriptor, this will be the table name.- Specified by:
getName
in classUniqueSQLObjectDescriptor
- Returns:
- the name
-
getSchemaDescriptor
public SchemaDescriptor getSchemaDescriptor() throws StandardException
Description copied from class:UniqueSQLObjectDescriptor
Get the objects schema descriptor- Specified by:
getSchemaDescriptor
in classUniqueSQLObjectDescriptor
- 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 classTupleDescriptor
- See Also:
TupleDescriptor.getDescriptorType()
-
getDescriptorName
public java.lang.String getDescriptorName()
- Overrides:
getDescriptorName
in classTupleDescriptor
- See Also:
TupleDescriptor.getDescriptorName()
-
getObjectID
public UUID getObjectID()
Get the provider's UUID- Specified by:
getObjectID
in interfaceDependable
- 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 interfaceDependable
- Overrides:
isPersistent
in classTupleDescriptor
- 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 interfaceDependable
- Returns:
- String The name of this provider.
-
getClassType
public java.lang.String getClassType()
Get the provider's type.- Specified by:
getClassType
in interfaceDependable
- 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 interfaceDependable
- 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()
-
-