You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lenya.apache.org by Andreas Hartmann <an...@apache.org> on 2006/09/08 10:15:16 UTC
Re: svn commit: r441423 - /lenya/trunk/src/modules/lenyadoc/java/src/org/apache/lenya/cms/cocoon/source/LenyaDocSourceFactory.java
Hi Thorsten,
thorsten@apache.org wrote:
> Author: thorsten
> Date: Fri Sep 8 01:04:41 2006
> New Revision: 441423
>
> URL: http://svn.apache.org/viewvc?view=rev&rev=441423
> Log:
> This commit extends the lenyadoc protocol with the ability to return
> the meta data instead of the document. This commit is not a 100% clean solution
> since it assumes that the meta data are stored in the document URL + ".meta"
> which may not be true as soon JCR comes in to the game.
IMO we should use a different solution. This code bypasses the
API and violates the repository and meta data abstractions.
Please let's discuss it again.
-- Andreas
>
> You can use now lenyadoc:meta:... (the rest is like before lenyadoc:// or lenyadoc:/)
> as protocol to get the meta data for the document.
>
> Modified:
> lenya/trunk/src/modules/lenyadoc/java/src/org/apache/lenya/cms/cocoon/source/LenyaDocSourceFactory.java
>
> Modified: lenya/trunk/src/modules/lenyadoc/java/src/org/apache/lenya/cms/cocoon/source/LenyaDocSourceFactory.java
> URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/lenyadoc/java/src/org/apache/lenya/cms/cocoon/source/LenyaDocSourceFactory.java?view=diff&rev=441423&r1=441422&r2=441423
> ==============================================================================
> --- lenya/trunk/src/modules/lenyadoc/java/src/org/apache/lenya/cms/cocoon/source/LenyaDocSourceFactory.java (original)
> +++ lenya/trunk/src/modules/lenyadoc/java/src/org/apache/lenya/cms/cocoon/source/LenyaDocSourceFactory.java Fri Sep 8 01:04:41 2006
> @@ -57,16 +57,27 @@
> * <code>lenyadoc://<publication>/<area>/<language>/<uuid></code>
> * <code>lenyadoc:/<language>/<uuid></code>
> *
> + * If we want to request the meta data for a document
> + * instead of the document itself, we need to use
> + *
> + * <code>lenyadoc:meta:/<language>/<uuid></code>
> + * <code>lenyadoc:meta://<publication>/<area>/<language>/<uuid></code>
> + *
> * @version $Id:$
> */
> public class LenyaDocSourceFactory extends AbstractLogEnabled implements SourceFactory, ThreadSafe,
> Contextualizable, Serviceable, Configurable {
>
> + private static final String META_SUFFIX = ".meta";
> +
> protected static final String SCHEME = "lenyadoc";
>
> private Context context;
> private ServiceManager manager;
>
> + // Determines whether we have to request the meta data instead of the doc
> + private boolean isMetaDataLookup;
> +
> /**
> * Used for resolving the object model.
> * @see org.apache.avalon.framework.context.Contextualizable#contextualize(org.apache.avalon.framework.context.Context)
> @@ -97,6 +108,7 @@
> String area = null;
> String language = null;
> String uuid = null;
> + isMetaDataLookup=false;
> Publication pub;
>
> // Parse the url
> @@ -119,8 +131,16 @@
> Request request = ObjectModelHelper.getRequest(objectModel);
> DocumentFactory factory = DocumentUtil.getDocumentFactory(this.manager, request);
>
> - // Absolute vs. relative
> start = end + 1;
> +
> + // Meta data document instead of the doc?
> + if (location.startsWith("meta", start)){
> + end = location.indexOf(':', start);
> + this.isMetaDataLookup = true;
> + start = end + 1;
> + }
> +
> + // Absolute vs. relative
> if (location.startsWith("//", start)) {
> // Absolute: get publication id
> start += 2;
> @@ -200,7 +220,11 @@
> + language + "] could not be created.");
> }
>
> - String lenyaURL = document.getSourceURI();
> + String lenyaURL;
> + if (this.isMetaDataLookup)
> + lenyaURL = document.getSourceURI()+META_SUFFIX;
> + else
> + lenyaURL = document.getSourceURI();
>
> if (getLogger().isDebugEnabled()) {
> getLogger().debug("Mapping 'lenyadoc:' URL [" + location + "] to 'lenya:' URL ["
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org
Re: svn commit: r441423 - /lenya/trunk/src/modules/lenyadoc/java/src/org/apache/lenya/cms/cocoon/source/LenyaDocSourceFactory.java
Posted by Andreas Hartmann <an...@apache.org>.
Thorsten Scherler wrote:
> Commit reverted.
Thanks a lot!
-- Andreas
>
> salu2
>
> El vie, 08-09-2006 a las 11:31 +0200, Thorsten Scherler escribió:
>> El vie, 08-09-2006 a las 11:11 +0200, Andreas Hartmann escribió:
>>> Thorsten Scherler wrote:
>>>> El vie, 08-09-2006 a las 10:15 +0200, Andreas Hartmann escribió:
>>>>> Hi Thorsten,
>>>>>
>>>>> thorsten@apache.org wrote:
>>>>>> Author: thorsten
>>>>>> Date: Fri Sep 8 01:04:41 2006
>>>>>> New Revision: 441423
>>>>>>
>>>>>> URL: http://svn.apache.org/viewvc?view=rev&rev=441423
>>>>>> Log:
>>>>>> This commit extends the lenyadoc protocol with the ability to return
>>>>>> the meta data instead of the document. This commit is not a 100% clean solution
>>>>>> since it assumes that the meta data are stored in the document URL + ".meta"
>>>>>> which may not be true as soon JCR comes in to the game.
>>>>> IMO we should use a different solution.
>>>> Do you have a suggestion?
>>> === XSLT ===
>>>
>>> <h1>
>>> <meta:value
>>> namespace="http://http://purl.org/dc/elements/1.1/"
>>> element="title"/>
>>> </h1>
>>>
>>> === Sitemap ===
>>>
>>> <map:transform type="metadata"/>
>>>
>>>
>> That would get the meta data for the *one* document that is behind the
>> match. How can you include the meta data for a different document?
>>
>> Further this transformer is not implemented yet right?
>>
>> salu2
>>
>>> A specific source would be fine as well, but it should generate specific
>>> XML using the API like the LenyaMetaDataGenerator and not directly read
>>> the meta data from the source.
>>>
>>>
>>> -- Andreas
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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
Re: svn commit: r441423 -
/lenya/trunk/src/modules/lenyadoc/java/src/org/apache/lenya/cms/cocoon/source/LenyaDocSourceFactory.java
Posted by Thorsten Scherler <th...@wyona.com>.
Commit reverted.
salu2
El vie, 08-09-2006 a las 11:31 +0200, Thorsten Scherler escribió:
> El vie, 08-09-2006 a las 11:11 +0200, Andreas Hartmann escribió:
> > Thorsten Scherler wrote:
> > > El vie, 08-09-2006 a las 10:15 +0200, Andreas Hartmann escribió:
> > >> Hi Thorsten,
> > >>
> > >> thorsten@apache.org wrote:
> > >>> Author: thorsten
> > >>> Date: Fri Sep 8 01:04:41 2006
> > >>> New Revision: 441423
> > >>>
> > >>> URL: http://svn.apache.org/viewvc?view=rev&rev=441423
> > >>> Log:
> > >>> This commit extends the lenyadoc protocol with the ability to return
> > >>> the meta data instead of the document. This commit is not a 100% clean solution
> > >>> since it assumes that the meta data are stored in the document URL + ".meta"
> > >>> which may not be true as soon JCR comes in to the game.
> > >> IMO we should use a different solution.
> > >
> > > Do you have a suggestion?
> >
> > === XSLT ===
> >
> > <h1>
> > <meta:value
> > namespace="http://http://purl.org/dc/elements/1.1/"
> > element="title"/>
> > </h1>
> >
> > === Sitemap ===
> >
> > <map:transform type="metadata"/>
> >
> >
>
> That would get the meta data for the *one* document that is behind the
> match. How can you include the meta data for a different document?
>
> Further this transformer is not implemented yet right?
>
> salu2
>
> > A specific source would be fine as well, but it should generate specific
> > XML using the API like the LenyaMetaDataGenerator and not directly read
> > the meta data from the source.
> >
> >
> > -- Andreas
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
> > For additional commands, e-mail: dev-help@lenya.apache.org
> >
--
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: svn commit: r441423 -
/lenya/trunk/src/modules/lenyadoc/java/src/org/apache/lenya/cms/cocoon/source/LenyaDocSourceFactory.java
Posted by Thorsten Scherler <th...@apache.org>.
El vie, 08-09-2006 a las 11:11 +0200, Andreas Hartmann escribió:
> Thorsten Scherler wrote:
> > El vie, 08-09-2006 a las 10:15 +0200, Andreas Hartmann escribió:
> >> Hi Thorsten,
> >>
> >> thorsten@apache.org wrote:
> >>> Author: thorsten
> >>> Date: Fri Sep 8 01:04:41 2006
> >>> New Revision: 441423
> >>>
> >>> URL: http://svn.apache.org/viewvc?view=rev&rev=441423
> >>> Log:
> >>> This commit extends the lenyadoc protocol with the ability to return
> >>> the meta data instead of the document. This commit is not a 100% clean solution
> >>> since it assumes that the meta data are stored in the document URL + ".meta"
> >>> which may not be true as soon JCR comes in to the game.
> >> IMO we should use a different solution.
> >
> > Do you have a suggestion?
>
> === XSLT ===
>
> <h1>
> <meta:value
> namespace="http://http://purl.org/dc/elements/1.1/"
> element="title"/>
> </h1>
>
> === Sitemap ===
>
> <map:transform type="metadata"/>
>
>
That would get the meta data for the *one* document that is behind the
match. How can you include the meta data for a different document?
Further this transformer is not implemented yet right?
salu2
> A specific source would be fine as well, but it should generate specific
> XML using the API like the LenyaMetaDataGenerator and not directly read
> the meta data from the source.
>
>
> -- Andreas
>
>
> ---------------------------------------------------------------------
> 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: svn commit: r441423 - /lenya/trunk/src/modules/lenyadoc/java/src/org/apache/lenya/cms/cocoon/source/LenyaDocSourceFactory.java
Posted by Andreas Hartmann <an...@apache.org>.
Thorsten Scherler wrote:
> El vie, 08-09-2006 a las 10:15 +0200, Andreas Hartmann escribió:
>> Hi Thorsten,
>>
>> thorsten@apache.org wrote:
>>> Author: thorsten
>>> Date: Fri Sep 8 01:04:41 2006
>>> New Revision: 441423
>>>
>>> URL: http://svn.apache.org/viewvc?view=rev&rev=441423
>>> Log:
>>> This commit extends the lenyadoc protocol with the ability to return
>>> the meta data instead of the document. This commit is not a 100% clean solution
>>> since it assumes that the meta data are stored in the document URL + ".meta"
>>> which may not be true as soon JCR comes in to the game.
>> IMO we should use a different solution.
>
> Do you have a suggestion?
=== XSLT ===
<h1>
<meta:value
namespace="http://http://purl.org/dc/elements/1.1/"
element="title"/>
</h1>
=== Sitemap ===
<map:transform type="metadata"/>
A specific source would be fine as well, but it should generate specific
XML using the API like the LenyaMetaDataGenerator and not directly read
the meta data from the source.
-- Andreas
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org
Re: svn commit: r441423 -
/lenya/trunk/src/modules/lenyadoc/java/src/org/apache/lenya/cms/cocoon/source/LenyaDocSourceFactory.java
Posted by Thorsten Scherler <th...@wyona.com>.
El vie, 08-09-2006 a las 10:15 +0200, Andreas Hartmann escribió:
> Hi Thorsten,
>
> thorsten@apache.org wrote:
> > Author: thorsten
> > Date: Fri Sep 8 01:04:41 2006
> > New Revision: 441423
> >
> > URL: http://svn.apache.org/viewvc?view=rev&rev=441423
> > Log:
> > This commit extends the lenyadoc protocol with the ability to return
> > the meta data instead of the document. This commit is not a 100% clean solution
> > since it assumes that the meta data are stored in the document URL + ".meta"
> > which may not be true as soon JCR comes in to the game.
>
> IMO we should use a different solution.
Do you have a suggestion?
> This code bypasses the
> API and violates the repository and meta data abstractions.
> Please let's discuss it again.
Like said we need something that we can use from within xsl and we need
something for the case where we cannot pass the values as param to the
xsl.
salu2
>
> -- Andreas
>
> >
> > You can use now lenyadoc:meta:... (the rest is like before lenyadoc:// or lenyadoc:/)
> > as protocol to get the meta data for the document.
> >
> > Modified:
> > lenya/trunk/src/modules/lenyadoc/java/src/org/apache/lenya/cms/cocoon/source/LenyaDocSourceFactory.java
> >
> > Modified: lenya/trunk/src/modules/lenyadoc/java/src/org/apache/lenya/cms/cocoon/source/LenyaDocSourceFactory.java
> > URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/lenyadoc/java/src/org/apache/lenya/cms/cocoon/source/LenyaDocSourceFactory.java?view=diff&rev=441423&r1=441422&r2=441423
> > ==============================================================================
> > --- lenya/trunk/src/modules/lenyadoc/java/src/org/apache/lenya/cms/cocoon/source/LenyaDocSourceFactory.java (original)
> > +++ lenya/trunk/src/modules/lenyadoc/java/src/org/apache/lenya/cms/cocoon/source/LenyaDocSourceFactory.java Fri Sep 8 01:04:41 2006
> > @@ -57,16 +57,27 @@
> > * <code>lenyadoc://<publication>/<area>/<language>/<uuid></code>
> > * <code>lenyadoc:/<language>/<uuid></code>
> > *
> > + * If we want to request the meta data for a document
> > + * instead of the document itself, we need to use
> > + *
> > + * <code>lenyadoc:meta:/<language>/<uuid></code>
> > + * <code>lenyadoc:meta://<publication>/<area>/<language>/<uuid></code>
> > + *
> > * @version $Id:$
> > */
> > public class LenyaDocSourceFactory extends AbstractLogEnabled implements SourceFactory, ThreadSafe,
> > Contextualizable, Serviceable, Configurable {
> >
> > + private static final String META_SUFFIX = ".meta";
> > +
> > protected static final String SCHEME = "lenyadoc";
> >
> > private Context context;
> > private ServiceManager manager;
> >
> > + // Determines whether we have to request the meta data instead of the doc
> > + private boolean isMetaDataLookup;
> > +
> > /**
> > * Used for resolving the object model.
> > * @see org.apache.avalon.framework.context.Contextualizable#contextualize(org.apache.avalon.framework.context.Context)
> > @@ -97,6 +108,7 @@
> > String area = null;
> > String language = null;
> > String uuid = null;
> > + isMetaDataLookup=false;
> > Publication pub;
> >
> > // Parse the url
> > @@ -119,8 +131,16 @@
> > Request request = ObjectModelHelper.getRequest(objectModel);
> > DocumentFactory factory = DocumentUtil.getDocumentFactory(this.manager, request);
> >
> > - // Absolute vs. relative
> > start = end + 1;
> > +
> > + // Meta data document instead of the doc?
> > + if (location.startsWith("meta", start)){
> > + end = location.indexOf(':', start);
> > + this.isMetaDataLookup = true;
> > + start = end + 1;
> > + }
> > +
> > + // Absolute vs. relative
> > if (location.startsWith("//", start)) {
> > // Absolute: get publication id
> > start += 2;
> > @@ -200,7 +220,11 @@
> > + language + "] could not be created.");
> > }
> >
> > - String lenyaURL = document.getSourceURI();
> > + String lenyaURL;
> > + if (this.isMetaDataLookup)
> > + lenyaURL = document.getSourceURI()+META_SUFFIX;
> > + else
> > + lenyaURL = document.getSourceURI();
> >
> > if (getLogger().isDebugEnabled()) {
> > getLogger().debug("Mapping 'lenyadoc:' URL [" + location + "] to 'lenya:' URL ["
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
> For additional commands, e-mail: dev-help@lenya.apache.org
--
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