At 03:15 PM 6/26/2001 +0100, Dylan J Browne wrote:
>In the example the AddressBook is self populating, it doesnt exist and isnt
>populated until I run GetAddress... (is this right?).
or PutAddress, or PutListings, or any of the other clients...
>What I want to do is remove the creation of AddressBook, (and its
>population), into a separate class that I can run (with a main method) so I
>know the AddressBook exists and is populated. So I've removed the addEntry
>lines from AddressBook constructor, so I can do it in my own separate class.
>Then I want to run GetAddress and talk to *that* AddressBook that I've
>already created and populated, but it tells me the AddressBook is null, IE
>it cant find the one that I've just created.....
Don't create a separate AddressBook object, just run PutAddress or PutListings,
editted as you please to add as many records as you please. These are clients
so they can talk to the service AddressBook from any machine, and it will be
initialized (with 0 records, if you've removed the addEntry lines) as soon as
any client does so.
It might be better to edit the AddressBook constructor so it calls on your
utility code, though, to populate the address book within the same JVM. Surely
in anything realistic you'd be using a database of some sort?
Tom Myers