views:

97

answers:

2

I have come up with a small project to help me learn Java EE, i'm unsure what technology best suites what I want to achieve however so i'm hoping someone can point me in the right direction.

What is essentially a gloried web crawler should be constantly running somewhere - maybe updating a database or not (the information will become out of date quickly so there might be no need to persist the information).

Clients can then view the up to date information when they log in, i presume a servlet is the best approach for this.

I'm not sure what technology is best for this kind of 'always running service'. I want the information always there regardless of whether a client is viewing it or not.

What approach would you take? While i realise it might not be the best solution using an application server for this, i'm doing this as a fun project for myself to help me learn.

A: 

Ill address each point below:

1) Your concern over storing data in a db or not. The information should be stored in a database as your server will die from not having enough memory to keep everything available freely.

2) When clients log in yes you would want to use a servlet. To be more specific you would want a layer of abstraction between the model and the database. The Controller would speak with the model about its current state than proceed to paint the view (the web page) with the most recent data.

3) I wouldn't necessarily classify this as a service so to speak, but more so a portal of information. An application server is fine for this type of work as it provides a central point for clients to interface with the application.

Woot4Moo
+1  A: 

have come up with a small project to help me learn Java EE, i'm unsure what technology best suites what I want to achieve however so i'm hoping someone can point me in the right direction..

Let's try. I'll base my answer on Java EE 6.

Clients can then view the up to date information when they log in, I presume a servlet is the best approach for this.

Or JSF 2.0 and Facelets (Facelets are the default view technology in JSF 2.0 and replace JSP as the view technology for pages)

I'm not sure what technology is best for this kind of 'always running service'. I want the information always there regardless of whether a client is viewing it or not.

It would be probably easier to run this in another VM but you could try with an @Asynchronous bean with EJB 3.1. See the links below.

See also

Pascal Thivent
Thanks, i'll try an Asynchronous bean and will play about with JSF. When you say run in another VM do you mean just as POJO's? I'm not particulary looks for the most eligant or best solution, just most practical for learning the different aspects of Java EE
AphexMunky
@AphexMunky Then Java EE 6 and `@Asynchronous` EJB will give you more fun (and yes, I meant a standalone application).
Pascal Thivent
Perhaps a timer EJB would be better?
Justin
@Justin I thought about this too but running something periodically is not exactly what the OP described. Maybe an alternative though.
Pascal Thivent