You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lenya.apache.org by Michael Ralston <mi...@ralston.id.au> on 2006/05/02 03:23:15 UTC

EJB Content Generator

I'm working on a lenya project which requires a shopping cart to be built.

I would like to keep my products etc in a database and I'm using EJB 
entity beans to store these products. I've already migrated the lenya ac 
system to EJB and it's working great.

Now I'm trying to generate content from my ejb entities. I've made a 
ServiceableGenerator which is able to look up the correct entity bean 
from the publicationId, documentId, area and language. This is using an 
implementation of DocumentIdentifier as an entity which then has a 
reference to an implementation of a Lenya Node. The lenya node then has 
a references to a bunch of ContentBeans (for different versions of 
content, authoring live etc), which implement an interface which 
requires the method:
void generate(org.xml.sax.ContentHandler ch)
this way I pass the contentHandler through from the 
ServiceableGenerator, and each instance of my EJB Entity will be able to 
generate xml content in it's own way.

What I want to know next, is how to configure my publication to use this 
generator for specific document types? I've also contemplated using my 
EJBGenerator for all document types in the same way the JCRGenerator 
works. I'm having trouble understanding how this would work too. Any ideas?

Can anyone give me some ideas on what would be involved in implementing 
a EJBGenerator to completely replace the filesystem based storage? I 
believe this would have a number of advantages, especially if using the 
generate(ch) interface I mention above. You would simply implement a new 
Bean which implemented that interface and it could generate XML content, 
this could then be passed through an XSLT in the same way all other 
content is.

I'm interested in contributing the code I have written back into the 
lenya project. However I have made substantial changes to much of the 
core of lenya. I've defined interfaces for a bunch of lenya classes 
which did not have them, I've then moved all the interfaces to a 
src/common directory, so they can be shared between EJB and lenya. I've 
rewritten alot of lenya code which used arrays to use Java1.5 typed 
collections, and many for loops now use iterators instead of counting 
through an array with an index. Any ideas on the best way to contribute 
this code back? Maybe make a bunch of patches which are split into the 
different areas they effect. Unfortunetly I'm under alot of pressure to 
get the site I'm working on finished so I won't have alot of time to 
create patches such as this... so it may be a while forthcoming.

Thanks for any help :)
Michael Ralston

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


Re: EJB Content Generator

Posted by Thorsten Scherler <th...@apache.org>.
El lun, 08-05-2006 a las 08:49 +1000, Michael Ralston escribió:
> Michael Wechner wrote:
> > Doug Chestnut wrote:
> >
> >>
> >> Sweet, sounds like a good way integrate single sign on solutions.
> > sounds very good indeed. Would you be interested to share/contribute 
> > this code?
> >
> > Also is there a standard for single-sign own? E.g. with some kind of 
> > security tokens within HTTP headers and authentication mechanisms 
> > within the container?
> 
> I've just reimplemented the user, group and item interfaces as entity
> beans, then created a stateless bean to look up single user/group and
> retrieve a set of all user/group. The interface for the stateless bean
> is then access by EjbUserManager and EjbGroupManager on the lenya side.
> I also tweaked the user/group manager so they have a create method to 
> make new users/groups through the entity manager, rather than using the
> constructor directly on the User/Group object.
> 
> Not sure what you mean by single sign on, from the http point of view
> there is no difference between my ejb users and lenya's xml users, they
> both still use cocoons session object to store the user. I don't plan on
> changing this side of the interaction. The only aspect I can think of
> for single-sign on is sharing the User database with a non-lenya
> application, but this would not be truly single sign on, as you would
> have to 'sign on' more than once, but with the same details.
> 
> In regards to the EJB content generator I've been working on, I've
> implemented nodes, metadata, rcml etc. But I decided to change something
> with how nodes work... I wanted to be able to have the same content
> appear at different urls within my site. So I've made the Node pass all
> it's methods on to a Content object, which can be accessed by more than
> one different Node. This also means that the same Content object will
> provide content for Authoring and Live. This doesn't mean that editing
> Authoring will change Live without the usual workflow, as I've changed
> the RCMLEntry objects to store backups of content when it is changed.
> 
> WDYT?

I am working better with code examples. 
Can you add a patch that we can review?

salu2


> 
> Michael Ralston
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
> For additional commands, e-mail: dev-help@lenya.apache.org
> 
-- 
thorsten

"Together we stand, divided we fall!" 
Hey you (Pink Floyd)


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


Re: EJB Content Generator

Posted by Michael Ralston <mi...@ralston.id.au>.
Michael Wechner wrote:
> Doug Chestnut wrote:
>
>>
>> Sweet, sounds like a good way integrate single sign on solutions.
> sounds very good indeed. Would you be interested to share/contribute 
> this code?
>
> Also is there a standard for single-sign own? E.g. with some kind of 
> security tokens within HTTP headers and authentication mechanisms 
> within the container?

I've just reimplemented the user, group and item interfaces as entity
beans, then created a stateless bean to look up single user/group and
retrieve a set of all user/group. The interface for the stateless bean
is then access by EjbUserManager and EjbGroupManager on the lenya side.
I also tweaked the user/group manager so they have a create method to 
make new users/groups through the entity manager, rather than using the
constructor directly on the User/Group object.

Not sure what you mean by single sign on, from the http point of view
there is no difference between my ejb users and lenya's xml users, they
both still use cocoons session object to store the user. I don't plan on
changing this side of the interaction. The only aspect I can think of
for single-sign on is sharing the User database with a non-lenya
application, but this would not be truly single sign on, as you would
have to 'sign on' more than once, but with the same details.

In regards to the EJB content generator I've been working on, I've
implemented nodes, metadata, rcml etc. But I decided to change something
with how nodes work... I wanted to be able to have the same content
appear at different urls within my site. So I've made the Node pass all
it's methods on to a Content object, which can be accessed by more than
one different Node. This also means that the same Content object will
provide content for Authoring and Live. This doesn't mean that editing
Authoring will change Live without the usual workflow, as I've changed
the RCMLEntry objects to store backups of content when it is changed.

WDYT?

Michael Ralston


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


Re: EJB Content Generator

Posted by Michael Wechner <mi...@wyona.com>.
Doug Chestnut wrote:

> Hi Michael,
>
> Michael Ralston wrote:
>
>> I'm working on a lenya project which requires a shopping cart to be 
>> built.
>>
>> I would like to keep my products etc in a database and I'm using EJB 
>> entity beans to store these products. I've already migrated the lenya 
>> ac system to EJB and it's working great.
>
> Sweet, sounds like a good way integrate single sign on solutions.


sounds very good indeed. Would you be interested to share/contribute 
this code?

Also is there a standard for single-sign own? E.g. with some kind of 
security tokens within HTTP headers and authentication mechanisms within 
the container?

Thanks

Michi


-- 
Michael Wechner
Wyona      -   Open Source Content Management   -    Apache Lenya
http://www.wyona.com                      http://lenya.apache.org
michael.wechner@wyona.com                        michi@apache.org
+41 44 272 91 61


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


Re: EJB Content Generator

Posted by Doug Chestnut <dh...@virginia.edu>.
Hi Michael,

Michael Ralston wrote:
> I'm working on a lenya project which requires a shopping cart to be built.
> 
> I would like to keep my products etc in a database and I'm using EJB 
> entity beans to store these products. I've already migrated the lenya ac 
> system to EJB and it's working great.
Sweet, sounds like a good way integrate single sign on solutions.

> 
> Now I'm trying to generate content from my ejb entities. I've made a 
> ServiceableGenerator which is able to look up the correct entity bean 
> from the publicationId, documentId, area and language. This is using an 
> implementation of DocumentIdentifier as an entity which then has a 
> reference to an implementation of a Lenya Node. The lenya node then has 
> a references to a bunch of ContentBeans (for different versions of 
> content, authoring live etc), which implement an interface which 
> requires the method:
> void generate(org.xml.sax.ContentHandler ch)
> this way I pass the contentHandler through from the 
> ServiceableGenerator, and each instance of my EJB Entity will be able to 
> generate xml content in it's own way.
> 
> What I want to know next, is how to configure my publication to use this 
> generator for specific document types? I've also contemplated using my 
> EJBGenerator for all document types in the same way the JCRGenerator 
> works. I'm having trouble understanding how this would work too. Any ideas?
I am not sure if I am on the same page (a little above my head), but 
here are my ideas.  I assume that your using lenya 1.4?  Did your see 
the resource-type inputmodule and it's use of formats?

The default pub gets the resource types content like this:
<map:part src="{resource-type:format-xhtml}" />

This is defined in the resource types xconf file 
(modules/xhtml/config/cocoon-xconf/resource-type-xhtml.xconf for 
example) like so:
<format name="xhtml" uri="cocoon://modules/xhtml/xhtml.xml"/>
witch is then matched in the resource types sitemap 
(modules/xhtml/sitemap.xmap for example).

> 
> Can anyone give me some ideas on what would be involved in implementing 
> a EJBGenerator to completely replace the filesystem based storage? I 
> believe this would have a number of advantages, especially if using the 
> generate(ch) interface I mention above. You would simply implement a new 
> Bean which implemented that interface and it could generate XML content, 
> this could then be passed through an XSLT in the same way all other 
> content is.
You might want to take a look at the jcrsource module in 1.4.

I have been trying to wrap my head around using javasvn to utilize a svn 
repo for storage/versioning/locking along with a local filesystem based 
repo (working copy) for delivery.  This way I would have a master lenya 
server where authoring takes place, and then a cluster of slaves 
(perhaps slimmed down lenya builds) serving from a working copy that is 
updated every so often.  Perhaps EJB would be a good way to implement this?

> 
> I'm interested in contributing the code I have written back into the 
> lenya project. However I have made substantial changes to much of the 
> core of lenya. I've defined interfaces for a bunch of lenya classes 
> which did not have them, I've then moved all the interfaces to a 
> src/common directory, so they can be shared between EJB and lenya. I've 
> rewritten alot of lenya code which used arrays to use Java1.5 typed 
> collections, and many for loops now use iterators instead of counting 
> through an array with an index. Any ideas on the best way to contribute 
> this code back? Maybe make a bunch of patches which are split into the 
> different areas they effect. Unfortunetly I'm under alot of pressure to 
> get the site I'm working on finished so I won't have alot of time to 
> create patches such as this... so it may be a while forthcoming.
I am not sure if we want to lock lenya 1.4 to java1.5?
WDOT?

> 
> Thanks for any help :)
> Michael Ralston
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
> For additional commands, e-mail: dev-help@lenya.apache.org
> 

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