public interface DataInterfaceFactory extends Remote - One method defined here
(public DataInterface getDatabaseInstance() throws RemoteException).
public class FBNServer extends UnicastRemoteObject implements DataInterfaceFactory - Just returns
a new DataInterface
public class RemoteDataImplementation extends UnicastRemoteObject implements DataInterface - The
database instance that is passed to each client
Originally posted by Amish Patel:
I have couple of questions regarding the following statement
1) For your FBNServer you are going to return new DataInterface? Why? Shouldn't you be returning the same RemoteObject that the first client created for a particular filePath? Meaning Client A connects Remotely to a server he gets a RemoteData, Client B connects remotely to the same server he should also get the same RemoteData correct?
2) What are the flow of things that happen when a remote client tries to connect?
The Data for now is still static and if we want to add "db1.db" we add a new static Data to the FBNServer and a new method to the DataInterfaceFactory that will return a new instance of RemoteDataInterface but with a new Data.
public class DataTableModel
a toolbar on the top with 4 buttons (search, reserve, help and exit).
public class FBNAsksNumberOfSeatsToReserve extends JDialog
public class NoSeatsAvailableException extends Exception
public class NotEnoughSeatsAvailableException extends Exception
The only that accepts command line parameters is the server that wants the database location.
For the FBNServer i've used a RMI Factory so that any client that connects to the server gets a new RemoteDataImplementation. With this, I will have the clientID that's needed in order to lock and unlock the records.
Regarding the server accepting parameters, what would be the point for doesn't accept parameters if the server can open multiple databases?
One approach is to start the server with the database names as parameters. Another approach is to start the server without any parameters and let the client request a particular database. The latter approach doesn't preclude the server from serving multiple database files.
So what you mean is
java client.jar www.server.com 1234 c:\tmp\db.db
java client.jar c:\tmp\db.db
I think that what Eugene means is:
java -jar client.jar db.db
java -jar client.jar c:\tmp\db.db
In server mode, the server knows where to look for the database file (i.e. the server knows the directory where the database files are) and when a client requests to open one database, the server looks to see if the database as already been opened or not. If opened, it returns a instance to the remote Data and if not opened, the server opens the database and returns the instance of the database to the client.
Am I right Eugene?
In server mode, the server knows where to look for the database file (i.e. the server knows the directory where the database files are) and when a client requests to open one database, the server looks to see if the database as already been opened or not.