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 booleancanCycleprivate java.lang.LongcurrentValueprivate DataTypeDescriptordataTypeprivate longincrementprivate longmaximumValueprivate longminimumValueprivate SchemaDescriptorschemaDescriptorprivate UUIDschemaIdprivate java.lang.StringsequenceNameprivate UUIDsequenceUUIDprivate longstartValue-
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 booleancanCycle()voiddrop(LanguageConnectionContext lcc)Drop this sequence descriptor.java.lang.StringgetClassType()Get the provider's type.java.lang.LonggetCurrentValue()DataTypeDescriptorgetDataType()DependableFindergetDependableFinder()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.StringgetDescriptorName()java.lang.StringgetDescriptorType()Each descriptor must identify itself with its type; i.e index, check constraint whatever.longgetIncrement()longgetMaximumValue()longgetMinimumValue()java.lang.StringgetName()Get the name of this object.UUIDgetObjectID()Get the provider's UUIDjava.lang.StringgetObjectName()Return the name of this Provider.java.lang.StringgetObjectTypeName()Get the type of the object for storage in SYS.SYSPERMSSchemaDescriptorgetSchemaDescriptor()Get the objects schema descriptorUUIDgetSchemaId()java.lang.StringgetSequenceName()longgetStartValue()UUIDgetUUID()Return the UUID for this DescriptorbooleanisPersistent()Is this provider persistent?booleanisValid()Check that all of the dependent's dependencies are valid.voidmakeInvalid(int action, LanguageConnectionContext lcc)Mark the dependent as invalid (due to at least one of its dependencies being invalid).voidprepareToInvalidate(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.StringtoString()-
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:UniqueTupleDescriptorReturn the UUID for this Descriptor- Specified by:
getUUIDin classUniqueTupleDescriptor- Returns:
- the uuid
- See Also:
UniqueTupleDescriptor.getUUID()
-
getObjectTypeName
public java.lang.String getObjectTypeName()
Description copied from class:PrivilegedSQLObjectGet the type of the object for storage in SYS.SYSPERMS- Specified by:
getObjectTypeNamein classPrivilegedSQLObject- See Also:
PrivilegedSQLObject.getObjectTypeName()
-
toString
public java.lang.String toString()
- Overrides:
toStringin 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:
prepareToInvalidatein 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 StandardExceptionMark the dependent as invalid (due to at least one of its dependencies being invalid).- Specified by:
makeInvalidin 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:UniqueSQLObjectDescriptorGet the name of this object. E.g. for a table descriptor, this will be the table name.- Specified by:
getNamein classUniqueSQLObjectDescriptor- Returns:
- the name
-
getSchemaDescriptor
public SchemaDescriptor getSchemaDescriptor() throws StandardException
Description copied from class:UniqueSQLObjectDescriptorGet the objects schema descriptor- Specified by:
getSchemaDescriptorin classUniqueSQLObjectDescriptor- Returns:
- the schema descriptor
- Throws:
StandardException- on error
-
getDescriptorType
public java.lang.String getDescriptorType()
Description copied from class:TupleDescriptorEach descriptor must identify itself with its type; i.e index, check constraint whatever.- Overrides:
getDescriptorTypein classTupleDescriptor- See Also:
TupleDescriptor.getDescriptorType()
-
getDescriptorName
public java.lang.String getDescriptorName()
- Overrides:
getDescriptorNamein classTupleDescriptor- See Also:
TupleDescriptor.getDescriptorName()
-
getObjectID
public UUID getObjectID()
Get the provider's UUID- Specified by:
getObjectIDin 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:
isPersistentin interfaceDependable- Overrides:
isPersistentin 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:
getObjectNamein interfaceDependable- Returns:
- String The name of this provider.
-
getClassType
public java.lang.String getClassType()
Get the provider's type.- Specified by:
getClassTypein interfaceDependable- Returns:
- char The provider's type.
-
getDependableFinder
public DependableFinder getDependableFinder()
Description copied from interface:DependableGet an object which can be written to disk and which, when read from disk, will find or reconstruct this in-memory Dependable.- Specified by:
getDependableFinderin 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()
-
-