WebObjects 5.2

com.webobjects.eodistribution.client
Class EODistributedDataSource

java.lang.Object
  |
  +--com.webobjects.eocontrol.EODataSource
        |
        +--com.webobjects.eodistribution.client.EODistributedDataSource

public class EODistributedDataSource
extends EODataSource

EODistributedDataSource is a concrete subclass of EODataSource (defined in the control layer) that fetches using an EOEditingContext as its source of objects. The editing context, in turn, forwards the fetch requests to its parent object store (usually an instance of EODistributedObjectStore) where it is ultimately serviced by an EODatabaseContext on the server.

EODistributedDataSource implements all the functionality defined by EODataSource: In addition to fetching objects, it can insert and delete them (provided the entity isn't read-only). See the EODataSource class specification for more information on these topics.

EODistributedDataSource provides several methods in addition to those defined by EODataSource. The additional methods (fetchEnabled and setFetchEnabled, fetchSpecification and setFetchSpecification, and setAuxiliaryQualifier) are added to support enabling and disabling fetching and to support fetching with an EOFetchSpecification.


Constructor Summary
EODistributedDataSource(EOEditingContext editingContext, String entityName)
          Creates a new EODistributedDataSource for the entity identified by entityName.
EODistributedDataSource(EOEditingContext editingContext, String entityName, String fetchSpecificationName)
          Creates a new EODistributedDataSource for the entity identified by entityName.
EODistributedDataSource(String entityName)
          Creates a new EODistributedDataSource for the entity identified by entityName.
 
Method Summary
 EOClassDescription classDescriptionForObjects()
          Implemented by subclasses to return an EOClassDescription that provides information about the objects provided by the receiver.
 EODataSource dataSourceQualifiedByKey(String key)
          Implemented by subclasses to provide the destination objects of a relationship.
 void deleteObject(Object eo)
          Implemented by subclasses to delete an object.
 EOEditingContext editingContext()
          Implemented by subclasses to return the receiver's EOEditingContext.
 boolean fetchEnabled()
          Returns whether fetching is enabled.
 NSArray fetchObjects()
          If fetching is enabled, fetches and returns objects with the receiver's fetch specification; returns null otherwise.
 EOFetchSpecification fetchSpecification()
          Returns the receiver's fetch specification (which by default fetches all the objects for the receiver's entity unless it is further restricted with setFetchSpecification or setAuxiliaryQualifier).
 void insertObject(Object eo)
          Implemented by subclasses to insert objects.
 void qualifyWithRelationshipKey(String key, Object sourceObject)
          Displays destination objects for the relationship named key belonging to the source object sourceObject (owner of the relationship).
 void setAuxiliaryQualifier(EOQualifier qualifier)
          Assigns qualifier as an auxiliary qualifier to the receiver's fetch specification.
 void setEditingContext(EOEditingContext editingContext)
          Sets the receiver's editing context.
 void setFetchEnabled(boolean fetchEnabled)
          Sets whether or not fetching is enabled in the receiver.
 void setFetchSpecification(EOFetchSpecification fetchSpecification)
          Assigns fetchSpecification to the receiver as the fetch specification to use when fetching objects.
 void setFetchSpecificationName(String name)
           
 
Methods inherited from class com.webobjects.eocontrol.EODataSource
createObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EODistributedDataSource

public EODistributedDataSource(String entityName)
Creates a new EODistributedDataSource for the entity identified by entityName.
Parameters:
entityName - the name of the entity this data source handles

EODistributedDataSource

public EODistributedDataSource(EOEditingContext editingContext,
                               String entityName,
                               String fetchSpecificationName)
Creates a new EODistributedDataSource for the entity identified by entityName. If editingContext is provided, the new data source uses it as its source of objects and fetching is enabled. If it isn't provided, you must assign one with the setEditingContext method; until you do, fetching is disabled. This constructor also allows you to designate a fetch specification to be used by the initialized instance.
Parameters:
editingContext - the editing context of the data source
entityName - the name of the entity this data source handles
fetchSpecificationName - the name of a fetch specification for the specified entity

EODistributedDataSource

public EODistributedDataSource(EOEditingContext editingContext,
                               String entityName)
Creates a new EODistributedDataSource for the entity identified by entityName. If editingContext is provided, the new data source uses it as its source of objects and fetching is enabled. If it isn't provided, you must assign one with the setEditingContext method; until you do, fetching is disabled.
Parameters:
editingContext - the editing context of the data source
entityName - the name of the entity this data source handles
Method Detail

classDescriptionForObjects

public EOClassDescription classDescriptionForObjects()
Description copied from class: EODataSource
Implemented by subclasses to return an EOClassDescription that provides information about the objects provided by the receiver.
Overrides:
classDescriptionForObjects in class EODataSource
Following copied from class: com.webobjects.eocontrol.EODataSource
Returns:
subclasses return an EOClassDescription EODataSource returns null

dataSourceQualifiedByKey

public EODataSource dataSourceQualifiedByKey(String key)
Description copied from class: EODataSource
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.
Overrides:
dataSourceQualifiedByKey in class EODataSource
Following copied from class: com.webobjects.eocontrol.EODataSource
Parameters:
key - the relationship key
Returns:
a detail EODataSource
Throws:
exception - on EODataSource's implementation.
See Also:
EODataSource.qualifyWithRelationshipKey( String key, Object sourceObject)

deleteObject

public void deleteObject(Object eo)
Description copied from class: EODataSource
Implemented by subclasses to delete an object. EODataSource's implementation merely throws an exception. Subclasses shouldn't invoke the superclass's implementation.
Overrides:
deleteObject in class EODataSource
Following copied from class: com.webobjects.eocontrol.EODataSource
Parameters:
eo - the object to be deleted
Throws:
exception - on EODataSource's implementation

editingContext

public EOEditingContext editingContext()
Description copied from class: EODataSource
Implemented by subclasses to return the receiver's EOEditingContext.
Overrides:
editingContext in class EODataSource
Following copied from class: com.webobjects.eocontrol.EODataSource
Returns:
receiver's EOEditingContext when implemented by subclasses, null when implemented by EODataSource

fetchEnabled

public boolean fetchEnabled()
Returns whether fetching is enabled.
Returns:
true if fetching is enabled; false otherwise

fetchObjects

public NSArray fetchObjects()
If fetching is enabled, fetches and returns objects with the receiver's fetch specification; returns null otherwise.
Overrides:
fetchObjects in class EODataSource
Returns:
the fetched objects or null if fetching is not enabled

fetchSpecification

public EOFetchSpecification fetchSpecification()
Returns the receiver's fetch specification (which by default fetches all the objects for the receiver's entity unless it is further restricted with setFetchSpecification or setAuxiliaryQualifier).
Returns:
the fetch specification of the data source
See Also:
setFetchSpecification(com.webobjects.eocontrol.EOFetchSpecification), setAuxiliaryQualifier(com.webobjects.eocontrol.EOQualifier)

insertObject

public void insertObject(Object eo)
Description copied from class: EODataSource
Implemented by subclasses to insert objects.
Overrides:
insertObject in class EODataSource
Following copied from class: com.webobjects.eocontrol.EODataSource
Parameters:
eo - the object to be inserted
Throws:
exception - on EODataSource's implementation

qualifyWithRelationshipKey

public void qualifyWithRelationshipKey(String key,
                                       Object sourceObject)
Displays destination objects for the relationship named key belonging to the source object sourceObject (owner of the relationship). key should be the same as the key specified in the dataSourceQualifiedByKey method. If sourceObject is null, no objects are provided. If the relationship named by key can't be found, an IllegalStateException is thrown. The source object must be an EOEnterpriseObject.
Overrides:
qualifyWithRelationshipKey in class EODataSource
Parameters:
key - name of the relationship
sourceObject - the source object (owner of the relationship), an EOEnterpriseObject

setAuxiliaryQualifier

public void setAuxiliaryQualifier(EOQualifier qualifier)
Assigns qualifier as an auxiliary qualifier to the receiver's fetch specification. This qualifier is combined with the qualifier with the fetch specification with an AND operation.
Parameters:
qualifier - the auxilary qualifier

setEditingContext

public void setEditingContext(EOEditingContext editingContext)
Sets the receiver's editing context. If editingContext is null, fetching is disabled.
Parameters:
editingContext - the editing context

setFetchEnabled

public void setFetchEnabled(boolean fetchEnabled)
Sets whether or not fetching is enabled in the receiver.
Parameters:
fetchEnabled - true if fetching is enabled; false otherwise

setFetchSpecification

public void setFetchSpecification(EOFetchSpecification fetchSpecification)
Assigns fetchSpecification to the receiver as the fetch specification to use when fetching objects.
Parameters:
fetchSpecification - the fetch specification

setFetchSpecificationName

public void setFetchSpecificationName(String name)

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

Copyright © 2003 Apple Computer, Inc.