You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lenya.apache.org by Richard Frovarp <Ri...@sendit.nodak.edu> on 2007/08/01 22:41:51 UTC

Leaving links as lenya-document

The question was brought up during the hackathon as to what to do about 
the possibility of changing nodes while a document referring to them was 
being edited. Didn't we decide that we could just leave links in their 
lenya-document form when loading a document to be edited? We can't do 
that for images, as the editors need to be able to display those. 
However, the chances of a document changing URL is probably greater than 
an image changing URL. The form editors are the only editors at the 
moment to not translate to a URL upon edit. The link insert that Jörn 
came up with does insert lenya-document links, so that part is already 
taken care of.

Richard

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


Re: Leaving links as lenya-document

Posted by Jörn Nettingsmeier <ne...@apache.org>.
Thomas Comiotto wrote:
>>> i don't know xopus, but i think all editors could be rewritten not to
>>> duplicate aggregations and transformations from the publication - by
>>> delegating it. every editor is free to apply another post-processing
>>> step and tweak the content as it wants (see tiny again: the rendered
>>> page from the publication sitemap is augmented with the necessary
>>> javascript snippets).
>> 
> No. Every web-based visual xml editor I am aware of is driven by some 
> sort of xml-to-xhtml mapping (the rest does raw document styling by css 
> and direct xml processing - see BXE 1). BTW I guess you would want xhtml 
> editors to operate on the raw source.

but they do. tiny does, fck does as well. with xhtml, the "raw source" 
is almost what people want to see, plus some css.
tiny just delegates the rest of the page rendering to the publication so 
that the surroundings (navigation, tabs, etc.) look right without code 
duplication. bxe does unspeakably ugly things to achive the same goal 
(or maybe it's just our integration...).

if an xml editor wants to work on the source, it can. but if it forces 
me to re-write my existing transformations in weird ways to cater to 
editor oddities (once for every resource type), then i'm not going to 
use it.

> For the xml-to-xhtml variants the content server has to provide what's 
> needed to build the corresponding map. This is usually xslt data (XOpus, 
> BXE 2, Yulup) for doing a xml-to-xhtml transformation whereas xslt's are 
> not only used for rendering the corresponding page (what you would like 
> to delegate to the server) but also for back-propagating modifications 
> from xhtml to xml.

well, i still don't really buy that "visual xml editor" thing... it may 
work for presentation-centric markup with a dash of semantics here and 
there, but never for generic xml with lots of data and heavy semantics.
if you can say it in xhtml, it's probably boring in xml >:->

> What's needed is a simple and possibly standardized way of generating 
> xslt's required by those editors out of what's already in use in the 
> xhtml rendering pipelines.

could work for xslt simple xslt.

but not for other transformations, such as i18n, uuid or proxy. at that 
point it's easy to introduce just one more kludgy hack, and then the 
number of hacks rises exponentially and you introduce N custom 
re-rendering mechanisms of what the presentation already does, where N 
is number of doctypes times number of editors you need to support...

<rant>
and that's where i'd rather give up the shiny visual-ness and confront 
the users with the true nature of what they are dealing with: semantic 
markup that is only marginally presentation-orientated.
after the initial shock, they will produce better markup that with a 
what-you-see-is-what-i-thought-you-meant-or-what-you-thought-looks-good 
interface.
i still think the best approach to arbitrary grammars is automatic form 
generation (but then i've tried that and accepted defeat for now).
</rant>

are you experimenting with lenya 2.0 already? let me know what kind of 
xslt data you need and how, and i'd be very happy to try figure out 
elegant ways of providing it. i'm just saying that there is a point 
where the tradeoff between visual-ness and kludge turns bad...

regards,

jörn


-- 
Jörn Nettingsmeier

"One of my most productive days was throwing away 1000 lines of code."
   - Ken Thompson.

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


Re: Leaving links as lenya-document

Posted by Thomas Comiotto <th...@id.uzh.ch>.
>> i don't know xopus, but i think all editors could be rewritten not to
>> duplicate aggregations and transformations from the publication - by
>> delegating it. every editor is free to apply another post-processing
>> step and tweak the content as it wants (see tiny again: the rendered
>> page from the publication sitemap is augmented with the necessary
>> javascript snippets).
>

No. Every web-based visual xml editor I am aware of is driven by some  
sort of xml-to-xhtml mapping (the rest does raw document styling by  
css and direct xml processing - see BXE 1). BTW I guess you would  
want xhtml editors to operate on the raw source.

For the xml-to-xhtml variants the content server has to provide  
what's needed to build the corresponding map. This is usually xslt  
data (XOpus, BXE 2, Yulup) for doing a xml-to-xhtml transformation  
whereas xslt's are not only used for rendering the corresponding page  
(what you would like to delegate to the server) but also for back- 
propagating modifications from xhtml to xml.

What's needed is a simple and possibly standardized way of generating  
xslt's required by those editors out of what's already in use in the  
xhtml rendering pipelines.


Cheers
Thomas


------------------------------------------------------------------------ 
-----
                         Thomas Comiotto              
thomas.comiotto@id.uzh.ch

                         Universitaet Zuerich
                         Informatikdienste                Tel: +41 44  
63 54541
                         Winterthurerstrasse 190               +41 44  
63 43333
                         CH-8057 Zuerich                  Fax: +41 44  
63 54505





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


Re: Leaving links as lenya-document

Posted by Andreas Hartmann <an...@apache.org>.
Jörn Nettingsmeier schrieb:
> Andreas Hartmann wrote:
>> Jörn Nettingsmeier schrieb:
>>> Richard Frovarp wrote:
>>>> The question was brought up during the hackathon as to what to do
>>>> about the possibility of changing nodes while a document referring to
>>>> them was being edited. 
> <snip>
>>> 1. there is a *single* global pipeline in the core that gets to handle
>>> all outgoing content. this pipeline applies the i18n, uuid2uri and proxy
>>> transformations as well as any necessary namespace node cleanups
>>> (probably even prettyprinting, if desired).
>>
>> The proxy transformation is configurable (absolute/relative URLs).
>> Can we assume that a global setting is sufficient, or do we need this
>> per publication?
> 
> if people need to configure that, we provide a configuration option
> (maybe in publication.xml), which the global pipeline looks up. less
> boilerplate code in pubs, better maintainability.

OK, that sounds reasonable.

>>> the publication is not concerned with that.
>>> moreover, there is a *single* global pipeline that fetches documents
>>> from the repository (sort of the cocoon repository "api").
>>
>> Would the sole purpose of this pipeline be to deliver the content to
>> editor clients? If yes, maybe we should place it in the editors module?
> 
> no. whenever a document is needed, it should be done via that pipeline.
> there is no win as long as fetching a document is as trivial as saying
> <map:generate src="lenya-document:<uuid>/>, but users may want to be
> able to apply quick-and-dirty hacks in some central place - imaging
> company changes its name from foo to bar: one transformation hacked into
> the repository pipeline will keep management off your back and give you
> time to think of a proper solution.

Hmm, do you think this is worth the overhead generated by the pipeline,
especially the performance overhead? Apart from that, you'd always have
to use the cocoon:// protocol to request a document, and would lose the
nice unambiguous lenya-document: syntax contract. IMO the
post-processing hacks you mentioned should happen in the repository, not
the Cocoon application (which we even considered to get rid of as far
as the repository layer is concerned).


>>> 3. all editors delegate the rendering of a page to the publication
>>> pipeline (unless they operate more effectively on the raw document as it
>>> comes from the repository, oneform being an example), and apply
>>> necessary tweaks afterwards.
>>
>> Would you mind elaborating a bit more on the delegation? As I understand
>> it, the rendering can't be delegated to the server. Even if it was
>> technologically possible, it wouldn't make sense from a performance
>> point of view.
> 
> sorry. with rendering, i don't mean the actual display - that happens in
> the browser, with the help of either design mode or javascript magic.
> i mean the aggregation and preparation of page content (see tinymce: no
> custom code, the aggregation is done by mounting the publication sitemap).

OK, I see. But doesn't this require a special editor architecture
(embedded in the page as a JavaScript widget)? Would it work with
BXE too?


>> IMO it will be very hard to find a common approach for editor-side
>> page rendering. An example for a simple approach:
>>
>> When integrating Xopus, I once built an infrastructure to generate an
>> XSLT stylesheet on the fly which contained all navigation elements,
>> context-dependent widgets etc. and sent it to the editor to render the
>> page. The stylesheet could also be used to render the actual page, but
>> only if everything was cached.
> 
> i don't know xopus, but i think all editors could be rewritten not to
> duplicate aggregations and transformations from the publication - by
> delegating it. every editor is free to apply another post-processing
> step and tweak the content as it wants (see tiny again: the rendered
> page from the publication sitemap is augmented with the necessary
> javascript snippets).

OK, I hope you're right :)
I'm not quite sure yet what this would look like, but I guess I'll see
as soon as there is some example code.

[...]

>>> this is quite a job for the usecase handler, and it would make sense
>>> imho to only attempt that after all editors have been migrated to a
>>> generic usecase handler.
>>
>> Or we could provide a simple-to-use service which can be used by all
>> editors (delegation).
> 
> another possible solution. but why this extra indirection?

A separate service has many advantages:

* single-purpose interface
* easier to understand
* smaller classes
* better reusability (complementary functionalities)

A very nice example how not to do it is the LuceneIndexTransformer.
Service functionality (indexing) mixed with XML processing
functionality. This class is a PITA - sorry, Thorsten :) - to read.


> i'd prefer a generic usecase handler,

Sure, that would be good, but it doesn't contradict delegating some
functionality to a distinct service.


> because for example we still don't
> have consistent locking behaviour across editors and have been fixing a
> number of bugs for each editor independently.
> it all could be done with a generic class. hard cases could be
> subclasses imho. i know it's not en vogue, but i don't know why. if
> there are disadvantages to subclassing in this context, please educate me.

If you search the web for "composition vs. inheritance" you'll find
some articles, e.g.

http://www.artima.com/designtechniques/compoinh4.html

Here's a section from an interview with Erich Gamma:

http://www.artima.com/lejava/articles/designprinciplesP.html
(scroll down to "Composition versus inheritance")

-- Andreas


-- 
Andreas Hartmann, CTO
BeCompany GmbH
http://www.becompany.ch


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


Re: Leaving links as lenya-document

Posted by Jörn Nettingsmeier <ne...@apache.org>.
Andreas Hartmann wrote:
> Jörn Nettingsmeier schrieb:
>> Richard Frovarp wrote:
>>> The question was brought up during the hackathon as to what to do
>>> about the possibility of changing nodes while a document referring to
>>> them was being edited. 
<snip>
>> 1. there is a *single* global pipeline in the core that gets to handle
>> all outgoing content. this pipeline applies the i18n, uuid2uri and proxy
>> transformations as well as any necessary namespace node cleanups
>> (probably even prettyprinting, if desired).
> 
> The proxy transformation is configurable (absolute/relative URLs).
> Can we assume that a global setting is sufficient, or do we need this
> per publication?

if people need to configure that, we provide a configuration option 
(maybe in publication.xml), which the global pipeline looks up. less 
boilerplate code in pubs, better maintainability.

>> the publication is not concerned with that.
>> moreover, there is a *single* global pipeline that fetches documents
>> from the repository (sort of the cocoon repository "api").
> 
> Would the sole purpose of this pipeline be to deliver the content to
> editor clients? If yes, maybe we should place it in the editors module?

no. whenever a document is needed, it should be done via that pipeline. 
there is no win as long as fetching a document is as trivial as saying 
<map:generate src="lenya-document:<uuid>/>, but users may want to be 
able to apply quick-and-dirty hacks in some central place - imaging 
company changes its name from foo to bar: one transformation hacked into 
the repository pipeline will keep management off your back and give you 
time to think of a proper solution.

>> 3. all editors delegate the rendering of a page to the publication
>> pipeline (unless they operate more effectively on the raw document as it
>> comes from the repository, oneform being an example), and apply
>> necessary tweaks afterwards.
> 
> Would you mind elaborating a bit more on the delegation? As I understand
> it, the rendering can't be delegated to the server. Even if it was
> technologically possible, it wouldn't make sense from a performance
> point of view.

sorry. with rendering, i don't mean the actual display - that happens in 
the browser, with the help of either design mode or javascript magic.
i mean the aggregation and preparation of page content (see tinymce: no 
custom code, the aggregation is done by mounting the publication sitemap).

> IMO it will be very hard to find a common approach for editor-side
> page rendering. An example for a simple approach:
> 
> When integrating Xopus, I once built an infrastructure to generate an
> XSLT stylesheet on the fly which contained all navigation elements,
> context-dependent widgets etc. and sent it to the editor to render the
> page. The stylesheet could also be used to render the actual page, but
> only if everything was cached.

i don't know xopus, but i think all editors could be rewritten not to 
duplicate aggregations and transformations from the publication - by 
delegating it. every editor is free to apply another post-processing 
step and tweak the content as it wants (see tiny again: the rendered 
page from the publication sitemap is augmented with the necessary 
javascript snippets).

>> "necessary tweaks" would include resolving
>> lenya-document:// links to images and possibly storing the orginal uuid
>> somewhere in the usecase proxy for later restoration.
>>
>> that way, publications themselves would be totally agnostic to the fact
>> that out there, lenya-document:// does not exist. which solves the problem.
>>
>> if the editor usecase stores a mapping of uuid -> uri as it was when the
>> page was invoked, the correct uuid can be restored regardless of
>> concurrent sitetree rearrangements by other users.
> 
> Yes, I guess there's no way to avoid that.
> 
>> this is quite a job for the usecase handler, and it would make sense
>> imho to only attempt that after all editors have been migrated to a
>> generic usecase handler.
> 
> Or we could provide a simple-to-use service which can be used by all
> editors (delegation).

another possible solution. but why this extra indirection?
i'd prefer a generic usecase handler, because for example we still don't 
have consistent locking behaviour across editors and have been fixing a 
number of bugs for each editor independently.
it all could be done with a generic class. hard cases could be 
subclasses imho. i know it's not en vogue, but i don't know why. if 
there are disadvantages to subclassing in this context, please educate me.



-- 
Jörn Nettingsmeier

"One of my most productive days was throwing away 1000 lines of code."
   - Ken Thompson.

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


Re: Leaving links as lenya-document

Posted by Andreas Hartmann <an...@apache.org>.
Jörn Nettingsmeier schrieb:
> Richard Frovarp wrote:
>> The question was brought up during the hackathon as to what to do
>> about the possibility of changing nodes while a document referring to
>> them was being edited. Didn't we decide that we could just leave links
>> in their lenya-document form when loading a document to be edited? We
>> can't do that for images, as the editors need to be able to display
>> those. However, the chances of a document changing URL is probably
>> greater than an image changing URL. The form editors are the only
>> editors at the moment to not translate to a URL upon edit. The link
>> insert that Jörn came up with does insert lenya-document links, so
>> that part is already taken care of.
> 
> in the grand scheme of things, the problem could be solved as follows:
> 
> 1. there is a *single* global pipeline in the core that gets to handle
> all outgoing content. this pipeline applies the i18n, uuid2uri and proxy
> transformations as well as any necessary namespace node cleanups
> (probably even prettyprinting, if desired).

The proxy transformation is configurable (absolute/relative URLs).
Can we assume that a global setting is sufficient, or do we need this
per publication?


> the publication is not concerned with that.
> moreover, there is a *single* global pipeline that fetches documents
> from the repository (sort of the cocoon repository "api").

Would the sole purpose of this pipeline be to deliver the content to
editor clients? If yes, maybe we should place it in the editors module?


> 2. all publications have a single pipeline that does the part of the
> renderning the publication is concerned with (which excludes uuid2uri
> transformation).
> 
> 3. all editors delegate the rendering of a page to the publication
> pipeline (unless they operate more effectively on the raw document as it
> comes from the repository, oneform being an example), and apply
> necessary tweaks afterwards.

Would you mind elaborating a bit more on the delegation? As I understand
it, the rendering can't be delegated to the server. Even if it was
technologically possible, it wouldn't make sense from a performance
point of view.

IMO it will be very hard to find a common approach for editor-side
page rendering. An example for a simple approach:

When integrating Xopus, I once built an infrastructure to generate an
XSLT stylesheet on the fly which contained all navigation elements,
context-dependent widgets etc. and sent it to the editor to render the
page. The stylesheet could also be used to render the actual page, but
only if everything was cached.


> "necessary tweaks" would include resolving
> lenya-document:// links to images and possibly storing the orginal uuid
> somewhere in the usecase proxy for later restoration.
> 
> that way, publications themselves would be totally agnostic to the fact
> that out there, lenya-document:// does not exist. which solves the problem.
> 
> if the editor usecase stores a mapping of uuid -> uri as it was when the
> page was invoked, the correct uuid can be restored regardless of
> concurrent sitetree rearrangements by other users.

Yes, I guess there's no way to avoid that.

> this is quite a job for the usecase handler, and it would make sense
> imho to only attempt that after all editors have been migrated to a
> generic usecase handler.

Or we could provide a simple-to-use service which can be used by all
editors (delegation).

> but all of this should happen after 2.0. or do you consider the issue
> with changing sitetrees critical?

I can't speak for Richard, but IMO this doesn't need to be addressed
before the release (a comment in the release notes would be nice,
though). We should tackle it asap after the release.

-- Andreas


-- 
Andreas Hartmann, CTO
BeCompany GmbH
http://www.becompany.ch


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


Re: Leaving links as lenya-document

Posted by Jörn Nettingsmeier <ne...@apache.org>.
Richard Frovarp wrote:
> The question was brought up during the hackathon as to what to do about 
> the possibility of changing nodes while a document referring to them was 
> being edited. Didn't we decide that we could just leave links in their 
> lenya-document form when loading a document to be edited? We can't do 
> that for images, as the editors need to be able to display those. 
> However, the chances of a document changing URL is probably greater than 
> an image changing URL. The form editors are the only editors at the 
> moment to not translate to a URL upon edit. The link insert that Jörn 
> came up with does insert lenya-document links, so that part is already 
> taken care of.

in the grand scheme of things, the problem could be solved as follows:

1. there is a *single* global pipeline in the core that gets to handle 
all outgoing content. this pipeline applies the i18n, uuid2uri and proxy 
transformations as well as any necessary namespace node cleanups 
(probably even prettyprinting, if desired).
the publication is not concerned with that.
moreover, there is a *single* global pipeline that fetches documents 
from the repository (sort of the cocoon repository "api").

2. all publications have a single pipeline that does the part of the 
renderning the publication is concerned with (which excludes uuid2uri 
transformation).

3. all editors delegate the rendering of a page to the publication 
pipeline (unless they operate more effectively on the raw document as it 
comes from the repository, oneform being an example), and apply 
necessary tweaks afterwards. "necessary tweaks" would include resolving 
lenya-document:// links to images and possibly storing the orginal uuid 
somewhere in the usecase proxy for later restoration.

that way, publications themselves would be totally agnostic to the fact 
that out there, lenya-document:// does not exist. which solves the problem.

if the editor usecase stores a mapping of uuid -> uri as it was when the 
page was invoked, the correct uuid can be restored regardless of 
concurrent sitetree rearrangements by other users.

this is quite a job for the usecase handler, and it would make sense 
imho to only attempt that after all editors have been migrated to a 
generic usecase handler.

but all of this should happen after 2.0. or do you consider the issue 
with changing sitetrees critical?

regards,

jörn


-- 
Jörn Nettingsmeier

"One of my most productive days was throwing away 1000 lines of code."
   - Ken Thompson.

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