hi,all I am very confused with my design before upload. Comments are very welcome and will be much appreciated. suncertify.db Data DataInfo FieldInfo DatabaseException //not changed interface DataAccessInterface extends Remote //for DataAccessLocal and DataAccessRemote. have all the public method of Data class and have criteriaFind(String criteria),book(String flightNumber,int num),String getData() interface ConnectInterface extends Remote// for ConnectRemote(the Remote Object) suncertify.server ConnectRemote extends UnicastRemoteObject implements ConnectInterface //the Remote Object,new DataAccessRemote(dbname). private LockManager lockManager; //to product a unique LcokManager DataAccessRemote extends UnicastRemoteObject implements DataAccessInterface //Remote Object too,as clientID,I am confused with it. Can I do it like this? LockManager // change lock(int) to lock(String flight,ClientID) ,confuse too FBNServer // Remote server:new ConnectRemote(). suncertify.client DataAccessFactory //connect factory, return DataAccessLocal or DataAccessRemote DataAccessLocal implements DataAccessInterface //Local data FBNClient FBNClientFrame// dataAccessInterface.book(String flightNumber,int num) FBNTableModel FBNComboboxModel no SecurityManager and can i copy DataAccessRemote_stub to client.jar? Thanks for your comment and advice. Christopher
I don't want to sound mean spirited, but if you are confused with your own design, imagine how confused your assessor will be. This assignment is like marriage, -- if you are not sure about your choice, it will fail. No one can make this choice for you, -- you need to undestand it by heart and soul. The good news is that you have a ranch full of competent marriage councelors here willing to help. That is, unless you ask "I married a blond, and I am confiused. What should I do?". Eugene.
posted 17 years ago
^_^,thank you I have not enough confidence. can you give me some advice. thank you
interface DataAccessInterface extends Remote //for DataAccessLocal and DataAccessRemote. have all the public method of Data class and have criteriaFind(String criteria),book(String flightNumber,int num),String getData()
There's a fundamental design problem with that. This mixes low-level, concrete, generic database API ("criteriaFind", "read", "write", etc) with high-level, abstract, application-specific business API ("book"). Never the twain should meet. On an architectural level, take a look at my boilerplate 3-tier architecture diagram[tm]: User Interface <==> Business Logic <==> Database You find this approach in almost any well-conceived modern application. There are three tiers, and two interfaces between them. You are mixing up the two interfaces, which means you are mixing up the Business Logic tier with the Database tier. In the FBN project, either interface is in principle a good candidate for the RMI interface between the client and the server. However, Sun's requirement that you should have a client-side object that implements all the public Data method effectively forces you to make the RMI interface correspond to the Business Logic <==> Database interface. Anything else would make a muddle of your architecture. With the above considerations in mind, it should be clear that the book() method implements business logic, and that it therefore cannot live on the server.
DataAccessRemote extends UnicastRemoteObject implements DataAccessInterface //Remote Object too,as clientID,I am confused with it. Can I do it like this?
DataAccessLocal implements DataAccessInterface //Local data
What do you need this for? Surely Data implements DataAccessInterface? Junk this class. It serves no purpose.
and can i copy DataAccessRemote_stub to client.jar?
Either that, or put it in a shared.jar and use the Class-Path manifest attribute in client.jar and server.jar to link in shared.jar. HTH - Peter