Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » OHF » RetrieveDocumentSet - Serious Memory Problem
RetrieveDocumentSet - Serious Memory Problem [message #587676] Wed, 17 September 2008 09:24
Stefan S. is currently offline Stefan S.Friend
Messages: 22
Registered: July 2009
Junior Member
Hi Everybody!

Recently - during developing the ITI-43 RetrieveDocumentSet - I have
stumbled accross a serious problem.

Please correct me, if I am wrong but the correct workflow is to create a
new RetrieveDocumentSetRepsonseType, loop over all documents that must be
returned and creating a DocumentResponseType by setting basic attributes
as well as the actual document every time.

I achieve this by doing the following (just the relevant lines... *g*):

RetrieveDocumentSetResponseType retrieveDocumentSetResponse =
org.eclipse.ohf.ihe.xds.consumer.retrieve.RetrieveFactory.eI NSTANCE.createRetrieveDocumentSetResponseType();

DocumentResponseType documentResponse =
org.eclipse.ohf.ihe.xds.consumer.retrieve.RetrieveFactory.eI NSTANCE.createDocumentResponseType();

//Set "easy" attributes
documentResponse.setRepositoryUniqueId(drt.getRepositoryUniq ueId());
documentResponse.setDocumentUniqueId(drt.getDocumentUniqueId ());
documentResponse.setHomeCommunityId(drt.getHomeCommunityId() );
documentResponse.setMimeType(dr.getMimeType());

//Set the "tricky" document content part
byte[] fileBytes = this.getBytesFromFile(document);
documentResponse.setDocument(fileBytes);

As you can see, the document (its content) is set using a byte array.
This tends to be a serious issue as you run out of memory in no time!

So I think the only solution to this problem is to leave setting the
document as a byte array beside, generate an OMElement from the rest of
the model and set the attachments lateron - directly within the OMElement.
(Of course the approach should be a streaming solution, because otherwise
OMElement is very likely to run out of memory, too... ;)

Bu my problem is, that I have no clue on how to achive this.

I already tried setting the attachment "manually", which looks something
like:

FileDataSource fds = new FileDataSource(document);
DataHandler dh = new DataHandler(fds);

MessageContext inMessageContext =
MessageContext.getCurrentMessageContext();
OperationContext operationContext =
inMessageContext.getOperationContext();
MessageContext outMessageContext =
operationContext.getMessageContext(WSDLConstants.MESSAGE_LAB EL_OUT_VALUE);
String attachmentID = outMessageContext.addAttachment(dh);

Sadly this does not work, because then the response does not contain a
"Document" Tag (Part), that would hold the actual content of the retrieved
document.

Can anyone provide me some help, hints - or better - has anyone stumbled
across the same problem and can provide a solution? (God, I hope it is so!
*g*)

Thanks in Advance for your time and your answers!

Greetings
Stefan
Previous Topic:Using org.eclipse.ohf.ihe.common.cdar2 to Create CDA Document?
Next Topic:IMPORTANT: IHE and Bridge Project Notice -- Please Read
Goto Forum:
  


Current Time: Fri Apr 19 21:15:36 GMT 2024

Powered by FUDForum. Page generated in 0.02821 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top