Originally posted by Yan Zhou:
My B&S assignment spec. says:
the program must allow the user to specify the location of the database, and it must also accept an indication that a local database is to be used, in which case, the networking must be bypassed entirely.
I wonder what it means. Is this referring to the stand-alone mode, i.e., specified by command-line argument "alone", or is this referring to the network mode with server being the local host, i.e., server is //localhost. If it is the latter, how could I pass the networking layer entirely since the program is running in network mode, although the server happens to be localhost.
Thanks.
Yan
The standalone mode MUST NOT use networking at all, it must access the database directly. What I do is have the Model access a DBAccess instance that is either a Data object or a DataProxy object the structure is:
Networked
Model -> DBAccess(DataProxy) -> DataAdapter --RMI--> DataAdapterImpl -> DBAccess(Data)
Standalone
Model -> DBAccess(Data)
The Model uses a Factory to produce the appropriate DBAccess instance. When RMI is used the Factory references a DataAdapterFactory that uses a single instance of DataAdapterFactoryImpl to provide instances on the server. This is the only object registered with the RMI registry.