Merged V2.1 to HEAD

6455: OpenOffice transformer and extractor register regardless of the initial connection state.
   6456: Fix for WCM-636 (Clicking OK twice while deleting web project results in exception)
   6457: Updated installers and associated config
   6458: AR-1669 Add getQnamePath to Javascript
   6459: Fix for AWC-1456 - Word and Excel documents were being stored as octet streams rather than their correct mimetype
   6460: Reverse order of reject & approve transitions, so that approve appears first in list of ui actions.
   6461: Removed Process.exe (often detected as a virus) and updated config wizard.
   6462: Switch to synchronous indexing for AVM by default
   6463: Better support to query the state of AVM indexes
   6464: Added Office 2007 document mimetypes and icons
   6465: Added Office 2007 icons without the typo this time


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6736 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2007-09-10 22:41:44 +00:00
parent 28d4278290
commit 1f3aabc6a0
17 changed files with 265 additions and 158 deletions

View File

@@ -27,7 +27,6 @@ package org.alfresco.repo.content.transform;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.ConnectException;
import java.util.Map;
import net.sf.jooreports.converter.DocumentFamily;
@@ -46,8 +45,6 @@ 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.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.core.io.DefaultResourceLoader;
/**
@@ -58,11 +55,7 @@ import org.springframework.core.io.DefaultResourceLoader;
*/
public class OpenOfficeContentTransformer extends AbstractContentTransformer
{
private static Log logger = LogFactory.getLog(OpenOfficeContentTransformer.class);
private OpenOfficeConnection connection;
/** Keep track of the initial connection state */
private boolean initiallyConnected;
private OpenOfficeDocumentConverter converter;
private String documentFormatsConfiguration;
private DocumentFormatRegistry formatRegistry;
@@ -91,30 +84,6 @@ public class OpenOfficeContentTransformer extends AbstractContentTransformer
return connection.isConnected();
}
private synchronized boolean connect()
{
boolean success = false;
if (isConnected())
{
// just leave it
success = true;
}
else
{
try
{
connection.connect();
success = true;
}
catch (ConnectException e)
{
logger.warn(e.getMessage());
}
}
// Done
return success;
}
@Override
public void register()
{
@@ -140,18 +109,11 @@ public class OpenOfficeContentTransformer extends AbstractContentTransformer
formatRegistry = new XmlDocumentFormatRegistry();
}
// attempt to establish a connection
initiallyConnected = connect();
// set up the converter
converter = new OpenOfficeDocumentConverter(connection);
if (initiallyConnected)
{
// If the server starts with OO running, then it will attempt reconnections. Otherwise it will
// just be wasting time trying to see if a connection is available all the time.
super.register();
}
// Register
super.register();
}
/**
@@ -161,16 +123,8 @@ public class OpenOfficeContentTransformer extends AbstractContentTransformer
{
if (!isConnected())
{
if (!initiallyConnected)
{
// It wasn't there to start with, so we won't bother trying to connect
return 0.0;
}
// The connection may have gone away, so attempt to get it again
if (!connect())
{
return 0.0;
}
// The connection management is must take care of this
return 0.0;
}
// there are some conversions that fail, despite the converter believing them possible