FileFinderAdaptor

Overview
This example shows how to build a basic Database Kit adaptor using the IXFileFinder class of the Indexing Kit.  For simplicity, the database model built with this adaptor is READ-ONLY and has 3 attributes: Filename, Date, and Type. Since the data is READ-ONLY, it is possible to insert or delete records, but save will not make any changes to the model.

Building the Adaptor
To build the adaptor, you'll need to do the following:
1) Run make:
Either type the following in a terminal shell:
% make PRODUCT_ROOT= FileFinderAdaptor.adaptor
Or type "PRODUCT_ROOT = FileFinderAdaptor.adaptor" into the Args textfield of Project Builder and select Build.
This will create an executable file package named FileFinderAdaptor.adaptor
2) Put the .adaptor file into your ~/Library/Adaptors directory.

Testing the Adaptor
1) Start up DBModeler, and select FileFinder Adaptor in your Preferences. 
Create a New model by selecting New in the menu, with the selection set on Default Model and FileFinderAdaptor.
2) Save your model into your ~/Library/Databases directory.

1. Testing the Adaptor using Interface Builder
Now you can test your model in Interface Builder:
1) Drag a DBModule instance into a new nib file. Select the proper model.
2) Place a DBTableView into your application window. 
3) Connect FileName, Date, and Type attributes of the model to your TableView.
4) Drag a button into your application window and connect that button to the DBModule instance with fetchAllRecords: as the target of this button.
5) Go into IB test interface mode
6) Do a fetch. 

2. Testing the Adaptor using a test program
1) Compile the FFAdaptorTest program.
2) Run it. Select Fetch to show all files in the /NextLibrary/Documentation/NextDev/ReleaseNotes directory. 

Program Organization

Major Class in the Application

FileFinderAdaptor	A subclass of DBBasicAdaptor.  It is responsible for all adaptor operations.

Other Pecularities
The Makefile.preamble is needed in order to link the Indexing kit .

Change History
May 1992		David Stutz, original author
August 1992	Mai Nguyen, adapted for final 3.0 and  IndexingKit