com.silverpeas.converter.openoffice
Class OpenOfficeConverter

java.lang.Object
  extended by com.silverpeas.converter.openoffice.OpenOfficeConverter
All Implemented Interfaces:
DocumentFormatConversion
Direct Known Subclasses:
OpenOfficeHTMLConverter, OpenOfficeODTConverter, OpenOfficeToHTMLConverter, OpenOfficeToPDFConverter

public abstract class OpenOfficeConverter
extends Object
implements DocumentFormatConversion

A document format converter using the OpenOffice API to perform its task. This class is the common one of all of the API document conversion implementation based on the OpenOffice API.


Constructor Summary
OpenOfficeConverter()
           
 
Method Summary
protected  void closeConnection(com.artofsolving.jodconverter.openoffice.connection.OpenOfficeConnection connection)
          Closes the connection to an OpenOffice service.
 File convert(File source, DocumentFormat inFormat, FilterOption... options)
          Converts the specified document in the specified format.
 File convert(File source, File destination, DocumentFormat inFormat, FilterOption... options)
          Converts the specified document in the specified format.
 void convert(InputStream source, DocumentFormat inFormat, OutputStream destination, DocumentFormat outFormat, FilterOption... options)
          Converts the specified inputstream/format in the specified outputstream/format.
protected  void convert(SilverpeasOpenOfficeDocumentConverter documentConverter, File source, File destination, FilterOption... options)
          Technical converting operations
protected  void convert(SilverpeasOpenOfficeDocumentConverter documentConverter, InputStream source, DocumentFormat inFormat, OutputStream destination, DocumentFormat outFormat, FilterOption... options)
          Technical converting operations
protected  SilverpeasOpenOfficeDocumentConverter getOpenOfficeDocumentConverterFrom(com.artofsolving.jodconverter.openoffice.connection.OpenOfficeConnection connection)
          Gets a converter from the OpenOffice service at the end-point of the connection.
abstract  boolean isDocumentSupported(File document)
          Is the specified document in the format on which the converter works?
protected  com.artofsolving.jodconverter.openoffice.connection.OpenOfficeConnection openConnection()
          Opens a connection to an OpenOffice service.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.silverpeas.converter.DocumentFormatConversion
getSupportedFormats
 

Constructor Detail

OpenOfficeConverter

public OpenOfficeConverter()
Method Detail

isDocumentSupported

public abstract boolean isDocumentSupported(File document)
Is the specified document in the format on which the converter works?

Parameters:
document - the document to check its format is supported.
Returns:
true if the format of the document is supported by this converter, false otherwise.

convert

public File convert(File source,
                    DocumentFormat inFormat,
                    FilterOption... options)
Description copied from interface: DocumentFormatConversion
Converts the specified document in the specified format. The format should be supported by the converter. If an error occurs while converting the specified file, then a runtime exception DocumentFormatConversionException is thrown.

Specified by:
convert in interface DocumentFormatConversion
Parameters:
source - the document to convert.
inFormat - the format into which the document has to be converted.
options - additional options such as "PageRange"
Returns:
the file with the converted document.

convert

public File convert(File source,
                    File destination,
                    DocumentFormat inFormat,
                    FilterOption... options)
Description copied from interface: DocumentFormatConversion
Converts the specified document in the specified format. The format should be supported by the converter. If an error occurs while converting the specified file, then a runtime exception DocumentFormatConversionException is thrown.

Specified by:
convert in interface DocumentFormatConversion
Parameters:
source - the document to convert.
destination - the converted document.
inFormat - the format into which the document has to be converted.
Returns:
the destination file.

convert

public void convert(InputStream source,
                    DocumentFormat inFormat,
                    OutputStream destination,
                    DocumentFormat outFormat,
                    FilterOption... options)
Description copied from interface: DocumentFormatConversion
Converts the specified inputstream/format in the specified outputstream/format.

Specified by:
convert in interface DocumentFormatConversion
Parameters:
source - the source stream to convert.
inFormat - the format from which the document has to be converted.
destination - the converted stream.
outFormat - the format into which the document has to be converted.

convert

protected void convert(SilverpeasOpenOfficeDocumentConverter documentConverter,
                       File source,
                       File destination,
                       FilterOption... options)
Technical converting operations

Parameters:
documentConverter -
source -
destination -
options -

convert

protected void convert(SilverpeasOpenOfficeDocumentConverter documentConverter,
                       InputStream source,
                       DocumentFormat inFormat,
                       OutputStream destination,
                       DocumentFormat outFormat,
                       FilterOption... options)
Technical converting operations

Parameters:
documentConverter -
source -
inFormat -
destination -
outFormat -
options -

openConnection

protected com.artofsolving.jodconverter.openoffice.connection.OpenOfficeConnection openConnection()
                                                                                           throws ConnectException
Opens a connection to an OpenOffice service. This methods wraps the way the connection(s) life-cycle is managed.

Returns:
a connection to an OpenOffice service.
Throws:
ConnectException - if no connection can be opened with an OpenOffice service. This can occurs when no OpenOffice service is available for example.

closeConnection

protected void closeConnection(com.artofsolving.jodconverter.openoffice.connection.OpenOfficeConnection connection)
Closes the connection to an OpenOffice service. This methods wraps the way the connection(s) life-cycle is managed.

Parameters:
connection - the connection to release.

getOpenOfficeDocumentConverterFrom

protected SilverpeasOpenOfficeDocumentConverter getOpenOfficeDocumentConverterFrom(com.artofsolving.jodconverter.openoffice.connection.OpenOfficeConnection connection)
Gets a converter from the OpenOffice service at the end-point of the connection. This method wraps the way the OpenOfficeDocumentConverter instances are managed.

Parameters:
connection - the connection an OpenOffice service.
Returns:
a converter of documents.


Copyright © 2016 Silverpeas. All Rights Reserved.