WebObjects 5.2.3

com.webobjects.eoaccess
Interface EOSchemaGeneration

All Known Implementing Classes:
EOSynchronizationFactory

public interface EOSchemaGeneration

This interface has been introduced to define API for generating database schemas from EOModel files. None of the API is new in WebObjects 5.x. Rather, it was moved to EOSchemaGeneration from EOSQLExpression. The API is essentially the same as in WebObjects 4.5.x except that methods that were static methods of EOSQLExpression in WebObjects 4.5.x are now are instance methods on EOSchemaGeneration.

An implementation of the EOSchemaGeneration interface is provided by EOSynchronizationFactory, a new class introduced in WebObjects 5.0.

EOSchemaGeneration defines a number of constants that are intended for use as keys in options dictionaries. A corresponding value of "YES" indicates that the EOSQLExpression should generate SQL to perform the corresponding database operation.

See Also:
EOSQLExpression, EOSynchronizationFactory

Field Summary
static String CreateDatabaseKey
          Options dictionary key whose value determines whether the EOSQLExpression should generate SQL to create a database.
static String CreatePrimaryKeySupportKey
          Options dictionary key whose value determines whether the EOSQLExpression should generate SQL to create primary key support.
static String CreateTablesKey
          Options dictionary key whose value determines whether the EOSQLExpression should generate SQL to create tables.
static String DropDatabaseKey
          Options dictionary key whose value determines whether the EOSQLExpression should generate SQL to drop a database.
static String DropPrimaryKeySupportKey
          Options dictionary key whose value determines whether the EOSQLExpression should generate SQL to drop primary key support.
static String DropTablesKey
          Options dictionary key whose value determines whether the EOSQLExpression should generate SQL to drop tables.
static String ForeignKeyConstraintsKey
          Options dictionary key whose value determines whether the EOSQLExpression should generate SQL to create foreign key constraints.
static String PrimaryKeyConstraintsKey
          Options dictionary key whose value determines whether the EOSQLExpression should generate SQL to create primary key constraints.
 
Method Summary
 void appendExpressionToScript(EOSQLExpression expression, StringBuffer script)
          Appends expression's statement to script along with any necessary delimiter.
 NSArray createDatabaseStatementsForConnectionDictionary(NSDictionary connectionDictionary, NSDictionary administrativeConnectionDictionary)
          Generates and returns an array of EOSQLExpressions containing the SQL statements to create a database or user that can be accessed by the provided connectionDictionary and administrativeConnectionDictionary.
 NSArray createTableStatementsForEntityGroup(NSArray entityGroup)
          Returns an array of EOSQLExpression objects that define the SQL necessary to create a table for entityGroup.
 NSArray createTableStatementsForEntityGroups(NSArray entityGroups)
          Returns an array of EOSQLExpression objects that define the SQL necessary to create the tables for each of the entity groups in entityGroups.
 NSArray dropDatabaseStatementsForConnectionDictionary(NSDictionary connectionDictionary, NSDictionary administrativeConnectionDictionary)
          Generates and returns an array of EOSQLExpressions that define the SQL statements to drop a database or user that is accessed by the provided connectionDictionary and administrativeConnectionDictionary.
 NSArray dropPrimaryKeySupportStatementsForEntityGroup(NSArray entityGroup)
          Returns an array of EOSQLExpression objects that define the SQL necessary to drop the primary key generation support for entityGroup, or null if primary key generation is not supported.
 NSArray dropPrimaryKeySupportStatementsForEntityGroups(NSArray entityGroups)
          Returns an array of EOSQLExpression objects that define the SQL necessary to drop the primary key generation support for all the entities in each of the the entity groups in entityGroups.
 NSArray dropTableStatementsForEntityGroup(NSArray entityGroup)
          Returns an array of EOSQLExpression objects that define the SQL necessary to drop the table identified by entityGroup.
 NSArray dropTableStatementsForEntityGroups(NSArray entityGroups)
          Returns an array of EOSQLExpression objects that define the SQL necessary to drop the tables for all the entity groups in entityGroups.
 NSArray foreignKeyConstraintStatementsForRelationship(EORelationship relationship)
          Returns an array of EOSQLExpression objects that define the SQL statements necessary to create foreign key constraints for relationship.
 NSArray primaryKeyConstraintStatementsForEntityGroup(NSArray entityGroup)
          Returns an array of EOSQLExpression objects that define the SQL necessary to create the primary key constraints for entityGroup.
 NSArray primaryKeyConstraintStatementsForEntityGroups(NSArray entityGroups)
          Returns an array of EOSQLExpression objects that define the SQL necessary to create the primary key constraints for the entities specified in entityGroups.
 NSArray primaryKeySupportStatementsForEntityGroup(NSArray entityGroup)
          Returns an array of EOSQLExpression objects that define the SQL necessary to create the primary key generation support for entityGroup, or null if primary key generation is not supported.
 NSArray primaryKeySupportStatementsForEntityGroups(NSArray entityGroups)
          Returns an array of EOSQLExpression objects that define the SQL necessary to create the primary key generation support for all the entities in each of the the entity groups in entityGroups.
 String schemaCreationScriptForEntities(NSArray allEntities, NSDictionary options)
          Returns a script of SQL statements suitable to create the schema based on options for the EOEntity objects in allEntities.
 NSArray schemaCreationStatementsForEntities(NSArray allEntities, NSDictionary options)
          Returns an array of EOSQLExpressions suitable to create the schema based on options for the EOEntity objects in allEntities.
 

Field Detail

CreateDatabaseKey

public static final String CreateDatabaseKey
Options dictionary key whose value determines whether the EOSQLExpression should generate SQL to create a database.


CreatePrimaryKeySupportKey

public static final String CreatePrimaryKeySupportKey
Options dictionary key whose value determines whether the EOSQLExpression should generate SQL to create primary key support.


CreateTablesKey

public static final String CreateTablesKey
Options dictionary key whose value determines whether the EOSQLExpression should generate SQL to create tables.


DropDatabaseKey

public static final String DropDatabaseKey
Options dictionary key whose value determines whether the EOSQLExpression should generate SQL to drop a database.


DropPrimaryKeySupportKey

public static final String DropPrimaryKeySupportKey
Options dictionary key whose value determines whether the EOSQLExpression should generate SQL to drop primary key support.


DropTablesKey

public static final String DropTablesKey
Options dictionary key whose value determines whether the EOSQLExpression should generate SQL to drop tables.


ForeignKeyConstraintsKey

public static final String ForeignKeyConstraintsKey
Options dictionary key whose value determines whether the EOSQLExpression should generate SQL to create foreign key constraints.


PrimaryKeyConstraintsKey

public static final String PrimaryKeyConstraintsKey
Options dictionary key whose value determines whether the EOSQLExpression should generate SQL to create primary key constraints.

Method Detail

appendExpressionToScript

public void appendExpressionToScript(EOSQLExpression expression,
                                     StringBuffer script)
Appends expression's statement to script along with any necessary delimiter. script is the StringBuffer in which the SQL script is built.

Used in conjunction with schemaCreationStatementsForEntities and schemaCreationScriptForEntities to build up the SQL script to generate the specified schema for a set of EOEntities.

Parameters:
expression - An EOSQLExpression.
script - A StringBuffer used to build the SQL script.
See Also:
createTableStatementsForEntityGroup( NSArray entityGroup), EOSynchronizationFactory.appendExpressionToScript( EOSQLExpression expression, StringBuffer script), EOSQLExpression

createDatabaseStatementsForConnectionDictionary

public NSArray createDatabaseStatementsForConnectionDictionary(NSDictionary connectionDictionary,
                                                               NSDictionary administrativeConnectionDictionary)
Generates and returns an array of EOSQLExpressions containing the SQL statements to create a database or user that can be accessed by the provided connectionDictionary and administrativeConnectionDictionary. Returns null if this feature is not supported.

Parameters:
connectionDictionary - A dictionary of information needed by the adaptor to connect to the database server.
administrativeConnectionDictionary - A dictionary of administrative login information for the database server.
Returns:
An array of the EOSQLExpressions needed to create a database for the given parameters.
See Also:
dropDatabaseStatementsForConnectionDictionary( NSDictionary connectionDictionary, NSDictionary administrativeConnectionDictionary)

createTableStatementsForEntityGroup

public NSArray createTableStatementsForEntityGroup(NSArray entityGroup)
Returns an array of EOSQLExpression objects that define the SQL necessary to create a table for entityGroup. Returns an empty array if entityGroup is null or empty.

Parameters:
entityGroup - An array of EOEntity objects that have the same external name.
Returns:
An array of EOSQLExpressions that define the SQL necessary to create tables for the entities in entityGroup, or an empty array.
See Also:
createTableStatementsForEntityGroups( NSArray entityGroup), dropTableStatementsForEntityGroup( NSArray entityGroup), EOEntity.externalName(), EOSynchronizationFactory.createTableStatementsForEntityGroup( NSArray entityGroup)

createTableStatementsForEntityGroups

public NSArray createTableStatementsForEntityGroups(NSArray entityGroups)
Returns an array of EOSQLExpression objects that define the SQL necessary to create the tables for each of the entity groups in entityGroups. Returns an empty array if entityGroups is null or empty.

Parameters:
entityGroups - An array of entity groups, which are arrays of EOEntity objects that have the same external name.
Returns:
An array of EOSQLExpressions that define the SQL necessary to create tables for the entity groups in entityGroups, or an empty array.
See Also:
createTableStatementsForEntityGroup( NSArray entityGroup), schemaCreationStatementsForEntities( NSArray allEntities, NSDictionary options), EOEntity.externalName(), EOSynchronizationFactory.createTableStatementsForEntityGroups( NSArray entityGroups)

dropDatabaseStatementsForConnectionDictionary

public NSArray dropDatabaseStatementsForConnectionDictionary(NSDictionary connectionDictionary,
                                                             NSDictionary administrativeConnectionDictionary)
Generates and returns an array of EOSQLExpressions that define the SQL statements to drop a database or user that is accessed by the provided connectionDictionary and administrativeConnectionDictionary. Returns null if this feature is not supported.

Parameters:
connectionDictionary - A dictionary of information needed by the adaptor to connect to the database server.
administrativeConnectionDictionary - A dictionary of administrative login information for the database server.
Returns:
An array of the EOSQLExpressions needed to drop a database for the given parameters.
See Also:
createDatabaseStatementsForConnectionDictionary( NSDictionary connectionDictionary, NSDictionary administrativeConnectionDictionary)

dropPrimaryKeySupportStatementsForEntityGroup

public NSArray dropPrimaryKeySupportStatementsForEntityGroup(NSArray entityGroup)
Returns an array of EOSQLExpression objects that define the SQL necessary to drop the primary key generation support for entityGroup, or null if primary key generation is not supported.

Parameters:
entityGroup - An array of EOEntity objects that have the same external name.
Returns:
An array of EOSQLExpressions that define the SQL necessary to drop primary key generation support for entityGroup, or null.
See Also:
primaryKeySupportStatementsForEntityGroup( NSArray entityGroup), EOEntity.externalName(), EOSynchronizationFactory.dropPrimaryKeySupportStatementsForEntityGroup( NSArray entityGroup)

dropPrimaryKeySupportStatementsForEntityGroups

public NSArray dropPrimaryKeySupportStatementsForEntityGroups(NSArray entityGroups)
Returns an array of EOSQLExpression objects that define the SQL necessary to drop the primary key generation support for all the entities in each of the the entity groups in entityGroups. Returns an empty array if entityGroups is null or empty. Returns an array containing an error message if primary key generation support is not available.

Parameters:
entityGroups - An array of entity groups, which are arrays of EOEntity objects that have the same external name.
Returns:
An array of EOSQLExpressions that define the SQL necessary to drop primary key generation support for entityGroups, or an empty array, or an array containing an error string.
See Also:
dropPrimaryKeySupportStatementsForEntityGroup( NSArray entityGroup), schemaCreationStatementsForEntities( NSArray allEntities, NSDictionary options), EOAdaptorChannel.primaryKeyForNewRowWithEntity( EOEntity entity), EOEntity.externalName(), EOSynchronizationFactory.dropPrimaryKeySupportStatementsForEntityGroups( NSArray entityGroups)

dropTableStatementsForEntityGroup

public NSArray dropTableStatementsForEntityGroup(NSArray entityGroup)
Returns an array of EOSQLExpression objects that define the SQL necessary to drop the table identified by entityGroup. Returns an empty array if entityGroup is null. The drop statement generated by this method should be sufficient to remove the table created by createTableStatementsForEntityGroup's statements.

Parameters:
entityGroup - An array of EOEntity objects that have the same external name.
Returns:
An array of EOSQLExpressions that define the SQL necessary to drop tables for the entities in entityGroup, or an empty array.
See Also:
createTableStatementsForEntityGroup(NSArray entityGroup), dropTableStatementsForEntityGroups(NSArray entityGroups), EOEntity.externalName(), EOSynchronizationFactory.dropTableStatementsForEntityGroup( NSArray entityGroup)

dropTableStatementsForEntityGroups

public NSArray dropTableStatementsForEntityGroups(NSArray entityGroups)
Returns an array of EOSQLExpression objects that define the SQL necessary to drop the tables for all the entity groups in entityGroups. Returns an empty array if entityGroups is null or empty.

Parameters:
entityGroups - An array of entity groups, which are arrays of EOEntity objects that have the same external name.
Returns:
An array of EOSQLExpressions that define the SQL necessary to drop tables for the entity groups in entityGroups, or an empty array.
See Also:
dropTableStatementsForEntityGroup( NSArray entityGroup), schemaCreationStatementsForEntities( NSArray allEntities, NSDictionary options), EOEntity.externalName(), EOSynchronizationFactory.dropTableStatementsForEntityGroups( NSArray entityGroups)

foreignKeyConstraintStatementsForRelationship

public NSArray foreignKeyConstraintStatementsForRelationship(EORelationship relationship)
Returns an array of EOSQLExpression objects that define the SQL statements necessary to create foreign key constraints for relationship. Returns an empty array if unable to generate foreign key constraints for relationship

Parameters:
relationship - An EORelationship.
Returns:
An array of EOSQLExpressions to create the foreign key constraints for relationship, or an empty array.
See Also:
EOSQLExpression, EOSynchronizationFactory.foreignKeyConstraintStatementsForRelationship(EORelationship relationship), schemaCreationStatementsForEntities( NSArray allEntities, NSDictionary options)

primaryKeyConstraintStatementsForEntityGroup

public NSArray primaryKeyConstraintStatementsForEntityGroup(NSArray entityGroup)
Returns an array of EOSQLExpression objects that define the SQL necessary to create the primary key constraints for entityGroup. Returns an empty array if any of the primary key attributes in entityGroup don't have a column name or if entityGroup is null.

Parameters:
entityGroup - An array of EOEntity objects that have the same external name.
Returns:
An array of EOSQLExpressions that define the SQL necessary to create primary key constraints for entityGroup, or an empty array.
See Also:
EOAttribute.columnName(), EOEntity.externalName(), EOEntity.primaryKeyAttributes(), EOSynchronizationFactory.primaryKeyConstraintStatementsForEntityGroup( NSArray entityGroup)

primaryKeyConstraintStatementsForEntityGroups

public NSArray primaryKeyConstraintStatementsForEntityGroups(NSArray entityGroups)
Returns an array of EOSQLExpression objects that define the SQL necessary to create the primary key constraints for the entities specified in entityGroups. Returns an empty array if entityGroups is null or empty.

Parameters:
entityGroups - An array of entity groups, which are arrays of EOEntity objects that have the same external name.
Returns:
An array of EOSQLExpressions that define the SQL necessary to create primary key constraints for entityGroups, or an empty array.
See Also:
primaryKeyConstraintStatementsForEntityGroup( NSArray entityGroup), EOEntity.externalName(), EOSynchronizationFactory.primaryKeyConstraintStatementsForEntityGroups( NSArray entityGroups)

primaryKeySupportStatementsForEntityGroup

public NSArray primaryKeySupportStatementsForEntityGroup(NSArray entityGroup)
Returns an array of EOSQLExpression objects that define the SQL necessary to create the primary key generation support for entityGroup, or null if primary key generation is not supported.

Parameters:
entityGroup - An array of EOEntity objects that have the same external name.
Returns:
An array of EOSQLExpressions that define the SQL necessary to create primary key generation support for entityGroup, or null>.
See Also:
dropPrimaryKeySupportStatementsForEntityGroup( NSArray entityGroup), EOAdaptorChannel.primaryKeyForNewRowWithEntity( EOEntity entity), EOEntity.externalName(), EOSynchronizationFactory.primaryKeySupportStatementsForEntityGroup( NSArray entityGroup)

primaryKeySupportStatementsForEntityGroups

public NSArray primaryKeySupportStatementsForEntityGroups(NSArray entityGroups)
Returns an array of EOSQLExpression objects that define the SQL necessary to create the primary key generation support for all the entities in each of the the entity groups in entityGroups. Returns an empty array if entityGroups is null or empty. Returns an array containing an error message if primary key generation support is not available.

Parameters:
entityGroups - An array of entity groups, which are arrays of EOEntity objects that have the same external name.
Returns:
An array of EOSQLExpressions that define the SQL necessary to create primary key generation support for entityGroups, or an empty array, or an array containing an error string.
See Also:
primaryKeySupportStatementsForEntityGroup( NSArray entityGroup), EOAdaptorChannel.primaryKeyForNewRowWithEntity( EOEntity entity), EOEntity.externalName(), EOSynchronizationFactory.primaryKeySupportStatementsForEntityGroups( NSArray entityGroups)

schemaCreationScriptForEntities

public String schemaCreationScriptForEntities(NSArray allEntities,
                                              NSDictionary options)
Returns a script of SQL statements suitable to create the schema based on options for the EOEntity objects in allEntities. Returns an empty string if either options or allEntities is empty or null.

options is a dictionary whose keys describe possible aspects of a schema and whose respective values of "YES" or "NO" determine whether that schema option is enabled for a particular invocation. The possible option keys are:


Used in conjunction with appendExpressionToScript and schemaCreationStatementsForEntities to build up the SQL script to generate the specified schema for allEntities.

Parameters:
allEntities - An array of EOEntity objects.
options - A dictionary describing the schema options for which to generate SQL statements.
Returns:
A string comprising the SQL statements necessary to create a schema for allEntities with the given options.
See Also:
appendExpressionToScript( EOSQLExpression anSQLExpression, StringBuffer script), schemaCreationStatementsForEntities( NSArray allEntities, NSDictionary options), EOSynchronizationFactory.schemaCreationScriptForEntities( NSArray allEntities, NSDictionary options)

schemaCreationStatementsForEntities

public NSArray schemaCreationStatementsForEntities(NSArray allEntities,
                                                   NSDictionary options)
Returns an array of EOSQLExpressions suitable to create the schema based on options for the EOEntity objects in allEntities. Returns an empty array if either allEntities or options is null or empty.

options is a dictionary whose keys possible aspects of a schema and whose respective values of "YES" or "NO" determine whether that schema option is enabled for a particular invocation. The possible option keys are:



Used in conjunction with appendExpressionToScript and schemaCreationScriptForEntities to build up the SQL script to generate the specified schema for allEntities.

Parameters:
allEntities - An array of EOEntity objects.
options - A dictionary describing the schema options for which to generate SQL statements.
Returns:
An array of EOSQLExpressions that define the SQL statements necessary to create a schema for allEntities with the given options.
See Also:
schemaCreationScriptForEntities( NSArray allEntities, NSDictionary options), appendExpressionToScript( EOSQLExpression expression, StringBuffer script), EOSynchronizationFactory.schemaCreationStatementsForEntities(NSArray allEntities, NSDictionary options)

Last updated Thu Oct 21 15:04:16 PDT 2004.

Copyright © 2004 Apple Computer, Inc.