Originally posted by Fred Barnes:
Hi Guys,
Here is my plan of attack! Please comment and advise...
suncertify.db
public interface DataInterface
Includes all the public methods of Data, plus criteriaFind method.
All methods throws IOExceptions.
getRecord, find, add, modify, delete also throws DatabaseExceptions.
public class Data
Data is changed to implement DataInterface
citeriaFind is implemented while lock and unlock remain empty.
Datainfo, FieldInfo and DatabaseException remain unchanged.
suncertify.server
public interface RemoteDataInterface
Extends DataInterface and implements Remote.
public class RemoteData
Extends UnicastRemoteObject implements RemoteDataInterface and Unreferenced.
Has a static reference to Data and LockManager.
Implement lock and unlock methods.
public interface ConnectionFactory
Implements Remote
Has a getConnection method that returns a DataInterface. For local connection it will return Data and remote an instance of RemoteData.
public class ConnectionFactoryImpl
Extends UnicastRemoteObject and implements ConnectionFactory.
public class LockManager
Uses a HashMap to store locked records.
suncertify.client
public class DataModel extends AbstractTableModel
Implemented as a facade.
Contains the book, search and getConnection methods.
public class DataController
The controller class in my client side MVC.
Here I will implement all needed listeners.
public class DataView
Class containing all my GUI components.
Kind Regards
Fred
Static? As in "private static FooBar foobar"? Reconsider that -- this would limit you to a single database table, ruining most prospects of reusability for the server.Originally posted by Fred Barnes:
public class RemoteData [...]
Has a static reference to Data and LockManager.
Peter den Haan | peterdenhaan.com | quantum computing specialist, Objectivity Ltd
The factory gives each client its own connection object to talk to -- that way, clients can be identified and unlock() implemented as required (see the javadoc). Both the factory and the connections it creates need to be remote objects, but only the factory is bound in the RMI registry; connections are private to each client.Originally posted by Omar Abdel Moniem:
[...] Why RemoteData class and ConnectionFactoryImpl both extend UnicastRemoteObject.
Peter den Haan | peterdenhaan.com | quantum computing specialist, Objectivity Ltd
Originally posted by Jawad Kakar:
There are 2 constructor, by calling
you get an instance of remote object only.
Jawad
The second constructor which no parameter the one you are talking about is called inside getConnection() method.
Originally posted by Jawad Kakar:
This is a default constructor which is for getting different client id.
Jawad
You guys wanna see my fabulous new place? Or do you wanna look at this tiny ad?
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
|