Merge V4.1-BUG-FIX (4.1.1) to HEAD

38859: ALF-14240: Merged V3.4-BUG-FIX (3.4.11) to V4.1-BUG-FIX (4.1.1)
      38858: ALF-15012 CLONE - New properties for "baseContentTransformer" prevent a remote OpenOffice configuration to start
         - Turns out that the 'New properties' that I added in 3.4.8 made it harder to get a remote OpenOffice instance
           working, but it has not been possible to do OpenOffice transformations on a remote machine for some time in the
           way described on the wiki
           https://wiki.alfresco.com/wiki/Running_OpenOffice_From_Remote_Machine#Remote_Machine_Setup
         - The following issues were all closed as "Not a Bug - Unsupported use case", even though the wiki describes it.
           They all work now - Only discovered these after I had fixed the code.
           ALF-236:  (Alfresco 3.1.1) RemoteOpenOfficeContentTransformer fails to transform txt to odt
           ALF-4049: (Alfresco 3.2.2) RemoteOpenOfficeContentTransformer can't be used in a sub-system...
           ALF-8440: (Alfresco 3.3.3) Indicates moving OpenOffice transformations to the subsystem OOoDirect requires
                     different spring bean overrides.
         - Having worked out that RemoteOpenOfficeContentTransformer was really just a very early version of
           OpenOfficeContentTransformerWorker, I have removed RemoteOpenOfficeContentTransformer and the
           remote-openoffice-context.xml.sample and modified OpenOfficeContentTransformerWorker to support remote
           OpenOffice instances. Rather than having to override spring beans it is now possible to do the
           configuration using Alfresco global properties. Introduced one new one: ooo.host This must be set to the name
           or ip of the remote system, ooo.port (already existed) must be set to the port used by the remote OppenOffice
           instance and ooo.enabled (already existed) must be set to false so that a local instance is not started.
         - As a side effect of using OpenOfficeContentTransformerWorker, all bug fixes that have been added to this
           class will now also be available to remote OpenOffice instances.
         - Added extra change to share-form-config.xml (not in 3.4) to include the host as a field
   38742: ALF-14801 - Overwrite or delete a folder containing multiple files and folders via CIFS on Lion OS X fails with StringIndexOutOfBoundsException
   38679: ALF-14857 - Importing .eml messages generated from Lotus Notes doesn't work
   38675: ALF-14942	Cast operation will always fail in MoveFileOperation
   38666: Merged V4.1 to V4.1-BUG-FIX
      38665: ALF-13260: Mysql does an awful planification of ibatis "select_ChildAssocOfParentByName" query after some heavy load
         - improved "select_ChildAssocOfParentByName" where clause to engage existing index
   38598: New Chinese translations from Gloria plus Bitrock configuration to enable them


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@38860 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2012-07-06 09:47:41 +00:00
parent f23940b55c
commit 0bd1c922b4
10 changed files with 134 additions and 307 deletions

View File

@@ -246,6 +246,7 @@
<list> <list>
<value>EEE, d MMM yyyy HH:mm:ss Z</value> <value>EEE, d MMM yyyy HH:mm:ss Z</value>
<value>EEE, d MMM yy HH:mm:ss Z</value> <value>EEE, d MMM yy HH:mm:ss Z</value>
<value>d MMM yyyy HH:mm:ss Z</value>
</list> </list>
</property> </property>
</bean> </bean>

View File

@@ -1,14 +0,0 @@
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
<beans>
<bean id="openOfficeConnection" class="net.sf.jooreports.openoffice.connection.SocketOpenOfficeConnection">
<constructor-arg type="java.lang.String" value="156.124.13.102"/>
<constructor-arg type="int" value="8100"/>
</bean>
<bean id="transformer.OpenOffice" class="org.alfresco.repo.content.transform.RemoteOpenOfficeContentTransformer" parent="baseContentTransformer" >
<property name="connection">
<ref bean="openOfficeConnection" />
</property>

View File

@@ -1127,6 +1127,7 @@
<include refid="alfresco.node.select_ChildAssoc_FromSimple"/> <include refid="alfresco.node.select_ChildAssoc_FromSimple"/>
where where
parentNode.id = #{parentNode.id} parentNode.id = #{parentNode.id}
and assoc.type_qname_id = #{typeQNameId}
and assoc.child_node_name = #{childNodeName} and assoc.child_node_name = #{childNodeName}
and assoc.child_node_name_crc = #{childNodeNameCrc} and assoc.child_node_name_crc = #{childNodeNameCrc}
</select> </select>

View File

@@ -45,7 +45,8 @@
</property> </property>
</bean> </bean>
<bean id="openOfficeConnection" class="net.sf.jooreports.openoffice.connection.SocketOpenOfficeConnection"> <bean id="openOfficeConnection" class="org.alfresco.util.SocketOpenOfficeConnection">
<constructor-arg value="${ooo.host}"/>
<constructor-arg value="${ooo.port}"/> <constructor-arg value="${ooo.port}"/>
</bean> </bean>

View File

@@ -4,4 +4,5 @@ ooo.exe=soffice
# This property determines whether the OOoDirect services are available. # This property determines whether the OOoDirect services are available.
# Allowed values: "true" or "false" # Allowed values: "true" or "false"
ooo.enabled=true ooo.enabled=true
ooo.host=localhost
ooo.port=8100 ooo.port=8100

View File

@@ -180,7 +180,7 @@ public class ScenarioCreateDeleteRenameShuffleInstance implements ScenarioInstan
{ {
int i = deleteName.lastIndexOf('.'); int i = deleteName.lastIndexOf('.');
if(i > 0 && deleteName.substring(0, i).equalsIgnoreCase(createName.substring(0,i))) if((i > 0) && (i < createName.length()) && deleteName.substring(0, i).equalsIgnoreCase(createName.substring(0,i)))
{ {
logger.debug("check filenames - does match"); logger.debug("check filenames - does match");
} }

View File

@@ -89,7 +89,7 @@ public class MoveFileOperation implements Operation
{ {
if(o instanceof MoveFileOperation) if(o instanceof MoveFileOperation)
{ {
RenameFileOperation r = (RenameFileOperation)o; MoveFileOperation r = (MoveFileOperation)o;
if(fromPath.equals(r.getFromPath()) && toPath.equals(r.getToPath())) if(fromPath.equals(r.getFromPath()) && toPath.equals(r.getToPath()))
{ {
return true; return true;

View File

@@ -38,6 +38,7 @@ import org.alfresco.service.cmr.repository.ContentWriter;
import org.alfresco.service.cmr.repository.MimetypeService; import org.alfresco.service.cmr.repository.MimetypeService;
import org.alfresco.service.cmr.repository.TransformationOptions; import org.alfresco.service.cmr.repository.TransformationOptions;
import org.alfresco.util.PropertyCheck; import org.alfresco.util.PropertyCheck;
import org.alfresco.util.SocketOpenOfficeConnection;
import org.alfresco.util.TempFileProvider; import org.alfresco.util.TempFileProvider;
import org.apache.pdfbox.exceptions.COSVisitorException; import org.apache.pdfbox.exceptions.COSVisitorException;
import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.pdmodel.PDDocument;
@@ -97,40 +98,48 @@ public class OpenOfficeContentTransformerWorker extends OOoContentTransformerHel
public boolean isAvailable() public boolean isAvailable()
{ {
return this.connection.isConnected(); return connection.isConnected();
} }
public void afterPropertiesSet() throws Exception public void afterPropertiesSet() throws Exception
{ {
PropertyCheck.mandatory("OpenOfficeContentTransformerWorker", "connection", this.connection); PropertyCheck.mandatory("OpenOfficeContentTransformerWorker", "connection", connection);
// load the document conversion configuration // load the document conversion configuration
if (this.documentFormatsConfiguration != null) if (documentFormatsConfiguration != null)
{ {
DefaultResourceLoader resourceLoader = new DefaultResourceLoader(); DefaultResourceLoader resourceLoader = new DefaultResourceLoader();
try try
{ {
InputStream is = resourceLoader.getResource(this.documentFormatsConfiguration).getInputStream(); InputStream is = resourceLoader.getResource(documentFormatsConfiguration).getInputStream();
this.formatRegistry = new XmlDocumentFormatRegistry(is); formatRegistry = new XmlDocumentFormatRegistry(is);
} }
catch (IOException e) catch (IOException e)
{ {
throw new AlfrescoRuntimeException("Unable to load document formats configuration file: " throw new AlfrescoRuntimeException(
+ this.documentFormatsConfiguration); "Unable to load document formats configuration file: " +
documentFormatsConfiguration);
} }
} }
else else
{ {
this.formatRegistry = new XmlDocumentFormatRegistry(); formatRegistry = new XmlDocumentFormatRegistry();
} }
// set up the converter // set up the converter
if (this.converter == null) if (converter == null)
{ {
this.converter = new OpenOfficeDocumentConverter(this.connection); converter = getDefaultConverter(connection);
} }
} }
protected AbstractOpenOfficeDocumentConverter getDefaultConverter(OpenOfficeConnection connection)
{
return (connection instanceof SocketOpenOfficeConnection)
? ((SocketOpenOfficeConnection)connection).getDefaultConverter()
: new OpenOfficeDocumentConverter(connection);
}
/** /**
* @see DocumentFormatRegistry * @see DocumentFormatRegistry
*/ */
@@ -157,14 +166,14 @@ public class OpenOfficeContentTransformerWorker extends OOoContentTransformerHel
String sourceExtension = mimetypeService.getExtension(sourceMimetype); String sourceExtension = mimetypeService.getExtension(sourceMimetype);
String targetExtension = mimetypeService.getExtension(targetMimetype); String targetExtension = mimetypeService.getExtension(targetMimetype);
// query the registry for the source format // query the registry for the source format
DocumentFormat sourceFormat = this.formatRegistry.getFormatByFileExtension(sourceExtension); DocumentFormat sourceFormat = formatRegistry.getFormatByFileExtension(sourceExtension);
if (sourceFormat == null) if (sourceFormat == null)
{ {
// no document format // no document format
return false; return false;
} }
// query the registry for the target format // query the registry for the target format
DocumentFormat targetFormat = this.formatRegistry.getFormatByFileExtension(targetExtension); DocumentFormat targetFormat = formatRegistry.getFormatByFileExtension(targetExtension);
if (targetFormat == null) if (targetFormat == null)
{ {
// no document format // no document format
@@ -185,7 +194,10 @@ public class OpenOfficeContentTransformerWorker extends OOoContentTransformerHel
} }
} }
public void transform(ContentReader reader, ContentWriter writer, TransformationOptions options) throws Exception public void transform(
ContentReader reader,
ContentWriter writer,
TransformationOptions options) throws Exception
{ {
String sourceMimetype = getMimetype(reader); String sourceMimetype = getMimetype(reader);
String targetMimetype = getMimetype(writer); String targetMimetype = getMimetype(writer);
@@ -194,14 +206,14 @@ public class OpenOfficeContentTransformerWorker extends OOoContentTransformerHel
String sourceExtension = mimetypeService.getExtension(sourceMimetype); String sourceExtension = mimetypeService.getExtension(sourceMimetype);
String targetExtension = mimetypeService.getExtension(targetMimetype); String targetExtension = mimetypeService.getExtension(targetMimetype);
// query the registry for the source format // query the registry for the source format
DocumentFormat sourceFormat = this.formatRegistry.getFormatByFileExtension(sourceExtension); DocumentFormat sourceFormat = formatRegistry.getFormatByFileExtension(sourceExtension);
if (sourceFormat == null) if (sourceFormat == null)
{ {
// source format is not recognised // source format is not recognised
throw new ContentIOException("No OpenOffice document format for source extension: " + sourceExtension); throw new ContentIOException("No OpenOffice document format for source extension: " + sourceExtension);
} }
// query the registry for the target format // query the registry for the target format
DocumentFormat targetFormat = this.formatRegistry.getFormatByFileExtension(targetExtension); DocumentFormat targetFormat = formatRegistry.getFormatByFileExtension(targetExtension);
if (targetFormat == null) if (targetFormat == null)
{ {
// target format is not recognised // target format is not recognised
@@ -212,15 +224,19 @@ public class OpenOfficeContentTransformerWorker extends OOoContentTransformerHel
// does the format support the conversion // does the format support the conversion
if (!targetFormat.isExportableFrom(sourceFamily)) if (!targetFormat.isExportableFrom(sourceFamily))
{ {
throw new ContentIOException("OpenOffice conversion not supported: \n" + " reader: " + reader + "\n" throw new ContentIOException(
+ " writer: " + writer); "OpenOffice conversion not supported: \n" +
" reader: " + reader + "\n" +
" writer: " + writer);
} }
// create temporary files to convert from and to // create temporary files to convert from and to
File tempFromFile = TempFileProvider.createTempFile("OpenOfficeContentTransformer-source-", "." File tempFromFile = TempFileProvider.createTempFile(
+ sourceExtension); "OpenOfficeContentTransformer-source-",
File tempToFile = TempFileProvider "." + sourceExtension);
.createTempFile("OpenOfficeContentTransformer-target-", "." + targetExtension); File tempToFile = TempFileProvider.createTempFile(
"OpenOfficeContentTransformer-target-",
"." + targetExtension);
final long documentSize = reader.getSize(); final long documentSize = reader.getSize();
@@ -247,14 +263,17 @@ public class OpenOfficeContentTransformerWorker extends OOoContentTransformerHel
// it is preferred over PDFBox. // it is preferred over PDFBox.
try try
{ {
this.converter.convert(tempFromFile, sourceFormat, tempToFile, targetFormat); converter.convert(tempFromFile, sourceFormat, tempToFile, targetFormat);
// conversion success // conversion success
} }
catch (OpenOfficeException e) catch (OpenOfficeException e)
{ {
throw new ContentIOException("OpenOffice server conversion failed: \n" + " reader: " + reader + "\n" throw new ContentIOException("OpenOffice server conversion failed: \n" +
+ " writer: " + writer + "\n" + " from file: " + tempFromFile + "\n" + " to file: " " reader: " + reader + "\n" +
+ tempToFile, e); " writer: " + writer + "\n" +
" from file: " + tempFromFile + "\n" +
" to file: " + tempToFile,
e);
} }
} }
@@ -267,11 +286,11 @@ public class OpenOfficeContentTransformerWorker extends OOoContentTransformerHel
* This method produces an empty PDF file at the specified File location. * This method produces an empty PDF file at the specified File location.
* Apache's PDFBox is used to create the PDF file. * Apache's PDFBox is used to create the PDF file.
*/ */
private void produceEmptyPdfFile(File tempToFile) private void produceEmptyPdfFile(File tempToFile)
{ {
// If improvement PDFBOX-914 is incorporated, we can do this with a straight call to // If improvement PDFBOX-914 is incorporated, we can do this with a straight call to
// org.apache.pdfbox.TextToPdf.createPDFFromText(new StringReader("")); // org.apache.pdfbox.TextToPdf.createPDFFromText(new StringReader(""));
// https://issues.apache.org/jira/browse/PDFBOX-914 // https://issues.apache.org/jira/browse/PDFBOX-914
PDDocument pdfDoc = null; PDDocument pdfDoc = null;
PDPageContentStream contentStream = null; PDPageContentStream contentStream = null;
@@ -279,45 +298,49 @@ public class OpenOfficeContentTransformerWorker extends OOoContentTransformerHel
{ {
pdfDoc = new PDDocument(); pdfDoc = new PDDocument();
PDPage pdfPage = new PDPage(); PDPage pdfPage = new PDPage();
// Even though, we want an empty PDF, some libs (e.g. PDFRenderer) object to PDFs // Even though, we want an empty PDF, some libs (e.g. PDFRenderer) object to PDFs
// that have literally nothing in them. So we'll put a content stream in it. // that have literally nothing in them. So we'll put a content stream in it.
contentStream = new PDPageContentStream(pdfDoc, pdfPage); contentStream = new PDPageContentStream(pdfDoc, pdfPage);
pdfDoc.addPage(pdfPage); pdfDoc.addPage(pdfPage);
// Now write the in-memory PDF document into the temporary file. // Now write the in-memory PDF document into the temporary file.
pdfDoc.save(tempToFile.getAbsolutePath()); pdfDoc.save(tempToFile.getAbsolutePath());
} }
catch (COSVisitorException cvx) catch (COSVisitorException cvx)
{ {
throw new ContentIOException("Error creating empty PDF file", cvx); throw new ContentIOException("Error creating empty PDF file", cvx);
} }
catch (IOException iox) catch (IOException iox)
{ {
throw new ContentIOException("Error creating empty PDF file", iox); throw new ContentIOException("Error creating empty PDF file", iox);
} }
finally finally
{ {
if (contentStream != null) if (contentStream != null)
{ {
try try
{ {
contentStream.close(); contentStream.close();
} catch (IOException ignored) { }
// Intentionally empty catch (IOException ignored)
} {
} // Intentionally empty
if (pdfDoc != null) }
{ }
try if (pdfDoc != null)
{ {
pdfDoc.close(); try
} catch (IOException ignored) { {
// Intentionally empty. pdfDoc.close();
} }
} catch (IOException ignored)
{
// Intentionally empty.
}
}
} }
} }
/* /*
* (non-Javadoc) * (non-Javadoc)

View File

@@ -1,234 +0,0 @@
/*
* Copyright (C) 2005-2010 Alfresco Software Limited.
*
* This file is part of Alfresco
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
package org.alfresco.repo.content.transform;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.Map;
import net.sf.jooreports.converter.DocumentFamily;
import net.sf.jooreports.converter.DocumentFormat;
import net.sf.jooreports.converter.DocumentFormatRegistry;
import net.sf.jooreports.converter.XmlDocumentFormatRegistry;
import net.sf.jooreports.openoffice.connection.OpenOfficeConnection;
import net.sf.jooreports.openoffice.connection.OpenOfficeException;
import net.sf.jooreports.openoffice.converter.StreamOpenOfficeDocumentConverter;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.repo.content.MimetypeMap;
import org.alfresco.repo.content.transform.AbstractContentTransformer;
import org.alfresco.service.cmr.repository.ContentIOException;
import org.alfresco.service.cmr.repository.ContentReader;
import org.alfresco.service.cmr.repository.ContentWriter;
import org.alfresco.service.cmr.repository.MimetypeService;
import org.alfresco.util.PropertyCheck;
import org.alfresco.util.TempFileProvider;
import org.springframework.core.io.DefaultResourceLoader;
/**
* Makes use of the {@link http://sourceforge.net/projects/joott/JOOConverter} library to
* perform OpenOffice-drive conversions.
*
* @author Derek Hulley
* @author Juan David Zuluaga Arboleda
* @author Jared Ottley
*
*/
public class RemoteOpenOfficeContentTransformer extends AbstractContentTransformer
{
private OpenOfficeConnection connection;
private StreamOpenOfficeDocumentConverter converter;
private String documentFormatsConfiguration;
private DocumentFormatRegistry formatRegistry;
public RemoteOpenOfficeContentTransformer()
{
}
public void setConnection(OpenOfficeConnection connection)
{
this.connection = connection;
}
/**
* Set a non-default location from which to load the document format mappings.
*
* @param path a resource location supporting the <b>file:</b> or <b>classpath:</b> prefixes
*/
public void setDocumentFormatsConfiguration(String path)
{
this.documentFormatsConfiguration = path;
}
public boolean isConnected()
{
return connection.isConnected();
}
@Override
public void register()
{
PropertyCheck.mandatory("OpenOfficeContentTransformer", "connection", connection);
// load the document conversion configuration
if (documentFormatsConfiguration != null)
{
DefaultResourceLoader resourceLoader = new DefaultResourceLoader();
try
{
InputStream is = resourceLoader.getResource(documentFormatsConfiguration).getInputStream();
formatRegistry = new XmlDocumentFormatRegistry(is);
}
catch (IOException e)
{
throw new AlfrescoRuntimeException(
"Unable to load document formats configuration file: " + documentFormatsConfiguration);
}
}
else
{
formatRegistry = new XmlDocumentFormatRegistry();
}
// set up the converter
converter = new StreamOpenOfficeDocumentConverter(connection);
// Register
super.register();
}
/**
* @see DocumentFormatRegistry
*/
public double getReliability(String sourceMimetype, String targetMimetype)
{
if (!isConnected())
{
// The connection management is must take care of this
return 0.0;
}
// there are some conversions that fail, despite the converter believing them possible
if (targetMimetype.equals(MimetypeMap.MIMETYPE_XHTML))
{
return 0.0;
}
else if (targetMimetype.equals(MimetypeMap.MIMETYPE_WORDPERFECT))
{
return 0.0;
}
MimetypeService mimetypeService = getMimetypeService();
String sourceExtension = mimetypeService.getExtension(sourceMimetype);
String targetExtension = mimetypeService.getExtension(targetMimetype);
// query the registry for the source format
DocumentFormat sourceFormat = formatRegistry.getFormatByFileExtension(sourceExtension);
if (sourceFormat == null)
{
// no document format
return 0.0;
}
// query the registry for the target format
DocumentFormat targetFormat = formatRegistry.getFormatByFileExtension(targetExtension);
if (targetFormat == null)
{
// no document format
return 0.0;
}
// get the family of the target document
DocumentFamily sourceFamily = sourceFormat.getFamily();
// does the format support the conversion
if (!targetFormat.isExportableFrom(sourceFamily))
{
// unable to export from source family of documents to the target format
return 0.0;
}
else
{
return 1.0;
}
}
protected void transformInternal(
ContentReader reader,
ContentWriter writer,
Map<String, Object> options) throws Exception
{
String sourceMimetype = getMimetype(reader);
String targetMimetype = getMimetype(writer);
MimetypeService mimetypeService = getMimetypeService();
String sourceExtension = mimetypeService.getExtension(sourceMimetype);
String targetExtension = mimetypeService.getExtension(targetMimetype);
// query the registry for the source format
DocumentFormat sourceFormat = formatRegistry.getFormatByFileExtension(sourceExtension);
if (sourceFormat == null)
{
// source format is not recognised
throw new ContentIOException("No OpenOffice document format for source extension: " + sourceExtension);
}
// query the registry for the target format
DocumentFormat targetFormat = formatRegistry.getFormatByFileExtension(targetExtension);
if (targetFormat == null)
{
// target format is not recognised
throw new ContentIOException("No OpenOffice document format for target extension: " + targetExtension);
}
// get the family of the target document
DocumentFamily sourceFamily = sourceFormat.getFamily();
// does the format support the conversion
if (!targetFormat.isExportableFrom(sourceFamily))
{
throw new ContentIOException(
"OpenOffice conversion not supported: \n" +
" reader: " + reader + "\n" +
" writer: " + writer);
}
// create temporary files to convert from and to
File tempFromFile = TempFileProvider.createTempFile(
"OpenOfficeContentTransformer-source-",
"." + sourceExtension);
File tempToFile = TempFileProvider.createTempFile(
"OpenOfficeContentTransformer-target-",
"." + targetExtension);
// download the content from the source reader
reader.getContent(tempFromFile);
try
{
converter.convert(tempFromFile, sourceFormat, tempToFile, targetFormat);
// conversion success
}
catch (OpenOfficeException e)
{
throw new ContentIOException("OpenOffice server conversion failed: \n" +
" reader: " + reader + "\n" +
" writer: " + writer + "\n" +
" from file: " + tempFromFile + "\n" +
" to file: " + tempToFile,
e);
}
// upload the temp output to the writer given us
writer.putContent(tempToFile);
}
}

View File

@@ -0,0 +1,48 @@
/*
* Copyright (C) 2005-2012 Alfresco Software Limited.
*
* This file is part of Alfresco
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
package org.alfresco.util;
import net.sf.jooreports.openoffice.converter.AbstractOpenOfficeDocumentConverter;
import net.sf.jooreports.openoffice.converter.OpenOfficeDocumentConverter;
import net.sf.jooreports.openoffice.converter.StreamOpenOfficeDocumentConverter;
public class SocketOpenOfficeConnection extends net.sf.jooreports.openoffice.connection.SocketOpenOfficeConnection
{
private boolean defaultHost = true;
public SocketOpenOfficeConnection() {
super();
}
public SocketOpenOfficeConnection(int port) {
super(port);
}
public SocketOpenOfficeConnection(String host, int port) {
super(host, port);
defaultHost = DEFAULT_HOST.equals(host);
}
public AbstractOpenOfficeDocumentConverter getDefaultConverter()
{
return defaultHost
? new OpenOfficeDocumentConverter(this)
: new StreamOpenOfficeDocumentConverter(this);
}
}