Top Description Fields Constructors Methods
org.apache.derby.iapi.sql.dictionary

public Class DataDescriptorGenerator

extends Object
Class Inheritance
Imports
java.sql.Timestamp, org.apache.derby.catalog.ReferencedColumns, .UUID, org.apache.derby.catalog.types.ReferencedColumnsDescriptorImpl, org.apache.derby.shared.common.error.StandardException, org.apache.derby.iapi.services.io.FormatableBitSet, org.apache.derby.iapi.services.monitor.ModuleFactory, .Monitor, org.apache.derby.shared.common.sanity.SanityManager, org.apache.derby.iapi.services.uuid.UUIDFactory, org.apache.derby.iapi.types.DataTypeDescriptor

This is an implementation of the DataDescriptorGenerator interface that lives in the DataDictionary protocol. See that interface for a description of what this class is supposed to do.
Version
0.1

Field Summary

Modifier and TypeField and Description
protected final DataDictionary
private UUIDFactory

Constructor Summary

AccessConstructor and Description
public
DataDescriptorGenerator(DataDictionary
the data dictionary that this generator makes objects for
dataDictionary
)

Make a generator.

Method Summary

Modifier and TypeMethod and Description
pack-priv static ModuleFactory
getMonitor()

Must be package private so that user code can't call this entry point.

protected UUIDFactory
public CheckConstraintDescriptor
newCheckConstraintDescriptor(TableDescriptor table, String constraintName, boolean deferrable, boolean initiallyDeferred, UUID constraintId, String constraintText, ReferencedColumns referencedColumns, SchemaDescriptor schemaDesc, boolean isEnabled)

public CheckConstraintDescriptor
newCheckConstraintDescriptor(TableDescriptor table, String constraintName, boolean deferrable, boolean initiallyDeferred, UUID constraintId, String constraintText, int[] refCols, SchemaDescriptor schemaDesc, boolean isEnabled)

public ColPermsDescriptor
newColPermsDescriptor(TableDescriptor
The descriptor of the table.
td
,
String
The action type:
  1. "s" - select without grant
  2. "S" - select with grant
  3. "u" - update without grant
  4. "U" - update with grant
  5. "r" - references without grant
  6. "R" - references with grant
type
,
FormatableBitSet
the set of columns
columns
,
String grantor)

Manufacture a new ColPermsDescriptor.

public ConglomerateDescriptor

Returns:

A ConglomerateDescriptor describing the conglomerate.
newConglomerateDescriptor
(long
The identifier for the conglomerate we're interested in
conglomerateId
,
String
The name of the conglomerate, if any
name
,
boolean
TRUE means the conglomerate is indexable, FALSE means it isn't
indexable
,
IndexRowGenerator
The IndexRowGenerator for the conglomerate, null if it's a heap
indexRowGenerator
,
boolean
TRUE means the conglomerate is an index backing up a constraint, FALSE means it isn't
isConstraint
,
UUID
UUID for this conglomerate
uuid
,
UUID
UUID for the table that this conglomerate belongs to
tableID
,
UUID
UUID for the schema that conglomerate belongs to
schemaID
)

Create a conglomerate descriptor for the given conglomerate id.

public FileInfoDescriptor

Returns:

the newly created file info descriptor
newFileInfoDescriptor
(UUID id, SchemaDescriptor sd, String sqlName, long generationId)

Create a new FileInfoDescriptor using the supplied arguments.

public ForeignKeyConstraintDescriptor
newForeignKeyConstraintDescriptor(TableDescriptor table, String constraintName, boolean deferrable, boolean initiallyDeferred, int[] fkColumns, UUID constraintId, UUID indexId, SchemaDescriptor schemaDesc, ReferencedKeyConstraintDescriptor referencedConstraintDescriptor, boolean isEnabled, int raDeleteRule, int raUpdateRule)

public ForeignKeyConstraintDescriptor
newForeignKeyConstraintDescriptor(TableDescriptor table, String constraintName, boolean deferrable, boolean initiallyDeferred, int[] fkColumns, UUID constraintId, UUID indexId, SchemaDescriptor schemaDesc, UUID referencedConstraintId, boolean isEnabled, int raDeleteRule, int raUpdateRule)

public PermDescriptor
newPermDescriptor(UUID uuid, String objectType, UUID permObjectId, String permission, String grantor, String grantee, boolean grantable)

public ReferencedKeyConstraintDescriptor
newPrimaryKeyConstraintDescriptor(TableDescriptor table, String constraintName, boolean deferrable, boolean initiallyDeferred, int[] referencedColumns, UUID constraintId, UUID indexId, SchemaDescriptor schemaDesc, boolean isEnabled, int referenceCount)

public RoleGrantDescriptor
newRoleGrantDescriptor(UUID
unique identifier for this role grant descriptor in time and space
uuid
,
String
the name of the role for which a new descriptor is created
roleName
,
String
authorization identifier of grantee
grantee
,
String
authorization identifier of grantor
grantor
,
boolean
if true, WITH ADMIN OPTION is set for this descriptor
withadminoption
,
boolean
if true, this descriptor represents a role definition, otherwise it represents a grant.
isDef
)

Create a new role grant descriptor

public RoutinePermsDescriptor
newRoutinePermsDescriptor(AliasDescriptor
The routine's alias descriptor
ad
,
String grantor)

Create a new routine permissions descriptor

public SchemaDescriptor

Returns:

The descriptor for the schema.
newSchemaDescriptor
(String
The name of the schema we're interested in. If the name is NULL, get the descriptor for the current schema.
schemaName
,
String
The authorization ID associated with the schema. The owner of the schema.
aid
,
UUID
The object ID
oid
)

Create a descriptor for the named schema with a null UUID.

public SequenceDescriptor

Returns:

SequenceDescriptor
newSequenceDescriptor
(SchemaDescriptor sd, UUID uuid, String sequenceName, DataTypeDescriptor dataType, Long currentValue, long startValue, long minimumValue, long maximumValue, long increment, boolean cycle)

Create a new sequence descriptor

public TableDescriptor

Returns:

The descriptor for the table.
newTableDescriptor
(String
The name of the table to get the descriptor for
tableName
,
SchemaDescriptor
The descriptor for the schema the table lives in. If null, use the current (default) schema.
schema
,
int
The type of the table: base table or view.
tableType
,
char
The lock granularity.
lockGranularity
)

Create a descriptor for the named table within the given schema.

public TableDescriptor

Returns:

The descriptor for the table.
newTableDescriptor
(String
The name of the temporary table to get the descriptor for
tableName
,
SchemaDescriptor
The descriptor for the schema the table lives in.
schema
,
int
The type of the table: temporary table
tableType
,
boolean
If true, on commit delete rows else on commit preserve rows of temporary table.
onCommitDeleteRows
,
boolean
If true, on rollback, delete rows from temp tables which were logically modified. true is the only supported value
onRollbackDeleteRows
)

Create a descriptor for the temporary table within the given schema.

public TablePermsDescriptor
newTablePermsDescriptor(TableDescriptor td, String selectPerm, String deletePerm, String insertPerm, String updatePerm, String referencesPerm, String triggerPerm, String grantor)

public TriggerDescriptor

Returns:

a trigger descriptor
newTriggerDescriptor
(SchemaDescriptor
the schema descriptor for this trigger
sd
,
UUID
the trigger id
uuid
,
String
the trigger name
name
,
int
TriggerDescriptor.TRIGGER_EVENT_XXXX
eventMask
,
boolean
is this a before (as opposed to after) trigger
isBefore
,
boolean
is this a row trigger or statement trigger
isRow
,
boolean
is this trigger enabled or disabled
isEnabled
,
TableDescriptor
the table upon which this trigger is defined
td
,
UUID
the sps id for the when clause (may be null)
whenSPSId
,
UUID
the spsid for the trigger action (may be null)
actionSPSId
,
Timestamp
when was this trigger created?
creationTimestamp
,
int[]
what columns does this trigger reference (may be null)
referencedCols
,
int[]
what columns does the trigger action reference through old/new transition variables (may be null)
referencedColsInTriggerAction
,
String
The original user text of the trigger action
triggerDefinition
,
boolean
whether or not OLD appears in REFERENCING clause
referencingOld
,
boolean
whether or not NEW appears in REFERENCING clause
referencingNew
,
String
old referencing table name, if any, that appears in REFERCING clause
oldReferencingName
,
String
new referencing table name, if any, that appears in REFERCING clause
newReferencingName
,
String
the SQL text of the WHEN clause (may be null)
whenClauseText
)

Create a new trigger descriptor.

public ReferencedKeyConstraintDescriptor
newUniqueConstraintDescriptor(TableDescriptor table, String constraintName, boolean deferrable, boolean initiallyDeferred, int[] referencedColumns, UUID constraintId, UUID indexId, SchemaDescriptor schemaDesc, boolean isEnabled, int referenceCount)

public UserDescriptor
newUserDescriptor(String userName, String hashingScheme, char[] password, Timestamp lastModified)

public ViewDescriptor

Returns:

A descriptor for the view
newViewDescriptor
(UUID
the UUID for the view.
viewID
,
String
the name of the view
viewName
,
String
the text of the view's query.
viewText
,
int
int for check option type
checkOption
,
UUID
the UUID of the schema this was compiled in
compSchemaId
)

Create a viewDescriptor for the view with the given UUID.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

dataDictionaryback to summary
protected final DataDictionary dataDictionary
uuidfback to summary
private UUIDFactory uuidf

Constructor Detail

DataDescriptorGeneratorback to summary
public DataDescriptorGenerator(DataDictionary dataDictionary)

Make a generator. Specify the data dictionary that it operates on.

Parameters
dataDictionary:DataDictionary

the data dictionary that this generator makes objects for

Method Detail

getMonitorback to summary
pack-priv static ModuleFactory getMonitor()

Must be package private so that user code can't call this entry point.

getUUIDFactoryback to summary
protected UUIDFactory getUUIDFactory()
newCheckConstraintDescriptorback to summary
public CheckConstraintDescriptor newCheckConstraintDescriptor(TableDescriptor table, String constraintName, boolean deferrable, boolean initiallyDeferred, UUID constraintId, String constraintText, ReferencedColumns referencedColumns, SchemaDescriptor schemaDesc, boolean isEnabled)
See Also
DataDescriptorGenerator#newCheckConstraintDescriptor
newCheckConstraintDescriptorback to summary
public CheckConstraintDescriptor newCheckConstraintDescriptor(TableDescriptor table, String constraintName, boolean deferrable, boolean initiallyDeferred, UUID constraintId, String constraintText, int[] refCols, SchemaDescriptor schemaDesc, boolean isEnabled)
newColPermsDescriptorback to summary
public ColPermsDescriptor newColPermsDescriptor(TableDescriptor td, String type, FormatableBitSet columns, String grantor) throws StandardException

Manufacture a new ColPermsDescriptor.

Parameters
td:TableDescriptor

The descriptor of the table.

type:String

The action type:

  1. "s" - select without grant
  2. "S" - select with grant
  3. "u" - update without grant
  4. "U" - update with grant
  5. "r" - references without grant
  6. "R" - references with grant
columns:FormatableBitSet

the set of columns

newConglomerateDescriptorback to summary
public ConglomerateDescriptor newConglomerateDescriptor(long conglomerateId, String name, boolean indexable, IndexRowGenerator indexRowGenerator, boolean isConstraint, UUID uuid, UUID tableID, UUID schemaID)

Create a conglomerate descriptor for the given conglomerate id.

Parameters
conglomerateId:long

The identifier for the conglomerate we're interested in

name:String

The name of the conglomerate, if any

indexable:boolean

TRUE means the conglomerate is indexable, FALSE means it isn't

indexRowGenerator:IndexRowGenerator

The IndexRowGenerator for the conglomerate, null if it's a heap

isConstraint:boolean

TRUE means the conglomerate is an index backing up a constraint, FALSE means it isn't

uuid:UUID

UUID for this conglomerate

tableID:UUID

UUID for the table that this conglomerate belongs to

schemaID:UUID

UUID for the schema that conglomerate belongs to

Returns:ConglomerateDescriptor

A ConglomerateDescriptor describing the conglomerate.

newFileInfoDescriptorback to summary
public FileInfoDescriptor newFileInfoDescriptor(UUID id, SchemaDescriptor sd, String sqlName, long generationId)

Create a new FileInfoDescriptor using the supplied arguments. id unique id to be used for the new file descriptor sd schema of the new file to be stored in the database SQLName the SQL name of the new schema object representing the file generationID version numberof the file the descriptor describes

Returns:FileInfoDescriptor

the newly created file info descriptor

newForeignKeyConstraintDescriptorback to summary
public ForeignKeyConstraintDescriptor newForeignKeyConstraintDescriptor(TableDescriptor table, String constraintName, boolean deferrable, boolean initiallyDeferred, int[] fkColumns, UUID constraintId, UUID indexId, SchemaDescriptor schemaDesc, ReferencedKeyConstraintDescriptor referencedConstraintDescriptor, boolean isEnabled, int raDeleteRule, int raUpdateRule)
See Also
DataDescriptorGenerator#newForeignKeyConstraintDescriptor
newForeignKeyConstraintDescriptorback to summary
public ForeignKeyConstraintDescriptor newForeignKeyConstraintDescriptor(TableDescriptor table, String constraintName, boolean deferrable, boolean initiallyDeferred, int[] fkColumns, UUID constraintId, UUID indexId, SchemaDescriptor schemaDesc, UUID referencedConstraintId, boolean isEnabled, int raDeleteRule, int raUpdateRule)
See Also
DataDescriptorGenerator#newForeignKeyConstraintDescriptor
newPermDescriptorback to summary
public PermDescriptor newPermDescriptor(UUID uuid, String objectType, UUID permObjectId, String permission, String grantor, String grantee, boolean grantable)
newPrimaryKeyConstraintDescriptorback to summary
public ReferencedKeyConstraintDescriptor newPrimaryKeyConstraintDescriptor(TableDescriptor table, String constraintName, boolean deferrable, boolean initiallyDeferred, int[] referencedColumns, UUID constraintId, UUID indexId, SchemaDescriptor schemaDesc, boolean isEnabled, int referenceCount)
See Also
DataDescriptorGenerator#newPrimaryKeyConstraintDescriptor
newRoleGrantDescriptorback to summary
public RoleGrantDescriptor newRoleGrantDescriptor(UUID uuid, String roleName, String grantee, String grantor, boolean withadminoption, boolean isDef) throws StandardException

Create a new role grant descriptor

Parameters
uuid:UUID

unique identifier for this role grant descriptor in time and space

roleName:String

the name of the role for which a new descriptor is created

grantee:String

authorization identifier of grantee

grantor:String

authorization identifier of grantor

withadminoption:boolean

if true, WITH ADMIN OPTION is set for this descriptor

isDef:boolean

if true, this descriptor represents a role definition, otherwise it represents a grant.

newRoutinePermsDescriptorback to summary
public RoutinePermsDescriptor newRoutinePermsDescriptor(AliasDescriptor ad, String grantor) throws StandardException

Create a new routine permissions descriptor

Parameters
ad:AliasDescriptor

The routine's alias descriptor

newSchemaDescriptorback to summary
public SchemaDescriptor newSchemaDescriptor(String schemaName, String aid, UUID oid) throws StandardException

Create a descriptor for the named schema with a null UUID.

Parameters
schemaName:String

The name of the schema we're interested in. If the name is NULL, get the descriptor for the current schema.

aid:String

The authorization ID associated with the schema. The owner of the schema.

oid:UUID

The object ID

Returns:SchemaDescriptor

The descriptor for the schema.

Exceptions
StandardException:
Thrown on failure
newSequenceDescriptorback to summary
public SequenceDescriptor newSequenceDescriptor(SchemaDescriptor sd, UUID uuid, String sequenceName, DataTypeDescriptor dataType, Long currentValue, long startValue, long minimumValue, long maximumValue, long increment, boolean cycle)

Create a new sequence descriptor

Returns:SequenceDescriptor

SequenceDescriptor

newTableDescriptorback to summary
public TableDescriptor newTableDescriptor(String tableName, SchemaDescriptor schema, int tableType, char lockGranularity)

Create a descriptor for the named table within the given schema. If the schema parameter is NULL, it creates a schema descriptor using the current default schema.

Parameters
tableName:String

The name of the table to get the descriptor for

schema:SchemaDescriptor

The descriptor for the schema the table lives in. If null, use the current (default) schema.

tableType:int

The type of the table: base table or view.

lockGranularity:char

The lock granularity.

Returns:TableDescriptor

The descriptor for the table.

newTableDescriptorback to summary
public TableDescriptor newTableDescriptor(String tableName, SchemaDescriptor schema, int tableType, boolean onCommitDeleteRows, boolean onRollbackDeleteRows)

Create a descriptor for the temporary table within the given schema.

Parameters
tableName:String

The name of the temporary table to get the descriptor for

schema:SchemaDescriptor

The descriptor for the schema the table lives in.

tableType:int

The type of the table: temporary table

onCommitDeleteRows:boolean

If true, on commit delete rows else on commit preserve rows of temporary table.

onRollbackDeleteRows:boolean

If true, on rollback, delete rows from temp tables which were logically modified. true is the only supported value

Returns:TableDescriptor

The descriptor for the table.

newTablePermsDescriptorback to summary
public TablePermsDescriptor newTablePermsDescriptor(TableDescriptor td, String selectPerm, String deletePerm, String insertPerm, String updatePerm, String referencesPerm, String triggerPerm, String grantor) throws StandardException
newTriggerDescriptorback to summary
public TriggerDescriptor newTriggerDescriptor(SchemaDescriptor sd, UUID uuid, String name, int eventMask, boolean isBefore, boolean isRow, boolean isEnabled, TableDescriptor td, UUID whenSPSId, UUID actionSPSId, Timestamp creationTimestamp, int[] referencedCols, int[] referencedColsInTriggerAction, String triggerDefinition, boolean referencingOld, boolean referencingNew, String oldReferencingName, String newReferencingName, String whenClauseText) throws StandardException

Create a new trigger descriptor.

Parameters
sd:SchemaDescriptor

the schema descriptor for this trigger

uuid:UUID

the trigger id

name:String

the trigger name

eventMask:int

TriggerDescriptor.TRIGGER_EVENT_XXXX

isBefore:boolean

is this a before (as opposed to after) trigger

isRow:boolean

is this a row trigger or statement trigger

isEnabled:boolean

is this trigger enabled or disabled

td:TableDescriptor

the table upon which this trigger is defined

whenSPSId:UUID

the sps id for the when clause (may be null)

actionSPSId:UUID

the spsid for the trigger action (may be null)

creationTimestamp:Timestamp

when was this trigger created?

referencedCols:int[]

what columns does this trigger reference (may be null)

referencedColsInTriggerAction:int[]

what columns does the trigger action reference through old/new transition variables (may be null)

triggerDefinition:String

The original user text of the trigger action

referencingOld:boolean

whether or not OLD appears in REFERENCING clause

referencingNew:boolean

whether or not NEW appears in REFERENCING clause

oldReferencingName:String

old referencing table name, if any, that appears in REFERCING clause

newReferencingName:String

new referencing table name, if any, that appears in REFERCING clause

whenClauseText:String

the SQL text of the WHEN clause (may be null)

Returns:TriggerDescriptor

a trigger descriptor

Exceptions
StandardException:
on error
newUniqueConstraintDescriptorback to summary
public ReferencedKeyConstraintDescriptor newUniqueConstraintDescriptor(TableDescriptor table, String constraintName, boolean deferrable, boolean initiallyDeferred, int[] referencedColumns, UUID constraintId, UUID indexId, SchemaDescriptor schemaDesc, boolean isEnabled, int referenceCount)
See Also
DataDescriptorGenerator#newUniqueConstraintDescriptor
newUserDescriptorback to summary
public UserDescriptor newUserDescriptor(String userName, String hashingScheme, char[] password, Timestamp lastModified)
newViewDescriptorback to summary
public ViewDescriptor newViewDescriptor(UUID viewID, String viewName, String viewText, int checkOption, UUID compSchemaId)

Create a viewDescriptor for the view with the given UUID.

Parameters
viewID:UUID

the UUID for the view.

viewName:String

the name of the view

viewText:String

the text of the view's query.

checkOption:int

int for check option type

compSchemaId:UUID

the UUID of the schema this was compiled in

Returns:ViewDescriptor

A descriptor for the view