I'm really confused here
ConnectionFactoryImpl contains instance of Data or RemoteDataObject?
Does this instance of Data passes "Database File" name or I have to give flexibility to user to select Database?
in RemoteDataObject(data, lockManager) what should I write in the body of constructor?
I'm just writing,
this.data = data;
this.lockManager = lockManager;
thats all.
I need some more information and small hints to write code.
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Personally I assume that the database is in the same directory as my server.jar file, but I also allow the user to override that location from the command line.
I dont think there is any need to have the networked client code specify the location of the database. I would even recommend against it - it is not very user friendly, and it is error prone.
Perhaps you should post a specific problem rather than having such an open ended question - we cannot give a complete solution to you, and I dont want to start talking about things which you have not thought about yourself yet.
would assume RemoteDataObject also extends UnicastRemoteObject
would also assume RemoteDataObject has wrapper methods for each of the methods in the Data class - in most cases it will call them directly.
Andrew: Personally I assume that the database is in the same directory as my server.jar file, but I also allow the user to override that location from the command line.
Panku: Can you please elaborate on this? How and why you allow user to override location of DB file?
Andrew: would also assume RemoteDataObject has wrapper methods for each of the methods in the Data class - in most cases it will call them directly.
PankuYes, RemoteDataObject has all Data methods, but can you again explain "in most cases it will call them directly"
Do you mean call Data methods from RemoteDataObject ? like data.modify()?
Please don't think I'ma sking dumb questions but I just want to have clear understanding and also confirm my line of thinking with you guys( open ended again...Ooops!!!)
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
How is easy: your ConnectionFactoryImpl currently hard codes the location of the database file path. All you need to do is allow the user to enter it on the command line and pass it to the ConnectionFactoryImpl which can then use the command line argument instead of the hard coded location.
Kevin Cao :
1. Since your RemoteDataImpl is a wraper class of Data, why create Data and Lockmanager instance in there? The purpose of ConnectionFactoryImpl is to create RemoteDataImpl
3. Also, you can provide a main class in ConnetionFactoryImpl to registry this object. And it will be your main class of your server.jar.
Andrew: Personally I assume that the database is in the same directory as my server.jar file, but I also allow the user to override that location from the command line.
Panku Can you please elaborate on this? How and why you allow user to override location of DB file?[/i]
Andrew How is easy: your ConnectionFactoryImpl currently hard codes the location of the database file path. All you need to do is allow the user to enter it on the command line and pass it to the ConnectionFactoryImpl which can then use the command line argument instead of the hard coded location.
Panku doens't this have a disadvanatage of every time typing the path to database and again if he typed wrong path ,Exception
Panku Every user should use single instance of LockManager. Doesn't this is a requirement? If I create LockManager instance in RemoteDataImpl, every user will get his/her own instance of it and that is not what ir required.
Also, I don't want user to mention whether he want to access database locally or remotelly. My system should identify it. How can I implement that?
The user interface should connect to the database using either a local or a network based connection according to user choice.
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Originally posted by Andrew Monkhouse:
Hi Max,
If you want it to fail, try adding a record, even as you're modifying another.
I take it you are telling me that this is an area where failure can hapen, even if it cant be proved in testing?
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Originally posted by Andrew Monkhouse:
Hi Max,
Yes, I made readcount a static.
I did consider the -1 for adds, but I considered it overkill: as long as only one client can do an add at any given time, I shouldn't need to be so Draconian.
I hadn't thought about a double monitor - I dont think I really want to though
Regards, Andrew
How are you enforcing that only one client adds or deletes a record?
Also, how are you making sure that no one is modify a record while another client is adding a new record, or deleting an existing one? Are you only allowing a single client to access the db file at a time, even if they want to read different records?
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
For my next trick, I'll need the help of a tiny ad ...
Smokeless wood heat with a rocket mass heater
https://woodheat.net
|