You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lenya.apache.org by Michael Ralston <mi...@ralston.id.au> on 2007/03/30 12:25:23 UTC

DocumentManagerImpl assumes ByteStream content

Hi Guys

You haven't heard from me in a while... been busy getting client
websites done and stuff.

I checked out the latest lenya from trunk and was quite impressed with
the improvements, from a user/customer perspective, and also the
organization of the code has improved a lot.

I've spent the past week updating the ejb backend I've been working on
so it works with the latest version from trunk. I've got it working
with very few changes to the lenya code.

I've got it working to the point that "Import example pages" works,
but publishing a page to the live area does not. I've come across a
problem with the DocumentManagerImpl which I think is caused by it
assuming that all content is a Byte Stream.

copy(SourceResolver resolver, InputStream sourceInputStream, Document
destination)
copyContent(Document sourceDocument, Document destinationDocument)

These two methods both use ByteArrayOutputStream to copy the contents
of documents. My implementation based on a lenya snapshot from 6
months ago, used Object.clone() to copy the content of a page, and
then left it up to the implementation of that content to decide how to
best clone its data. What do you think of this approach?

Once again, I'd like to contribute my code as soon as possible. Should
I wait until after the 1.4 release candidate? Or would it be
appropriate to include it in modules-optional?

thanks
Michael Ralston

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


Re: DocumentManagerImpl assumes ByteStream content

Posted by Michael Wechner <mi...@wyona.com>.
Michael Ralston wrote:

>
>
> Once again, I'd like to contribute my code as soon as possible. Should
> I wait until after the 1.4 release candidate?


I think indenpendently f how and when it would be nice if you could make 
your code available within Bugzilla.

> Or would it be
> appropriate to include it in modules-optional?


if that's possible, then I think that would be good idea and maybe move 
at some later stage
when more people will have been able to get more experience with it.

Cheers

Michi

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


-- 
Michael Wechner
Wyona      -   Open Source Content Management   -    Apache Lenya
http://www.wyona.com                      http://lenya.apache.org
michael.wechner@wyona.com                        michi@apache.org
+41 44 272 91 61


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


Re: DocumentManagerImpl assumes ByteStream content

Posted by Jörn Nettingsmeier <ne...@apache.org>.
Andreas Hartmann wrote:
> Hi Michael,
> 
> Michael Ralston schrieb:
>> Once again, I'd like to contribute my code as soon as possible. Should
>> I wait until after the 1.4 release candidate? Or would it be
>> appropriate to include it in modules-optional?
> 
> I think both options are OK.

imo modules-optional should not be subject to the pre-rc code freeze 
anyways, and i'd very much like to see that code :)

just my .02 €


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


Re: DocumentManagerImpl assumes ByteStream content

Posted by Andreas Hartmann <an...@apache.org>.
Michael Ralston schrieb:
> On 4/2/07, Andreas Hartmann <an...@apache.org> wrote:
>> > These two methods both use ByteArrayOutputStream to copy the contents
>> > of documents. My implementation based on a lenya snapshot from 6
>> > months ago, used Object.clone() to copy the content of a page, and
>> > then left it up to the implementation of that content to decide how to
>> > best clone its data. What do you think of this approach?
>>
>> What would be the benefits in comparison with streams?
>> I guess you need the input and output streams anyway, or am I
>> missing something?
>>
> 
> My content implementation has a relational nature. My content does not
> have a getOutputStream method, as it is manipulated by a content
> specific interface (eg, setName, setDescription etc). My content does
> have a getInputStream method for generating content. I build my
> content procedurally as a org.w3c.dom.Document and then translate that
> into an inputStream.

Would it be very difficult to implement getOutputStream(), converting
the stream to a DOM and parsing this to get the relational data?

>From the performance POV this is certainly not a good idea, but IMO
we have to find a least common denominator for all repo implementations.
You can still provide your own DocumentManager if this isn't sufficient.

What do the others think?

-- Andreas


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


Re: DocumentManagerImpl assumes ByteStream content

Posted by Michael Ralston <mi...@kcms.com.au>.
On 4/2/07, Andreas Hartmann <an...@apache.org> wrote:
> > These two methods both use ByteArrayOutputStream to copy the contents
> > of documents. My implementation based on a lenya snapshot from 6
> > months ago, used Object.clone() to copy the content of a page, and
> > then left it up to the implementation of that content to decide how to
> > best clone its data. What do you think of this approach?
>
> What would be the benefits in comparison with streams?
> I guess you need the input and output streams anyway, or am I
> missing something?
>

My content implementation has a relational nature. My content does not
have a getOutputStream method, as it is manipulated by a content
specific interface (eg, setName, setDescription etc). My content does
have a getInputStream method for generating content. I build my
content procedurally as a org.w3c.dom.Document and then translate that
into an inputStream.

Michael Ralston

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


Re: DocumentManagerImpl assumes ByteStream content

Posted by Andreas Hartmann <an...@apache.org>.
Hi Michael,

Michael Ralston schrieb:

[...]

> I've got it working to the point that "Import example pages" works,
> but publishing a page to the live area does not. I've come across a
> problem with the DocumentManagerImpl which I think is caused by it
> assuming that all content is a Byte Stream.
> 
> copy(SourceResolver resolver, InputStream sourceInputStream, Document
> destination)
> copyContent(Document sourceDocument, Document destinationDocument)

You could probably extend the DocumentManagerImpl and override
these methods.


> These two methods both use ByteArrayOutputStream to copy the contents
> of documents. My implementation based on a lenya snapshot from 6
> months ago, used Object.clone() to copy the content of a page, and
> then left it up to the implementation of that content to decide how to
> best clone its data. What do you think of this approach?

What would be the benefits in comparison with streams?
I guess you need the input and output streams anyway, or am I
missing something?

> Once again, I'd like to contribute my code as soon as possible. Should
> I wait until after the 1.4 release candidate? Or would it be
> appropriate to include it in modules-optional?

I think both options are OK.

Thanks for sharing your code and ideas!

-- Andreas


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