[xwiki-devs] [GSOC]get control of the conversion target temp file path
Hi Vincent, Sorry for not send the mail to the dev list. I just reply the mail. On Sun, Aug 24, 2008 at 6:13 PM, Vincent Massol <vincent@massol.net> wrote:
On Aug 24, 2008, at 10:15 AM, Vincent Massol wrote:
On Aug 24, 2008, at 6:40 AM, Wang Ning wrote:
Hi,
Yes, I think it's necessary, if the client want to control the output directory.
Ok I've thought a bit about this and here's what I propose:
1) Introduce a new ConverterOutput interface with the following methods: - saveImage(String imageName, InputStream imageData); - saveDocument(InputStream documentData);
Actually just realized that in some cases you'll have more than 1 output file so instead you should have:
saveDocument(String documentName, InpuStream documentData);
Also is there a notion of main file? When there are several files how do the user know which one is the start/main file?
If the use give the target File to output to, like then the main result file is just it. We can get the main output file in the DefaultOfficeConverter as I change the inputstream to File and create a temp file for the main target output file.
2) Modify Converter interface to be:
void convert(InputStream sourceData, OfficeDocumentType sourceType, ConverterOutput outputData, OfficeDocumentType outputType);
3) Provide 1 implementation of ConverterOutput for the moment (+ a mock one for the unit tests of the Converter):
I didn't mean a mock class but to use jmock as we're doing in other tests to dynamically mock the ConverterOutput interface.
[snip] -- Thanks Wang Ning -- Thanks Wang Ning
On Aug 24, 2008, at 7:17 PM, Wang Ning wrote:
Hi Vincent,
Sorry for not send the mail to the dev list. I just reply the mail.
On Sun, Aug 24, 2008 at 6:13 PM, Vincent Massol <vincent@massol.net> wrote:
On Aug 24, 2008, at 10:15 AM, Vincent Massol wrote:
On Aug 24, 2008, at 6:40 AM, Wang Ning wrote:
Hi,
Yes, I think it's necessary, if the client want to control the output directory.
Ok I've thought a bit about this and here's what I propose:
1) Introduce a new ConverterOutput interface with the following methods: - saveImage(String imageName, InputStream imageData); - saveDocument(InputStream documentData);
Actually just realized that in some cases you'll have more than 1 output file so instead you should have:
saveDocument(String documentName, InpuStream documentData);
Also is there a notion of main file? When there are several files how do the user know which one is the start/main file?
If the use give the target File to output to, like then the main result file is just it. We can get the main output file in the DefaultOfficeConverter as I change the inputstream to File and create a temp file for the main target output file.
Again please don't change the interface. The right API is inputStream not File. File is never a good object to pass because it's way too limitating. For example you can't use a URL for a file. Thanks -Vincent
2) Modify Converter interface to be:
void convert(InputStream sourceData, OfficeDocumentType sourceType, ConverterOutput outputData, OfficeDocumentType outputType);
3) Provide 1 implementation of ConverterOutput for the moment (+ a mock one for the unit tests of the Converter):
I didn't mean a mock class but to use jmock as we're doing in other tests to dynamically mock the ConverterOutput interface.
[snip]
-- Thanks Wang Ning
-- Thanks Wang Ning _______________________________________________ devs mailing list devs@xwiki.org http://lists.xwiki.org/mailman/listinfo/devs
participants (2)
-
Vincent Massol -
Wang Ning