diff --git a/source/java/org/alfresco/filesys/alfresco/PseudoFileOverlayImpl.java b/source/java/org/alfresco/filesys/alfresco/PseudoFileOverlayImpl.java
index 3210c6ee2a..84b10822f6 100644
--- a/source/java/org/alfresco/filesys/alfresco/PseudoFileOverlayImpl.java
+++ b/source/java/org/alfresco/filesys/alfresco/PseudoFileOverlayImpl.java
@@ -168,17 +168,16 @@ public class PseudoFileOverlayImpl implements PseudoFileOverlay
}
if ( context.isShareURLEnabled())
{
-// try
-// {
String site = getSiteForNode(nodeRef);
-// String site = "wibble";
if(site != null)
{
// Make sure the state has the associated node details
// Build the URL file data
StringBuilder urlStr = new StringBuilder();
-
+
+// This is the URL generated
+// http://markr:8080/share/page/site/wibble/folder-details?nodeRef=workspace://SpacesStore/f72b2475-7571-46fe-947b-b0ee1b6a82ea
urlStr.append("[InternetShortcut]\r\n");
urlStr.append("URL=");
urlStr.append(getShareURLPrefix());
@@ -188,23 +187,20 @@ public class PseudoFileOverlayImpl implements PseudoFileOverlay
urlStr.append( nodeRef.getId());
urlStr.append("\r\n");
+ // Should this be the URL instead
+// http://markr:8080/share/page/site/wibble/documentlibrary#filter=path%7C%2Ffolder%2520A%2FFolderB&page=1
+
// Create the in memory pseudo file for the URL link
if(logger.isDebugEnabled())
{
logger.debug("generateShareURLShortcut url as string:" + urlStr);
- }
-//
+ }
byte[] urlData = urlStr.toString().getBytes();
-//
+
MemoryPseudoFile urlFile = new MemoryPseudoFile( context.getShareURLFileName(), urlData);
return urlFile;
-// }
}
-// catch (Throwable t)
-// {
-// logger.error("unexpected exception ", t);
-// return null;
-// }
+
}
return null;
diff --git a/source/java/org/alfresco/filesys/repo/CacheLookupSearchContext.java b/source/java/org/alfresco/filesys/repo/CacheLookupSearchContext.java
index 8717032c41..af0bbfed6d 100644
--- a/source/java/org/alfresco/filesys/repo/CacheLookupSearchContext.java
+++ b/source/java/org/alfresco/filesys/repo/CacheLookupSearchContext.java
@@ -37,7 +37,7 @@ import org.apache.commons.logging.LogFactory;
*
* @author gkspencer
*/
-public class CacheLookupSearchContext extends ContentSearchContext {
+public class CacheLookupSearchContext extends DotDotContentSearchContext {
// Debug logging
@@ -47,11 +47,6 @@ public class CacheLookupSearchContext extends ContentSearchContext {
private FileStateCache m_stateCache;
- // File information for the '.' and '..' pseduo entries, returned during a wildcard search
-
- private FileInfo m_dotInfo;
- private FileInfo m_dotDotInfo;
-
/**
* Class constructor
*
@@ -125,77 +120,7 @@ public class CacheLookupSearchContext extends ContentSearchContext {
return true;
}
- /**
- * Check if the '.' and '..' pseudo file entries are available
- *
- * @return boolean
- */
- public boolean hasDotFiles() {
- return (m_dotInfo != null && m_dotDotInfo != null) ? true : false;
- }
-
- /**
- * Return the '.' pseudo file entry details
- *
- * @param finfo FileInfo
- * @return boolean
- */
- public boolean getDotInfo(FileInfo finfo) {
-
- // Check if the '.' file information is valid
-
- if ( m_dotInfo != null) {
- finfo.copyFrom( m_dotInfo);
- return true;
- }
-
- // File information not valid
-
- return false;
- }
-
- /**
- * Return the '..' pseudo file entry details
- *
- * @param finfo FileInfo
- * @return boolean
- */
- public boolean getDotDotInfo(FileInfo finfo) {
-
- // Check if the '..' file information is valid
-
- if ( m_dotDotInfo != null) {
- finfo.copyFrom( m_dotDotInfo);
- return true;
- }
-
- // File information not valid
-
- return false;
- }
-
- /**
- * Set the '.' pseudo file entry details
- *
- * @param finfo FileInfo
- */
- protected void setDotInfo(FileInfo finfo) {
- m_dotInfo = finfo;
- if ( m_dotInfo != null)
- m_dotInfo.setFileName( ".");
- }
-
- /**
- * Set the '..' pseudo file entry details
- *
- * @param finfo FileInfo
- */
- protected void setDotDotInfo(FileInfo finfo) {
- m_dotDotInfo = finfo;
- if ( m_dotDotInfo != null)
- m_dotDotInfo.setFileName( "..");
- }
-
+
/**
* Return the search as a string
*
@@ -217,10 +142,11 @@ public class CacheLookupSearchContext extends ContentSearchContext {
sb.append(",cache=");
sb.append(m_stateCache);
- if ( m_dotInfo != null)
- sb.append(",Dot");
- if ( m_dotDotInfo != null)
- sb.append(",DotDot");
+// if ( super.getDotInfo(finfo)
+// != null)
+// sb.append(",Dot");
+// if ( m_dotDotInfo != null)
+// sb.append(",DotDot");
sb.append("]");
return sb.toString();
diff --git a/source/java/org/alfresco/filesys/repo/CifsHelper.java b/source/java/org/alfresco/filesys/repo/CifsHelper.java
index e130023e49..5b799b6113 100644
--- a/source/java/org/alfresco/filesys/repo/CifsHelper.java
+++ b/source/java/org/alfresco/filesys/repo/CifsHelper.java
@@ -199,6 +199,10 @@ public class CifsHelper
// retrieve required properties and create new JLAN file info
ContentFileInfo fileInfo = new ContentFileInfo(nodeRef);
+ // Set the file id from the node's DBID
+ long id = DefaultTypeConverter.INSTANCE.convert(Long.class, nodeService.getProperty(nodeRef, ContentModel.PROP_NODE_DBID));
+ fileInfo.setFileId((int) (id & 0xFFFFFFFFL));
+
// unset all attribute flags
int fileAttributes = 0;
fileInfo.setFileAttributes(fileAttributes);
@@ -226,7 +230,9 @@ public class CifsHelper
// Set the allocation size by rounding up the size to a 512 byte block boundary
if ( size > 0)
+ {
fileInfo.setAllocationSize((size + 512L) & 0xFFFFFFFFFFFFFE00L);
+ }
// Check the lock status of the file
@@ -252,7 +258,9 @@ public class CifsHelper
// Check if it is a link node
if ( fileFolderInfo.isLink())
+ {
fileInfo.setLinkNodeRef( fileFolderInfo.getLinkNodeRef());
+ }
}
// created
diff --git a/source/java/org/alfresco/filesys/repo/CommandExecutorImpl.java b/source/java/org/alfresco/filesys/repo/CommandExecutorImpl.java
index 234d28ac55..a91c8139a9 100644
--- a/source/java/org/alfresco/filesys/repo/CommandExecutorImpl.java
+++ b/source/java/org/alfresco/filesys/repo/CommandExecutorImpl.java
@@ -209,10 +209,51 @@ public class CommandExecutorImpl implements CommandExecutor
OpenFileCommand o = (OpenFileCommand)command;
int openAction = FileAction.OpenIfExists;
- // TODO Open Action FileAction.NTOverwrite o.truncate
- // TODO ATTRIBUTES ONLY and DELETE ONLY
- FileOpenParams params = new FileOpenParams(o.getPath(), openAction, o.getMode() == OpenFileMode.WRITE ? AccessMode.ReadWrite : AccessMode.ReadOnly, FileAttribute.NTNormal, 0);
+ OpenFileMode mode = o.getMode();
+ int jlanAccessMode = 0;
+ switch (mode)
+ {
+ case ATTRIBUTES_ONLY:
+ jlanAccessMode = AccessMode.ReadWrite;
+ break;
+ case READ_ONLY:
+ jlanAccessMode = AccessMode.ReadOnly;
+ break;
+ case READ_WRITE:
+ jlanAccessMode = AccessMode.ReadWrite;
+ break;
+ case DELETE:
+ // Don't care file is being deleted
+ jlanAccessMode = AccessMode.ReadOnly;
+ break;
+ case WRITE_ONLY:
+ jlanAccessMode = AccessMode.WriteOnly;
+ break;
+ }
+
+ FileOpenParams params = new FileOpenParams(o.getPath(), openAction, jlanAccessMode, FileAttribute.NTNormal, 0);
+ if(logger.isDebugEnabled())
+ {
+ int sharedAccess = params.getSharedAccess();
+ String strSharedAccess = SharingMode.getSharingModeAsString(sharedAccess);
+
+ logger.debug("openFile:" + o.getPath()
+ + ", isDirectory: " + params.isDirectory()
+ + ", isStream: " + params.isStream()
+ + ", readOnlyAccess: " + params.isReadOnlyAccess()
+ + ", readWriteAccess: " + params.isReadWriteAccess()
+ + ", writeOnlyAccess:" +params.isWriteOnlyAccess()
+ + ", attributesOnlyAccess:" +params.isAttributesOnlyAccess()
+ + ", sequentialAccessOnly:" + params.isSequentialAccessOnly()
+ + ", requestBatchOpLock:" +params.requestBatchOpLock()
+ + ", requestExclusiveOpLock:" +params.requestExclusiveOpLock()
+ + ", isDeleteOnClose:" +params.isDeleteOnClose()
+ + ", allocationSize:" + params.getAllocationSize()
+ + ", sharedAccess: " + strSharedAccess
+ );
+ }
+
return diskInterface.openFile(sess, tree, params);
}
else if(command instanceof CloseFileCommand)
diff --git a/source/java/org/alfresco/filesys/repo/ContentDiskDriver2.java b/source/java/org/alfresco/filesys/repo/ContentDiskDriver2.java
index 174eec1873..971706aa6c 100644
--- a/source/java/org/alfresco/filesys/repo/ContentDiskDriver2.java
+++ b/source/java/org/alfresco/filesys/repo/ContentDiskDriver2.java
@@ -685,10 +685,11 @@ public class ContentDiskDriver2 extends AlfrescoDiskDriver implements ExtendedD
{
logger.debug("getFileInformation found nodeRef for nodeRef :"+ nodeRef + ", path: " + path);
}
-
- // Set the file id from the node's DBID
- long id = DefaultTypeConverter.INSTANCE.convert(Long.class, nodeService.getProperty(nodeRef, ContentModel.PROP_NODE_DBID));
- finfo.setFileId((int) (id & 0xFFFFFFFFL));
+
+ // Moved to CIFS Helper
+// // Set the file id from the node's DBID
+// long id = DefaultTypeConverter.INSTANCE.convert(Long.class, nodeService.getProperty(nodeRef, ContentModel.PROP_NODE_DBID));
+// finfo.setFileId((int) (id & 0xFFFFFFFFL));
}
// Return the file information or null if the node ref does not exist
@@ -805,7 +806,11 @@ public class ContentDiskDriver2 extends AlfrescoDiskDriver implements ExtendedD
pseudoList = ctx.getPseudoFileOverlay().searchPseudoFiles(dirNodeRef, searchFileSpec);
}
- SearchContext searchCtx = new ContentSearchContext(getCifsHelper(), results, searchFileSpec, pseudoList, paths[0]);
+ DotDotContentSearchContext searchCtx = new DotDotContentSearchContext(getCifsHelper(), results, searchFileSpec, pseudoList, paths[0]);
+
+ // Need to set dot and dotdot
+ //searchCtx.setDotInfo(finfo);
+ //searchCtx.setDotDotInfo(finfo);
// Debug
if (logger.isDebugEnabled())
@@ -975,6 +980,10 @@ public class ContentDiskDriver2 extends AlfrescoDiskDriver implements ExtendedD
if ( params.hasAccessMode(AccessMode.NTRead) &&
permissionService.hasPermission(nodeRef, PermissionService.READ) == AccessStatus.DENIED)
{
+ if(logger.isDebugEnabled())
+ {
+ logger.debug("about to throw an no read access denied exception path:" +params.getFullPath());
+ }
throw new AccessDeniedException("No read access to " + params.getFullPath());
}
@@ -982,6 +991,11 @@ public class ContentDiskDriver2 extends AlfrescoDiskDriver implements ExtendedD
if ( params.hasAccessMode(AccessMode.NTWrite) &&
permissionService.hasPermission(nodeRef, PermissionService.WRITE) == AccessStatus.DENIED)
{
+ if(logger.isDebugEnabled())
+ {
+ logger.debug("about to throw an no write access denied exception path:" +params.getFullPath());
+ }
+
throw new AccessDeniedException("No write access to " + params.getFullPath());
}
@@ -1000,6 +1014,8 @@ public class ContentDiskDriver2 extends AlfrescoDiskDriver implements ExtendedD
if ( linkRef == null)
{
+ // A normal node, not a link node
+
// TODO MER REWRITE HERE
FileInfo fileInfo = cifsHelper.getFileInformation(nodeRef, "", false, false);
@@ -1011,6 +1027,7 @@ public class ContentDiskDriver2 extends AlfrescoDiskDriver implements ExtendedD
}
else
{
+ // A normal file
if(params.isReadOnlyAccess())
{
logger.debug("open file for read only");
@@ -1042,8 +1059,26 @@ public class ContentDiskDriver2 extends AlfrescoDiskDriver implements ExtendedD
netFile = new TempNetworkFile(file, name);
- // Always allow write access to a newly created file
- netFile.setGrantedAccess(NetworkFile.READWRITE);
+ // Generate a file id for the file
+
+ if ( netFile != null)
+ {
+ long id = DefaultTypeConverter.INSTANCE.convert(Long.class, nodeService.getProperty(nodeRef, ContentModel.PROP_NODE_DBID));
+ netFile.setFileId((int) (id & 0xFFFFFFFFL));
+ }
+
+ if (logger.isDebugEnabled())
+ {
+ logger.debug("Created file: path=" + name + " node=" + nodeRef + " network file=" + netFile);
+ }
+ }
+ else
+ {
+ // Write only or AttributesOnly
+ logger.debug("open file write or attributes only");
+ File file = TempFileProvider.createTempFile("cifs", ".bin");
+
+ netFile = new TempNetworkFile(file, name);
// Generate a file id for the file
@@ -1058,7 +1093,21 @@ public class ContentDiskDriver2 extends AlfrescoDiskDriver implements ExtendedD
logger.debug("Created file: path=" + name + " node=" + nodeRef + " network file=" + netFile);
}
}
- }
+
+ if ( params.isReadOnlyAccess())
+ {
+ netFile.setGrantedAccess( NetworkFile.READONLY);
+ }
+ else if ( params.isWriteOnlyAccess())
+ {
+ netFile.setGrantedAccess( NetworkFile.WRITEONLY);
+ }
+ else
+ {
+ netFile.setGrantedAccess( NetworkFile.READWRITE);
+ }
+
+ } // end of a normal file
}
else
{
@@ -2672,8 +2721,8 @@ public class ContentDiskDriver2 extends AlfrescoDiskDriver implements ExtendedD
// Always allow write access to a newly created file
netFile.setGrantedAccess(NetworkFile.READWRITE);
-
-
+ netFile.setAllowedAccess(NetworkFile.READWRITE);
+
// Truncate the file so that the content stream is created
//netFile.truncateFile( 0L);
@@ -2773,11 +2822,22 @@ public class ContentDiskDriver2 extends AlfrescoDiskDriver implements ExtendedD
{
logger.debug("closeFile has delete on close set");
}
-
- NodeRef target = getCifsHelper().getNodeRef(rootNode, path);
- if(target!=null)
+ try
{
- nodeService.deleteNode(target);
+ NodeRef target = getCifsHelper().getNodeRef(rootNode, path);
+ if(target!=null)
+ {
+ nodeService.deleteNode(target);
+ }
+ }
+ catch (org.alfresco.repo.security.permissions.AccessDeniedException ex)
+ {
+ if ( logger.isDebugEnabled())
+ {
+ logger.debug("Delete file from close file- access denied", ex);
+ }
+ // Convert to a filesystem access denied status
+ throw new AccessDeniedException("Unable to delete " + path);
}
// Still need to close the open file handle.
@@ -2786,8 +2846,8 @@ public class ContentDiskDriver2 extends AlfrescoDiskDriver implements ExtendedD
if (logger.isDebugEnabled())
{
logger.debug("Closed file: network file=" + file + " delete on close=" + file.hasDeleteOnClose());
- }
-
+ }
+
return;
}
diff --git a/source/java/org/alfresco/filesys/repo/DotDotContentSearchContext.java b/source/java/org/alfresco/filesys/repo/DotDotContentSearchContext.java
new file mode 100644
index 0000000000..7135bb1197
--- /dev/null
+++ b/source/java/org/alfresco/filesys/repo/DotDotContentSearchContext.java
@@ -0,0 +1,169 @@
+/*
+ * Copyright (C) 2006-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 .
+ */
+
+package org.alfresco.filesys.repo;
+
+import java.util.List;
+
+import org.alfresco.jlan.server.filesys.FileInfo;
+import org.alfresco.jlan.server.filesys.cache.FileState;
+import org.alfresco.jlan.server.filesys.cache.FileStateCache;
+import org.alfresco.jlan.server.filesys.pseudo.PseudoFileList;
+import org.alfresco.service.cmr.repository.NodeRef;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Cache Lookup Search Context Class
+ *
+ * ContentSearchContext with DotDot methods.
+ *
+ */
+public class DotDotContentSearchContext extends ContentSearchContext {
+
+ // Debug logging
+
+ private static final Log logger = LogFactory.getLog(DotDotContentSearchContext.class);
+
+
+ // File information for the '.' and '..' pseduo entries, returned during a wildcard search
+
+ private FileInfo m_dotInfo;
+ private FileInfo m_dotDotInfo;
+
+ /**
+ * Class constructor
+ *
+ * @param cifsHelper Filesystem helper class
+ * @param results List of file/folder nodes that match the search pattern
+ * @param searchStr Search path
+ * @param pseudoList List of pseudo files to be blended into the returned list of files
+ * @param relPath Relative path being searched
+ * @param stateCache File state cache
+ */
+ protected DotDotContentSearchContext(
+ CifsHelper cifsHelper,
+ List results,
+ String searchStr,
+ PseudoFileList pseudoList,
+ String relPath)
+
+ {
+ super(cifsHelper, results, searchStr, pseudoList, relPath);
+ super.setSearchString(searchStr);
+ }
+
+ /**
+ * Check if the '.' and '..' pseudo file entries are available
+ *
+ * @return boolean
+ */
+ public boolean hasDotFiles() {
+ return (m_dotInfo != null && m_dotDotInfo != null) ? true : false;
+ }
+
+ /**
+ * Return the '.' pseudo file entry details
+ *
+ * @param finfo FileInfo
+ * @return boolean
+ */
+ public boolean getDotInfo(FileInfo finfo) {
+
+ // Check if the '.' file information is valid
+
+ if ( m_dotInfo != null) {
+ finfo.copyFrom( m_dotInfo);
+ return true;
+ }
+
+ // File information not valid
+
+ return false;
+ }
+
+ /**
+ * Return the '..' pseudo file entry details
+ *
+ * @param finfo FileInfo
+ * @return boolean
+ */
+ public boolean getDotDotInfo(FileInfo finfo) {
+
+ // Check if the '..' file information is valid
+
+ if ( m_dotDotInfo != null) {
+ finfo.copyFrom( m_dotDotInfo);
+ return true;
+ }
+
+ // File information not valid
+
+ return false;
+ }
+
+ /**
+ * Set the '.' pseudo file entry details
+ *
+ * @param finfo FileInfo
+ */
+ protected void setDotInfo(FileInfo finfo) {
+ m_dotInfo = finfo;
+ if ( m_dotInfo != null)
+ m_dotInfo.setFileName( ".");
+ }
+
+ /**
+ * Set the '..' pseudo file entry details
+ *
+ * @param finfo FileInfo
+ */
+ protected void setDotDotInfo(FileInfo finfo) {
+ m_dotDotInfo = finfo;
+ if ( m_dotDotInfo != null)
+ m_dotDotInfo.setFileName( "..");
+ }
+
+ /**
+ * Return the search as a string
+ *
+ * @return String
+ */
+ public String toString()
+ {
+ StringBuilder sb = new StringBuilder(60);
+
+ sb.append("[DotDotContextSearch searchStr=");
+ sb.append(getSearchString());
+ sb.append(", resultCount=");
+ sb.append(getResultsSize());
+ sb.append(", pseudoList=");
+ if ( getPseudoListSize() != 0)
+ sb.append( getPseudoListSize());
+ else
+ sb.append("NULL");
+ if ( m_dotInfo != null)
+ sb.append(",Dot");
+ if ( m_dotDotInfo != null)
+ sb.append(",DotDot");
+ sb.append("]");
+
+ return sb.toString();
+ }
+}
diff --git a/source/java/org/alfresco/filesys/repo/LegacyFileStateDriver.java b/source/java/org/alfresco/filesys/repo/LegacyFileStateDriver.java
index 57d1ac407e..c046eb16fb 100644
--- a/source/java/org/alfresco/filesys/repo/LegacyFileStateDriver.java
+++ b/source/java/org/alfresco/filesys/repo/LegacyFileStateDriver.java
@@ -272,6 +272,13 @@ public class LegacyFileStateDriver implements ExtendedDiskInterface
FileStateCache cache = tctx.getStateCache();
FileState fstate = cache.findFileState( param.getFullName(), true);
+ // MER Experiment Need to reset shared access
+ if(fstate.getOpenCount() ==0 )
+ {
+ logger.debug("reset shared access to READWRITEDELETE");
+ fstate.setSharedAccess( SharingMode.READWRITE + SharingMode.DELETE);
+ }
+
if(fstate != null && param.getAccessToken() != null)
{
FileAccessToken token = param.getAccessToken();
diff --git a/source/java/org/alfresco/filesys/repo/NonTransactionalRuleContentDiskDriver.java b/source/java/org/alfresco/filesys/repo/NonTransactionalRuleContentDiskDriver.java
index d8fac420c4..083c948148 100644
--- a/source/java/org/alfresco/filesys/repo/NonTransactionalRuleContentDiskDriver.java
+++ b/source/java/org/alfresco/filesys/repo/NonTransactionalRuleContentDiskDriver.java
@@ -178,29 +178,9 @@ public class NonTransactionalRuleContentDiskDriver implements ExtendedDiskInterf
{
if(logger.isDebugEnabled())
{
-
- int sharedAccess = params.getSharedAccess();
- String strSharedAccess = "none";
-
- switch(sharedAccess)
- {
- case SharingMode.NOSHARING:
- strSharedAccess = "nosharing";
- break;
- case SharingMode.READ:
- strSharedAccess = "read";
- break;
- case SharingMode.WRITE:
- strSharedAccess = "write";
- break;
- case SharingMode.READWRITE:
- strSharedAccess = "read-write";
- break;
- case SharingMode.DELETE:
- strSharedAccess = "delete";
- break;
- }
-
+ int sharedAccess = params.getSharedAccess();
+ String strSharedAccess = SharingMode.getSharingModeAsString(sharedAccess);
+
logger.debug("createFile:" + params.getPath()
+ ", isDirectory: " + params.isDirectory()
+ ", isStream: " + params.isStream()
@@ -219,8 +199,6 @@ public class NonTransactionalRuleContentDiskDriver implements ExtendedDiskInterf
ContentContext tctx = (ContentContext) tree.getContext();
NodeRef rootNode = tctx.getRootNode();
-
-
String[] paths = FileName.splitPath(params.getPath());
String folder = paths[0];
String file = paths[1];
@@ -235,7 +213,6 @@ public class NonTransactionalRuleContentDiskDriver implements ExtendedDiskInterf
if(ret != null && ret instanceof NetworkFile)
{
-
return (NetworkFile)ret;
}
else
@@ -309,27 +286,8 @@ public class NonTransactionalRuleContentDiskDriver implements ExtendedDiskInterf
if(logger.isDebugEnabled())
{
int sharedAccess = param.getSharedAccess();
- String strSharedAccess = "none";
-
- switch(sharedAccess)
- {
- case SharingMode.NOSHARING:
- strSharedAccess = "nosharing";
- break;
- case SharingMode.READ:
- strSharedAccess = "read";
- break;
- case SharingMode.WRITE:
- strSharedAccess = "write";
- break;
- case SharingMode.READWRITE:
- strSharedAccess = "read-write";
- break;
- case SharingMode.DELETE:
- strSharedAccess = "delete";
- break;
- }
-
+ String strSharedAccess = SharingMode.getSharingModeAsString(sharedAccess);
+
logger.debug("openFile:" + path
+ ", isDirectory: " + param.isDirectory()
+ ", isStream: " + param.isStream()
@@ -358,32 +316,50 @@ public class NonTransactionalRuleContentDiskDriver implements ExtendedDiskInterf
EvaluatorContext ctx = getEvaluatorContext(driverState, folder);
- // Todo what about attributes only and writeOnly ?
- OpenFileMode writeAccess = param.isReadWriteAccess() ? OpenFileMode.WRITE : OpenFileMode.READ ;
+ // Todo what about attributes only ?
- if(param.isDeleteOnClose())
+ OpenFileMode openMode = OpenFileMode.READ_WRITE;
+
+ if(param.isAttributesOnlyAccess())
+ {
+ openMode = OpenFileMode.ATTRIBUTES_ONLY;
+ }
+ else if (param.isReadWriteAccess())
+ {
+ openMode = OpenFileMode.READ_WRITE;
+ }
+ else if (param.isWriteOnlyAccess())
+ {
+ openMode = OpenFileMode.WRITE_ONLY;
+ }
+ else if (param.isReadOnlyAccess())
+ {
+ openMode = OpenFileMode.READ_ONLY;
+ }
+ else if(param.isDeleteOnClose())
{
if(logger.isDebugEnabled())
{
logger.debug("open file has delete on close");
}
- writeAccess = OpenFileMode.DELETE;
+ openMode = OpenFileMode.DELETE;
}
boolean truncate = param.isOverwrite();
- Operation o = new OpenFileOperation(file, writeAccess, truncate, rootNode, path);
+ Operation o = new OpenFileOperation(file, openMode, truncate, rootNode, path);
Command c = ruleEvaluator.evaluate(ctx, o);
Object ret = commandExecutor.execute(sess, tree, c);
if(ret != null && ret instanceof NetworkFile)
{
-
+ NetworkFile x = (NetworkFile)ret;
+
if(logger.isDebugEnabled())
{
logger.debug("returning open file: for path:" + path +", ret:" + ret);
}
- return (NetworkFile)ret;
+ return x;
}
else
{
diff --git a/source/java/org/alfresco/filesys/repo/OpenFileMode.java b/source/java/org/alfresco/filesys/repo/OpenFileMode.java
index 49db82e5a8..2042106b83 100644
--- a/source/java/org/alfresco/filesys/repo/OpenFileMode.java
+++ b/source/java/org/alfresco/filesys/repo/OpenFileMode.java
@@ -2,8 +2,9 @@ package org.alfresco.filesys.repo;
public enum OpenFileMode
{
- READ,
- WRITE,
+ READ_ONLY,
+ WRITE_ONLY,
+ READ_WRITE,
DELETE,
ATTRIBUTES_ONLY
}
diff --git a/source/java/org/alfresco/filesys/repo/rules/ScenarioOpenFileInstance.java b/source/java/org/alfresco/filesys/repo/rules/ScenarioOpenFileInstance.java
index 4132ee5fdf..3db966b35f 100644
--- a/source/java/org/alfresco/filesys/repo/rules/ScenarioOpenFileInstance.java
+++ b/source/java/org/alfresco/filesys/repo/rules/ScenarioOpenFileInstance.java
@@ -268,7 +268,7 @@ class ScenarioOpenFileInstance implements ScenarioInstance
commands.add(new CloseFileCommand(c.getName(), file, c.getRootNodeRef(), c.getPath()));
- postErrorCommands.add(new RemoveNoContentFileOnError(c.getName(), c.getRootNodeRef(), c.getPath()));
+ //postErrorCommands.add(new RemoveNoContentFileOnError(c.getName(), c.getRootNodeRef(), c.getPath()));
if(c.isDeleteOnClose())
{
@@ -306,7 +306,7 @@ class ScenarioOpenFileInstance implements ScenarioInstance
if(name != null && name.equalsIgnoreCase(o.getName()))
{
- if(o.getMode() == OpenFileMode.WRITE)
+ if(o.getMode() == OpenFileMode.READ_WRITE)
{
// This is an open of a read write access
if(openReadWriteCount == 0)
diff --git a/source/java/org/alfresco/filesys/repo/rules/ScenarioSimpleNonBufferedInstance.java b/source/java/org/alfresco/filesys/repo/rules/ScenarioSimpleNonBufferedInstance.java
index 54ac229557..35b40263ef 100644
--- a/source/java/org/alfresco/filesys/repo/rules/ScenarioSimpleNonBufferedInstance.java
+++ b/source/java/org/alfresco/filesys/repo/rules/ScenarioSimpleNonBufferedInstance.java
@@ -90,7 +90,7 @@ public class ScenarioSimpleNonBufferedInstance implements ScenarioInstance
commands.add(new CloseFileCommand(c.getName(), file, c.getRootNodeRef(), c.getPath()));
- postErrorCommands.add(new RemoveNoContentFileOnError(c.getName(), c.getRootNodeRef(), c.getPath()));
+ // postErrorCommands.add(new RemoveNoContentFileOnError(c.getName(), c.getRootNodeRef(), c.getPath()));
if(c.isDeleteOnClose())
{
diff --git a/source/java/org/alfresco/filesys/repo/rules/commands/OpenFileCommand.java b/source/java/org/alfresco/filesys/repo/rules/commands/OpenFileCommand.java
index 2b9df70a0f..ae323666d3 100644
--- a/source/java/org/alfresco/filesys/repo/rules/commands/OpenFileCommand.java
+++ b/source/java/org/alfresco/filesys/repo/rules/commands/OpenFileCommand.java
@@ -31,7 +31,7 @@ import org.alfresco.service.cmr.repository.NodeRef;
public class OpenFileCommand implements Command
{
private String name;
- private OpenFileMode mode = OpenFileMode.READ;
+ private OpenFileMode mode = OpenFileMode.READ_ONLY;
private boolean truncate = false;
private String path;
private NodeRef rootNode;
diff --git a/source/java/org/alfresco/filesys/repo/rules/commands/RemoveNoContentFileOnError.java b/source/java/org/alfresco/filesys/repo/rules/commands/RemoveNoContentFileOnError.java
index e9d4755fb5..8ae11aa872 100644
--- a/source/java/org/alfresco/filesys/repo/rules/commands/RemoveNoContentFileOnError.java
+++ b/source/java/org/alfresco/filesys/repo/rules/commands/RemoveNoContentFileOnError.java
@@ -37,6 +37,8 @@ public class RemoveNoContentFileOnError implements Command
public RemoveNoContentFileOnError(String name, NodeRef rootNode, String path)
{
this.name = name;
+ this.rootNode = rootNode;
+ this.path = path;
}
public String getName()