Inherits From:
Object (Java Client)
NSObject (Yellow Box)
Package:
com.apple.client.eocontrol (Java Client)
com.apple.yellow.eocontrol (WebObjects and Yellow Box)
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 very few methods; concrete subclasses, such as EODatabaseDataSource (defined in EOAccess) and EODetailDataSource, 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. For information on creating your own EODataSource subclass, see the section "Creating a Subclass."
An EODataSource provides its objects with its fetchObjects method. insertObject and deleteObject add and remove individual objects, and createObject instantiates a new object. Other methods provide information about the objects, as described below.
classDescriptionForObjects
public EOClassDescription classDescriptionForObjects ()
Implemented by subclasses to return an EOClassDescription that provides information about the objects provided by the receiver. EODataSource's implementation returns null .
createObject
public java.lang.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 super 's implementation.
See also: - classDescriptionForObjects , - editingContext
dataSourceQualifiedByKey
public abstract EODataSource dataSourceQualifiedByKey (java.lang.String relationshipKey)
Implemented by subclasses to return a detail EODataSource that provides the destination objects of the relationship named by relationshipKey. The detail EODataSource can be qualified using qualifyWithRelationshipKeyAndObject to set a specific master object (or to change the relationship key). EODataSource's implementation merely throws an exception; subclasses shouldn't invoke super 's implementation.
deleteObject
public abstract void deleteObject (java.lang.Object anObject)
Implemented by subclasses to delete anObject. EODataSource's implementation merely throws an exception; subclasses shouldn't invoke super 's implementation.
editingContext
public EOEditingContext editingContext ()
Implemented by subclasses to return the receiver's EOEditingContext. EODataSource's implementation returns null .
fetchObjects
public NSArray fetchObjects ()
Implemented by subclasses to fetch and return the objects provided by the receiver. EODataSource's implementation returns null .
insertObject
public abstract void insertObject (java.lang.Object object)
Implemented by subclasses to insert object. EODataSource's implementation merely throws an exception; subclasses shouldn't invoke super 's implementation.
qualifyWithRelationshipKeyAndObject
public abstract void qualifyWithRelationshipKey (
java.lang.String key,
java.lang.Object sourceObject)
Implemented by subclasses to qualify the receiver, a detail EODataSource, to display destination objects for the relationship named key belonging to sourceObject. key should be the same as the key specified in the message that created the receiver. If sourceObject is null , the receiver qualifies itself to provide no objects. EODataSource's implementation merely throws an exception; subclasses shouldn't invoke super 's implementation.