You can also use google Guice to inject an instance of the DAO if that is what 
you want.

Check out the stripes Guice plugin for samples

Regards

--- On Thu, 9/12/10, Nikolaos Giannopoulos <[email protected]> wrote:

From: Nikolaos Giannopoulos <[email protected]>
Subject: Re: [Stripes-users] getting specified instance of DAO in ActionBean
To: "Stripes Users List" <[email protected]>
Date: Thursday, 9 December, 2010, 17:25

Milan,

In that case why bother with a DAO at all?  i.e. although it would be 
nice to plug in a DB later the problem you are going to have is where to 
store the information for the life of a user session and that is 
typically going to be on the session itself... however until you pass 
the http request to the DAO you won't have access to that.

Personally... I see 2 obvious choices:

#1  Use DAO's and add arguments to pass in the http request / session.

#2  Use a custom action bean context as I showed you in the previous 
reply and put access methods on the context itself.

I would go with #2 regardless so that it encapsulates the data you are 
retaining.

And if you need to create the additional abstraction or will want to 
eventually go to a DB then wrap #1 around it but in that case you will 
want to eventually change both the DAO interfaces (as the http request / 
session will no longer be required) and the DAO implementation;  doesn't 
totally defeat the purpose of a DAO abstraction but isn't the right thing.

In fact, the more I think about it I would look at a different design 
pattern altogether that focuses on maintaining state or simply do #2.

--Nikolaos



Milan Halenar wrote:
> Milan Halenar <mhale...@...> writes:
>
>
>
> Ad: im not using any DB, im just storing the content of file in memory in the 
> FileParser class in an ArrayList. And i need for every session to have its 
> own 
> instance of that class. I hope i cleared it a bit.
>
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Stripes-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/stripes-users
>   

------------------------------------------------------------------------------
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users



      
------------------------------------------------------------------------------
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to