Class ContentDiskDriver2

java.lang.Object
org.alfresco.filesys.alfresco.AlfrescoDiskDriver
org.alfresco.filesys.repo.ContentDiskDriver2
All Implemented Interfaces:
ExtendedDiskInterface, RepositoryDiskInterface, org.alfresco.jlan.server.core.DeviceInterface, org.alfresco.jlan.server.filesys.DiskInterface, org.alfresco.jlan.server.filesys.DiskSizeInterface, org.alfresco.jlan.server.locking.FileLockingInterface, org.alfresco.jlan.server.locking.OpLockInterface

public class ContentDiskDriver2 extends AlfrescoDiskDriver implements ExtendedDiskInterface, org.alfresco.jlan.server.filesys.DiskInterface, org.alfresco.jlan.server.filesys.DiskSizeInterface, RepositoryDiskInterface, org.alfresco.jlan.server.locking.OpLockInterface, org.alfresco.jlan.server.locking.FileLockingInterface
Alfresco Content repository filesystem driver class

Provides a JLAN ContentDiskDriver for various JLAN protocols such as SMB/CIFS, NFS and FTP.

  • Constructor Details

    • ContentDiskDriver2

      public ContentDiskDriver2()
  • Method Details

    • init

      public void init()
    • getCifsHelper

      public final CifsHelper getCifsHelper()
      Return the CIFS helper
      Returns:
      CifsHelper
    • getAuthenticationService

      public final AuthenticationService getAuthenticationService()
      Return the authentication service
      Returns:
      AuthenticationService
    • getAuthenticationContext

      public final AuthenticationContext getAuthenticationContext()
      Return the authentication context
      Returns:
      AuthenticationContext
    • getNodeService

      public final NodeService getNodeService()
      Return the node service
      Returns:
      NodeService
    • getContentService

      public final ContentService getContentService()
      Return the content service
      Returns:
      ContentService
    • getNamespaceService

      public final NamespaceService getNamespaceService()
      Return the namespace service
      Returns:
      NamespaceService
    • getSearchService

      public final SearchService getSearchService()
      Return the search service
      Returns:
      SearchService
    • getFileFolderService

      public final FileFolderService getFileFolderService()
      Return the file folder service
      Returns:
      FileFolderService
    • getPermissionService

      public final PermissionService getPermissionService()
      Return the permission service
      Returns:
      PermissionService
    • getLockService

      public final LockService getLockService()
      Return the lock service
      Returns:
      LockService
    • getPolicyFilter

      public BehaviourFilter getPolicyFilter()
      Get the policy behaviour filter, used to inhibit versioning on a per transaction basis
    • setContentService

      public void setContentService(ContentService contentService)
      Parameters:
      contentService - the content service
    • setNamespaceService

      public void setNamespaceService(NamespaceService namespaceService)
      Parameters:
      namespaceService - the namespace service
    • setNodeService

      public void setNodeService(NodeService nodeService)
      Parameters:
      nodeService - the node service
    • setSearchService

      public void setSearchService(SearchService searchService)
      Parameters:
      searchService - the search service
    • setPermissionService

      public void setPermissionService(PermissionService permissionService)
      Set the permission service
      Parameters:
      permissionService - PermissionService
    • setAuthenticationContext

      public void setAuthenticationContext(AuthenticationContext authContext)
      Set the authentication context
      Parameters:
      authContext - AuthenticationContext
    • setAuthenticationService

      public void setAuthenticationService(AuthenticationService authService)
      Set the authentication service
      Parameters:
      authService - AuthenticationService
    • setFileFolderService

      public void setFileFolderService(FileFolderService fileService)
      Set the file folder service
      Parameters:
      fileService - FileFolderService
    • setMimetypeService

      public void setMimetypeService(MimetypeService mimetypeService)
      Parameters:
      mimetypeService - service for helping with mimetypes and encoding
    • setNodeMonitorFactory

      public void setNodeMonitorFactory(NodeMonitorFactory nodeMonitorFactory)
      Set the node monitor factory
      Parameters:
      nodeMonitorFactory - NodeMonitorFactory
    • setLockService

      public void setLockService(LockService lockService)
      Set the lock service
      Parameters:
      lockService - LockService
    • setPolicyFilter

      public void setPolicyFilter(BehaviourFilter policyFilter)
      Set the policy behaviour filter, used to inhibit versioning on a per transaction basis
      Parameters:
      policyFilter - PolicyBehaviourFilter
    • setHiddenAspect

      public void setHiddenAspect(HiddenAspect hiddenAspect)
      Parameters:
      hiddenAspect -
    • setAlfrescoLockKeeper

      public void setAlfrescoLockKeeper(LockKeeper lockKeeper)
      Parameters:
      lockKeeper - lockKeeper
    • createContext

      public org.alfresco.jlan.server.core.DeviceContext createContext(String deviceName, org.springframework.extensions.config.ConfigElement cfg) throws org.alfresco.jlan.server.core.DeviceContextException
      Deprecated.
      - no longer used. Construction of context is via spring now.
      Parse and validate the parameter string and create a device context object for this instance of the shared device. The same DeviceInterface implementation may be used for multiple shares.

      Specified by:
      createContext in interface org.alfresco.jlan.server.core.DeviceInterface
      Parameters:
      deviceName - The name of the device
      cfg - ConfigElement the configuration of the device context.
      Returns:
      DeviceContext
      Throws:
      org.alfresco.jlan.server.core.DeviceContextException
    • registerContext

      public void registerContext(org.alfresco.jlan.server.core.DeviceContext ctx) throws org.alfresco.jlan.server.core.DeviceContextException
      Description copied from class: AlfrescoDiskDriver
      Registers a device context object for this instance of the shared device. The same DeviceInterface implementation may be used for multiple shares. In this base class, we initialize all desktop actions.
      Specified by:
      registerContext in interface ExtendedDiskInterface
      Overrides:
      registerContext in class AlfrescoDiskDriver
      Parameters:
      ctx - the context
      Throws:
      org.alfresco.jlan.server.core.DeviceContextException
    • isReadOnly

      public boolean isReadOnly(org.alfresco.jlan.server.SrvSession sess, org.alfresco.jlan.server.core.DeviceContext ctx) throws IOException
      Determine if the disk device is read-only.
      Specified by:
      isReadOnly in interface org.alfresco.jlan.server.filesys.DiskInterface
      Parameters:
      sess - Server session
      ctx - Device context
      Returns:
      boolean
      Throws:
      IOException - If an error occurs.
    • getFileInformation

      public org.alfresco.jlan.server.filesys.FileInfo getFileInformation(org.alfresco.jlan.server.SrvSession session, org.alfresco.jlan.server.filesys.TreeConnection tree, String path) throws IOException
      Get the file information for the specified file.
      Specified by:
      getFileInformation in interface org.alfresco.jlan.server.filesys.DiskInterface
      Parameters:
      session - Server session
      tree - Tree connection
      path - File name/path that information is required for.
      Returns:
      File information if valid, else null
      Throws:
      IOException - The exception description.
    • startSearch

      public org.alfresco.jlan.server.filesys.SearchContext startSearch(org.alfresco.jlan.server.SrvSession session, org.alfresco.jlan.server.filesys.TreeConnection tree, String searchPath, int attributes) throws FileNotFoundException
      Start a new search on the filesystem using the specified searchPath that may contain wildcards.
      Specified by:
      startSearch in interface org.alfresco.jlan.server.filesys.DiskInterface
      Parameters:
      session - Server session
      tree - Tree connection
      searchPath - File(s) to search for, may include wildcards.
      attributes - Attributes of the file(s) to search for, see class SMBFileAttribute.
      Returns:
      SearchContext
      Throws:
      FileNotFoundException - If the search could not be started.
    • fileExists

      public int fileExists(org.alfresco.jlan.server.SrvSession session, org.alfresco.jlan.server.filesys.TreeConnection tree, String name)
      Check if the specified file exists, and whether it is a file or directory.
      Specified by:
      fileExists in interface org.alfresco.jlan.server.filesys.DiskInterface
      Parameters:
      session - Server session
      tree - Tree connection
      name - the path of the file
      Returns:
      FileStatus (0: NotExist, 1 : FileExist, 2: DirectoryExists)
      See Also:
      • FileStatus
    • openFile

      public org.alfresco.jlan.server.filesys.NetworkFile openFile(org.alfresco.jlan.server.SrvSession session, org.alfresco.jlan.server.filesys.TreeConnection tree, org.alfresco.jlan.server.filesys.FileOpenParams params) throws IOException
      Open a file or folder - obsolete implementation.
      Specified by:
      openFile in interface org.alfresco.jlan.server.filesys.DiskInterface
      Parameters:
      session - SrvSession
      tree - TreeConnection
      params - FileOpenParams
      Returns:
      NetworkFile
      Throws:
      IOException
    • createFile

      public org.alfresco.jlan.server.filesys.NetworkFile createFile(org.alfresco.jlan.server.SrvSession sess, org.alfresco.jlan.server.filesys.TreeConnection tree, org.alfresco.jlan.server.filesys.FileOpenParams params) throws IOException
      Create a new file on the file system.
      Specified by:
      createFile in interface org.alfresco.jlan.server.filesys.DiskInterface
      Parameters:
      sess - Server session
      tree - Tree connection
      params - File create parameters
      Returns:
      NetworkFile
      Throws:
      IOException - If an error occurs.
    • createDirectory

      public void createDirectory(org.alfresco.jlan.server.SrvSession sess, org.alfresco.jlan.server.filesys.TreeConnection tree, org.alfresco.jlan.server.filesys.FileOpenParams params) throws IOException
      Create a new directory on this file system.
      Specified by:
      createDirectory in interface org.alfresco.jlan.server.filesys.DiskInterface
      Parameters:
      sess - Server session
      tree - Tree connection.
      params - Directory create parameters
      Throws:
      IOException - If an error occurs.
    • deleteDirectory

      public void deleteDirectory(org.alfresco.jlan.server.SrvSession session, org.alfresco.jlan.server.filesys.TreeConnection tree, String dir) throws IOException
      Delete the directory from the filesystem.

      The directory must be empty in order to be able to delete ity

      Specified by:
      deleteDirectory in interface org.alfresco.jlan.server.filesys.DiskInterface
      Parameters:
      session - Server session
      tree - Tree connection
      dir - Directory name.
      Throws:
      IOException - The exception description.
    • flushFile

      public void flushFile(org.alfresco.jlan.server.SrvSession session, org.alfresco.jlan.server.filesys.TreeConnection tree, org.alfresco.jlan.server.filesys.NetworkFile file) throws IOException
      Flush any buffered output for the specified file.
      Specified by:
      flushFile in interface org.alfresco.jlan.server.filesys.DiskInterface
      Parameters:
      session - Server session
      tree - Tree connection
      file - Network file context.
      Throws:
      IOException - The exception description.
    • closeFile

      public void closeFile(org.alfresco.jlan.server.SrvSession session, org.alfresco.jlan.server.filesys.TreeConnection tree, org.alfresco.jlan.server.filesys.NetworkFile file) throws IOException
      Close the file.
      Specified by:
      closeFile in interface org.alfresco.jlan.server.filesys.DiskInterface
      Parameters:
      session - Server session
      tree - Tree connection.
      file - Network file context.
      Throws:
      IOException - If an error occurs.
    • deleteFile

      public void deleteFile(org.alfresco.jlan.server.SrvSession session, org.alfresco.jlan.server.filesys.TreeConnection tree, String name) throws IOException
      Specified by:
      deleteFile in interface org.alfresco.jlan.server.filesys.DiskInterface
      Throws:
      IOException
    • deleteFile2

      public NodeRef deleteFile2(org.alfresco.jlan.server.SrvSession session, org.alfresco.jlan.server.filesys.TreeConnection tree, NodeRef rootNode, String path) throws IOException
      Delete the specified file.
      Specified by:
      deleteFile2 in interface RepositoryDiskInterface
      Parameters:
      session - Server session
      tree - Tree connection
      rootNode - Root node
      path - NetworkFile
      Returns:
      NodeRef of deletedFile
      Throws:
      IOException - The exception description.
    • renameFile

      public void renameFile(org.alfresco.jlan.server.SrvSession session, org.alfresco.jlan.server.filesys.TreeConnection tree, String oldName, String newName) throws IOException
      Specified by:
      renameFile in interface org.alfresco.jlan.server.filesys.DiskInterface
      Throws:
      IOException
    • renameFile

      public void renameFile(NodeRef rootNode, String oldName, String newName, boolean soft, boolean moveAsSystem) throws IOException
      Rename the specified file.
      Specified by:
      renameFile in interface RepositoryDiskInterface
      Parameters:
      rootNode -
      oldName - path/name of old file
      newName - path/name of new file
      soft - boolean
      moveAsSystem - move as system
      Throws:
      IOException - The exception description.
    • setFileInformation

      public void setFileInformation(org.alfresco.jlan.server.SrvSession sess, org.alfresco.jlan.server.filesys.TreeConnection tree, String name, org.alfresco.jlan.server.filesys.FileInfo info) throws IOException
      Set file information
      Specified by:
      setFileInformation in interface org.alfresco.jlan.server.filesys.DiskInterface
      Parameters:
      sess - SrvSession
      tree - TreeConnection
      name - String
      info - FileInfo
      Throws:
      IOException
    • truncateFile

      public void truncateFile(org.alfresco.jlan.server.SrvSession sess, org.alfresco.jlan.server.filesys.TreeConnection tree, org.alfresco.jlan.server.filesys.NetworkFile file, long size) throws IOException
      Truncate a file to the specified size
      Specified by:
      truncateFile in interface org.alfresco.jlan.server.filesys.DiskInterface
      Parameters:
      sess - Server session
      tree - Tree connection
      file - Network file details
      size - New file length
      Throws:
      IOException - The exception description.
    • readFile

      public int readFile(org.alfresco.jlan.server.SrvSession sess, org.alfresco.jlan.server.filesys.TreeConnection tree, org.alfresco.jlan.server.filesys.NetworkFile file, byte[] buffer, int bufferPosition, int size, long fileOffset) throws IOException
      Read a block of data from the specified file.
      Specified by:
      readFile in interface org.alfresco.jlan.server.filesys.DiskInterface
      Parameters:
      sess - Session details
      tree - Tree connection
      file - Network file
      buffer - Buffer to return data to
      bufferPosition - Starting position in the return buffer
      size - Maximum size of data to return
      fileOffset - File offset to read data
      Returns:
      Number of bytes read
      Throws:
      IOException - The exception description.
    • seekFile

      public long seekFile(org.alfresco.jlan.server.SrvSession sess, org.alfresco.jlan.server.filesys.TreeConnection tree, org.alfresco.jlan.server.filesys.NetworkFile file, long pos, int typ) throws IOException
      Seek to the specified file position.
      Specified by:
      seekFile in interface org.alfresco.jlan.server.filesys.DiskInterface
      Parameters:
      sess - Server session
      tree - Tree connection
      file - Network file.
      pos - Position to seek to.
      typ - Seek type.
      Returns:
      New file position, relative to the start of file.
      Throws:
      IOException
    • writeFile

      public int writeFile(org.alfresco.jlan.server.SrvSession sess, org.alfresco.jlan.server.filesys.TreeConnection tree, org.alfresco.jlan.server.filesys.NetworkFile file, byte[] buffer, int bufferOffset, int size, long fileOffset) throws IOException
      Write a block of data to the file.
      Specified by:
      writeFile in interface org.alfresco.jlan.server.filesys.DiskInterface
      Parameters:
      sess - Server session
      tree - Tree connection
      file - Network file details
      buffer - byte[] Data to be written
      bufferOffset - Offset within the buffer that the data starts
      size - int Data length
      fileOffset - Position within the file that the data is to be written.
      Returns:
      Number of bytes actually written
      Throws:
      IOException - The exception description.
    • getNodeForPath

      public NodeRef getNodeForPath(NodeRef rootNode, String path) throws FileNotFoundException
      Get the node for the specified path
      Parameters:
      rootNode - rootNode
      path - String
      Returns:
      NodeRef
      Throws:
      FileNotFoundException
    • getLockManager

      public org.alfresco.jlan.server.locking.LockManager getLockManager(org.alfresco.jlan.server.SrvSession sess, org.alfresco.jlan.server.filesys.TreeConnection tree)
      Return the lock manager used by this filesystem
      Specified by:
      getLockManager in interface org.alfresco.jlan.server.locking.FileLockingInterface
      Parameters:
      sess - SrvSession
      tree - TreeConnection
      Returns:
      LockManager
    • getDiskInformation

      public void getDiskInformation(org.alfresco.jlan.server.filesys.DiskDeviceContext ctx, org.alfresco.jlan.server.filesys.SrvDiskInfo diskDev) throws IOException
      Get the disk information for this shared disk device.
      Specified by:
      getDiskInformation in interface org.alfresco.jlan.server.filesys.DiskSizeInterface
      Parameters:
      ctx - DiskDeviceContext
      diskDev - SrvDiskInfo
      Throws:
      IOException
    • setCifsHelper

      public void setCifsHelper(CifsHelper cifsHelper)
    • treeOpened

      public void treeOpened(org.alfresco.jlan.server.SrvSession sess, org.alfresco.jlan.server.filesys.TreeConnection tree)
      Specified by:
      treeOpened in interface org.alfresco.jlan.server.core.DeviceInterface
    • treeClosed

      public void treeClosed(org.alfresco.jlan.server.SrvSession sess, org.alfresco.jlan.server.filesys.TreeConnection tree)
      Specified by:
      treeClosed in interface org.alfresco.jlan.server.core.DeviceInterface
    • setCheckOutCheckInService

      public void setCheckOutCheckInService(CheckOutCheckInService service)
    • getCheckOutCheckInService

      public final CheckOutCheckInService getCheckOutCheckInService()
      Returns:
      the service to provide check-in and check-out data
    • copyContent

      public void copyContent(NodeRef rootNode, String fromPath, String toPath) throws FileNotFoundException
      Description copied from interface: RepositoryDiskInterface
      Copy the content from one node to another.
      Specified by:
      copyContent in interface RepositoryDiskInterface
      Parameters:
      rootNode - NodeRef
      fromPath - - the source node
      toPath - - the target node
      Throws:
      FileNotFoundException
    • createFile

      public org.alfresco.jlan.server.filesys.NetworkFile createFile(NodeRef rootNode, String path, long allocationSize, boolean isHidden) throws IOException
      Description copied from interface: RepositoryDiskInterface
      CreateFile.
      Specified by:
      createFile in interface RepositoryDiskInterface
      Parameters:
      rootNode - NodeRef
      path - - path
      allocationSize - size to allocate for new file
      isHidden - boolean
      Throws:
      FileNotFoundException
      IOException
    • openFile

      public org.alfresco.jlan.server.filesys.NetworkFile openFile(org.alfresco.jlan.server.SrvSession session, org.alfresco.jlan.server.filesys.TreeConnection tree, NodeRef rootNode, String path, OpenFileMode mode, boolean truncate) throws IOException
      Open the file - Repo Specific implementation
      Specified by:
      openFile in interface RepositoryDiskInterface
      Parameters:
      session - // temp until refactor
      tree - // temp until refactor
      rootNode - NodeRef
      path - String
      mode - OpenFileMode
      truncate - boolean
      Returns:
      NetworkFile
      Throws:
      IOException
    • closeFile

      public NodeRef closeFile(org.alfresco.jlan.server.filesys.TreeConnection tree, NodeRef rootNode, String path, org.alfresco.jlan.server.filesys.NetworkFile file) throws IOException
      Close the file.
      Specified by:
      closeFile in interface RepositoryDiskInterface
      Parameters:
      tree - TreeConnection
      rootNode - NodeRef
      path - - path
      file - - file
      Returns:
      node ref of deleted file
      Throws:
      IOException - If an error occurs.
    • reduceQuota

      public void reduceQuota(org.alfresco.jlan.server.SrvSession session, org.alfresco.jlan.server.filesys.TreeConnection tree, org.alfresco.jlan.server.filesys.NetworkFile file)
      Specified by:
      reduceQuota in interface RepositoryDiskInterface
      Parameters:
      session -
      tree -
      file -
    • deleteEmptyFile

      public void deleteEmptyFile(NodeRef rootNode, String path)
      Specified by:
      deleteEmptyFile in interface RepositoryDiskInterface
      Parameters:
      rootNode - NodeRef
      path - String
    • getOpLockManager

      public org.alfresco.jlan.server.locking.OpLockManager getOpLockManager(org.alfresco.jlan.server.SrvSession sess, org.alfresco.jlan.server.filesys.TreeConnection tree)
      Specified by:
      getOpLockManager in interface org.alfresco.jlan.server.locking.OpLockInterface
    • isOpLocksEnabled

      public boolean isOpLocksEnabled(org.alfresco.jlan.server.SrvSession sess, org.alfresco.jlan.server.filesys.TreeConnection tree)
      Specified by:
      isOpLocksEnabled in interface org.alfresco.jlan.server.locking.OpLockInterface
    • setContentComparator

      public void setContentComparator(ContentComparator contentComparator)
    • getContentComparator

      public ContentComparator getContentComparator()
    • restoreFile

      public org.alfresco.jlan.server.filesys.NetworkFile restoreFile(org.alfresco.jlan.server.SrvSession sess, org.alfresco.jlan.server.filesys.TreeConnection tree, NodeRef rootNode, String path, long allocationSize, NodeRef originalNodeRef) throws IOException
      Description copied from interface: RepositoryDiskInterface
      RestoreFile. Either restores the file or creates a new one.
      Specified by:
      restoreFile in interface RepositoryDiskInterface
      Parameters:
      sess - SrvSession
      tree - TreeConnection
      rootNode - NodeRef
      path - - path
      allocationSize - size to allocate for new file
      originalNodeRef - NodeRef
      Throws:
      FileNotFoundException
      IOException
    • setNodeArchiveService

      public void setNodeArchiveService(NodeArchiveService nodeArchiveService)
    • getNodeArchiveService

      public NodeArchiveService getNodeArchiveService()