Hi,
I am really glad that the iteration stuff is working now. But how can I
achieve, that the iterator only pushes one iteration step into the
workflow and the next one not until the whole workflow is processed.
Regards,
Andreas
Am 25.08.2010 12:27, schrieb Donal K. Fellows:
> On 25/08/2010 11:09, Andreas Truszkowski wrote:
>> I need your help because I won't get the iterative file reader working.
>> The probelm is still the cumulativ arriving of the data in the
>> downstream activies. I mean if I divide my file i.e. into parts of size
>> 50, the downstream
>> activities get first 50 then 100, 150, ... elements.
>
> At a guess, the problem is that the 'dataList' is never being cleared
> out after registration with the reference service (this is in
> IterativeSDFileReaderActivity.work()). The easiest way to deal with
> this is to move the declaration and construction of dataList to inside
> the code that is guarded by 'if (line == null || counter >= readSize)
> {' as then the object will naturally have the correct lifetime (and
> the garbage collector will handle tidying up after you, of course).
>
> To be exact:
>
>> public Map<String, T2Reference> work(Map<String, T2Reference>
>> inputs, AsynchronousActivityCallback callback)
>> throws CDKTavernaException {
>> int readSize = (Integer)
>> this.getConfiguration().getAdditionalProperty(CDKTavernaConstants.PROPERTY_ITERATIVE_READ_SIZE);
>> Map<String, T2Reference> outputs = new HashMap<String,
>> T2Reference>();
>> InvocationContext context = callback.getContext();
>> ReferenceService referenceService =
>> context.getReferenceService();
>> List<CMLChemFile> cmlChemFileList = null;
>> List<byte[]> dataList = new ArrayList<byte[]>();
>
> Move from above:
>
> [...]
>> if (line == null || counter >= readSize) {
>> CMLChemFile cmlChemFile = new CMLChemFile();
>> MDLV2000Reader tmpMDLReader = new
>> MDLV2000Reader(new StringReader(SDFilePart));
>> tmpMDLReader.read(cmlChemFile);
>> cmlChemFileList =
>> CMLChemFileWrapper.wrapInChemModelList(cmlChemFile);
>
> To here:
>
>> // Congfigure output
>> for (CMLChemFile c : cmlChemFileList) {
>> dataList.add(CDKObjectHandler.getBytes(c));
>> }
>> T2Reference containerRef =
>> referenceService.register(dataList, 1, true, context);
> [...]
>
> Hope that helps!
>
> Donal.
------------------------------------------------------------------------------
Sell apps to millions through the Intel(R) Atom(Tm) Developer Program
Be part of this innovative community and reach millions of netbook users
worldwide. Take advantage of special opportunities to increase revenue and
speed time-to-market. Join now, and jumpstart your future.
http://p.sf.net/sfu/intel-atom-d2d
_______________________________________________
taverna-hackers mailing list
[email protected]
Web site: http://www.taverna.org.uk
Mailing lists: http://www.taverna.org.uk/about/contact-us/
Developers Guide: http://www.taverna.org.uk/developers/