Reputation: 7428
Technology stack
The problem
I need to be able to process ZIP files containing documents in the application, unzip them recursively. What I mean by recursively - if the ZIP contains other ZIP files they also should be unzipped. Then all documents inside all the archives should be processed.
Point 1 should be executed in parallel in order to speed up the process.
Implementation
compute()
method check if the set of ZIP contents is smaller enough (document set size is 1) to compute directly or if it should continue with the partitioning. If it should be computed directly I check if the current content/file is actually a file to be processed or it is another (nested) ZIP. Here comes the interesting part - when I create the ZipPartitioner in ZipService I pass this
to its constructor, so I have a reference to the ZipService. Then if in the compute directly logic it turns out the content is actually a ZIP again, I call the process(zip) method from the ZipService's reference so the process can start all over again recursively.Result
Question
Let me know what is unclear in my explanation (I bet there will be something).
Upvotes: 2
Views: 710
Reputation: 597046
A few advice that should help:
Upvotes: 5