File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Overall architecture for the FBN Project, a question ... 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 "Overall architecture for the FBN Project, a question ..." Watch "Overall architecture for the FBN Project, a question ..." New topic
Author

Overall architecture for the FBN Project, a question ...

arvindpopli
Greenhorn

Joined: Jul 06, 2001
Posts: 5
My overall architecture for the FBN Project is: (RMI implementation)
I modularized the design by having the Database and Communication functionality operations as two separate classes, so that the GUI or the Client shall not have to be changed when either the Database or the Communications operation is changed or modified.

- DATABASE functionality: (database operations)
*Database interface -> which has definitions of all the public methods of the Data Class along with lock, unlock and criteriaFind method definitions.
*DatabaseImpl Class -> extends Data class and implements the Database interface. Overrides lock, unlock methods and implements the criteriaFind method. (so basically I do not change anything in the Data class).

- COMMUNICATION functionality: (Flight Services such as booking, search Flights etc..)
*FlightServices interface -> which has communication method definitions like: getInitialFlightInformation(...), searchFlight(...), bookFlight(...). And all of these methods throw only Exceptions.
*FlightServicesRemoteImpl class extends UnicastRemoteObject implements FlightServices and throws RemoteExceptions -> handles the communication part btwn clients and remote server. Has a reference to DatabaseImpl object to access the Database on the server.
*FlightServicesLocalImpl class implements FlightServices and throws Exception -> handles the communication part btwn clients and local server, bypasses RMI. Has a reference to DatabaseImpl object to access the Database locally.
Note: The reason for having two identical classes: FlightServicesRemoteImpl, FlightServicesLocalImpl (excepting the constructors) that the Remote throws RemoteExceptions and the Local throws only Exceptions.

- CLIENT: (currently non-GUI)
if (networkMode.equals("local")) {
FlightServicesLocalImpl fsLocal = new FlightServicesLocalImpl();
//Get LOCAL Initial Flight Information: ORIGIN, DESTINATION
System.out.println("LOCAL:: Getting Initial Flight Information: " + fsLocal.getInitFlightInfo());
.
.
.
}
//REMOTE MODE
else if (networkMode.equals("remote")) {
if(System.getSecurityManager() == null) {
System.setSecurityManager( new RMISecurityManager() );
}
String name = "//" + host + ":" + portno + "/FlightServices";
FlightServices fsRemote = (FlightServices)Naming.lookup(name);
//Get Initial Flight Information: ORIGIN, DESTINATION
System.out.println("Getting REMOTE Initial Flight Information: fsRemote.getInitFlightInfo());
.
.
.
}

- SERVER:
Binds the FlightServicesRemoteImpl object with the main Server Object.
Now my question is :
According to one of the project specs, one has to implement: "client-side database client part that handles the networking on behalf of the user interface". Am i doing the right thing in the design above ?

Any advice shall be appreciated
Thanks,
Arvind.

Rick Fortier
Ranch Hand

Joined: Jun 04, 2001
Posts: 147
That is pretty much the same design I had, and I passed.
My goal was to keep the GUI ignorant of the inner workings of the database so that it could be easily changed. To put all of the business logic in the Flight Services class and require any future GUIs to use it.
arvindpopli
Greenhorn

Joined: Jul 06, 2001
Posts: 5
Thanks, Rick. And congratulations on clearing the SCJD.
-Arvind
Jim Dong
Greenhorn

Joined: Jul 09, 2001
Posts: 12
Arvind,
in your message, your design is:
<bold>
- DATABASE functionality: (database operations)
*Database interface -> which has definitions of all the public methods of the Data Class along with lock, unlock and criteriaFind method definitions.
*DatabaseImpl Class -> extends Data class and implements the Database interface. Overrides lock, unlock methods and implements the criteriaFind method. (so basically I do not change anything in the Data class).
</bold>
I have a question:
Since your Database interface AND Data class both have lock/unlock and criteriaFind methods, how do you extend Data class and implement Database interface at the same time for DatabaseImpl class? Please clarify a little bit.
Thanks in advance.
[This message has been edited by Jim Dong (edited July 30, 2001).]
Rahul Mahindrakar
Ranch Hand

Joined: Jul 28, 2000
Posts: 1836
arvindpopli
Your user id is not valid as per the Javaranch naming conventions. Please refer to the document located here
You will have to re-register with a valid user id and comply with these conventions.
Thanks.

------------------

Mahindrakar
IBM Application Server Forum Moderator
Consultant - Zensar Technologies.
SCJP2, SCJD2 & SCJEA (Part I)

[This message has been edited by Rahul Mahindrakar (edited July 29, 2001).]
Arvind Popli
Greenhorn

Joined: Jul 30, 2001
Posts: 7
Originally posted by Jim Dong:
Arvind,
in your message, your design is:
<bold>
- DATABASE functionality: (database operations)
*Database interface -> which has definitions of all the public methods of the Data Class along with lock, unlock and criteriaFind method definitions.
*DatabaseImpl Class -> extends Data class and implements the Database interface. Overrides lock, unlock methods and implements the criteriaFind method. (so basically I do not change anything in the Data class).
</bold>
I have a question:
Since your Database interface AND Data class both have lock/unlock and criteriaFind methods, how do you extend Data class and implement Database interface at the same time for DatabaseImpl class? Please clarify a little bit.
Thanks in advance.
[This message has been edited by Jim Dong (edited July 30, 2001).]

Hi Jim,
Database interface just has lock,unlock and criteriaFind method definitions along with other public method definitions of the Data class. And DatabaseImpl class extend Data class and implement Database interface:
public class DatabaseImpl extends Data implements Database {
}
-Arvind
Jim Dong
Greenhorn

Joined: Jul 09, 2001
Posts: 12
Hi Arvind,
thanks for the reply. Maybe I didn't make myself clear. Please see my renewed explanation/question below.
You wrote:

Hi Jim,
Database interface just has lock,unlock and criteriaFind method definitions along with other public method
definitions of the Data class. And DatabaseImpl class extend Data class and implement Database interface:
public class DatabaseImpl extends Data implements Database {
}
-Arvind


My question is: Does Data class implement Database interface? I guess in your design it doesn't.
So your Data class would be like:
class Data {
...
void lock(int recordID);
void unlock(int recordID);
...
}
And your Database interface would have the redundant methods defined:
interface Database {
...
void lock(int recordID);
void unlock(int recordID);
...
}
When it comes to define DatabaseImpl class, you have following:
public class DatabaseImpl extends Data implements Database {
...
void lock(int recordID);
void unlock(int recorID);
}
Do the methods lock, unlock in DatabaseImpl implement the mothods in Database interface or do they override the methods defined in Data class?
If you removed lock, unlock and other methods from Data class that are defined in the Database interface, the it would be no confusions.
Please correct me if you think I miss something here.
Thanks.

[This message has been edited by Jim Dong (edited July 31, 2001).]
Arvind Popli
Greenhorn

Joined: Jul 30, 2001
Posts: 7
Hi Jim,
>Do the methods lock, unlock in DatabaseImpl implement the methods in Database interface or do they override the methods defined in Data class?
Database interface has only method definitions of lock, unlock. And as DatabaseImpl class extends Data class it overrides those methods. (Data class has empty lock and unlock methods).

>If you removed lock, unlock and other methods from Data class that are defined in the Database interface, the it would be no confusions.
U are right, but my point of doing this is that I do not want to touch/modify the Data class methods, with one exception of changing the Data class for removing the deprecated methods.
Lemme me know if this helps.
-Arvind
[This message has been edited by Arvind Popli (edited August 02, 2001).]
[This message has been edited by Arvind Popli (edited August 02, 2001).]
Jim Dong
Greenhorn

Joined: Jul 09, 2001
Posts: 12
Thanks Arvind! Now I understand what you are trying to do.
Thanks again.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Overall architecture for the FBN Project, a question ...
 
Similar Threads
FBN Design
design comments ...
Exception Handling
Differences btwn (response.sendRedirect) and (Requestdispatcher.forward)
Design issues with local-remote Data class