WebObjects 5.2

com.webobjects.eocontrol
Class EODataSource

java.lang.Object
  |
  +--com.webobjects.eocontrol.EODataSource
Direct Known Subclasses:
EOArrayDataSource, EODatabaseDataSource, EODetailDataSource, EODistributedDataSource

public abstract class EODataSource
extends Object

EODataSource is an abstract class that defines a basic API for providing enterprise objects. It exists primarily as a simple means for a display group (EODisplayGroup from EOInterface or WODisplayGroup from WebObjects) or other higher level class to access a store of objects. EODataSource defines functional implementations of concrete subclasses, such as EODatabaseDataSource (defined in com.webobjects.eoaccess) and EODetailDataSource, which define working data sources by implementing the others. EODatabaseDataSource, for example, provides objects fetched through an EOEditingContext, while EODetailDataSource provides objects from a relationship property of a master object.

An EODataSource provides its objects with its fetchObjects method. insertObject and deleteObject add and remove individual objects, while createObject instantiates new objects. Other methods provide information about the objects.

See EODataSourceConcepts for more information.

See Also:
fetchObjects(), insertObject(Object eo), deleteObject(Object eo), createObject()

Constructor Summary
EODataSource()
           
 
Method Summary
 EOClassDescription classDescriptionForObjects()
          Implemented by subclasses to return an EOClassDescription that provides information about the objects provided by the receiver.
 Object createObject()
          Creates a new object, inserts it in the receiver's collection of objects if appropriate, and returns the object.
abstract  EODataSource dataSourceQualifiedByKey(String key)
          Implemented by subclasses to provide the destination objects of a relationship.
abstract  void deleteObject(Object eo)
          Implemented by subclasses to delete an object.
 EOEditingContext editingContext()
          Implemented by subclasses to return the receiver's EOEditingContext.
 NSArray fetchObjects()
          Implemented by subclasses to fetch and return the objects provided by the receiver.
abstract  void insertObject(Object eo)
          Implemented by subclasses to insert objects.
abstract  void qualifyWithRelationshipKey(String key, Object sourceObject)
          Implemented by subclasses to qualify the receiver, a detailed EODataSource, to display destination objects for a relationship.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EODataSource

public EODataSource()
Method Detail

classDescriptionForObjects

public EOClassDescription classDescriptionForObjects()
Implemented by subclasses to return an EOClassDescription that provides information about the objects provided by the receiver.
Returns:
subclasses return an EOClassDescription EODataSource returns null

createObject

public Object createObject()
Creates a new object, inserts it in the receiver's collection of objects if appropriate, and returns the object. Returns null if the receiver can't create the object or can't insert it. You should invoke insertObject after this method to actually add the new object to the receiver.

As a convenience, EODataSource's implementation sends the receiver's EOClassDescription a createInstanceWithEditingContext message to create the object. If this succeeds and the receiver has an EOEditingContext, it sends the EOEditingContext an insertObject message to register the new object with the EOEditingContext (note that this does not insert the object into the EODataSource). Subclasses that don't use EOClassDescriptions or EOEditingContexts should override this method without invoking the superclass's implementation.

Returns:
null if the receiver can't create the object or can't insert it, otherwise returns the object
See Also:
insertObject(Object object), EOClassDescription.createInstanceWithEditingContext( EOEditingContext editingContext, EOGlobalID globalID), classDescriptionForObjects(), editingContext()

dataSourceQualifiedByKey

public abstract EODataSource dataSourceQualifiedByKey(String key)
Implemented by subclasses to provide the destination objects of a relationship. The detail EODataSource can be qualified using qualifyWithRelationshipKey to set a specific master object or to change the relationship key.
Parameters:
key - the relationship key
Returns:
a detail EODataSource
Throws:
exception - on EODataSource's implementation.
See Also:
qualifyWithRelationshipKey( String key, Object sourceObject)

deleteObject

public abstract void deleteObject(Object eo)
Implemented by subclasses to delete an object. EODataSource's implementation merely throws an exception. Subclasses shouldn't invoke the superclass's implementation.
Parameters:
eo - the object to be deleted
Throws:
exception - on EODataSource's implementation

editingContext

public EOEditingContext editingContext()
Implemented by subclasses to return the receiver's EOEditingContext.
Returns:
receiver's EOEditingContext when implemented by subclasses, null when implemented by EODataSource

fetchObjects

public NSArray fetchObjects()
Implemented by subclasses to fetch and return the objects provided by the receiver.
Returns:
objects provided when implemented by subclasses, null when implemented by EODataSource

insertObject

public abstract void insertObject(Object eo)
Implemented by subclasses to insert objects.
Parameters:
eo - the object to be inserted
Throws:
exception - on EODataSource's implementation

qualifyWithRelationshipKey

public abstract void qualifyWithRelationshipKey(String key,
                                                Object sourceObject)
Implemented by subclasses to qualify the receiver, a detailed EODataSource, to display destination objects for a relationship. The key should be the same as the key specified in the dataSourceQualifiedByKey message that created the receiver. If source object is null, the receiver qualifies itself to provide no objects.
Parameters:
key - names the relationship the objects is to be displayed with
sourceObject - destination objects belongs to this
Throws:
exception - on EODataSource's implementation.
See Also:
dataSourceQualifiedByKey(String key)

Last updated Fri Feb 21 13:15:00 PST 2003.

Copyright © 2003 Apple Computer, Inc.