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?

> 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.

Thanks
-Vincent


> XWikiDocumentConverterOutput. This implementation stores the result  
> of the conversion in a XWiki Document (it's name/location is passed  
> in the constructor). In the future if we need other implementations  
> we could add them (like a FileConverterOutput, etc) but they're not  
> needed for now.
>
> Note 1: 3) is much cleaner and allows to move some of the code in  
> the plugin to the XWikiDocumentConverterOutput class.
> Note 2: We can fully read the sourceData internally to save the  
> input data to a file in a XWiki temporary directory (and thus  
> control the output of the image files by jodconverter)
>
> WDYT?
>
> Thanks
> -Vincent
>
> PS: In the future please use the mailing list for everything related  
> to xwiki.
>
>>
>> In jodconverter, there a two main interface:
>>
>> 1) void convertInternal(InputStream inputStream, DocumentFormat
>> inputFormat, OutputStream outputStream, DocumentFormat outputFormat);
>>      
>> 2) void convertInternal(File inputFile, DocumentFormat inputFormat,
>> File outputFile, DocumentFormat outputFormat);
>>
>> The 1) just create a temp file for the outputstream in the system  
>> temp
>> directory. So if you want to control the output file directory, you
>> just have to change system temp directory which is not a way. In our
>> case, we want to get all the output when convert to html. So I don't
>> think this interface is enough.
>>
>> The 2) interface just can output all the result file to the
>> outputFile's directory which can get from xwiki.getTempFile().
>> Maybe you think we can use two Files in clients and deliver the
>> FileOutputStream and FileInputStream to the 1) interface, you just  
>> get
>> one output file in the FileOutputStream and can get the other  
>> results.
>> The client still can't get the temp directory where the other output
>> files.
>>
>> WDYT?
>>
>> On Sun, Aug 24, 2008 at 4:02 AM, Vincent Massol  
>> <[EMAIL PROTECTED]> wrote:
>>> Hi Wang,
>>>
>>> On Aug 23, 2008, at 9:55 PM, Wang Ning wrote:
>>>
>>>> Hi Vincent,
>>>>
>>>> I add a interface in the OfficeConverter
>>>> void convert(File inputFile, OfficeDocumentType inputDocumentType,
>>>> File outputFile,
>>>>     OfficeDocumentType outputDocumentType) throws
>>>> OfficeConverterException;
>>>> I think this useful.
>>>
>>> I don't think we need this since you can use a FileInputStream and a
>>> FileOutputStream.
>>>
>>> Thanks
>>> -Vincent
>>>
>>>> And I change the OfficeConverterPlugin that I can control the  
>>>> output
>>>> directory of the conversion.

_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs

Reply via email to