You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lenya.apache.org by "J. Wolfgang Kaltz" <jw...@apache.org> on 2005/05/12 12:24:40 UTC

[trunk] Lenya lightweight-repository, protocols and java.io.File

I'm trying to reduce dependency on java.io.File in the document creation 
process - and, as side-effect, enable the create document usecases to 
provide a URI to the DefaultCreator instead of a file location:
- the create document usecase would provide the uri for the sample of 
that type
- the create language usecase would provide the uri for the document of 
which a new language version is being created

This raises some questions:

- currently Document.getSourceURI() returns something like:
lenya:/lenya/pubs/default/content/authoring/doctypes/index_de.xml
IIRC the discussion in the mailing list a few weeks back, the "lenya:/" 
is no longer supported, so that would need to be changed ?

- there is DocumentHelper.readDocument() which takes a java.io.File and 
  produces a (DOM) document. DefaultCreator currently uses this.
I think we need something which takes a (Lenya) URI, such as the one 
returned by Document.getSourceURI(), accesses the Lenya lightweight 
repository, and returns a (DOM) document.
Or do we already have something like that ?
If not, maybe there should be a "RepositorySourceHelper" which 
accomplishes this (though to be honest I don't know how this would be 
implemented)

WDYT ?

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


Re: [trunk] Lenya lightweight-repository, protocols and java.io.File

Posted by "Gregor J. Rothfuss" <gr...@apache.org>.
J. Wolfgang Kaltz wrote:

>>> I'm trying to reduce dependency on java.io.File in the document 
>>> creation process - and, as side-effect, enable the create document 

> I checked in the above-mentioned changes. I noticed we now have several 
> places where we have code like
>   String someUri = "lenya://lenya/pubs/" + pubId + ...
> see FIXME note at DocumentTypeBuilderImpl::197
> 
> I guess we should encapsulate that somewhere ?
> How about Publication.getUri() ?

+1

time again to count the number of remaining java.io.File calls? :)

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


Re: [trunk] Lenya lightweight-repository, protocols and java.io.File

Posted by "Gregor J. Rothfuss" <gr...@apache.org>.
Andreas Hartmann wrote:

> BTW, is there a convention whether it should be
> 
>   get...Uri()
> 
> or
> 
>   get...URI()
> 
> I tend to use the latter for method names, since Cocoon does it
> like that in most cases.

definitely URI as it is an acronym and not a name (and therefore, imo, 
not subject to camel case rules)

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


[trunk] document creation API (was Re: [trunk] Lenya lightweight-repository, protocols and java.io.File)

Posted by "J. Wolfgang Kaltz" <jw...@apache.org>.
Gregor J. Rothfuss schrieb:
> (...)
> the publisher and creator classes are probably the two remaining warts 
> in lenya trunk. the creator uses inheritance when it really should use 
> composition, and other problems.

I tried to summarize the current state of the document creation API ( 
including yesterday's changes) in a Wiki page, see

http://wiki.apache.org/lenya/DocumentCreationAPI

(OK, some of that info should not be in a class diagram, but in a 
sequence diagram or something, but it will have to do for now)

I started to list the things we want to change that have been discussed 
in the mailing list.

@all please add any additional requirements / ideas (in the Wiki or in 
this thread)

@Gregor regarding your comment about the creator classes above, can you 
be more specific ?


--
Wolfgang

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


Re: [trunk] Lenya lightweight-repository, protocols and java.io.File

Posted by "Gregor J. Rothfuss" <gr...@apache.org>.
J. Wolfgang Kaltz wrote:

> Note that the document creation itself still uses java.io.File
> But anyway as discussed we want to refactor document creation code, 
> probably into DocumentManager.add() as you suggested

big +1

the publisher and creator classes are probably the two remaining warts 
in lenya trunk. the creator uses inheritance when it really should use 
composition, and other problems.

> Maybe that method should also have metadata as parameters, to ensure (or 
> at least suggest to callers) that metadata will always be created ? 
> Currently blog entries do not have metadata.

lenya metadata is mandatory, but i suppose that does not need to be 
exposed to the caller.

> Once that is done, we can start getting rid of DocumentTypeResolver and 
> associates.

indeed

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


Re: [trunk] Lenya lightweight-repository, protocols and java.io.File

Posted by Michael Wechner <mi...@wyona.com>.
J. Wolfgang Kaltz wrote:

> Andreas Hartmann schrieb:
>
>> J. Wolfgang Kaltz wrote:
>>
>> [...]
>>
>>> I checked in the above-mentioned changes. I noticed we now have 
>>> several places where we have code like
>>>   String someUri = "lenya://lenya/pubs/" + pubId + ...
>>> see FIXME note at DocumentTypeBuilderImpl::197
>>>
>>> I guess we should encapsulate that somewhere ?
>>> How about Publication.getUri() ?
>>
>>
>>
>> +1
>>
>> Maybe we should include the notion of "source" in the method name
>> to avoid confusion with the (browser) URI (like /lenya/default).
>>
>> Maybe just Publication.getSourceURI() ?
>
>
> OK, done
>
> Note that the document creation itself still uses java.io.File
> But anyway as discussed we want to refactor document creation code, 
> probably into DocumentManager.add() as you suggested
> Maybe that method should also have metadata as parameters, to ensure 
> (or at least suggest to callers) that metadata will always be created ? 


the question is what kind of meta-data. Lenya specific meta-data would make
sense, but custom/doctype specific meta-data not.

> Currently blog entries do not have metadata.


well, I would say blog entries do have meta-data, but it's not Dublin 
Core ;-)

Michi

>
>
> Once that is done, we can start getting rid of DocumentTypeResolver 
> and associates.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
> For additional commands, e-mail: dev-help@lenya.apache.org
>
>


-- 
Michael Wechner
Wyona Inc.  -   Open Source Content Management   -   Apache Lenya
http://www.wyona.com                      http://lenya.apache.org
michael.wechner@wyona.com                        michi@apache.org


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


Re: [trunk] Lenya lightweight-repository, protocols and java.io.File

Posted by "J. Wolfgang Kaltz" <jw...@apache.org>.
Andreas Hartmann schrieb:
> J. Wolfgang Kaltz wrote:
> 
> [...]
> 
>> I checked in the above-mentioned changes. I noticed we now have 
>> several places where we have code like
>>   String someUri = "lenya://lenya/pubs/" + pubId + ...
>> see FIXME note at DocumentTypeBuilderImpl::197
>>
>> I guess we should encapsulate that somewhere ?
>> How about Publication.getUri() ?
> 
> 
> +1
> 
> Maybe we should include the notion of "source" in the method name
> to avoid confusion with the (browser) URI (like /lenya/default).
> 
> Maybe just Publication.getSourceURI() ?

OK, done

Note that the document creation itself still uses java.io.File
But anyway as discussed we want to refactor document creation code, 
probably into DocumentManager.add() as you suggested
Maybe that method should also have metadata as parameters, to ensure (or 
at least suggest to callers) that metadata will always be created ? 
Currently blog entries do not have metadata.

Once that is done, we can start getting rid of DocumentTypeResolver and 
associates.

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


Re: [trunk] Lenya lightweight-repository, protocols and java.io.File

Posted by Andreas Hartmann <an...@apache.org>.
J. Wolfgang Kaltz wrote:

[...]

> I checked in the above-mentioned changes. I noticed we now have several 
> places where we have code like
>   String someUri = "lenya://lenya/pubs/" + pubId + ...
> see FIXME note at DocumentTypeBuilderImpl::197
> 
> I guess we should encapsulate that somewhere ?
> How about Publication.getUri() ?

+1

Maybe we should include the notion of "source" in the method name
to avoid confusion with the (browser) URI (like /lenya/default).

Maybe just Publication.getSourceURI() ?

BTW, is there a convention whether it should be

   get...Uri()

or

   get...URI()

I tend to use the latter for method names, since Cocoon does it
like that in most cases.

-- Andreas


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


Re: [trunk] Lenya lightweight-repository, protocols and java.io.File

Posted by "J. Wolfgang Kaltz" <jw...@apache.org>.
Andreas Hartmann schrieb:
> J. Wolfgang Kaltz wrote:
> 
>> I'm trying to reduce dependency on java.io.File in the document 
>> creation process - and, as side-effect, enable the create document 
>> usecases to provide a URI to the DefaultCreator instead of a file 
>> location:
>> - the create document usecase would provide the uri for the sample of 
>> that type
>> - the create language usecase would provide the uri for the document 
>> of which a new language version is being created
> (...)
>> - there is DocumentHelper.readDocument() which takes a java.io.File 
>> and  produces a (DOM) document. DefaultCreator currently uses this.
>> I think we need something which takes a (Lenya) URI, such as the one 
>> returned by Document.getSourceURI(), accesses the Lenya lightweight 
>> repository, and returns a (DOM) document.
>> Or do we already have something like that ?
> 
> 
> o.a.l.cms.cocoon.source.SourceUtil.readDOM(doc.getSourceURI(), manager)

Thank you, looks like it's working fine :)

I checked in the above-mentioned changes. I noticed we now have several 
places where we have code like
   String someUri = "lenya://lenya/pubs/" + pubId + ...
see FIXME note at DocumentTypeBuilderImpl::197

I guess we should encapsulate that somewhere ?
How about Publication.getUri() ?


--
Wolfgang

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


Re: [trunk] Lenya lightweight-repository, protocols and java.io.File

Posted by Andreas Hartmann <an...@apache.org>.
J. Wolfgang Kaltz wrote:
> I'm trying to reduce dependency on java.io.File in the document creation 
> process - and, as side-effect, enable the create document usecases to 
> provide a URI to the DefaultCreator instead of a file location:
> - the create document usecase would provide the uri for the sample of 
> that type
> - the create language usecase would provide the uri for the document of 
> which a new language version is being created

That sounds great


> This raises some questions:
> 
> - currently Document.getSourceURI() returns something like:
> lenya:/lenya/pubs/default/content/authoring/doctypes/index_de.xml
> IIRC the discussion in the mailing list a few weeks back, the "lenya:/" 
> is no longer supported, so that would need to be changed ?

Actually it's lenya://lenya/pubs/... which is fine. The discussion
was about lenya:/ (with a single slash). So no changes are required
in this area.


> - there is DocumentHelper.readDocument() which takes a java.io.File and 
>  produces a (DOM) document. DefaultCreator currently uses this.
> I think we need something which takes a (Lenya) URI, such as the one 
> returned by Document.getSourceURI(), accesses the Lenya lightweight 
> repository, and returns a (DOM) document.
> Or do we already have something like that ?

o.a.l.cms.cocoon.source.SourceUtil.readDOM(doc.getSourceURI(), manager)

This code just resolves the source and reads the DOM from
Source.getInputStream().


-- Andreas


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