You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lenya.apache.org by Thorsten Scherler <th...@wyona.com> on 2006/02/22 13:22:17 UTC

Implementing custom mapping

Hi all,

I am looking into customizing lenya regarding the internal mapping of
documents/assets in 1.4.

I have a dir which not only contain html/xml files but mainly pdf, avi,
mpg, png, tex, ... The idea till now in lenya is that those files would
be stored in a different dir then the content.

Further we always created a certain structure for our documents. e.g.
creating a doc-id like /samples/assets will create:
{area}/samples/assets/index_{lang}.xml
{area}/samples/assets/index_{lang}.xml.meta

This prevents that one can re use the document mapping api for assets
the way I would like it. :(

The idea is to generalize the document API to something more general
(implementing e.g. http://wiki.apache.org/lenya/ProposalContentModel).

It should be possible to have following workflow:
- create new asset (contentItem) screen
(doc-id[contentID]: /bar/foo.avi)
-- upload asset - stored in {area}/bar/foo.avi
-- add/edit meta data - stored in {area}/bar/foo.avi.meta

- assets (contentItem) url
-- /bar/foo.avi -> will return the actual file
-- /bar/foo.avi.meta.xml -> will return the meta data (raw xml)
-- /bar/foo.avi.meta.html -> will return the meta data rendered as html
view (could be mapped to /bar/foo.avi.html for resource-types "media")

I found 2 references to "index" as prefix for the mapping:
- DocumentHelper.java
- DefaultDocumentIdToPathMapper.java

So for my first tests about changing the mapping I will create my own
implemetations of this (at least) two classes in my pub, right?

What else do I need be aware of?

TIA for any imformation.

salu2
-- 
Thorsten Scherler
COO Spain
Wyona Inc.  -  Open Source Content Management  -  Apache Lenya
http://www.wyona.com                   http://lenya.apache.org
thorsten.scherler@wyona.com                thorsten@apache.org


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


Re: Implementing custom mapping

Posted by Andreas Hartmann <an...@apache.org>.
Thorsten Scherler wrote:
> El mié, 22-02-2006 a las 13:36 +0100, Andreas Hartmann escribió:
>> Thorsten Scherler wrote:
>>
>> [...]
>>
>>> I found 2 references to "index" as prefix for the mapping:
>>> - DocumentHelper.java
>> Really? This is knowledge duplication and should be removed.
>> The same applies to the DocumentReferencesHelper.
>>
>>> - DefaultDocumentIdToPathMapper.java
>> This should be the only place where the mapping happens.
>>
>>> So for my first tests about changing the mapping I will create my own
>>> implemetations of this (at least) two classes in my pub, right?
>> You have to implement your own DocumentIdToPathMapper and
>> declare it in publication.xconf.
> 
> Ok, I am debbuging ATM my custom implementation and am wondering how I
> can extend the docID with the extension.

I'm afraid this won't work without changing the API.
The DocumentIdToPathMapper would have to take the document
as a parameter, this way it could take the resource type
into account.

-- Andreas



-- 
Andreas Hartmann
Wyona Inc.  -   Open Source Content Management   -   Apache Lenya
http://www.wyona.com                      http://lenya.apache.org
andreas.hartmann@wyona.com                     andreas@apache.org


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


Re: Implementing custom mapping

Posted by Thorsten Scherler <th...@apache.org>.
El mié, 22-02-2006 a las 13:36 +0100, Andreas Hartmann escribió:
> Thorsten Scherler wrote:
> 
> [...]
> 
> > I found 2 references to "index" as prefix for the mapping:
> > - DocumentHelper.java
> 
> Really? This is knowledge duplication and should be removed.
> The same applies to the DocumentReferencesHelper.
> 
> > - DefaultDocumentIdToPathMapper.java
> 
> This should be the only place where the mapping happens.
> 
> > 
> > So for my first tests about changing the mapping I will create my own
> > implemetations of this (at least) two classes in my pub, right?
> 
> You have to implement your own DocumentIdToPathMapper and
> declare it in publication.xconf.

Ok, I am debbuging ATM my custom implementation and am wondering how I
can extend the docID with the extension.

I have:
<node id="index"/>
and everything is expected to be html/xml.

Now I cannot take this assumption anymore since the ending depends on
the request. 

How can I extend this?

I tried with <node id="index.html"/> but that was not working because it
strips everything after it finds a ".".

salu2
-- 
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: Implementing custom mapping

Posted by Andreas Hartmann <an...@apache.org>.
Thorsten Scherler wrote:

[...]

> I found 2 references to "index" as prefix for the mapping:
> - DocumentHelper.java

Really? This is knowledge duplication and should be removed.
The same applies to the DocumentReferencesHelper.

> - DefaultDocumentIdToPathMapper.java

This should be the only place where the mapping happens.

> 
> So for my first tests about changing the mapping I will create my own
> implemetations of this (at least) two classes in my pub, right?

You have to implement your own DocumentIdToPathMapper and
declare it in publication.xconf.

-- Andreas


-- 
Andreas Hartmann
Wyona Inc.  -   Open Source Content Management   -   Apache Lenya
http://www.wyona.com                      http://lenya.apache.org
andreas.hartmann@wyona.com                     andreas@apache.org


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