ContentDiskDriver2 - bug fix.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@32853 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Mark Rogers
2011-12-19 11:45:09 +00:00
parent 29f6d96852
commit 4b25d0a6d5

View File

@@ -403,6 +403,7 @@ public class ContentDiskDriver2 extends AlfrescoDiskDriver implements ExtendedD
*/ */
public DeviceContext createContext(String deviceName, ConfigElement cfg) throws DeviceContextException public DeviceContext createContext(String deviceName, ConfigElement cfg) throws DeviceContextException
{ {
logger.error("Obsolete method called");
throw new DeviceContextException("Obsolete Method called"); throw new DeviceContextException("Obsolete Method called");
} }
@@ -948,6 +949,7 @@ public class ContentDiskDriver2 extends AlfrescoDiskDriver implements ExtendedD
public NetworkFile openFile(SrvSession session, TreeConnection tree, FileOpenParams params) throws IOException public NetworkFile openFile(SrvSession session, TreeConnection tree, FileOpenParams params) throws IOException
{ {
// obsolete // obsolete
logger.error("Obsolete method called");
throw new AlfrescoRuntimeException("obsolete method called"); throw new AlfrescoRuntimeException("obsolete method called");
} }
@@ -963,6 +965,7 @@ public class ContentDiskDriver2 extends AlfrescoDiskDriver implements ExtendedD
public NetworkFile createFile(SrvSession sess, final TreeConnection tree, final FileOpenParams params) throws IOException public NetworkFile createFile(SrvSession sess, final TreeConnection tree, final FileOpenParams params) throws IOException
{ {
// Obsolete // Obsolete
logger.error("Obsolete method called");
throw new AlfrescoRuntimeException("obsolete method called"); throw new AlfrescoRuntimeException("obsolete method called");
} }
@@ -1500,15 +1503,40 @@ public class ContentDiskDriver2 extends AlfrescoDiskDriver implements ExtendedD
} }
} }
if(info.isHidden() && !nodeService.hasAspect(nodeRef, ContentModel.ASPECT_HIDDEN)) if(info.hasSetFlag(FileInfo.SetAttributes))
{
if ( logger.isDebugEnabled())
{
logger.debug("Set attributes" + name + ", file attrs = " + info.getFileAttributes());
}
//TODO MER Think we may need to implement, Temporary, Hidden, System, Archive
if(info.isHidden())
{
// yes is hidden
if(!nodeService.hasAspect(nodeRef, ContentModel.ASPECT_HIDDEN))
{ {
if ( logger.isDebugEnabled()) if ( logger.isDebugEnabled())
{ {
logger.debug("Set hidden aspect (not yet implemented)" + name); logger.debug("Set hidden aspect (not yet implemented)" + name);
} }
// TODO Not yet implemented - and how to reset hidden bit? // TODO Not yet implemented - and how to reset hidden bit?
// nodeService.addAspect(nodeRef, ContentModel.ASPECT_HIDDEN, null); // nodeService.addAspect(nodeRef, ContentModel.ASPECT_HIDDEN, null);
} }
}
else
{
// not hidden is hidden
if(nodeService.hasAspect(nodeRef, ContentModel.ASPECT_HIDDEN))
{
if ( logger.isDebugEnabled())
{
logger.debug("Reset hidden aspect (not yet implemented)" + name);
}
}
// not hidden
}
} // End of setting attributes
if( info.hasSetFlag(FileInfo.SetAllocationSize)) if( info.hasSetFlag(FileInfo.SetAllocationSize))
{ {
@@ -2423,6 +2451,8 @@ public class ContentDiskDriver2 extends AlfrescoDiskDriver implements ExtendedD
netFile = new TempNetworkFile(file, name); netFile = new TempNetworkFile(file, name);
netFile.setGrantedAccess( NetworkFile.READWRITE);
if(truncate) if(truncate)
{ {
netFile.truncateFile(0); netFile.truncateFile(0);
@@ -2440,7 +2470,7 @@ public class ContentDiskDriver2 extends AlfrescoDiskDriver implements ExtendedD
{ {
logger.debug("Created file: path=" + name + " node=" + nodeRef + " network file=" + netFile); logger.debug("Created file: path=" + name + " node=" + nodeRef + " network file=" + netFile);
} }
netFile.setGrantedAccess( NetworkFile.READWRITE);
} }
break; break;
@@ -2465,6 +2495,9 @@ public class ContentDiskDriver2 extends AlfrescoDiskDriver implements ExtendedD
netFile = new TempNetworkFile(file, name); netFile = new TempNetworkFile(file, name);
// Needs to be READWRITE for JavaNetworkFile - there's no such thing as WRITEONLY!
netFile.setGrantedAccess( NetworkFile.READWRITE);
// Generate a file id for the file // Generate a file id for the file
if ( netFile != null) if ( netFile != null)
@@ -2477,9 +2510,6 @@ public class ContentDiskDriver2 extends AlfrescoDiskDriver implements ExtendedD
{ {
logger.debug("Created temporary file: path=" + name + " node=" + nodeRef + " network file=" + netFile); logger.debug("Created temporary file: path=" + name + " node=" + nodeRef + " network file=" + netFile);
} }
// Needs to be READWRITE for JavaNetworkFile - there's no such thing as WRITEONLY!
netFile.setGrantedAccess( NetworkFile.READWRITE);
} }
} }
} // end of a normal file } // end of a normal file