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 Baranov <mi...@gmail.com> on 2008/02/21 19:57:38 UTC

More newbie questions

Hi!

How do I have a member section in lenya (live mode). I want to 
authenticate members against an existing external source. I also want to 
have self-registration page/module. Any suggestions which way to dig? 
Thanks!

Michael.
P.S. Just trying to figure out how to use lenya for my needs... what 
needs to be done and what's the simplest way to do it.

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


Re: Getting the Doctype in a custom export task

Posted by Andreas Hartmann <an...@apache.org>.
solprovider@apache.org schrieb:
> The "doctype" is decided in {pub}/parameter-doctype.xmap
> Rewrite the relevant portion in Java.
> In English, the default pub uses:
> 
> if identifier = "/index.html", doctype = "homepage"
> docNameSpace = [use code from SourceTypeAction]
> if docNameSpace = "http://www.w3.org/1999/xhtml", doctype = "xhtml"
> if docNameSpace = "http://apache.org/lenya/pubs/default/1.0", doctype = "links"
> 
> The code for SourceTypeAction and related classes is at:
> http://svn.apache.org/viewvc/forrest/trunk/main/java/org/apache/forrest/sourcetype/
> 
> The disadvantage is this code reduces maintainability, meaning
> additional work is required when changing the doctypes.  No worries if
> the export will only be run once. I would add a comment in
> parameter-doctype.xmap about the additional work so nobody adds a
> doctype in the next decade and breaks the export function.

Alternatively, you can just replace the matchers in 
parameter-doctype.xmap with an action that uses the code solprovider 
describes. So you don't have the problem of knowledge duplication. But 
this requires a bit more work.

BTW, in 2.0 there's a Document.getResourceType() method, and the 
resource type name is stored in the meta data. The resolving mechanism 
(URIParameterizer) of 1.2 is really quite impractical for using in Java 
code.

-- Andreas

> 
> Have you defined custom doctypes?  You might use "xhtml" for all
> documents, then handle the homepage separately. Or you might create
> easier rules than the default system e.g. documents in the "products"
> directory are doctype="product".
> 
> solprovider
> 
> On 3/6/08, Douglas.Hurbon@mail.cuny.edu <Do...@mail.cuny.edu> wrote:
>> I'm using lenya 1.2.4
>>
>> We are re-writing the default export class: staticHTMLExport.java
>>
>> The goal is to have an entire publication's pages statically exported with
>> the push of one button.  In doing so we also need to get the document type
>> of each document we are statically exporting (for a variety of reasons).
>>
>>  So from the within the java code, is there a way to get/construct the
>> document type.  Creating a pub and then creating the document doesn't give
>> us the document type.  It's simply not a property or method of a document:
>>
>> http://lenya.apache.org/apidocs/1.2/org/apache/lenya/cms/publication/Document.html
>>
>> Since all the URL's of the pub are fired from within the java class, we
>> don't have a page envelope for any given document, and are currently trying
>> to construct one, but need a cocoon Object Model in order to do so, as in:
>>
>> http://lenya.apache.org/apidocs/1.2/org/apache/lenya/cms/publication/PageEnvelope.html
>>
>> It seems like there should be a better way to do this rather than
>> reconstruct the entire cocoon environment for each document we wish to
>> export.
>>
>> Cheers,
>> -doug


-- 
Andreas Hartmann, CTO
BeCompany GmbH
http://www.becompany.ch
Tel.: +41 (0) 43 818 57 01


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


Re: Getting the Doctype in a custom export task

Posted by so...@apache.org.
The "doctype" is decided in {pub}/parameter-doctype.xmap
Rewrite the relevant portion in Java.
In English, the default pub uses:

if identifier = "/index.html", doctype = "homepage"
docNameSpace = [use code from SourceTypeAction]
if docNameSpace = "http://www.w3.org/1999/xhtml", doctype = "xhtml"
if docNameSpace = "http://apache.org/lenya/pubs/default/1.0", doctype = "links"

The code for SourceTypeAction and related classes is at:
http://svn.apache.org/viewvc/forrest/trunk/main/java/org/apache/forrest/sourcetype/

The disadvantage is this code reduces maintainability, meaning
additional work is required when changing the doctypes.  No worries if
the export will only be run once. I would add a comment in
parameter-doctype.xmap about the additional work so nobody adds a
doctype in the next decade and breaks the export function.

Have you defined custom doctypes?  You might use "xhtml" for all
documents, then handle the homepage separately. Or you might create
easier rules than the default system e.g. documents in the "products"
directory are doctype="product".

solprovider

On 3/6/08, Douglas.Hurbon@mail.cuny.edu <Do...@mail.cuny.edu> wrote:
> I'm using lenya 1.2.4
>
> We are re-writing the default export class: staticHTMLExport.java
>
> The goal is to have an entire publication's pages statically exported with
> the push of one button.  In doing so we also need to get the document type
> of each document we are statically exporting (for a variety of reasons).
>
>  So from the within the java code, is there a way to get/construct the
> document type.  Creating a pub and then creating the document doesn't give
> us the document type.  It's simply not a property or method of a document:
>
> http://lenya.apache.org/apidocs/1.2/org/apache/lenya/cms/publication/Document.html
>
> Since all the URL's of the pub are fired from within the java class, we
> don't have a page envelope for any given document, and are currently trying
> to construct one, but need a cocoon Object Model in order to do so, as in:
>
> http://lenya.apache.org/apidocs/1.2/org/apache/lenya/cms/publication/PageEnvelope.html
>
> It seems like there should be a better way to do this rather than
> reconstruct the entire cocoon environment for each document we wish to
> export.
>
> Cheers,
> -doug

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


Getting the Doctype in a custom export task

Posted by Do...@mail.cuny.edu.
Hello all,

I was told (thanks Solprovider) that this is a lenya user list question:

I'm using lenya 1.2.4

We are re-writing the default export class: staticHTMLExport.java

The goal is to have an entire publication's pages statically exported with 
the push of one button.  In doing so we also need to get the document type 
of each document we are statically exporting (for a variety of reasons).

So from the within the java code, is there a way to get/construct the 
document type.  Creating a pub and then creating the document doesn't give 
us the document type.  It's simply not a property or method of a document:

http://lenya.apache.org/apidocs/1.2/org/apache/lenya/cms/publication/Document.html

Since all the URL's of the pub are fired from within the java class, we 
don't have a page envelope for any given document, and are currently 
trying to construct one, but need a cocoon Object Model in order to do so, 
as in:

http://lenya.apache.org/apidocs/1.2/org/apache/lenya/cms/publication/PageEnvelope.html

It seems like there should be a better way to do this rather than 
reconstruct the entire cocoon environment for each document we wish to 
export.

Cheers,

-doug 

Re: More newbie questions

Posted by so...@apache.org.
My notes about implementing a members-only section in Lenya 1.2 are at:
http://solprovider.com/lenya/security

I have working code for a combination login/registration page, but
never packaged and posted it.  From memory, I ignored the standard
"login", created a "session" Usecase, fixed login.xsp, and wished
Cocoon Actions did not break most Cocoon functionality.  Does that
help?

Andreas already answered about custom Authenticators.

solprovider

On Thu, Feb 21, 2008 at 1:57 PM, Michael Baranov
<mi...@gmail.com> wrote:
>  How do I have a member section in lenya (live mode). I want to
>  authenticate members against an existing external source. I also want to
>  have self-registration page/module. Any suggestions which way to dig?
>  Thanks!
>
>  Michael.
>  P.S. Just trying to figure out how to use lenya for my needs... what
>  needs to be done and what's the simplest way to do it.

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


Re: More newbie questions

Posted by Andreas Hartmann <an...@apache.org>.
Andreas Hartmann schrieb:
> Michael Baranov schrieb:
>> Hi!
>>
>> How do I have a member section in lenya (live mode). I want to 
>> authenticate members against an existing external source. I also want 
>> to have self-registration page/module. Any suggestions which way to dig? 
> 
> If you want to use a custom authentication mechanism, you have to 
> implement a custom access controller.

Sorry, that should read "custom authenticator".

-- Andreas


-- 
Andreas Hartmann, CTO
BeCompany GmbH
http://www.becompany.ch
Tel.: +41 (0) 43 818 57 01


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


Re: More newbie questions

Posted by Andreas Hartmann <an...@apache.org>.
Michael Baranov schrieb:
> Hi!
> 
> How do I have a member section in lenya (live mode). I want to 
> authenticate members against an existing external source. I also want to 
> have self-registration page/module. Any suggestions which way to dig? 

If you want to use a custom authentication mechanism, you have to 
implement a custom access controller. There's not much documentation 
about it, but the concept is quite simple. Some docs are in the 1.2 section:

http://lenya.apache.org/docs/1_2_x/components/accesscontrol/authenticators.html

Basically you have to implement the Authenticator interface:
http://lenya.apache.org/apidocs/2.0/org/apache/lenya/ac/Authenticator.html

For an example of authentication against an external source, you could 
take a look at the Shibboleth branch:

http://svn.apache.org/viewvc/lenya/branches/branch_1_2_x_shibboleth/

especially the ShibbolethAuthenticator:

http://svn.apache.org/viewvc/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/shibboleth/ShibbolethAuthenticator.java?view=log

HTH,

-- Andreas


-- 
Andreas Hartmann, CTO
BeCompany GmbH
http://www.becompany.ch
Tel.: +41 (0) 43 818 57 01


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