Class DataDescriptorGenerator

java.lang.Object
org.apache.derby.iapi.sql.dictionary.DataDescriptorGenerator

public class DataDescriptorGenerator extends Object
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 Details

  • Constructor Details

    • DataDescriptorGenerator

      public DataDescriptorGenerator(DataDictionary dataDictionary)
      Make a generator. Specify the data dictionary that it operates on.
      Parameters:
      dataDictionary - the data dictionary that this generator makes objects for
  • Method Details

    • newSchemaDescriptor

      public SchemaDescriptor newSchemaDescriptor(String schemaName, String aid, UUID oid) throws StandardException
      Create a descriptor for the named schema with a null UUID.
      Parameters:
      schemaName - The name of the schema we're interested in. If the name is NULL, get the descriptor for the current schema.
      aid - The authorization ID associated with the schema. The owner of the schema.
      oid - The object ID
      Returns:
      The descriptor for the schema.
      Throws:
      StandardException - Thrown on failure
    • newTableDescriptor

      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 - The name of the table to get the descriptor for
      schema - The descriptor for the schema the table lives in. If null, use the current (default) schema.
      tableType - The type of the table: base table or view.
      lockGranularity - The lock granularity.
      Returns:
      The descriptor for the table.
    • newTableDescriptor

      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 - The name of the temporary table to get the descriptor for
      schema - The descriptor for the schema the table lives in.
      tableType - The type of the table: temporary table
      onCommitDeleteRows - If true, on commit delete rows else on commit preserve rows of temporary table.
      onRollbackDeleteRows - If true, on rollback, delete rows from temp tables which were logically modified. true is the only supported value
      Returns:
      The descriptor for the table.
    • newViewDescriptor

      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 - the UUID for the view.
      viewName - the name of the view
      viewText - the text of the view's query.
      checkOption - int for check option type
      compSchemaId - the UUID of the schema this was compiled in
      Returns:
      A descriptor for the view
    • newUniqueConstraintDescriptor

      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:
    • newPrimaryKeyConstraintDescriptor

      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:
    • newForeignKeyConstraintDescriptor

      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:
    • newForeignKeyConstraintDescriptor

      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:
    • newCheckConstraintDescriptor

      public CheckConstraintDescriptor newCheckConstraintDescriptor(TableDescriptor table, String constraintName, boolean deferrable, boolean initiallyDeferred, UUID constraintId, String constraintText, ReferencedColumns referencedColumns, SchemaDescriptor schemaDesc, boolean isEnabled)
      See Also:
    • newCheckConstraintDescriptor

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

      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 - The identifier for the conglomerate we're interested in
      name - The name of the conglomerate, if any
      indexable - TRUE means the conglomerate is indexable, FALSE means it isn't
      indexRowGenerator - The IndexRowGenerator for the conglomerate, null if it's a heap
      isConstraint - TRUE means the conglomerate is an index backing up a constraint, FALSE means it isn't
      uuid - UUID for this conglomerate
      tableID - UUID for the table that this conglomerate belongs to
      schemaID - UUID for the schema that conglomerate belongs to
      Returns:
      A ConglomerateDescriptor describing the conglomerate.
    • newTriggerDescriptor

      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 - the schema descriptor for this trigger
      uuid - the trigger id
      name - the trigger name
      eventMask - TriggerDescriptor.TRIGGER_EVENT_XXXX
      isBefore - is this a before (as opposed to after) trigger
      isRow - is this a row trigger or statement trigger
      isEnabled - is this trigger enabled or disabled
      td - the table upon which this trigger is defined
      whenSPSId - the sps id for the when clause (may be null)
      actionSPSId - the spsid for the trigger action (may be null)
      creationTimestamp - when was this trigger created?
      referencedCols - what columns does this trigger reference (may be null)
      referencedColsInTriggerAction - what columns does the trigger action reference through old/new transition variables (may be null)
      triggerDefinition - The original user text of the trigger action
      referencingOld - whether or not OLD appears in REFERENCING clause
      referencingNew - whether or not NEW appears in REFERENCING clause
      oldReferencingName - old referencing table name, if any, that appears in REFERCING clause
      newReferencingName - new referencing table name, if any, that appears in REFERCING clause
      whenClauseText - the SQL text of the WHEN clause (may be null)
      Returns:
      a trigger descriptor
      Throws:
      StandardException - on error
    • getUUIDFactory

      protected UUIDFactory getUUIDFactory()
    • newFileInfoDescriptor

      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:
      the newly created file info descriptor
    • newUserDescriptor

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

      public TablePermsDescriptor newTablePermsDescriptor(TableDescriptor td, String selectPerm, String deletePerm, String insertPerm, String updatePerm, String referencesPerm, String triggerPerm, String grantor) throws StandardException
      Throws:
      StandardException
    • newColPermsDescriptor

      public ColPermsDescriptor newColPermsDescriptor(TableDescriptor td, String type, FormatableBitSet columns, String grantor) throws StandardException
      Manufacture a new ColPermsDescriptor.
      Parameters:
      td - The descriptor of the table.
      type - 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 - the set of columns
      Throws:
      StandardException
    • newRoutinePermsDescriptor

      public RoutinePermsDescriptor newRoutinePermsDescriptor(AliasDescriptor ad, String grantor) throws StandardException
      Create a new routine permissions descriptor
      Parameters:
      ad - The routine's alias descriptor
      grantor -
      Throws:
      StandardException
    • newRoleGrantDescriptor

      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 - unique identifier for this role grant descriptor in time and space
      roleName - the name of the role for which a new descriptor is created
      grantee - authorization identifier of grantee
      grantor - authorization identifier of grantor
      withadminoption - if true, WITH ADMIN OPTION is set for this descriptor
      isDef - if true, this descriptor represents a role definition, otherwise it represents a grant.
      Throws:
      StandardException
    • newSequenceDescriptor

      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
      Parameters:
      uuid -
      sequenceName -
      Returns:
      SequenceDescriptor
    • newPermDescriptor

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

      static ModuleFactory getMonitor()
      Privileged Monitor lookup. Must be package private so that user code can't call this entry point.