diff options
Diffstat (limited to 'xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/xslt/PluginFactoryImpl.java')
-rw-r--r-- | xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/xslt/PluginFactoryImpl.java | 144 |
1 files changed, 60 insertions, 84 deletions
diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/xslt/PluginFactoryImpl.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/xslt/PluginFactoryImpl.java index 593ed3402c5c..c89fb72329aa 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/xslt/PluginFactoryImpl.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/xslt/PluginFactoryImpl.java @@ -37,21 +37,18 @@ import org.openoffice.xmerge.converter.dom.DOMDocument; import org.openoffice.xmerge.util.registry.ConverterInfo; /** - * <p>Xslt implementation of the <code>PluginFactory</code>. - * This encapsulates conversion of StarWriter XML format to and from - * a supported format.</p> + * Xslt implementation of the {@code PluginFactory}. * - * <p>The superclass produces a particular - * {@link org.openoffice.xmerge.Document Document} - * object, i.e. {@link - * org.openoffice.xmerge.converter.xml.sxw.SxwDocument - * SxwDocument} that the converters in this class work with. Thus, - * this class only implements the methods that produces the converters, - * i.e. {@link - * org.openoffice.xmerge.DocumentSerializer - * DocumentSerializer} and {@link - * org.openoffice.xmerge.DocumentDeserializer - * DocumentDeserializer}</p> + * <p>This encapsulates conversion of StarWriter XML format to and from a + * supported format.</p> + * + * <p>The superclass produces a particular {@link org.openoffice.xmerge.Document + * Document} object, i.e. {@link + * org.openoffice.xmerge.converter.xml.sxw.SxwDocument xwDocument} that the + * converters in this class work with. Thus, this class only implements the + * methods that produces the converters, i.e. {@link + * org.openoffice.xmerge.DocumentSerializer DocumentSerializer} and {@link + * org.openoffice.xmerge.DocumentDeserializer DocumentDeserializer}</p> */ public final class PluginFactoryImpl extends PluginFactory implements DocumentDeserializerFactory, DocumentSerializerFactory, DocumentMergerFactory @@ -65,46 +62,41 @@ public final class PluginFactoryImpl extends PluginFactory private final static ConverterCapabilities converterCap = new ConverterCapabilitiesImpl(); - /** - * Returns an instance of <code>DocumentSerializerImpl</code>, - * which is an implementation of the <code>DocumentSerializer</code> - * interface. + * Returns an instance of {@code DocumentSerializerImpl}, which is an + * implementation of the {@code DocumentSerializer} interface. * - * @param doc <code>Document</code> object to be - * converted/serialized. + * @param doc {@code Document} object to be converted/serialized. * - * @return A <code>DocumentSerializerImpl</code> object. + * @return A {@code DocumentSerializerImpl} object. */ public DocumentSerializer createDocumentSerializer(Document doc) { return new DocumentSerializerImpl(this,doc); } - /** - * Returns an instance of <code>DocumentDeserializerImpl</code>, - * which is an implementation of the <code>DocumentDeserializer</code> - * interface. + * Returns an instance of <code>DocumentDeserializerImpl</code>, + * which is an implementation of the <code>DocumentDeserializer</code> + * interface. * - * @param cd <code>ConvertData</code> object. + * @param cd {@code ConvertData} object. * - * @return A DocumentDeserializerImpl object. + * @return A {@code DocumentDeserializerImpl} object. */ public DocumentDeserializer createDocumentDeserializer(ConvertData cd) { - return new DocumentDeserializerImpl(this,cd); } - @Override - public org.openoffice.xmerge.Document createDeviceDocument(String str, java.io.InputStream inputStream) throws java.io.IOException { + @Override + public org.openoffice.xmerge.Document createDeviceDocument(String str, + java.io.InputStream inputStream) throws java.io.IOException { String ext = this.getDeviceFileExtension(); DOMDocument domDoc = new DOMDocument(str,ext); domDoc.read(inputStream); return domDoc; } - - @Override + @Override public Document createOfficeDocument(String name, InputStream is) throws IOException { @@ -114,8 +106,8 @@ public final class PluginFactoryImpl extends PluginFactory return doc; } - @Override - public Document createOfficeDocument(String name, InputStream is,boolean isZip) + @Override + public Document createOfficeDocument(String name, InputStream is, boolean isZip) throws IOException { // read zipped XML stream @@ -125,67 +117,51 @@ public final class PluginFactoryImpl extends PluginFactory } /** - * Returns a <code>String</code> containing the file extension of a - * <code>Document</code>. This method uses a properties file to determine - * a mapping from the device mime in the <code>ConverterInfo</code> to a - * particular file extension. If a mapping is not specified, the default - * is ".txt". + * Returns a {@code String} containing the file extension of a + * {@code Document}. + * + * <p>This method uses a properties file to determine a mapping from the + * device mime in the {@code ConverterInfo} to a particular file extension. + * If a mapping is not specified, the default is ".txt".</p> * - * @return <code>String</code>. + * @return The file extension of a {@code Document}. */ - - - public String getDeviceFileExtension(){ - Class<? extends PluginFactoryImpl> c = this.getClass(); - InputStream is = c.getResourceAsStream("XsltPlugin.properties"); - Properties props = new Properties(); - String ext= ".txt"; - String mimeType = null; - ConverterInfo ci = this.getConverterInfo(); - Iterator<String> enumerate = ci.getDeviceMime(); - while (enumerate.hasNext()) { - mimeType= enumerate.next(); - } - try { - props.load(is); - - String info = props.getProperty(mimeType); - if (info != null) { - ext = info; - } - } catch (Exception e) { + public String getDeviceFileExtension() { + Class<? extends PluginFactoryImpl> c = this.getClass(); + InputStream is = c.getResourceAsStream("XsltPlugin.properties"); + Properties props = new Properties(); + String ext = ".txt"; + String mimeType = null; + ConverterInfo ci = this.getConverterInfo(); + Iterator<String> enumerate = ci.getDeviceMime(); + while (enumerate.hasNext()) { + mimeType = enumerate.next(); + } + try { + props.load(is); + + String info = props.getProperty(mimeType); + if (info != null) { + ext = info; + } + } catch (Exception e) { // It is okay for the property file to not exist. - - } - return ext; + } + return ext; } /** - * Returns an instance of <code>DocumentMergerImpl</code>, - * which is an implementation of the <code>DocumentMerger</code> - * interface. + * Returns an instance of {@code DocumentMergerImpl}, which is an + * implementation of the {@code DocumentMerger} interface. * - * @param doc <code>Document</code> to merge. + * @param doc {@code Document} to merge. * - * @return A DocumentMergerImpl object. + * @return A {@code DocumentMergerImpl} object. */ public DocumentMerger createDocumentMerger(Document doc) { - ConverterCapabilities cc = converterCap; + ConverterCapabilities cc = converterCap; DocumentMergerImpl merger = new DocumentMergerImpl(doc, cc); return merger; - } - -} - - - - - - - - - - - +}
\ No newline at end of file |