| 
WebObjects 5.2.2 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--com.webobjects.eoaccess.EOModel
An EOModel represents a mapping between a database schema and a set of classes based on the entity-relationship model for an application. The model contains a number of EOEntity objects representing the tables (entities) of the database schema. Each EOEntity object has a number of EOAttribute and EORelationship objects representing the properties (columns or fields) of the table (entity) in the database schema.
An EOModel maintains a mapping between each of its EOEntity objects 
 and a corresponding Enterprise Object class for use with the database 
 level of the Enterprise Objects Framework. You can determine the EOEntity
 for a particular Enterprise Object with the entityForObject  
 method. 
An EOModel is specific to a particular database server, and can store information needed to connect to that server as well as the name of an adaptor framework to load so that the Enterprise Objects Framework can communicate with the database.
Models can be organized into model groups and may have relationships that reference other models in the same model group. The other models may map to different databases and types of servers.
EOModel files are usually built using the EOModeler application, but it is possible to build an EOModel file programmatically if needed. The EOAdaptorChannel class declares methods for reading basic schema information from a relational database. You can use this information to build up an EOModel programmatically, and then enhance that model by defining extra relationships, flattening attributes, and so on.
EOModel files are typically stored in a project or a framework.
 To load an EOModel, provide a model file's path to the constructor. Note
 that loading an EOModel doesn't have the effect of loading all of its
 entities. EOModel files can be quite large, so to reduce start-up time,
 entity definitions are only loaded as needed. This incremental model
 loading is possible because an EOModel actually consists of one index file
 and two files for each entity. Models have an .eomodeld file 
 wrapper ( which is actually a directory), and the individual entity files
 within the model are in ASCII format. The index file has the name 
 index.eomodeld, and it contains the connection dictionary, 
 the adaptor name, and a list of all of the entities in the model. This is
 the file that is loaded when you create a new model from a path. 
 The two entity files consist of a property list (.plist)
 file that describes the entity and a fetch specification 
 (.fspec) file that describes any named fetch specifications 
 for that entity. 
index.eomodeld file, which is used to access the model's 
 entities. 
When an entity is loaded, EOModel posts an 
 EntityLoadedNotification.
entityForObject(EOEnterpriseObject object)| Field Summary | |
static String | 
EntityLoadedNotification
The notification posted after an EOEntity is loaded into memory.  | 
| Constructor Summary | |
  | 
EOModel()
Creates and returns a new EOModel.  | 
protected  | 
EOModel(NSDictionary propertyList,
        String path)
 | 
protected  | 
EOModel(NSDictionary propertyList,
        URL url)
 | 
  | 
EOModel(String path)
Deprecated. use EOModel(URL url) instead.  | 
  | 
EOModel(URL url)
 | 
| Method Summary | |
 String | 
adaptorName()
Returns the name of the adaptor for the receiver.  | 
 void | 
addEntity(EOEntity entity)
Adds entity to the receiver. | 
 void | 
addStoredProcedure(EOStoredProcedure storedProcedure)
Adds storedProcedure to the receiver. | 
 NSArray | 
availablePrototypeAttributeNames()
Returns a list of names of all available prototypes.  | 
 void | 
beautifyNames()
Makes all of the receiver's named components conform to a standard convention.  | 
 NSDictionary | 
connectionDictionary()
Returns a dictionary containing information used to connect to the database server.  | 
 void | 
dispose()
Conformance to NSDisposable.  | 
 void | 
encodeTableOfContentsIntoPropertyList(NSMutableDictionary result)
Encodes the receiver into result. | 
 NSArray | 
entities()
Returns an array containing the receiver's entities.  | 
 NSArray | 
entitiesWithSharedObjects()
Returns an array of entities that have objects to load into a shared editing context.  | 
 EOEntity | 
entityForObject(EOEnterpriseObject object)
Returns the entity associated with object,
 whether object is an instance of an Enterprise Object
 class, an instance of EOGenericRecord, or  a fault. | 
 EOEntity | 
entityNamed(String name)
Returns the entity named name, or null 
 if no such entity exists in this model. | 
 NSArray | 
entityNames()
Returns an array containing the names of the receiver's entities.  | 
 NSArray | 
externalModelsReferenced()
Returns an array containing those models that are referenced by the receiver.  | 
 void | 
loadAllModelObjects()
Loads any of the receiver's entities, stored procedures, attributes, and relationships that have not yet been loaded.  | 
 EOModelGroup | 
modelGroup()
Returns the model group to which the receiver belongs.  | 
 String | 
name()
Returns the receiver's name.  | 
 String | 
path()
Deprecated. use pathURL instead.  | 
 URL | 
pathURL()
Returns the URL to the EOModel file used to create the receiver, or null if the model wasn't initialized from an URL. | 
 EOAttribute | 
prototypeAttributeNamed(String name)
Returns the prototype attribute identified by name. | 
 NSArray | 
referencesToProperty(Object property)
Returns an array of all properties in the receiver that reference property, whether derived attributes, relationships that 
 reference property, and so on. | 
 void | 
removeEntity(EOEntity entity)
Removes entity from the receiver without performing any
 referential integrity checking. | 
 void | 
removeEntityAndReferences(EOEntity entity)
Removes entity from the receiver along with any 
 attributes or relationships in other entities that reference 
 entity. | 
 void | 
removeStoredProcedure(EOStoredProcedure storedProcedure)
Removes storedProcedure from the receiver without 
 checking whether any entity  uses it. | 
 void | 
setAdaptorName(String adaptorName)
Sets the name of the receiver's adaptor to adaptorName. | 
 void | 
setConnectionDictionary(NSDictionary connectionDictionary)
Sets the dictionary containing information used to connect to the database to connectionDictionary. | 
 void | 
setModelGroup(EOModelGroup group)
Sets the model group to which the receiver should belong.  | 
 void | 
setName(String newName)
Sets the name of the receiver to newNname. | 
 void | 
setUserInfo(NSDictionary dictionary)
Sets the receiver's userInfo dictionary to dictionary. | 
 EOStoredProcedure | 
storedProcedureNamed(String name)
Returns the stored procedure named name, or 
 null if the receiver doesn't contain a stored procedure 
 with the given name. | 
 NSArray | 
storedProcedureNames()
Returns an array containing the names of all of the receiver's stored procedures sorted in alphabetical order.  | 
 NSArray | 
storedProcedures()
Returns an array containing all of the receiver's stored procedures or an empty array if the receiver has no stored procedures.  | 
 String | 
toString()
Returns a string representation of the receiver.  | 
 NSDictionary | 
userInfo()
Returns a dictionary of user data.  | 
 void | 
writeToFile(String path)
Writes out the model archive representation of the receiver in the location specified by path. | 
| Methods inherited from class java.lang.Object | 
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait | 
| Field Detail | 
public static final String EntityLoadedNotification
| Constructor Detail | 
public EOModel()
public EOModel(String path)
path. Sets the EOModel's
 name and path from the context of the model archive. Throws an 
 IllegalArgumentException if path is null or 
 if unable to read the file at path. Throws a runtime 
 exception if unable for any other reason to initialize the model from 
 the specified file path; the error text indicates the nature of the 
 exception.
path - The path to a model archive.
IllegalArgumentException - if path is 
             null or if unable to read the file.EOModel(URL url), 
name(), 
path(), 
(NSMutableDictionary propertyList)public EOModel(URL url)
protected EOModel(NSDictionary propertyList,
                  String path)
protected EOModel(NSDictionary propertyList,
                  URL url)
| Method Detail | 
public String adaptorName()
adaptorWithName
 to construct an adaptor.
EOAdaptor.adaptorWithName(String name)public void addEntity(EOEntity entity)
entity to the receiver. Throws an exception if:
 entity is null.entity's EOModel is not the receiver.entity.
entity - An EOEntity object to add to the receiver.
IllegalArgumentException - if entity is
               null, has a different EOModel, or has
               the same name as another entity registered with the
               receiver.entities(), 
removeEntity(EOEntity name), 
removeEntityAndReferences(EOEntity entity)public void addStoredProcedure(EOStoredProcedure storedProcedure)
storedProcedure to the receiver. Throws an 
 exception if:storedProcedure is null.storedProcedure's EOModel is not the
           receiver.storedProcedure does not have a valid name.storedProcedure.
storedProcedure - An EOStoredProcedure object to add to the
                        receiver.
IllegalArgumentException - if 
                        storedProcedure is 
                        null, has a different EOModel, 
                        has an invalid name, or has the same name as 
                        another stored procedure registered with the
                        receiver.removeStoredProcedure(EOStoredProcedure
                         storedProcedure), 
storedProcedures(), 
storedProcedureNamed(String name)public NSArray availablePrototypeAttributeNames()
prototypeAttributeNamed(String attributeName)public void beautifyNames()
EOEntity.nameForExternalName(String name, String separatorString
      , boolean initialCaps), 
name(), 
EOEntity.beautifyName(), 
EOAttribute.beautifyName(), 
EORelationship.beautifyName(), 
EOStoredProcedure.beautifyName()public NSDictionary connectionDictionary()
EOAdaptorpublic void dispose()
dispose in interface NSDisposablepublic void encodeTableOfContentsIntoPropertyList(NSMutableDictionary result)
result. This method is used to
 create an ASCII representation of an EOModel in property list format.
result - The dictionary into which to encode the receiver.EOModel(), 
EOModel(String path), 
EOModel(NSDictionary tableOfContents, String path)public NSArray entities()
entityNames()public NSArray entitiesWithSharedObjects()
EOEditingContextpublic EOEntity entityForObject(EOEnterpriseObject object)
object,
 whether object is an instance of an Enterprise Object
 class, an instance of EOGenericRecord, or  a fault. Returns 
 null if object has no associated entity.
object - An object.
object,
               or null.public EOEntity entityNamed(String name)
name, or null 
 if no such entity exists in this model. Posts an 
 EntityLoadedNotification when the entity is loaded.
 Throws a runtime exception if an error occurs during loading; the 
 error text indicates the nature of the exception.
name - The name of an entity.
name, or 
             null.EntityLoadedNotification, 
entityNames(), 
entities()public NSArray entityNames()
entities(), 
entityNamed(String name)public NSArray externalModelsReferenced()
referencesToProperty(Object aProperty)public void loadAllModelObjects()
entities(), 
storedProcedures(), 
EOEntity.attributes(), 
EOEntity.relationships()public EOModelGroup modelGroup()
setModelGroup(EOModelGroup group), 
EOModelGrouppublic String name()
path(), 
EOModel(String path), 
EOModel(NSDictionary tableOfContents, String path)public String path()
null.pathURL()public URL pathURL()
null if the model wasn't initialized from an URL.
null.name(), 
EOModel(String path), 
EOModel(NSDictionary tableOfContents, String path)public EOAttribute prototypeAttributeNamed(String name)
name.
 Looks first in the receiver, then in the model group to which the  
 receiver belongs, and finally in the adaptor associated with the 
 receiver.
name - An attribute name.
name.availablePrototypeAttributeNames()public NSArray referencesToProperty(Object property)
property, whether derived attributes, relationships that 
 reference property, and so on. Returns null 
 if property isn't referenced by any of the properties in 
 the model.
property - The name of a property.
property.externalModelsReferenced()public void removeEntity(EOEntity entity)
entity from the receiver without performing any
 referential integrity checking.
entity - An EOEntity object to remove from the receiver.addEntity(EOEntity anEntity), 
removeEntityAndReferences(EOEntity entity)public void removeEntityAndReferences(EOEntity entity)
entity from the receiver along with any 
 attributes or relationships in other entities that reference 
 entity.
entity - An EOEntity object to remove from the receiver.addEntity(EOEntity anEntity), 
removeEntity(EOEntity entity)public void removeStoredProcedure(EOStoredProcedure storedProcedure)
storedProcedure from the receiver without 
 checking whether any entity  uses it.
storedProcedure - The stored procedure to remove from the 
                        receiver.addStoredProcedure(EOStoredProcedure storedProcedure), 
storedProcedures()public void setAdaptorName(String adaptorName)
adaptorName.
adaptorName - The name of the receiver's adaptor.public void setConnectionDictionary(NSDictionary connectionDictionary)
connectionDictionary.
connectionDictionary - The information used to connect to the 
                             database.EOAdaptor, 
EOAdaptor.adaptorWithModel(EOModel model)public void setModelGroup(EOModelGroup group)
group - The model group to which the receiver should belong.modelGroup()public void setName(String newName)
newNname.
newName - A new name for the receiver.public void setUserInfo(NSDictionary dictionary)
dictionary. 
 User information is arbitrary auxiliary data which the application can
 use for whatever it needs. dictionary can only contain 
 property list data types, which are String, NSDictionary, NSArray, and
 NSData.
dictionary - A dictionary of auxiliary data for the application
                   to use as it needs.public EOStoredProcedure storedProcedureNamed(String name)
name, or 
 null if the receiver doesn't contain a stored procedure 
 with the given name.  Throws a runtime exception if an error
 occurs during processing; the error text indicates the nature of 
 the exception.  Throws an IllegalArgumentException if the model's
 index file (table of contents) contains name but
 the associated stored procedure is not found in the model's
 .eomodeld directory.
name - The name of a stored procedure.
name,
             or null.
IllegalArgumentException - if the model file is corrupted.storedProcedureNames(), 
storedProcedures(), 
EOStoredProcedurepublic NSArray storedProcedureNames()
storedProcedures(), 
storedProcedureNamed(String name), 
EOStoredProcedurepublic NSArray storedProcedures()
storedProcedureNames(), 
storedProcedureNamed(String name), 
EOStoredProcedurepublic String toString()
toString in class Objectpublic NSDictionary userInfo()
setUserInfo(NSDictionary dictionary)public void writeToFile(String path)
path. If the directory
 specified by path already exists, a backup copy is first
 created from the existing archive with a tilde (~) character appended
 to the archive name to distinguish it. As a side-effect,
 this method resets the current path for the receiver to 
 path.
 Throws a runtime exception if unable to write the archive; the error text indicates the nature of the exception.
path - The filesystem location at which to write the model
             archive.path()
  | 
Last updated Mon Oct 13 15:42:52 PDT 2003. | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||