You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@lenya.apache.org by Michael Ralston <mi...@ralston.id.au> on 2005/10/17 11:59:31 UTC

org.apache.lenya.ac.ejb - database user objects

Attached is a patch for the EJB user backend I wrote for Lenya early 2005. 
Please note this was created on an early incubating version of lenya. This 
patch will probably not apply against any current version of lenya, 1.2 or 
1.4. This code was also compiling with java 1.5, I don't think it does 
anymore. It was working great back in January though, so it is feasible.

I'm just sending it to the list so some people who are interested in 
implementing something similar can get an idea of how I did it.

To be honest, it's that long ago that I don't remember why I did certain 
things... and as you can tell I didn't comment very well either :)

One of the things that was necessary for me to use EJB's with lenya.ac was to 
change alot of the typed arrays to Collections with parameters. I don't know 
whether lenya has done this in version 1.4.

When I find where I put the code for the actual entity beans etc, I'll post 
that too. But it was written on an early alpha version of Jboss EJB3, and it 
no longer compiles as the api has changed quite a bit.

I will eventually rewrite all this code to work with lenya 1.4. If anyone else 
is interesting in a database backend for lenya, let me know and we can use 
this as a starting point. When I have rewritten it to work with a current 
version of lenya I will contribute the patch to bugzilla, I didn't want to 
stick this non-working patch on there.

Just to make sure you understand me completely, don't try to apply this patch 
and compile it, because it won't work. Just read it to get an idea of what I 
did and how this can be done.

Michael Ralston

Re: org.apache.lenya.ac.ejb - database user objects (w/ The actual Entity Beans)

Posted by Michael Ralston <mi...@ralston.id.au>.
On Mon, 17 Oct 2005 09:59 pm, Emmanouil Batsis wrote:
> On Monday 17 October 2005 12:59, Michael Ralston wrote:
> > I'm just sending it to the list so some people who are interested in
> > implementing something similar can get an idea of how I did it.
>
> Great, thanks. From what i can see you have submitted patches to the lenya
> codebase itself, to become more EJB-friendly but not parts from the actual
> implementation right?

Yep, attached to this email is a tar of the Session and Entity Beans I made.

Note that the actual beans doing stuff are in 'net.stral.access' the beans in 
'net.stral.contact' are what I was attaching to the access beans for storing 
business related information which lenya has no concern with.

Also as my last email said, these beans were implemented on a very early 
version of JBoss EJB3 and they don't work anymore.

>
> > When I find where I put the code for the actual entity beans etc, I'll
> > post that too. But it was written on an early alpha version of Jboss
> > EJB3, and it no longer compiles as the api has changed quite a bit.
>
> I'm currently implementing the backend using session beans and Hibernate 3
> (which is now JBoss' EJB 3 implementation) but without actually using the
> EJB 3 entity persister etc; just session beans over DAOs on JBoss. This
> approach can be tweacked to work on all appservers (i currently deploy
> Hibernate POJOs as a HAR).
>

Why did you choose to use Hibernate directly, rather than via Entity beans? 
Just curious as to what other approach I could have taken with my 
implementation.

> > I will eventually rewrite all this code to work with lenya 1.4. If anyone
> > else is interesting in a database backend for lenya, let me know and we
> > can use this as a starting point.
>
> Sounds cool but what are we going to use as a workspace to collaborate?
>

I have a server on the net which I can set up a cvs/subversion server or 
something if you want to cooperate that way.

> Currenty my implementation is as follows:
>

Mine was fairly similar, but I stayed completely within the JBoss EJB 
implementation.

>
> I think the furthest we can go for the lenya trunk (besides making the
> signatures more EJB-friendly) is to provide configurable lenya.ac
> implementations that will depend on an EJB provided by the user(hence the
> configurable part) and an additional interface for that EJB to implement.
>

Not sure what you mean here, can you explain what the configuration will 
specify?

I was designing my EJB implementation so that it could store info for many 
lenya websites running inside a single application server (with apache mod 
proxy etc). It stores which directory the lenya publication is running from 
so users are unique across publications. In this way it didn't really need 
any configuration.

> I'm currently trying to figure out how to move everything to the database,
> including users, groups, roles and user rights and metadata per document
> etc. My biggest trouble is to figure out the right places to hook my EJBs
> to update this information (when a document is created for example, how to
> create the initial metadata and rights for it in the DB).

In my research I found that lenya has interfaces for just about everything, I 
then found which classes implemented these interfaces using File IO, and then 
I reimplemented those to talk to beans.

I haven't looked into it too deeply, but I can see where that would be 
possible for some other parts of lenya, eg the scheduler (which has serious 
issues with garbage collection when running on windows).

I'm not sure if moving the metadata into a database would be that useful, some 
of the metadata should be available for the xslt to extra and stick into the 
header tag of the output html. I think it's a really sticky area, when do you 
leave things in files and when do you put them in a database? You don't want 
to over-complicate lenya by moving too much into a database as I think 
lenya's simplicity (in the rendering pipeline anyway) is one of its 
advantages.

Michael

Re: org.apache.lenya.ac.ejb - database user objects

Posted by Emmanouil Batsis <ma...@geekologue.com>.
On Monday 17 October 2005 12:59, Michael Ralston wrote:
> I'm just sending it to the list so some people who are interested in
> implementing something similar can get an idea of how I did it.


Great, thanks. From what i can see you have submitted patches to the lenya 
codebase itself, to become more EJB-friendly but not parts from the actual 
implementation right? 

> When I find where I put the code for the actual entity beans etc, I'll post
> that too. But it was written on an early alpha version of Jboss EJB3, and
> it no longer compiles as the api has changed quite a bit.

I'm currently implementing the backend using session beans and Hibernate 3 
(which is now JBoss' EJB 3 implementation) but without actually using the EJB 
3 entity persister etc; just session beans over DAOs on JBoss. This approach 
can be tweacked to work on all appservers (i currently deploy Hibernate POJOs 
as a HAR).


> I will eventually rewrite all this code to work with lenya 1.4. If anyone
> else is interesting in a database backend for lenya, let me know and we can
> use this as a starting point. 

Sounds cool but what are we going to use as a workspace to collaborate?

Currenty my implementation is as follows:

+------------------------------------+
| Custom Implementations of          | 
| lenya.ac.AccreditableManager etc   |
+------------------------------------+
                 |
                RMI
                 |
          +-------------+
          |  EJBs tier  |
          +-------------+
                 |
+------------------------------------+
|Hibernate 3 based DAOs using JTA    |
|transactions (managed completely by | 
|the container:                      |  
| SessionFactory.getCurrentSession() |
+------------------------------------+


I think the furthest we can go for the lenya trunk (besides making the 
signatures more EJB-friendly) is to provide configurable lenya.ac 
implementations that will depend on an EJB provided by the user(hence the 
configurable part) and an additional interface for that EJB to implement. 

I'm currently trying to figure out how to move everything to the database, 
including users, groups, roles and user rights and metadata per document etc. 
My biggest trouble is to figure out the right places to hook my EJBs to 
update this information (when a document is created for example, how to 
create the initial metadata and rights for it in the DB).

Manos


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org