home *** CD-ROM | disk | FTP | other *** search
/ OpenStep (Enterprise) / OpenStepENTCD.toast / OEDEV / EODEV.Z / EODataSource.h < prev    next >
Encoding:
Text File  |  1996-09-11  |  2.7 KB  |  67 lines

  1. // EODataSources.h
  2. // Copyright (c) 1994, NeXT Software, Inc. All rights reserved.
  3. //
  4. // The EODataSource abstract class defines a simple interface for accessing
  5. // a variety of object sources in a uniform way.  It exists primarily as
  6. // an interface for EOControllers to talk to the outside world.
  7. //
  8. // Subclasses should implement at least the fetchObjects method.  If the
  9. // subclass supports insertion of new objects, then createObject and insertObject:
  10. // should also be implemented.
  11. //
  12. #import <Foundation/Foundation.h>
  13.  
  14. @class EOEditingContext;
  15. @class EOClassDescription;
  16.  
  17.  
  18. @interface EODataSource : NSObject 
  19.  
  20. - (id)createObject;
  21.     // Returns a new data bearing object with no values set, or nil if the
  22.     // data source won't allow object insertion.  Returned object is autoreleased.
  23.     // The DataSource will register the newly created object with the
  24.     // editingContext automatically.
  25.     // Default implementation does:
  26.     // [[self classDescriptionForInstances] createInstanceWithEditingContext:globalID:zone:];
  27.     // [editingContext insertObject:eo];
  28.  
  29. - (void)insertObject:object;
  30.     // Inserts object into the data source. Raises exception on failure.
  31.     // Default raises.
  32.     // If the dataSource registers undos for the insertion it should be prepared to
  33.     // also receive a possibly redundant deleteObject: call from higher levels.
  34.  
  35. - (void)deleteObject:object;
  36.     // Deletes object from the data source.  Raises exception on failure.
  37.     // Default raises.
  38.     // If the dataSource registers undos for the deletion it should be prepared to
  39.     // also receive a possibly redundant insertObject: call from higher levels.
  40.  
  41. - (NSArray *)fetchObjects;
  42.     // Returns an array of the data-bearing objects in the data source.
  43.     // Default returns nil.
  44.  
  45. - (EOEditingContext *)editingContext;
  46.     // specifies the context in which this dataSource records its objects
  47.     // Default returns nil.
  48.  
  49. - (void)qualifyWithRelationshipKey:(NSString *)key ofObject:sourceObject;
  50.     // qualify ourselves according to the relationship from
  51.     // the given source object
  52.     // A nil object will set up a qualifier that returns no records.
  53.     // Default raises an exception.
  54.  
  55. - (EODataSource *)dataSourceQualifiedByKey:(NSString *)key;
  56.     // Returns a data source that can be set with 
  57.     // qualifyWithRelationshipKey:ofObject to supply objects associated 
  58.     // with a another objects key.  This is a useful way to get an appropriate
  59.     // detail data source for a given master data source.
  60.     // Default raises an exception.
  61.  
  62. - (EOClassDescription *)classDescriptionForObjects;
  63.     // Should return a class description describing objects returned
  64.     // by this dataSource.  Default returns nil.
  65. @end
  66.  
  67.