Sachin Jai

Greenhorn
+ Follow
since May 05, 2005
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 Sachin Jai

yes, you are correct, Singelton is one solution. But another doubt is what if I defined it as non static? Would that be inefficient ( from memory perspective)?
13 years ago
I am writing business logic for a web application in which web tier is done using JSF. My business logic is pretty much independent of UI aspects.

In few of my logic classes an error message bundle object is defined as:
/** The error message bundle object */
private static final AppResourceBundleUtil ERROR_MSG_RESOURCE_BUNDLE
= new AppResourceBundleUtil ( AppLogicConstants.APP_ERRORS );

Where AppResourceBundleUtil's construtor loads the resource bundle and this class has a method to access a message by key name.
My understanding is if I code this way then there will be many instances of AppResourceBundleUtil since they are static.

My confusion is should I define this object as public static final AppResourceBundleUtil ERROR_MSG_RESOURCE_BUNDLE in one utility class so that single instance is used in all the classes.
OR
Should I define as non static member in every class where I intend to use it : private final AppResourceBundleUtil ERROR_MSG_RESOURCE_BUNDLE

Which would be better approach?

TIA,
Sachin
13 years ago
We have a web application presentation layer is done using JSF which talks to business logic layer interfaces ( supplied as jar to JSF application) and business logic access DAO layer jar file to talk to backend.

My question is: Which is the best place ( in which layer) to put "log" statement when handling the exception? Should exception be logged when first caught? or let it propagate to UI layer and there it is logged?
Thanks to all for reply...

I am not too sure that If the sorting could be used for my validation.
My requirement is to compare object against all other objects based on some rules like: if Obj1.val1 == Obj2.val1 then check Obj1.val2 < Obj1.val2
and there are some more rules like this.
[ June 17, 2008: Message edited by: Sachin Jai ]
14 years ago
I guess we can't do that reason for that is that our data is coming from CSV file through a CSV parser. The CSV parser returns List of objects.
14 years ago
My problem statment is:

1."n" number of objects are stored in an Array list. We do have some limit for value "n". And these need to be cross validated.
2. There are certain set of rules that makes each object unique.
3. Requirement is to validate the list against such rules and throw some exception if validation fails.

My solution:
1. I take first object from the list and compare it against rest of the objects in the list. If validation passes then I remove first object from the list.
2. Repeat step 1 for second object and follow it untill list is empty. If any validation fails I stop in between and throw exception.

My Issue: It takes way too long to finish this process, almost 20 mins for around 3000 objects in collection.
Any other appraoch/method I could use to do this job very quickly?





TIA... Any suggestion appreciated.
[ June 17, 2008: Message edited by: Sachin Jai ]
14 years ago
Hi,
I need to develop an Extended datatable component based on existing Sun JSF h ataTable component.
The following features are needed for table ( And may be all these should be configurable as well):
1.Column Sorting
2.Select All Checkbox Coulmn
3.Pagination-It should display records range in a drop-down
4. A button panel bar which would do ADD/EDIT/Delete/refersh etc..

I am able to do all of these but not in a generic way. Like I have a seperate Button bar( made of htmlCommandButtons) and attached it with datatable's datamodel. Similary , i have got pagination working but with using an seperate <h:selectOneMenu> with logic inside backing bean. Select All checkbox as a coulmn in datatable.

Can anybody suggest a design pattern for such component? How should all these pieces should be organised so that it will result in a single extended table component?

Any suggestions greatly appreciated.

Thanks in Advance.
Sachin
17 years ago
JSF