Chapter 18
Chapter 18
<Author>
12345678901234567890123456789012345
”Simon”,”Bennett”,”Leicester”,”GB”,
1,”Simon”,”Bennett”
<Forename>Simon</Forename>
Simon
213,”22-01-2002”
2,1,”0077098641”,2002
Bennett Leice
<Surname>Bennett</Surname>
ster
2,2,”0077096738”,2001
GB 21322012002
</Author>
© Bennett, McRobb and Farmer 2002 8
File Systems
File organization
Serial—new records appended
Sequential—records ordered in file,
usually according to a numeric key
Random—uses an algorithm to
convert a key to an address in the
file
© Bennett, McRobb and Farmer 2002 9
File Systems
File access methods
Serial—to read serial and sequential
files
Index-sequential—using indexes to find
records in a sequential file and improve
access time
Direct—using relative or hashed
addressing to move directly to the
required record in the file
© Bennett, McRobb and Farmer 2002 10
earching for Hamer using index-sequential file access
Index-sequential Access
- objid: int
- iterator: RandomAccessFile
+ getObject( ): Object
Create an + store( )
+ delete( )
+ update( )
abstract + iterate( ): Object
+ write( ) {Ab stract}
+ read( ) {Ab stract}
superclass
and make all Location
it + removeIntCampaign( String )
+ numberOfCampaigns( ): int
+ write( )
+ read( )
© Bennett, McRobb and Farmer 2002 40
PersistentObject
Materialization as Class
Method
Sequence diagram
:ListCampaigns Location
Campaign
Dialog
Manager
GetNumberOf
findByLocation Location(
Campaigns( )
Code locationCode,
(locCode) locationName,
intCampaignList[ ]) :Location
numberOfCampaigns( )
- instance: LocationBroker
- LocationBroker( )
+ instance( ): LocationBroker
+ findByLocationCode( String ): Location
+ iterateLocation( ): Location
:ListCampaigns :LocationBroker
Campaign
Dialog
Manager
GetNumberOf
Campaigns( ) findByLocation Location(
Code locationCode,
(locCode) locationName,
intCampaignList[ ]) :Location
numberOfCampaigns( )
FileBroker RelationalBroker
LocationBroker IntCampaignBroker
materializes materializes
Location IntCampaign
java::sql::Connection
Location Broker
materializes
java:sql::Statement
Location
java::sql::ResultSet
sun.jdbc java.sql
«import» «import»
Broker Application
Framework Brokers
«Interface » RelationalBroker
IntCampaignInterface
«realize» «realize»
«Proxy» IntCampaignBroker
IntCampaignProxy
runs in materializes
Location IntCampaign
:IntCampaign :IntCampaignBroker