Dave Ward 82b9aba09a Merged V4.1-BUG-FIX to HEAD
41597: ALF-1907: Check out rule is active for spaces
    - Merged in fix from DEV
    - Changed List of applicable types to a Set
    - Added quick initial checks against the set before doing the subtype checks
    - Various typo fixes
   41598: Add an additional line of INFO to log the database details
   41599: Fix for ALF-8374 - Simple view: incorrect file type icon for *.page and *.eps files
   41600: Merge DEV to V4.1-BUG-FIX
      41478 : ALF-14078: CLONE - Saving files with apps on Mac OS X Lion in CIFS doesn't invoke rules
   41605: Fix for ALF-14653 - Share - Page link created wrongly in wiki. Solution to split wiki page name and title from Alex Bykov.
   41608: CIFS cluster saving of text file fails. ALF-14179
   The client releases the oplock by closing the file, if a remote oplock break was used then a notification to
   the remote node was missing in this case.
   41616: ALF-13577:modified the delete site REST API to set the status code to 409 if a node is locked.
   41624: MT: ALF-14331 - UserUsageTrackingComponent fails if disabled (in MT config)
   - defensive fix (exact steps do not repeat) - may also fix ALF-15956
   41652: more debug
   41653: Fix for ALF-15965 - IE9 - Script error occurs when manage aspect for a document
   41655: Merged BRANCHES/V4.1 to BRANCHES/DEV/V4.1-BUG-FIX (RECORD ONLY)
      41654: Fix for ALF-15965 - hand merged back from rev 41653
   41658: ALF-14967: Task operations through task-forms now audited
   41664: Reverse-merging change 41616 out of the product due to file formatting irregularities.
   This checkin was a fix for ALF-13577. A subsequent check-in will add the same fix but without the formatting problems.
   41665: ALF-11452: Disabling JBPM now prevents jobexecutor thread from starting and consuming unneeded resources
   41671: Reimplementation of fix for ALF-13577. Slight edit on previous fix.
   It now lets the NodeLockedException out of the Java layer and 'catches' this exception in the JavaScript layer. The API returns a 409 (conflict) if a NodeLockedException makes it to the JavaScript - the previous fix was returning 409 for *any* AlfrescoRuntimeException thrown during a site delete.
   Also this checkin preserves the whitespace/file layout of the preceding version.
   41688: ALF-15867 WikiServiceImplTest failing on SQL Server
      - Switched WikiService_transaction bean over to using RetryingTransactionInterceptor
   41720: ALF-15967: Using START_USER_ID_ instead of "initiator" property to query process instances started by user X to prevent extra joins
   41730: Fix for ALF-15995 NodeRef is missing in log on "Problem converting to Freemarker" error
   41743: ALF-9779	REGRESSION: FTP - Failed to retrieve directory listing for tenant user
   41745: Removed a HomeShareMapper - there were two
   41747: Fix for ALF-15811 SOLR query increases DocBitSet inefficiently
   Part of ALF-14861 SOLR to scale for non-admin users in 100k sites and a subgroup of each of 1000 independent groupings with 1000 subgroups
   41748: Fix for ALF-15950 Solr: throws NPE: org.alfresco.solr.SolrLuceneAnalyser.loadAnalyzer
   - return default analyzer
   41752: Fix for ALF-13634 Re-created category won't show up again on a node in Document Library.
   41779: ALF-11283 - Got the home share mapper up and working after some refactoring.
   41795: Fix for ALF-14361 CMIS object type definition for Document and Folder not spec compliant
   41796: ALF-16008: missing column on clean Alfresco and after upgrade from 3.4.10 (703)
     - Schema-Reference for DB2 referenced a non-existent column.
   41802: Fixed ALF-16029: TransactionCleanupTest throws constraint violations 
    - Fallout from ALF-12358; sys:deleted node types have a mandatory property
    - Before bulk-deleting nodes, we need to delete properties
    - Use overriding DAo for MySQL.  Other DBs can use standard delete with joins
    - NB: Fixed TransactionalCleanupTest to double-check the purge job
   41822: Refactor to both Share Mappers.
   41838: BDE-85: Deploy alfresco-mmt with a proper pom.xml containing dependencies
     Also, refactor Maven deployment to use a macro
   41858: ALF-14444 - CloudSync: Ensure unknown properties when synced to Cloud are ignored properly
   41876: Fix ALF-16067 - Items with cm:versionable aspect [custom aspect added] throw errors in Share UI
   41877: Updated Spring Surf libs (1148) - downgrades module deployment error messages
   41878: ALF-16069 - RU: 'Web Deployed' folder is not localized if Alfresco is installed with Russian locale.
   41879: Fix non-continuous build, trying to call continuous-init from maven-env-prerequisites
   41918: Merged PATCHES/V4.1.1 to V4.1-BUG-FIX
      41657: ALF-15965 - IE9 - Script error occurs when manage aspect for a document (correct 4.1.1 branch this time)
      41834: Merged DEV to V4.1.1 (4.1.1)
         41827: ALF-15983: SPP: Meeting space: all-day event is displayed on the day before specified during creation
         Removing of time zone has been modified to be sensitive to Outlook meeting events which are not requiring special conversion for the start and end dates
      41835: Merged DEV to V4.1.1 (4.1.1)
         41833: ALF-16038 : DB2: Upgrade script needed to remove ALFUSER.ACT_HI_ACTINST.OWNER_
         The patch was created to remove an unnecessary column in DB2.
      41845: Reverse merge: << In attempt to clear 12 new DB2 build errors - don't think it is going to work >> 
         41835: Merged DEV to V4.1.1 (4.1.1)
            41833: ALF-16038 : DB2: Upgrade script needed to remove ALFUSER.ACT_HI_ACTINST.OWNER_
            The patch was created to remove an unnecessary column in DB2.
      Merged V4.1-BUG-FIX (4.1.2) to V4.1.1 (4.1.1)
         41337: Merged V3.4-BUG-FIX (3.4.11) to V4.1-BUG-FIX (4.1.2)
            41336: TransformerDebug: Use debug rather than trace when there are transformers but they are all unavailable.
      41868: Reverse the reverse merge (back to r41835 state used in build #33 given to QA)
         41845: Reverse merge: << In attempt to clear 12 new DB2 build errors - don't think it is going to work >> 
            41835: Merged DEV to V4.1.1 (4.1.1)
               41833: ALF-16038 : DB2: Upgrade script needed to remove ALFUSER.ACT_HI_ACTINST.OWNER_
               The patch was created to remove an unnecessary column in DB2.
         Merged V4.1-BUG-FIX (4.1.2) to V4.1.1 (4.1.1)
            41337: Merged V3.4-BUG-FIX (3.4.11) to V4.1-BUG-FIX (4.1.2)
               41336: TransformerDebug: Use debug rather than trace when there are transformers but they are all unavailable.
      41914: Merged DEV to PATCHES/V4.1.1
         41909: ALF-16078 : DB2: it's impossible to upgrade Alfresco from 3.4.10 to 4.1.1 (build 33).
            The remove-column-activiti.sql was marked as optional.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@41919 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
2012-09-24 18:03:25 +00:00

436 lines
12 KiB
Java

/*
* 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.filesys.repo;
import java.util.regex.Pattern;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.filesys.alfresco.AlfrescoContext;
import org.alfresco.filesys.alfresco.AlfrescoDiskDriver;
import org.alfresco.filesys.alfresco.IOControlHandler;
import org.alfresco.filesys.alfresco.PseudoFileOverlay;
import org.alfresco.filesys.config.acl.AccessControlListBean;
import org.alfresco.jlan.server.config.CoreServerConfigSection;
import org.alfresco.jlan.server.core.DeviceContextException;
import org.alfresco.jlan.server.filesys.DiskInterface;
import org.alfresco.jlan.server.filesys.DiskSharedDevice;
import org.alfresco.jlan.server.filesys.FileName;
import org.alfresco.jlan.server.filesys.FileSystem;
import org.alfresco.jlan.server.filesys.cache.FileStateLockManager;
import org.alfresco.jlan.server.filesys.quota.QuotaManagerException;
import org.alfresco.jlan.server.thread.ThreadRequestPool;
import org.alfresco.service.cmr.repository.NodeRef;
/**
* Content Filesystem Context Class
*
* <p>Contains per filesystem context.
*
* @author GKSpencer
*/
public class ContentContext extends AlfrescoContext
{
// Store and root path
private String m_storeName;
private String m_rootPath;
// Root node
private NodeRef m_rootNodeRef;
private String m_relativePath;
private boolean m_offlineFiles;
private boolean m_disableNodeMonitor;
// Disable change notifications for CIFS
private boolean m_disableChangeNotifications;
private AccessControlListBean m_accessControlList;
// File state based lock/oplock manager
private FileStateLockManager m_lockManager;
// Enable/disable oplocks
private boolean m_oplocksDisabled;
// Node monitor
private NodeMonitor m_nodeMonitor;
private PseudoFileOverlay m_PseudoFileOverlay;
// Thread pool
private ThreadRequestPool m_threadPool;
// pattern is tested against full path after it has been lower cased.
private Pattern renameShufflePattern = Pattern.compile("(.*[a-f0-9]{8}+$)|(.*\\.tmp$)|(.*\\.wbk$)|(.*\\.bak$)|(.*\\~$)");
/**
* Default constructor allowing initialization by container.
*/
public ContentContext()
{
// // Create the I/O control handler
// setIOHandler( createIOHandler( null));
}
/**
* Class constructor
*
*@param deviceName
* String
* @param storeName
* String
* @param rootPath
* String
* @param rootNodeRef
* NodeRef
*/
public ContentContext(String deviceName, String storeName, String rootPath, NodeRef rootNodeRef)
{
setDeviceName(deviceName);
setStoreName(storeName);
setRootPath(rootPath);
setRootNodeRef(rootNodeRef);
}
public void setStoreName(String name)
{
m_storeName = name;
}
public void setRootPath(String path)
{
m_rootPath = path;
}
public void setRelativePath(String path)
{
// Make sure the path is in CIFS format
m_relativePath = path.replace( '/', FileName.DOS_SEPERATOR);;
}
public void setOfflineFiles(boolean offlineFiles)
{
m_offlineFiles = offlineFiles;
}
public void setDisableNodeMonitor(boolean disableNodeMonitor)
{
m_disableNodeMonitor = disableNodeMonitor;
}
/**
* Disable change notifications
*
* @param disableChangeNotify boolean
*/
public void setDisableChangeNotifications( boolean disableChangeNotify) {
m_disableChangeNotifications = disableChangeNotify;
}
public void setAccessControlList(AccessControlListBean accessControlList)
{
m_accessControlList = accessControlList;
}
public void setRootNodeRef(NodeRef nodeRef)
{
m_rootNodeRef = nodeRef;
setShareName(nodeRef.toString());
}
/**
* Enable/disable oplock support
*
* @param disableOplocks boolean
*/
public void setDisableOplocks( boolean disableOplocks) {
m_oplocksDisabled = disableOplocks;
}
/**
* Get the regular expression pattern that will be applied to detected potential
* rename shuffles.
*
* @return the regular expression pattern to match against
*/
public Pattern getRenameShufflePattern()
{
return renameShufflePattern;
}
/**
* Set the regular expression that will be applied to filenames during renames
* to detect whether clients are performing a renaming shuffle - common during
* file saving on various clients.
* <p/>
* <b>ALF-3856</b>
*
* @param renameShufflePattern a regular expression filename match
*/
public void setRenameShufflePattern(Pattern renameShufflePattern)
{
this.renameShufflePattern = renameShufflePattern;
}
@Override
public void initialize(AlfrescoDiskDriver filesysDriver)
{
super.initialize(filesysDriver);
if (m_storeName == null || m_storeName.length() == 0)
{
throw new AlfrescoRuntimeException("Device missing storeName");
}
if (m_rootPath == null || m_rootPath.length() == 0)
{
throw new AlfrescoRuntimeException("Device missing rootPath");
}
// Enable file state caching
getStateCache().setCaseSensitive( false);
// Create the file state based lock manager
m_lockManager = new FileStateLockManager( getStateCache());
}
/**
* Return the filesystem type, either FileSystem.TypeFAT or FileSystem.TypeNTFS.
*
* @return String
*/
public String getFilesystemType()
{
return FileSystem.TypeNTFS;
}
/**
* Return the store name
*
* @return String
*/
public final String getStoreName()
{
return m_storeName;
}
/**
* Return the root path
*
* @return String
*/
public final String getRootPath()
{
return m_rootPath;
}
/**
* Return the relative path
*
* @return String
*/
public String getRelativePath()
{
return m_relativePath;
}
/**
* Determines whether locked files should be marked as offline.
*
* @return <code>true</code> if locked files should be marked as offline
*/
public boolean getOfflineFiles()
{
return m_offlineFiles;
}
/**
* Determines whether a node monitor is required.
*
* @return <code>true</code> if a node monitor is required
*/
public boolean getDisableNodeMonitor()
{
return m_disableNodeMonitor;
}
/**
* Determine if oplocks support should be disabled
*
* @return boolean
*/
public boolean getDisableOplocks() {
return m_oplocksDisabled;
}
/**
* Return the lock manager
*
* @return FileStateLockManager
*/
public FileStateLockManager getLockManager() {
return m_lockManager;
}
/**
* Determine if change notifications are disabled
*
* @return boolean
*/
public boolean getDisableChangeNotifications() {
return m_disableChangeNotifications;
}
/**
* Gets the access control list.
*
* @return the access control list
*/
public AccessControlListBean getAccessControlList()
{
return m_accessControlList;
}
/**
* Return the root node
*
* @return NodeRef
*/
public final NodeRef getRootNode()
{
return m_rootNodeRef;
}
/**
* Return the thread pool
*
* @return ThreadRequestPool
*/
public final ThreadRequestPool getThreadPool() {
return m_threadPool;
}
/**
* Close the filesystem context
*/
public void CloseContext() {
// Stop the node monitor, if enabled
if ( m_nodeMonitor != null)
m_nodeMonitor.shutdownRequest();
// Stop the quota manager, if enabled
if ( hasQuotaManager()) {
try {
getQuotaManager().stopManager(null, this);
}
catch ( QuotaManagerException ex) {
}
}
// Call the base class
super.CloseContext();
}
// /**
// * Create the I/O control handler for this filesystem type
// *
// * @param filesysDriver DiskInterface
// * @return IOControlHandler
// */
// protected IOControlHandler createIOHandler( DiskInterface filesysDriver)
// {
// return new ContentIOControlHandler();
// }
/**
* Set the node monitor
*
* @param filesysDriver ContentDiskDriver
*/
protected void setNodeMonitor( NodeMonitor nodeMonitor) {
m_nodeMonitor = nodeMonitor;
}
/**
* Start the filesystem
*
* @param share DiskSharedDevice
* @exception DeviceContextException
*/
public void startFilesystem(DiskSharedDevice share)
throws DeviceContextException {
// Call the base class
super.startFilesystem(share);
if ( getStateCache() != null)
getStateCache().setCaseSensitive( false);
// Find the thread pool via the configuration
CoreServerConfigSection coreConfig = (CoreServerConfigSection) share.getConfiguration().getConfigSection( CoreServerConfigSection.SectionName);
if ( coreConfig != null)
m_threadPool = coreConfig.getThreadPool();
// Start the lock manager, use the thread pool if available
if ( getLockManager() != null) {
// Start the lock manager
m_lockManager.startLockManager( "OplockExpire_" + share.getName(), m_threadPool);
}
// Start the node monitor, if enabled
if ( m_nodeMonitor != null)
m_nodeMonitor.startMonitor();
}
public void setPseudoFileOverlay(PseudoFileOverlay pseudoFileOverlay)
{
this.m_PseudoFileOverlay = pseudoFileOverlay;
}
public PseudoFileOverlay getPseudoFileOverlay()
{
return m_PseudoFileOverlay;
}
}