Suresh Babu Seeram

Greenhorn
+ Follow
since Feb 04, 2002
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Suresh Babu Seeram

WaHHH dean,
Really great score.. Congrats..!!!
Could you please explain your design..?
How did you implement the lock/unlocl

-Suresh
[ July 04, 2002: Message edited by: Suresh Babu Seeram ]
19 years ago
Hi Matti,

Congrats!!! It's Great Score....
Can you explain . how did you implemented Locking mechanism.
thanks in advance.
20 years ago
Hi,

Can you explain how to achieve above with sample code. I could not understand that..
Hi Mark,
Thank you very much for your reply..

getCriteriaMap. My code to create a HashMap of the criteria string is only 10 lines of code. I am confused as to what you are actually doing in this method?
In one aspect it looks like it is trying to not only make the HashMap, but also check to see if it is a match to a record, then putting it somewhere.


Thanks for your patience of reading my post and your reply.....
In method getCriterMap(String criteria,Field fieldInfo)
StringTokenzier splits the criteria twice to get fieldName[i] and dataValue[i]..
eg:
criteria = "Carrier='PromptAir',Origin airport='DAL ',Destination airport='FRA'"
fieldName[0]=Carrier dataValue[0]='PromptAir'
fieldName[1]=Origin airport dataValue[1]='DAL'
fieldName[2]=Destination airport dataValue[2]='FRA'
My HasMap is not storing fieldName[i] & dataValue[i].. Instead of that it is storing
fieldIndex[i] & dataValue[i]..


Above code gets fieldIndex by using private method getKeyIndex()..
In fieldInfo... Header contains.
fieldInfo[0]=FlightNumber
fieldInfo[1]=Origin airport
fieldInfo[2]=Destination airport
fieldInfo[3]=Carrier
fieldINfo[4]=Price..
....
...
fieldInfo[8]=Available seats...
MEthod getKeyIndex(FieldName[i],FieldInfo)..
returns corresponding index..
i.e If fieldName is "Carrier" it returns "3"
If fieldName is "Origin airport" it returns "1"
If fieldName is "Destination airport" it returns "2"
So I am storing {(3,'PromptAir'),(1,'DAL'),(2,'FRA')} in to the HashMap...

public boolean isRecordMatch(DataInfo record,Map map){
}
This method Takes Datainfo record and HashMap(fieldIndex,dataValues).. It can search fastly by using fieldIndex..
eg;
In record it search whether 3 index Value is 'PromptAir' or not. If it matches then search for origin airport is 'DAL or not.It is matches then search for Destination airport is 'FRA' or not. If all these three matches then it return true otherwise false..
Please give your feedback on this..
[ June 24, 2002: Message edited by: Suresh Babu Seeram
[ June 24, 2002: Message edited by: Suresh Babu Seeram ]
Hi Friends,
I am using search algorithm in Separate class Called SearchCriteria Builder.
Please see the following code and comment on
clarity and efficiency of this alogrithm..


criteriaFind() method will look like this..

[ June 24, 2002: Message edited by: Suresh Babu Seeram ]
[ June 24, 2002: Message edited by: Suresh Babu Seeram ]
[ June 24, 2002: Message edited by: Suresh Babu Seeram ]
[ June 24, 2002: Message edited by: Suresh Babu Seeram ]
Hi James,
In Sun's Old assignment they haven't given db.db file.. and we have generate db.db file by using methods in the Data Class.
They have changed the assignment but they haven't changed the Data class.
[ June 24, 2002: Message edited by: Suresh Babu Seeram ]
Hi Sumit,
Congratulations!!! Great job done..
I am planning to give Oracle 9i DBA in the near future.. (after 2 months..) .Presently I am working on SCJD.. Could you please send available material by email to the address: suresh.seeram@wipro.com
Thanks once again..
[ June 20, 2002: Message edited by: Suresh Babu Seeram ]
20 years ago
Hi Sai,
Thanks for quick reply..
From your recommendations...design will change like this..
Design:
db:
--Data(class)implements DataAccess
..modify this class (it also implements criteriaFind())

--DataAccess(Interface)
...defines all public methods of Data Class
...all methods throws Exception

--DataAccessRemote extends Remote,DataAcess
...methods throws DataBase,Remote & IO Exceptions.


--DataAccesFactory(interface)
...returns DataAccess or DataAccessRemote.
--DataAccessFacade (Interface)
...contains searchFlight();.bookFlight() methods..
server:

--DataServer(class) extends UnicastRemoteObject,implements DataAccessRemote
...Data Class is wrapped within

--LockManager class..

--ConnectionFactory


client:
--DataProxy(class) implements DataAccess
...Data Class is Wrapped with in...

--StartGUI(classs)
--DataAccessFacadeImpl(class) implements DataAccessFacade.
...It will use DataAccessFactory class to get the..
DataAccessLocal or DataAccessRemote..
1.From the above design.. We are modifying Data Class with full implementation of (with record locking..)lock(),unlock(),criteriaFind() methods.. but record locking is not necessary in Local mode ..
2. I have one choice in my mind. I will neither modify the Data Class nor Subclass it..
I will have DataAcess,DataAccessRemote interfaces.
--DataServer implements DataAccessRemote with implementation of record locking ... Data Class is wrapped within this class for other methods..
--DataProxy implements DataAccess.It It wrapps Data class with in for all methods.. except criteriaFind()
If I am doing above design #2.. then I am deviatiing Sun's Instruction

Part of your assignment will be to enhance the Data class. You may do this by modification or subclassing, but you should document the approach and reason for your choice.



3.


Sai-- I would rename the DataClient to DataProxy


Could you please elaborate above..
4.

Sai-- 3) You need to create an interface that extends Remote for the ConnectionFactory to implement


Could you please explain this with simple example.
regards,
Suresh
[ June 20, 2002: Message edited by: Suresh Babu Seeram ]
[ June 20, 2002: Message edited by: Suresh Babu Seeram ]
Design Choices:
db:
--Data (class)
.. I decided not to modify this class.. I want extend this..class

--DataAccess(Interface)
...defines all public methods of Data Class
...all methods doesn't throw any exceptions
...it doesn't contains criterFind() ..as it is not present in original Data class

--DataAccessLocal(Interface) extends DataAccess
...method throws databaseExceptinons & IOExceptions
...It contains additionally criteriaFind() method
--DataAccessRemote(Interface) extends Remote,DataAcess
...methods throws DataBase,Remote & IO Exceptions.
--DataAccesFactory(interface)
...returns DataAccessLocal or DataAccessRemote.
--DataAccessFacade (Interface)
...contains searchFlight();.bookFlight() methods..

--LocalData(class) extends Data,implements DataAccessLocal
--RemoteData(class) extends Data,implements DataAccessRemote.

server:

--DataServer(class) extends UnicastRemoteObject,implements DataAccessRemote
...RemoteData Class is wrapped within

--LockManager class..
... I have no idea How to implement this class....

--ConnectionFactory


client:
--DataClient(class) implements DataAccessLocal
...LocalData Class is Wrapped with in...

--StartGUI(classs)
--DataAccessFacadeImpl(class) implements DataAccessFacade.
...It will use DataAccessFactory class to get the..
DataAccessLocal or DataAccessRemote..
*************************************************
Hi Mark,Sai and Others..
I have given my intial design choice with my rudimentary knowledge.. Because I am new to design pattern.... I need your help to get good design..
Please post your opinion on above design.
I have few doubts..
1. Please explain how LockManager class will implememnt.
2. How ConnectionFactory will implement here..
Thanks in advance...
regards,
Suresh
From Sun's Instructions page:

. The user must be able to select the operating mode, although it is acceptable that the program stay in one mode once it has started up.


From the above.. It is clear that We have to
Provide Operating mode(loca or remote) in UI...
eg:
I started application with the following command:
java StartGUILocalMode
In GUI I can switch.. to remote mode..
IF I started apps
java StartGUIRemoteMode
then I can switch to local mode..
Correct me If I am wrong.
Hi Sai & Mike,
Thanks for your suggestions.
Hi Mike,
Then How do you book the flight for particular Date.
Hi,
What I feel is
1) db.db file is Master table for Flights information.
2) We can add one or more ".db" files in our project. eg. FlightsReservationData.db, FlightCustomersData.db
Correct me If I am Wrong..

regards,
Suresh
Which pattern is good for our assignment.
Let me know how you guys are implementing?
What are pros & cons of these two patterns in our application (GUI).

Please reply with details.
Hi Mark & Junillu
Thanks for your suggestions..
mark SCJD FAQ is really good for starters..