There is a fair amount of information in the javadoc 
(http://docs.marklogic.com/4.2doc/xcc/javadoc/index.html), but other than the 
javadoc and the XCC Dev Guide, that is all there is.

-Danny

From: [email protected] 
[mailto:[email protected]] On Behalf Of Gary Larsen
Sent: Thursday, June 02, 2011 11:43 AM
To: 'General MarkLogic Developer Discussion'
Subject: Re: [MarkLogic Dev General] Storing with a ContenHandler

Thanks for everyone's help with this.  Is there a 'best practices' or other XCC 
documentation that's more in depth than the XCC Developer's Guide?

gary


From: [email protected] 
[mailto:[email protected]] On Behalf Of Jason Hunter
Sent: Wednesday, June 01, 2011 4:10 PM
To: General MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] Storing with a ContenHandler

The philosophy behind XCC is that the insertion work should be restartable.  
That's because there might be a deadlock detected during the insert (i.e. a 
conflict on URIs) and in that case your update statement may be restarted to 
free its locks and resolve the deadlock.  So with XCC you don't stream the data 
to the server, but rather have the XCC code pull the data from you, and you 
should design the client so it's OK if it pulls more than once (XCC calls it 
rewinding).

You can create a content source that's in memory (byte array output stream), if 
you'd like, streaming a serialization to memory and then wrapping the memory as 
an input stream.  Or use a temp file, like David suggested, which will be good 
if your data size is large or of unknown size.

-jh-

On Jun 1, 2011, at 1:01 PM, Gary Larsen wrote:

Hi David,

Thanks for your advice.   I wish I didn't need content handlers but much of our 
data is sourced through the serialization of Java beans.  I'll give the temp 
file method a go.

gary


From: 
[email protected]<mailto:[email protected]>
 [mailto:[email protected]] On Behalf Of Lee, David
Sent: Wednesday, June 01, 2011 3:38 PM
To: General MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] Storing with a ContenHandler

This is a bit tricky as ContentHandler is a callback (push) API while 
InputStream is a pull API.
Marrying the 2 is quite difficult.

I suggest serializing the data to a temporary file then using the File as the 
input to newContent()
This has the additional advantage of allowing XCC to intelligently retry as 
needed.



----------------------------------------
David A. Lee
Senior Principal Software Engineer
Epocrates, Inc.
[email protected]<mailto:[email protected]>
812-482-5224

From: 
[email protected]<mailto:[email protected]>
 [mailto:[email protected]] On Behalf Of Gary Larsen
Sent: Wednesday, June 01, 2011 2:41 PM
To: 'General MarkLogic Developer Discussion'
Subject: [MarkLogic Dev General] Storing with a ContenHandler

Sorry if this is a bit off topic.

The XML data I'm storing to MarkLogic (Java XCC) is being processed through one 
or more ContentHandlers.  With eXist I would create a resource that would 
accept the ContentHandler stream.

I'm trying to figure out how to convert the ContentHandler stream to in 
InputStream for use with one of the ContentFactory.newContent() methods.

>From looking at the samples it appears that eventually I should use the 
>DynamicContentStream class but I need to figure out the conversion problem 
>first.

I'd really appreciate any pointers in this area.

Thanks,
gary


_______________________________________________
General mailing list
[email protected]<mailto:[email protected]>
http://developer.marklogic.com/mailman/listinfo/general

_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to