mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-22 15:12:38 +00:00
29870: ALF-9952: Compatibility fix to allow mounting of Alfresco WebDAV as a network drive on Windows XP (without WebDrive)
29872: Fixed ALF-7698 "Defects in tags picker in SHARE."
- now checks added items to avoid duplicates
29873: Made sure the onActionDetails doclib action generates SimpleDialog instance ids each time, to avoid multiple js class instances with the same id getting called for every dialog created.
29878: ALF-9378: Use caching plus a read write lock, in a similar manner to ALF-7064, to avoid contention in SubsystemProxyFactory under load
29881: Added helper text for the translators to the property file.
29910: ALF-7433: a file deleted using the web UI still appears in a NFS mount but with NULL stats
- timestamp propagation now enabled by default so NFS always works
- timestamp propagation less agressive - only has to propagate on adds / deletes and renames
29911: Values for recurrence strings updated now that I've read RFC-2445
29944: ALF-9988: Merged PATCHES/V3.3.4 to V3.4-BUG-FIX
28581: ALF-8944: Corrected sort parameter handling for datetime fields, based on analyzer and tokenization mode
29955: Fixed ALF-9965: Property names matching fails if the property contains non Alphanumeric characters
29956: Fixed ALF-9424: Webform(XSD): xf:switch switch group does not work based on "complexContent with Base" element.
29964: Fixed ALF-9089: TinyMCE convert_fonts_to_spans parameter is not being picked up in Web Forms
29977: L10N Updates from Gloria (based on rev29838).
29980: Ignore virtual tomcat directory
29981: Merged BRANCHES/DEV/BELARUS/V3.4-BUG-FIX-2011_08_19 to BRANCHES/DEV/V3.4-BUG-FIX
ALF-6808 : Incorrect Search Language Conversion for wild card characters (%, _) for MS SQL
29984: ALF-4753: Fix search query escaping in Alfresco Explorer
- AWC-1743 / CHK-2171 fix restored
29993: Merged DEV/TEMPORARY to V3.4-BUG-FIX
29989: ALF-9976: WebDAV Class 2 compliance issue with OPTIONS response.
Class 2 incompliance connected with absence of 'PROPPATCH' method in the 'Allow' response header has been fixed
30009: ALF-7239 : Documents from Records Manager cannot be viewed in Outlook
30012: Merged BRANCHES/DEV/BELARUS/V3.4-BUG-FIX-2011_08_19 to BRANCHES/DEV/V3.4-BUG-FIX:
29986: ALF-7105: pdfbox returns errors in the logs but one cannot understand what file is affected (PDFBox)
30014: ALF-6284: Fix for Share Kerberos SSO Websphere compatibility (by Pavel)
30016: Merged DEV to V3.4-BUG-FIX
29424: ALF-8715: NFS: Admin sometimes cannot edit content uploaded via JSF
Fix for "Can't open file for writing" during saving file in VI-like editors connected with FileExpiry daemon:
- 'getNodeOrNull()' method extracted to get and check on existence of the cached file object
and then update cache timeout or remove it from the cache;
- 'getNodeForPath()' was appropriately updated in accordance with logic extracted to 'getNodeOrNull()';
- 'fileExists()' method was corrected to take into account existence of the cached file object
30017: Reverses an accidental check in made with the last L10N bundle update (r29977)
30045: ALF-8664 - Custom 'mandatory' RM metadata causes editing issues
30053: ALF-9681: webScriptsRegistryCache size in ehcache-default.xml
webScriptsRegistryCache maxElementsInMemory size was incremented up to 1000
30079: ALF-10027: Fix template alfresco-global.properties for custom tomcat ports
- Obselete web.application.context.url removed
- alfresco.host, alfresco.port, share.host and share.port added
30080: Fixed parse error mentioned in ALF-9511 "RSS Feeds with HTTP Auth doesn't work with Feed dashlet"
- In java regexps the . (dot) does NOT include the \r or \n by default, to change that a (?s) instruction was added in the beginning of the regexp
30083: Fixed ALF-10048 "Multiple thumbnails in RSS feeds causes problem for RSS Feed dashlet"
30088: ALF-7433: Fix unit test fallout from new timestamp propagation behaviour
30089: ALF-7433: Further unit test fallout from new timestamp propagation behaviour
- testPermissionsAndPolicies needs to get folder modification date in a distinct transaction after populating it
30091: ALF-10050: CIFS: Coordinator is unable to delete content after IMAP has been enabled
- Transactional cache null entry issue
30096: ALF-9793: Allow auto-created NFS authenticated users to work
- Also removed admin from default mappings to avoid security hole
30102: ALF-8723 CIFS on Windows fails to start under certain conditions
- Found another place >= was required rather than just >
30104: ALF-9890 SiteService is not producing audit data.
- Internal siteService rather than public SiteService was being used, so there was no audit advice.
30119: ALF-9793: Fallout from previous fix. Prevent initialization error when there are no user mappings and NFS is not enabled.
30120: ALF-9526: Work around the fact that Websphere ignores the response encoding unless you call response.setCharacterEncoding()
- GlobalLocalizationFilter inserts a response wrapper that parses the charset parameter from the content type header, if it is present
30121: ALF-9535: Alfresco ignores Accept-Language sent from Share
- Ticket and webscript authentication (i.e. Share requests) will use the language set in request headers as the session language
30130: ALF-10049: Fix by Andrey to enable Flash upload on Weblogic!
30141: ALF-8732 Now if the adhoc workflow throws exceptions while sending a notification email then those exceptions are ignored.
30226: ALF-9415: JSF - Copy/Paste vs Cut/Paste add aspect rule.
30242: Added NodeService.getNodeRef(Long nodeId)
- First step to remove Lucene search from inbound email server
- Done while investigating ALF-9660
30243: Fixed ALF-9660: Inbound emails are always stored with encoding=UTF-8 regardless the encoding the email client uses.
- If the encoding is provided, then it is not guessed
- Includes tweak to remove Lucene search and rather use direct node ID-NodeRef translation provided by NodeService
30263: Incremented version revision
30264: ALF-10187: Merged V3.3 to V3.4-BUG-FIX
30003: ALF-9898: More defensive exception handling to avoid packet pool leaks and extra logging on packet pool exhaustion
30265: Merged V3.4 to V3.4-BUG-FIX
30259: ALF-6527 LangPack FR - [Search results' page] Incorrect label when search matches results
- Added "(s)" to "trouvé(s) dans l'entrepôt." (for a repository search - found in retest)
- The original change:
Added "(s)" to "trouvé(s) dans tous les sites." (for an All Sites search)
However this leaves the current site search. As a result I also:
Added "(s)" to "trouvé(s) dans le site {0}." (for a current Site search)
and checked with a French speaker that this would sound correct.
Note: all three labels are prefixed by a separate text label: "N résultat(s) "
30261: (RECORD ONLY) Merged V3.4-BUG-FIX to V3.4 (3.4.5)
30262: ALF-10186: Merged PATCHES/V3.4.1 to V3.4
30126: ALF-10075: Concurrency during CMIS document update causes content stream to close prematurely.
- Created BufferedRequest request wrapper in RepositoryContainer
- If the content stream is accessed directly it is streamed to a temporary file so that requests can be retried
30137: ALF-10075: Fixed NPE
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@30271 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
371 lines
13 KiB
Java
371 lines
13 KiB
Java
/*
|
|
* Copyright (C) 2006-2011 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;
|
|
|
|
import java.io.Serializable;
|
|
import java.util.HashMap;
|
|
import java.util.Hashtable;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
|
|
import org.alfresco.error.AlfrescoRuntimeException;
|
|
import org.alfresco.filesys.repo.ContentContext;
|
|
import org.alfresco.jlan.oncrpc.nfs.NFSServer;
|
|
import org.alfresco.jlan.oncrpc.nfs.ShareDetails;
|
|
import org.alfresco.jlan.server.core.DeviceContext;
|
|
import org.alfresco.model.ContentModel;
|
|
import org.alfresco.repo.node.NodeServicePolicies;
|
|
import org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy;
|
|
import org.alfresco.repo.node.NodeServicePolicies.OnCreateChildAssociationPolicy;
|
|
import org.alfresco.repo.node.NodeServicePolicies.OnDeleteChildAssociationPolicy;
|
|
import org.alfresco.repo.node.NodeServicePolicies.OnDeleteNodePolicy;
|
|
import org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy;
|
|
import org.alfresco.repo.policy.JavaBehaviour;
|
|
import org.alfresco.repo.policy.PolicyComponent;
|
|
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
|
import org.alfresco.service.cmr.repository.NodeRef;
|
|
import org.alfresco.service.cmr.repository.NodeService;
|
|
import org.alfresco.service.cmr.repository.StoreRef;
|
|
import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter;
|
|
import org.alfresco.service.cmr.security.PermissionService;
|
|
import org.alfresco.service.namespace.QName;
|
|
import org.apache.log4j.Logger;
|
|
import org.springframework.beans.factory.InitializingBean;
|
|
|
|
/**
|
|
* Node monitor for NFS server which updates NFS cache on renaming or deleting nodes not through NFS protocol. This monitor may be dynamically enabled or disabled. It handles nodes
|
|
* for <code>${filesystem.name}</code> device name
|
|
*
|
|
* @author Dmitry Velichkevich
|
|
*/
|
|
public class NfsServerNodeMonitor
|
|
implements
|
|
NodeServicePolicies.OnUpdatePropertiesPolicy,
|
|
NodeServicePolicies.BeforeDeleteNodePolicy,
|
|
NodeServicePolicies.OnCreateChildAssociationPolicy,
|
|
NodeServicePolicies.OnDeleteChildAssociationPolicy,
|
|
NodeServicePolicies.OnDeleteNodePolicy,
|
|
InitializingBean
|
|
{
|
|
private static final Logger LOGGER = Logger.getLogger(NfsServerNodeMonitor.class);
|
|
|
|
public static final char NIX_SEPARATOR = '/';
|
|
public static final String NIX_SEPARATOR_STR = "/";
|
|
|
|
//
|
|
// Not static fields (or bean properties)
|
|
//
|
|
|
|
private Boolean enabled;
|
|
|
|
private String targetDeviceName;
|
|
|
|
// Calculable value
|
|
private StoreRef targetStoreRef;
|
|
|
|
private List<DeviceContext> filesystemContexts;
|
|
|
|
private NodeService nodeService;
|
|
private PolicyComponent policyComponent;
|
|
private PermissionService permissionService;
|
|
|
|
/**
|
|
* Calculable value (see {@link NFSServerBean})
|
|
*/
|
|
private NFSServer nfsServer;
|
|
|
|
private Map<NodeRef, Integer> cachedNodes = new HashMap<NodeRef, Integer>();
|
|
|
|
public NfsServerNodeMonitor()
|
|
{
|
|
}
|
|
|
|
/**
|
|
* Enables or disables policy handlers
|
|
*
|
|
* @param enabled {@link Boolean} value which determines working state of the handler
|
|
*/
|
|
public void setEnabled(boolean enabled)
|
|
{
|
|
Object previousState = this.enabled;
|
|
this.enabled = enabled;
|
|
if (null != previousState)
|
|
{
|
|
initialize();
|
|
}
|
|
}
|
|
|
|
public Boolean isEnabled()
|
|
{
|
|
return enabled;
|
|
}
|
|
|
|
public void setTargetDeviceName(String targetDeviceName)
|
|
{
|
|
this.targetDeviceName = targetDeviceName;
|
|
}
|
|
|
|
public String getTargetDeviceName()
|
|
{
|
|
return targetDeviceName;
|
|
}
|
|
|
|
public void setFilesystemContexts(List<DeviceContext> filesystemContexts)
|
|
{
|
|
this.filesystemContexts = filesystemContexts;
|
|
}
|
|
|
|
public StoreRef getTargetStoreRef()
|
|
{
|
|
return targetStoreRef;
|
|
}
|
|
|
|
public void setNodeService(NodeService nodeService)
|
|
{
|
|
this.nodeService = nodeService;
|
|
}
|
|
|
|
public void setPolicyComponent(PolicyComponent policyComponent)
|
|
{
|
|
this.policyComponent = policyComponent;
|
|
}
|
|
|
|
public void setPermissionService(PermissionService permissionService)
|
|
{
|
|
this.permissionService = permissionService;
|
|
}
|
|
|
|
public void setNfsServer(NFSServer nfsServer)
|
|
{
|
|
this.nfsServer = nfsServer;
|
|
}
|
|
|
|
@Override
|
|
public void afterPropertiesSet() throws Exception
|
|
{
|
|
initialize();
|
|
}
|
|
|
|
/**
|
|
* Performs all check on mandatory properties, searches for {@link StoreRef} for root path of target device and registers policy handlers for NFS cache updating on node
|
|
* properties updating and node deleting
|
|
*/
|
|
private void initialize()
|
|
{
|
|
if (enabled)
|
|
{
|
|
if (null == filesystemContexts)
|
|
{
|
|
throw new AlfrescoRuntimeException("'filesystemContexts' property is not configured");
|
|
}
|
|
for (DeviceContext context : filesystemContexts)
|
|
{
|
|
if ((context instanceof ContentContext) && (null != context.getDeviceName()) && context.getDeviceName().equals(targetDeviceName))
|
|
{
|
|
ContentContext targetContext = (ContentContext) context;
|
|
if (null != targetContext.getStoreName())
|
|
{
|
|
targetStoreRef = new StoreRef(targetContext.getStoreName());
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
if (null == targetStoreRef)
|
|
{
|
|
throw new AlfrescoRuntimeException("Target Store Reference can't be found for '" + targetDeviceName
|
|
+ "' device name. Check correctness of 'targetDeviceName' and 'filesystemContexts' properties configurations");
|
|
}
|
|
|
|
if (LOGGER.isDebugEnabled())
|
|
{
|
|
LOGGER.debug("StoreRef='" + targetStoreRef + "' was found for '" + targetDeviceName + "' device name");
|
|
}
|
|
|
|
policyComponent.bindAssociationBehaviour(OnCreateChildAssociationPolicy.QNAME, this, new JavaBehaviour(this, "onCreateChildAssociation"));
|
|
policyComponent.bindAssociationBehaviour(OnDeleteChildAssociationPolicy.QNAME, this, new JavaBehaviour(this, "onDeleteChildAssociation"));
|
|
policyComponent.bindClassBehaviour(OnDeleteNodePolicy.QNAME, this, new JavaBehaviour(this, "onDeleteNode"));
|
|
policyComponent.bindClassBehaviour(BeforeDeleteNodePolicy.QNAME, this, new JavaBehaviour(this, "beforeDeleteNode"));
|
|
policyComponent.bindClassBehaviour(OnUpdatePropertiesPolicy.QNAME, this, new JavaBehaviour(this, "onUpdateProperties"));
|
|
}
|
|
else
|
|
{
|
|
LOGGER.warn("NodeMonitor for NFS server is not enabled! Cache of NFS server will be never synchronized with target filesystem");
|
|
}
|
|
}
|
|
|
|
@Override
|
|
public void onUpdateProperties(NodeRef nodeRef, Map<QName, Serializable> before, Map<QName, Serializable> after)
|
|
{
|
|
if (enabled && (null != nfsServer) && targetStoreRef.equals(nodeRef.getStoreRef()))
|
|
{
|
|
int dbId = DefaultTypeConverter.INSTANCE.intValue(nodeService.getProperty(nodeRef, ContentModel.PROP_NODE_DBID));
|
|
if (null == findShareDetailsForId(dbId))
|
|
{
|
|
if (LOGGER.isDebugEnabled())
|
|
{
|
|
LOGGER.debug("Node with nodeRef='" + nodeRef + "' and dbId='" + dbId + "' is not in NFS server cache");
|
|
}
|
|
|
|
return;
|
|
}
|
|
cachedNodes.put(nodeRef, dbId);
|
|
|
|
String oldName = DefaultTypeConverter.INSTANCE.convert(String.class, before.get(ContentModel.PROP_NAME));
|
|
String newName = DefaultTypeConverter.INSTANCE.convert(String.class, after.get(ContentModel.PROP_NAME));
|
|
|
|
if (LOGGER.isDebugEnabled())
|
|
{
|
|
LOGGER.debug("oldName='" + oldName + "', newName='" + newName + "'");
|
|
}
|
|
|
|
if (((null == oldName) && (null != newName)) || ((null != oldName) && !oldName.equals(newName)))
|
|
{
|
|
updateNfsCache(nodeRef, null);
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override
|
|
public void beforeDeleteNode(NodeRef nodeRef)
|
|
{
|
|
if (enabled && (null != nfsServer) && (null != nodeRef) && targetStoreRef.equals(nodeRef.getStoreRef()))
|
|
{
|
|
int dbId = DefaultTypeConverter.INSTANCE.intValue(nodeService.getProperty(nodeRef, ContentModel.PROP_NODE_DBID));
|
|
cachedNodes.put(nodeRef, dbId);
|
|
}
|
|
}
|
|
|
|
@Override
|
|
public void onDeleteNode(ChildAssociationRef childAssocRef, boolean isNodeArchived)
|
|
{
|
|
updateNfsCache(childAssocRef.getChildRef(), null);
|
|
}
|
|
|
|
@Override
|
|
public void onCreateChildAssociation(ChildAssociationRef childAssocRef, boolean isNewNode)
|
|
{
|
|
updateNfsCache(childAssocRef.getChildRef(), null);
|
|
}
|
|
|
|
@Override
|
|
public void onDeleteChildAssociation(ChildAssociationRef childAssocRef)
|
|
{
|
|
updateNfsCache(childAssocRef.getChildRef(), null);
|
|
}
|
|
|
|
/**
|
|
* Searches for {@link ShareDetails} to access NFS server cache for specific device name (e.g. 'Alfresco', 'AVM' etc)
|
|
*
|
|
* @param fileId - {@link Integer} value which contains <code>fileId</code> specific to device
|
|
* @return {@link ShareDetails} instance which contains <code>fileId</code> key in the cache or <code>null</code> if such instance was not found
|
|
*/
|
|
private ShareDetails findShareDetailsForId(int fileId)
|
|
{
|
|
if ((null == nfsServer) || (null == nfsServer.getShareDetails()))
|
|
{
|
|
return null;
|
|
}
|
|
|
|
Hashtable<Integer, ShareDetails> details = nfsServer.getShareDetails().getShareDetails();
|
|
for (Integer key : details.keySet())
|
|
{
|
|
ShareDetails shareDetails = details.get(key);
|
|
if (null != shareDetails.getFileIdCache().findPath(fileId))
|
|
{
|
|
return shareDetails;
|
|
}
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
/**
|
|
* Updates NFS cache for specified node. <code>newPath</code> equal to <code>null</code> determines that node should be deleted from the cache
|
|
*
|
|
* @param nodeRef - {@link NodeRef} value of the target node
|
|
* @param newPath - {@link String} value or <code>null</code> to determine new cache value for specified node
|
|
*/
|
|
private void updateNfsCache(NodeRef nodeRef, String newPath)
|
|
{
|
|
if (!enabled || nfsServer == null || !targetStoreRef.equals(nodeRef.getStoreRef()))
|
|
{
|
|
return;
|
|
}
|
|
int dbId = -1;
|
|
if (cachedNodes.containsKey(nodeRef))
|
|
{
|
|
dbId = (null != cachedNodes.get(nodeRef)) ? (cachedNodes.get(nodeRef)) : (-1);
|
|
cachedNodes.remove(nodeRef);
|
|
}
|
|
else
|
|
{
|
|
if (nodeService.exists(nodeRef))
|
|
{
|
|
dbId = DefaultTypeConverter.INSTANCE.intValue(nodeService.getProperty(nodeRef, ContentModel.PROP_NODE_DBID));
|
|
}
|
|
}
|
|
|
|
ShareDetails shareDetails = findShareDetailsForId(dbId);
|
|
if (null != shareDetails)
|
|
{
|
|
if (null != newPath)
|
|
{
|
|
shareDetails.getFileIdCache().addPath(dbId, newPath);
|
|
|
|
if (LOGGER.isDebugEnabled())
|
|
{
|
|
LOGGER.debug("Path='" + newPath + "' in cache was set for NodeRef='" + nodeRef + "', dbId ='" + dbId + "'");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
shareDetails.getFileIdCache().deletePath(dbId);
|
|
|
|
if (LOGGER.isDebugEnabled())
|
|
{
|
|
LOGGER.debug("Cache field for node with NodeRef='" + nodeRef + "', dbId='" + dbId + "' was removed");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override
|
|
public boolean equals(Object obj)
|
|
{
|
|
if (obj instanceof NfsServerNodeMonitor)
|
|
{
|
|
NfsServerNodeMonitor converted = (NfsServerNodeMonitor) obj;
|
|
return areEqual(targetDeviceName, converted.getTargetDeviceName()) && areEqual(targetStoreRef, converted.getTargetStoreRef());
|
|
}
|
|
return false;
|
|
}
|
|
|
|
private boolean areEqual(Object left, Object right)
|
|
{
|
|
return (null != left) ? (left.equals(right)) : (null == right);
|
|
}
|
|
|
|
@Override
|
|
public int hashCode()
|
|
{
|
|
int result = (null != targetDeviceName) ? (targetDeviceName.hashCode()) : (31);
|
|
return result * 37 + ((null != targetStoreRef) ? (targetStoreRef.hashCode()) : (43));
|
|
}
|
|
}
|