Merged V2.2 to HEAD

8429: Merged V2.1 to V2.2 
      8387: Fix for WCM-1090 see ACT 1551 
      8421: Minor typo fix to OpenOffice document formats descriptions 
      8422: Fixed AR-2145: ContentStore cleaner was not watching out for VM shutdowns 
      8423: Removal of default root objects responsible

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@8510 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2008-03-11 14:01:39 +00:00
parent 9c43c09bdc
commit 6a541a840e
3 changed files with 50 additions and 8 deletions

View File

@@ -115,7 +115,7 @@
<document-format><name>Microsoft Excel</name> <document-format><name>Microsoft Excel</name>
<family>Spreadsheet</family> <family>Spreadsheet</family>
<mime-type>application/application/vnd.excel</mime-type> <mime-type>application/vnd.excel</mime-type>
<file-extension>xls</file-extension> <file-extension>xls</file-extension>
<export-filters> <export-filters>
<entry><family>Spreadsheet</family><string>MS Excel 97</string></entry> <entry><family>Spreadsheet</family><string>MS Excel 97</string></entry>

View File

@@ -45,6 +45,7 @@ import org.alfresco.service.cmr.repository.ContentData;
import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter; import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter;
import org.alfresco.service.transaction.TransactionService; import org.alfresco.service.transaction.TransactionService;
import org.alfresco.util.PropertyCheck; import org.alfresco.util.PropertyCheck;
import org.alfresco.util.VmShutdownListener;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
@@ -60,6 +61,9 @@ public class ContentStoreCleaner
{ {
private static Log logger = LogFactory.getLog(ContentStoreCleaner.class); private static Log logger = LogFactory.getLog(ContentStoreCleaner.class);
/** kept to notify the thread that it should quit */
private static VmShutdownListener vmShutdownListener = new VmShutdownListener("ContentStoreCleaner");
private DictionaryService dictionaryService; private DictionaryService dictionaryService;
private NodeDaoService nodeDaoService; private NodeDaoService nodeDaoService;
private AVMNodeDAO avmNodeDAO; private AVMNodeDAO avmNodeDAO;
@@ -178,6 +182,10 @@ public class ContentStoreCleaner
{ {
public void handle(Node node, Serializable value) public void handle(Node node, Serializable value)
{ {
if (vmShutdownListener.isVmShuttingDown())
{
throw new VmShutdownException();
}
// Convert the values to ContentData and extract the URLs // Convert the values to ContentData and extract the URLs
ContentData contentData = DefaultTypeConverter.INSTANCE.convert(ContentData.class, value); ContentData contentData = DefaultTypeConverter.INSTANCE.convert(ContentData.class, value);
String contentUrl = contentData.getContentUrl(); String contentUrl = contentData.getContentUrl();
@@ -204,6 +212,10 @@ public class ContentStoreCleaner
{ {
public void handle(String contentUrl) public void handle(String contentUrl)
{ {
if (vmShutdownListener.isVmShuttingDown())
{
throw new VmShutdownException();
}
contentUrlDAO.deleteContentUrl(contentUrl); contentUrlDAO.deleteContentUrl(contentUrl);
} }
}; };
@@ -225,6 +237,10 @@ public class ContentStoreCleaner
{ {
public void handle(String contentUrl) public void handle(String contentUrl)
{ {
if (vmShutdownListener.isVmShuttingDown())
{
throw new VmShutdownException();
}
contentUrlDAO.createContentUrl(contentUrl); contentUrlDAO.createContentUrl(contentUrl);
} }
}; };
@@ -251,6 +267,10 @@ public class ContentStoreCleaner
{ {
for (ContentStore store : stores) for (ContentStore store : stores)
{ {
if (vmShutdownListener.isVmShuttingDown())
{
throw new VmShutdownException();
}
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
{ {
if (store.isWriteSupported()) if (store.isWriteSupported())
@@ -280,12 +300,33 @@ public class ContentStoreCleaner
return null; return null;
}; };
}; };
transactionService.getRetryingTransactionHelper().doInTransaction(executeCallback); try
// Done
if (logger.isDebugEnabled())
{ {
logger.debug(" Content store cleanup completed."); transactionService.getRetryingTransactionHelper().doInTransaction(executeCallback);
// Done
if (logger.isDebugEnabled())
{
logger.debug(" Content store cleanup completed.");
}
}
catch (VmShutdownException e)
{
// Aborted
if (logger.isDebugEnabled())
{
logger.debug(" Content store cleanup aborted.");
}
} }
} }
/**
* Message carrier to break out of loops using the callback.
*
* @author Derek Hulley
* @since 2.1.3
*/
private class VmShutdownException extends RuntimeException
{
private static final long serialVersionUID = -5876107469054587072L;
}
} }

View File

@@ -509,8 +509,9 @@ public class RhinoScriptProcessor extends BaseProcessor implements ScriptProcess
// add the global scripts // add the global scripts
for (ProcessorExtension ex : this.processorExtensions.values()) for (ProcessorExtension ex : this.processorExtensions.values())
{ {
model.put(ex.getExtensionName(), ex); model.put(ex.getExtensionName(), ex);
} }
// insert supplied object model into root of the default scope // insert supplied object model into root of the default scope
for (String key : model.keySet()) for (String key : model.keySet())