- Business Delegate (One for each client (Stand alone client / remote)) - RemoteService / RemoteServiceImpl (Optional for remote clients) - DatabaseRegister (RMI initialization) - Facade (Business logic like 48 rule here) - Data (Singleton) - DataFileAccess (Access to data file) - URLyBirdDataAccess (URLyBird specific data file methods) - LockManager (with a static map of locked recs) - ApplicationCodedNames (static / static final atributes) - AcommodationTO (Transfer Object)
[ August 11, 2006: Message edited by: Tony Bouer ] [ August 11, 2006: Message edited by: Tony Bouer ]
I don't understand why so many people want to use Singleton for Data class. Is that any reason for that (except programmer mistake)? Isn't it too limiting? When some other/new version of application will have to use two different database files why it shouldn't be possible?
It looks to me like having (for example) RandomAccessFile as Singleton. Yes you can open same file with two instance of RandomAccessFile and if you will use it wrong way, your data will be corrupted. But it is not reason to have it a Singleton, is it?
Hi, I want to share my design and welcome your suggestions. db package: Data LockManager RecordInfo FieldInfo business package: HotelInterface HotelBusiness(for local) HotelRemote(for rmi which will create an instance of HotelBusiness) HotelBusinessFactory ServerRun(application to start server) client package: RoomModel(extends javax.swing.table.AbstractTableModel) ClientFrame MainRun(application to start GUI)
Ask a quetion: how do you guys realize that one server has only one Data object? My way is make a static Data object as a member of HotelBusiness and in HotelBusiness constructor check if that member variable == null. But one experienced developer recommended me abandon such bad design. How about yours?
using multiple objects could cause the data file to be in an inconsistent state therefore when opening the Random Access File i used the mode "rws" This one states that it will make it synchronously write it to the storage device. Thus the file corruption should be handled by the File system making it less head ache for the programer Please let me know if my approach is correct