Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Server design

 
Miguel Roque
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello again.
Please review the database and server design.
I've created a DataInterface that extends Remote. This interface implements all the methods from the Data class and besides the exceptions throw by the Data class it also throws RemoteException. The Data class extends this DataInterface.
The access to the Data class or to the remote server is made using a DatabaseFacade class that has two constructors, one for local access and other for remote access) and both constructors create a DataInterface instance that's used internaly by this class. One thing in this class is that it catches all the exceptions throw either by the local Data class or by the remote server and only throws a DatabaseFacadeException. This way, the final user of this class doesn't have to catch a big amount of exceptions.
For the server, I've created a RemoteDatabase class that creates a instance of the Data class and a instance of LockManager. I have a RemoteDataImplementation that accepts a RemoteDatabase as constructor parameter and defines all the methods from the Data class, but using the instance of the Data class created by the RemoteDatabase class.
I have also a DataInterfaceFactory interface that defines a method that accepts a database name and returns a DataInterface instance (the server can open more that one database). This interface is used by the FBNServer class that when created just has a method that comes from the interface and it's used by the DatabaseFacade to get a instance of a remote Data class.
Please comment.
I think that i've been clear in my explanation
Thankc,
Miguel
 
Miguel Roque
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello.
Comments please.
Thanks,
Miguel
 
Raffe Paffe
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Witch class is the one that starts the server? is it FBNServer ?
Thanks
 
Miguel Roque
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello.
Yes. I use FBNServer to start the server.
Miguel
 
Raffe Paffe
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you.
A few Questions.
So in FBNServer class constructor you create a RemoteDatabase for each db and you start up your server in main?
The only additional method is getDatabaseInstance and that one is remote?
Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic