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

Final database design. Your comments, please.

 
Marcos Motta
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
package suncertify.db;
----------------------
class Data
- implements criteriaFind()
- lock()/unlock() not implemented
- deprecated methods replaced
package suncertify.db.server;
----------------------------
interface RemoteDataInterface:
- same methods as Data plus RemoteException
interface DataServerInterface
- is a factory of ServerConnection
- Has only one method: RemoteDataInterface Connect()
class DataServer:
- one instance per database
- extends Data
- implements DataServerInterface
- implements lock/unlock behaviour. keeps all locks granted to all clients in a list
- Connect returns an instance of ServerConnection.
class ServerConnection
- Is an adapter class that delegates calls to the single DataServer instance
- implements RemoteDataInterface
- one instance per client connection
- keeps a list of locks granted to this
client. lock()/unlock() keep this list
updated to validate calls. like to avoid
unlocking records not locked by the client.

package suncertify.client;
-----------------------
interface DataConnection:
- same methods as Data class.
- throws only DatabaseException in all methods.
- The gui client uses this interface to access
the database.
class RemoteDataConnection
- implements DataConnection
- Adapter class that delegates all calls to an
instance of RemoteDataInterface
- when delegating calls to the internal
RemoteDataInterface, all exceptions catched
are bubbled up canned in a new
DatabaseException
class LocalDataConnection
- implements DataConnection
- Adapter class that delegates all calls to an
instance of Data
- All exceptions catched when delegating calls
to the internal Data are thrown wrapped in a
new DatabaseException.
class DataConnector
- singleton with only two static methods:
DataConnection connectLocal (databasefile);
DataConnection connectRemote(String host);
- these methods returns instances of
RemoteDataConnection or LocalDataConnection
depending on the connection mode.
[ March 24, 2003: Message edited by: Marcos Motta ]
[ March 24, 2003: Message edited by: Marcos Motta ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic