wood burning stoves 2.0*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes FBN Design Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "FBN Design" Watch "FBN Design" New topic
Author

FBN Design

ravi janap
Ranch Hand

Joined: Nov 04, 2000
Posts: 389
FBN design
This is the final design , I have in my mind before I am going ahead with my implementation.
1. DatabaseInterface : This interface defines the public methods of Data class , lock ,
unlock and criteriaFind() method.
2. I don't modify the Data class but rather extend it.
3. DatabaseImpl class extends Data implements DatabaseInterface : This class overrides
the lock, unlock and implements the criteriaFind() method.
4. Interface FBNServices defines the business logic methods to search for flight
information and book the flight.
5. FBNServicesLocalImpl implements FBNServices and is used for local mode . It has the reference to DatabaseImpl class and is used to access
the local database.
5. FBNServicesRemoteImpl extends UnicastRemoteObject implements FBNServices and it has the reference to
DatabaseImpl class and is used to access the remote database.
The client must transparently connect to local or remote database while he is operating in
local or remote mode respectively.
Please comment on the design.
I also intend to first implement the application for local mode followed by remote mode
implementation. Is this approach correct ?


SCJP, SCJD, SCWCD, SCBCD, SCEA
Bal Sharma
Ranch Hand

Joined: Sep 19, 2001
Posts: 273
Hello:
Looks good to me. I am just curious, your DatabaseImpl class which extends Data class and implements DatabaseInterface. Why do you need FBNServicesLocalImpl to use at local mode? Don't you think DatabaseImpl class can be used for local mode? It has everything on it just to add search and book functionality. I may be wrong! the way you are thinking! Good luck with you logic and algorithim.
-Bal
ravi janap
Ranch Hand

Joined: Nov 04, 2000
Posts: 389
FBNServices service = null;
if ( mode.equals("local" ) )
service = new FBNServicesLocalImpl();
else if ( mode.equals("remote" ) )
service = new FBNServicesRemoteImpl();
If the mode is local then FBNServiceLocalImpl has the necessary code to access the
local database.

If the mode is remote then FBNServiceRemoteImpl has the necessary code to access the
remote database.
I want to use the DatabaseImpl class purely for database assess and this class could be
used by the user to get connected to the database local or remote when he is in local
or remote mode respectively. The user must be transparent to which database he is
getting connected.
This way , I am trying to achieve a clear seperation among the various layers of the
architecture.
Thus presently the flow of control is the presentation layer ( the client GUI ) talks
to the service layer ( FBN Services ) which in turn talks to Persistence layer or
DB layer ( DatabaseImpl ) which in turn talks to the database ( db.db ).
Please guide me if you think , there is some flaw in the design.
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

How do you specify the location of the remote server when you start up the client?
Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
ravi janap
Ranch Hand

Joined: Nov 04, 2000
Posts: 389
String server = "//" + host + ":" + port + "/FBNServices";
FBNServices fbnRemote = ( FBNServices ) Naming.lookup( server );
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

Am I to assume that host and port variables are assigned values from the command line arguments or are they from a "Splash" screen that the user can enter that information.
If that's so, It looks good to me
Mark
ravi janap
Ranch Hand

Joined: Nov 04, 2000
Posts: 389
Am I to assume that host and port variables are assigned values from the command line arguments or are they from a "Splash" screen that the user can enter that information.
If that's so, It looks good to me
When the user clicks on the Remote mode , A GUI pops-up which prompts the user to enter the server name and port #
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

Cool
Mark
Forrest Xu
Greenhorn

Joined: Jan 30, 2002
Posts: 26
Hi,
It is good.
but for local mode, you don't need lock and unlock
method.
So I guess you may use two databaseImpl.
one called remotedabseImpl need to overrides
the lock, unlock and implements the criteriaFind method. The other localdabse don't need overrides the lock, unlock method but implements the criteriaFind method.
if you add criteriaFind method into Data class, then you can DIRECTLY use Data as local database.
AND remotedabseImpl derive from Data class and overrides the lock, unlock method.
Is it Ok?
thanks for any feedback!
java2de
Forrest Xu
Greenhorn

Joined: Jan 30, 2002
Posts: 26
hi janapareddy ravindra,
please see assignment submission:
Writing Data Client
To connect with your server, you should create a client program. This implementation should include a class that implements the same public methods as the suncertify.db.Data class, although it will need different constructors to allow it to support the network configuration.
include a class that implements the same public methods as the suncertify.db.Data class. but you have not have this class in your client side.
I use same design with you. but i think we have problem. instead using
FBNServicesRemoteImpl extends UnicastRemoteObject implements FBNServices,
we may use
FBNDatabaseImpl extends UnicastRemoteObject implements ***?
Regards,
java2de
Forrest Xu
Greenhorn

Joined: Jan 30, 2002
Posts: 26
Hi,
I think your design not follow instruction.
Meanwhile, Normally Server needs more generic methods. Service method should not be included in server. for example, if some day service has been changed. in your design both server and client also needs to be changed. So I think you may change your design.
but antwhy your design help me a lot.
thanks,
java2de.
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

Originally posted by java2de XIU:
Hi,
It is good.
but for local mode, you don't need lock and unlock
method.
So I guess you may use two databaseImpl.
one called remotedabseImpl need to overrides
the lock, unlock and implements the criteriaFind method. The other localdabse don't need overrides the lock, unlock method but implements the criteriaFind method.
if you add criteriaFind method into Data class, then you can DIRECTLY use Data as local database.
AND remotedabseImpl derive from Data class and overrides the lock, unlock method.
Is it Ok?
thanks for any feedback!
java2de

Yes!!!
Mark
ravi janap
Ranch Hand

Joined: Nov 04, 2000
Posts: 389
Thanks java2de XIU for the valuable feedback.
I myself was bit sceptic about my design and it is lot more clearer now.
I shall try to improvise my design as per your suggestions.
ravi janap
Ranch Hand

Joined: Nov 04, 2000
Posts: 389
java2de.
I think your design not follow instruction.
Meanwhile, Normally Server needs more generic methods. Service method should not be included in server. for example, if some day service has been changed. in your design both server and client also needs to be changed. So I think you may change your design.
but antwhy your design help me a lot.

I have evaluated my design .
Data : I don't change anything here.
RemoteDatabaseImpl extends Data : Here , I override lock, unlock and implement criteriaFind.
LocalDatabaseImpl extends Data : Here , I don't override the lock , unlock but implement criteriaFind.
RemoteFBNIntf : defines the business logic methods to getInitialFlightInformation, searchFlight and bookFlight. These methods throws RemoteException and DatbaseException.
LocalFBNIntf : defines the business logic methods to getInitialFlightInformation, searchFlight and bookFlight. These methods throws DatbaseException.
RemoteFBNSystem implements RemoteFBNIntf extends UnicastRemoteObject : implements the business logic methods to be invoked remotely.
LocalFBNSystem implements LocalFBNIntf : implements the business logic methods to be invoked locally.
Coming to your query that the server methods need to be more generic ...
I feel that the FBNSystem provides for a interface to getInitialFlightInformation , searchFlight and bookFlight.
The client gets a reference to the server and invoke these business logic methods on the server reference. The business logic methods should have the necessary implementation to connect to remote / local database as the case may be , query the database and return a resultset to the client .
Any comments ???
-- Ravindra
Forrest Xu
Greenhorn

Joined: Jan 30, 2002
Posts: 26
Please see instruction:
to connect with your server, you should creae a cliebt program. this implemtntation should include a class that implements the same public methods as the suncertify.db.Data class. ......

your class is like below.
RemoteFBNSystem implements RemoteFBNIntf extends UnicastRemoteObject : implements the business logic methods to be invoked remotely.
where is the same public methods as the suncertify.db.Data class?
javad2e
ravi janap
Ranch Hand

Joined: Nov 04, 2000
Posts: 389
java2de XIU
I was thinking in terms of 3-tier architecture for this application i.e client(GUI), server( business methods ) and database.
I should redesign my application in terms of 2-tier architecture i.e client which implements the same public methods as Data class that also means I need to think in terms of a thick client rather than a thin client as per the sun requirements.
-- Ravindra
XJ LIN
Greenhorn

Joined: Feb 05, 2002
Posts: 18
Ravindra,
Your design needs to follow the instruction even it is good one.
Now I think you are OK.
ravi janap
Ranch Hand

Joined: Nov 04, 2000
Posts: 389
I have redesigned my application.
Sun requirement : enhance the Data class. You may do this by modification or subclassing.
My design : I choose not to modify the Data Class and rather extend it.
Sun requirement : Writing the Data Server . You must create a Data server that accepts concurrent nerwork connections and allow them to interrogate and manipulate the database. You may implement your threaded server in more than one class.
My design : I have defined a DataRemoteInterface which defines all the public methods in Data class plus lock, unlock and criteriaFind method. These methods throws remote exceptions. This class is meant for use in remote mode.
I have defines a DataServer class which extends UnicastRemoteObject and implements
DataRemoteInterface so that the methods defined in DataServer can be remotely invoked.
This class is meant for use in remote mode.

Sun requirement : Writing Data Client. This implementation should include a class that
implements the same public methods as the Data class.
My design : I have defined a class called DataClient which extends the Data class . This
class overrides the lock, unlock and implements the criteriaFind method. This class is
meant for use in the local mode directly.
Sun requirement : Creating the user interface
The user should connect to database using either a local or a network based connection according to the user choice.
My design : I have defined a FBNClient class which extends JFrame and it has reference to
DataServer and LocalData.
if ( mode.equals( remote ) )
look up for remote server object i.e DataServer
else if ( mode.equals( local ) )
DataClient object = new DataClient();
I have the following concerns about my design at this point of time.
Remote mode :
I need to duplicate the code in Data class in my DataServer class for the remote mode.
I might also be violating sun's requirements that [B]" Writing Data Client. This implementation should include a class that implements the same public methods as the Data class "[\B]
Local mode :
I am using the DataClient class and Data class only. I have nothing like a server class
defined for local mode implementation.
Meeting sun's requirements looks a bit difficult for me. I hope my design is okay now .
Any comments welcome ?
-- Ravindra
 
GeeCON Prague 2014
 
subject: FBN Design