• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Final review. Planning to submit this weekend. Please comment.

 
jay denzel
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I am planning to submit my assignment this weekend.
This is my final review. I would like your opinion.
RMI Implementation: I have a DataClient interface which
has all public methods of Data. My DataWrapper class
has a reference to Data and implements DataClient.
My connections are provided by ConnectionFactory which
returns either a DataWrapper instance (for local mode)
or a FBNDatabaseImpl instance (for remote).
FBNDatabaseImpl extends UnicastRemoteObject and implements
FBNDatabaseRemote which extends Remote and DataClient.
Data: I modified the Data class and added a LockManager
class.
LockManager: Locked records are kept in a Hashtable with
the record as the key. I did not implement client ID
tracking and justified this decision in my designchoices.txt.
When the whole database gets locked all clients
attempting to aquire a lock wait. Stale client locks are
handled via a LockChecker class which is a periodically
running thread which releases locks held longer than
a certain amount of time.
GUI: I use the MVC pattern for client implementation.
My model extends AbstractTableModel. The controller
modifies the model and the model updates the JTable.
All my dialogs (searching, booking ...) are implemented
using JDialog. I created a generic dialog class
which all other dialogs extends to provide general
layout of the dialog. My search is also generic, meaning
you can use any field of the underlying database model
to search independant of the database model.
For the JTable I implemented Tooltips and sorting the
table in both directions.
The user can change the connection type on the fly.
My help window displays a HTML page including screenshots.
I have 2 jar files (client.jar, server.jar), I do not
use codebase, server.jar has all necessary classes included.
Documented each and every file I will submit.
Did extensive testing all week, works fine.
Is there anything I missed? Is there anyone who sees a
flaw in there?
Thanks for your advice...
Best of luck.
jay
-----
SCJP2
 
Jeff Song
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well design, It can be seem that u spent a lot of thing on it!
But why can not combine your two interface into one?
And where are u invoke the connectionFactory method? In main method or in DataWrapper.
Where are u putting ur business logical class?
 
jay denzel
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
I do not understand what you mean by two interfaces,
I have one interface DataClient. If the user chooses
a remote connection I cast my FBNDatabaseImpl
in the registry to DataClient, for local mode a DataWrapper
instance is returned which in turns implements DataClient.
The ConnectionFactory is used by the controller, because the
controller holds the actual connection type, this way I can
easy switch between both connection types, I just call
the appropriate method in the controller which gets the
connection from the ConnectionFactory.
Thanks for your response.
jay
 
Jeff Song
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the FBNDatabaseRemote is class or a interface?
FBNDatabaseImpl implements the FBNDatabaseRemote .
FBNDatabaseRemote extends Remote and DataClient?
I am confusing about their relationship...
can u explain it to me?
BTS. where do u put your business logic?
 
jay denzel
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
FBNDatabaseRemote (interface) extends Remote and DataClient,
FBNDatabaseImpl extends UnicastRemoteObject and implements FBNDatabaseRemote.
FBNDatabaseImpl is for remote mode DataWrapper is for local mode,
both implement DataClient, this way the ConnectionFactory always
issues an instance of DataClient.
I did not add a particular business layer, meaning I do not wrap my
returning DataInfo objects in any object like e.g. "flight" objects.
The objects DataWrapper is dealing with are always instances of DataInfo,
so I would say my business logic is in DataWrapper.
Hope this helps.
jay
 
Jeff Song
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
WI can almost understand what your mean.
But FBNDatabaseRemote is a interface and DataClient is also a interface.
Why not combine them?
And u said ur business logic is DataWrapper so that u put the business method such as book(),getFlight() in this class. Am I right?
 
Mag Hoehme
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jay,
your design sounds ok to me.
I wish you good luck!!!
 
jay denzel
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well I use a Factory pattern to issue the appropriate connection
type. My ConnectionFactory class has two methods getLocalConnection()
and getRemoteConnection(String ip) the first one returns an
instance of DataWrapper which implements DataClient, this is only
for local mode, so DataClient does not need to extend Remote, the
second interface is for remote mode and therefore extends both
Remote and DataClient. Does this explanation make it clearer?
Yes my bookFlight, criteriaFind, etc. are implemented in DataWrapper
which calls the corresponding methods in Data.
Thanks for your answers.
jay
 
jyothi sunke
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jay,
After seeing ur design I am getting doubt that whether my procedure is wrong...So, I have one question to u. Is MVC pattern must in devloping this assignment??
I have 4 GUI classes in my application namely,
ModeSelectionGUI(used for selecting the mode and accroding to that connecting to the Data class),
SearchGUI(used for slecting the criteria from three comboboxes and accroding to taht it invoke FlightServicesGUI with search results),
FlightServicesGUI(through which we can go back to SearchGUI(if user want to seach again) and can book the flight),
DisplayItenaryGUI(is used for displaying the itenary after booking the seats),
Each GUI class is independant. we can invoke them whenever we want(and there is connection between them while running the application) I don't know whether I used MVC pattern in that.. but application running fine. and I am not able to find which one is Model,View and Controller in my GUI classes....Is my procedure wrong??
Please let me know..
Thanks..
 
jay denzel
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I do not think that it is a must nor is it explicitly mentioned in the assignment. The only thing they demand is to use "Standard elements and design patterns" so therefore I choose to implement my GUI using MVC. My general execution path is UI -> Controller -> Data facade -> Data -> Data facade -> Controller -> View, so every interaction with the application must pass the controller and the controller modifies the model which is used be the View. If all of your GUI classes modify the View then I would say you have a mixture of UI and Controller. I prefer to separate these, additionally the future benefit will be that you can extends the application much easier if everything is clearly separated and it also reflects good OOD. If you can clearly justify your implemention decision I do not think the grader will mark you off.
Best of luck.
jay
 
Jeff Song
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,Jay
I still have a question to ask u.
About the DataWrapper, it inplement the DataClient so it must implement the getRecordCount(),getRecord(int).. methods. How to implement? like below??
public int getRecordCount() {
data.getRecordCount;
}
and how u implement ur business logic method of ur business class(DataWrapper) ,like below??
public bookFlight(int i ) {
data.lock()
.
.
}
or
public bookFlight(int i ) {
this.lock()
.
.
}
I only want to know whether u invoke directly the method of the instance of Data or invoke the DataWrapper's method and just depend the wrapper to pass the operation to data instance.
 
jay denzel
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi jeff,
DataWrapper has a reference to Data so DataWrapper calls the methods in Data.
greets
jay
 
Jeff Song
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,Jay
But in this way, Wrapper just has a refrence of Data instance, but in the guide said, must include a class implement all the public method of Data Class.
You just have a interface with all the public method of Data, not a class IMPLEMENT all the public method. You must have your own reason of resolving this issue. Can u explain it to me?
 
jay denzel
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
DataWrapper implements DataClient, DataClient has
all public methods of Data, so the DataWrapper class has also the same public methods of Data implemented. Hope this explains it.
jay
 
Jeff Song
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,Jay
I an still wondering how you write ur method content:

public int getRecordCount() {
data.getRecordCount;
}
OR
public int getRecordCount() {
//do nothing
}
 
walid aly
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have my own design that looks simillar to u
BUT
1- i do not understand y do u have class datwraper at the server side ,u said that the connection factory in local mode returns a datawraper object .
i have this data wraper class at the client side and not the server side , (i use adapter pattern)
so that the client can go local without dealing with the server at all.... plz comment
2-u did not use client_id in ur hash table , can u plz clarify what was ur key value.
3.if i did not understand u wrong , the class bind to registery is connection manager right???and not fbndatbaseimpl , that mean u have in ur design 2 classes that extend unicast.
good luck!
 
jay denzel
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Jeff:
public int getRecordCount() {
return data.getRecordCount();
}
walid:
1. The ConnectionFactory class in local mode
returns a DataWrapper instance, in remote mode
a FBNDatabaseImpl with has a DataWrapper instance,
both (DataWrapper and FBNDatabaseImpl) implement
DataClient which implements all public methods of
Data.
2. I use the record number as the key, if you do not use a client ID I would suggest to justify this decision in your designchoices.
3. FBNDatabaseImpl is bound to the registry, there is no need to bind the ConnectionFactory to the registry the ConnectionFactory actually looks up the bound object there.
jay
 
walid aly
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for ur reply
1-since connection is not bind at all to registery, how can clients invoke it at the very start of connection to get a instance of FBNDatabaseImpl.
u said "My connections are provided by ConnectionFactory which
returns either a DataWrapper instance (for local mode)or a FBNDatabaseImpl instance (for remote)."
2-i bind connection to registery to return a differnt FBNDatabaseImpl object for each connection .
I think u use datawraper as a unique object. am i right?
3-since connection is part of the server , if the client go local will it need to be on the same machine as server?
thanks
walid
 
jay denzel
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
1. my Controller takes care of this, because the controller actually holds the chosen connection type.
After startup the user selects a connection type, a new Controller instance is created which gets the
connection from the ConnectionFactory which has two static methods for that. One of them looks up the
bound remote object in the registry and returns this (in network mode), for local mode only a newly
created instance of DataWrapper is returned.
2. right.
3. my ConnectionFactory is not part of the server, it does not need to be, only if the user chooses to
go over the network the factory provides the appropriate connection type which is like I said looked
up remotely in the servers registry.
This was the solution for me which made the most sense.
jay
 
walid aly
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Jay
now it all makes sense to me
thanks..
in my design i have a problem
i know have a unique remote object for each rmi connection
all these remote objects(wrapers) acess the methods in the data class using the same instance of class data
my question is
How in the body of the lock method can i get to know which remote object has initiated the invoke?
i wanna use this as clientid
thanks
 
jay denzel
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
if you have unique connection objects how do achieve
to have only one Data object?
Did you change Data to be a singleton?
jay
 
Pervez Ahmed
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by jay denzel:
RMI Implementation: I have a DataClient interface which
has all public methods of Data.

I know the assignment specifies that you must provide all the public methods of the Data class in the remote client code, but this confuses me. Public methods like lock() and unlock() is implemented in my Data class. I'm wondering why there is a need to have ALL of the methods in your DataClient interface and then again implemented in your DataWrapper and FBNDatabaseImpl. What did you do with methods like finalize() and close()? Please help.
 
Mag Hoehme
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Pervez Ahmed:

What did you do with methods like finalize() and close()? Please help.

Finalize() is not public, and close () has to be implemented, e.g. in local mode shutting down the database, and in remote mode shutting down the connection.
[ November 11, 2002: Message edited by: Mag Hoehme ]
 
Pervez Ahmed
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mag,
Then what do I do with the unlock/lock methods. These methods I've implemented in Data. If I provide an interface with all the public methods in Data, what implementation do I provide for these methods in my RemoteConnection and LocalConnection. What about methods like getFieldInfo(), getRecordCount(), getRecord(). Will these also be part of the DataClient interface?
 
Jeff Song
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,Jay
When I implement my assignment, I encounter a problem.
The DataClient interface has all public method of Data, and it DOESN'T throws RemoteException.
FBNDatabaseRemote extends Remote and DataClient,
but when code FBNDatabaseImpl, the compiler said the methods in interface DataClient don't throw RemoteException!!??
Do those methods in interface DataClient need to throw RemoteException?
 
jay denzel
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, mine throw IOException.
jay
 
Jeff Song
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
but in this case,the compiler would said the methods in interface DataClient don't throw RemoteException!
FBNDatabaseRemote only extends Remote and DataInterface, it has no any body,right?
but every remote method must declared to throw RemoteException. If the methods in DataInterface don't throw RemoteException, How can the FBNDatabaseImpl pass complier.
 
jay denzel
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
once again, please recap my design:
DataClient is the central interface which identifies each client connection.
DataClient has all the public methods of Data.
FBNDatabaseRemote (interface) extends DataClient, Remote
FBNDatabaseImpl extends UnicastRemoteObject and implements FBNDatabaseRemote
FBNDatabaseImpl methods throw RemoteException
DataClient methods throw IOException
IOException is a super class of RemoteException.
Hope this helps...
jay
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic