org.alfresco.filesys.avm
Class AVMDiskDriver

java.lang.Object
  extended by org.alfresco.filesys.alfresco.AlfrescoDiskDriver
      extended by org.alfresco.filesys.alfresco.AlfrescoTxDiskDriver
          extended by org.alfresco.filesys.avm.AVMDiskDriver
All Implemented Interfaces:
ExtendedDiskInterface, org.alfresco.jlan.server.core.DeviceInterface, org.alfresco.jlan.server.filesys.DiskInterface, org.alfresco.jlan.server.filesys.IOCtlInterface, org.alfresco.jlan.server.filesys.TransactionalFilesystemInterface

public class AVMDiskDriver
extends AlfrescoTxDiskDriver
implements org.alfresco.jlan.server.filesys.DiskInterface

AVM Repository Filesystem Driver Class

Provides a filesystem interface for various protocols such as SMB/CIFS and FTP.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.alfresco.filesys.alfresco.AlfrescoTxDiskDriver
AlfrescoTxDiskDriver.CallableIO, AlfrescoTxDiskDriver.PropagatingException
 
Field Summary
static char AVM_SEPERATOR
           
static java.lang.String AVM_SEPERATOR_STR
           
static int CustomFileStatus
           
static int DirectoryExists
           
static int FileExists
           
static int FileNotExist
           
static int FileUnknown
           
static java.lang.String RoleContentManager
           
static java.lang.String RoleNotWebAuthor
           
static java.lang.String RoleWebProject
           
 
Fields inherited from class org.alfresco.filesys.alfresco.AlfrescoDiskDriver
ioControlHandler, m_transactionService
 
Constructor Summary
AVMDiskDriver()
          Default constructor
 
Method Summary
protected  void addNewStore(AVMContext avmCtx, java.lang.String storeName)
          Add a new store to the top level folder list
protected  AVMPath buildStorePath(AVMContext ctx, java.lang.String path, org.alfresco.jlan.server.SrvSession sess)
          Build the full store path for a file/folder using the share relative path
 void closeFile(org.alfresco.jlan.server.SrvSession sess, org.alfresco.jlan.server.filesys.TreeConnection tree, org.alfresco.jlan.server.filesys.NetworkFile file)
          Close the file.
 org.alfresco.jlan.server.core.DeviceContext createContext(java.lang.String shareName, org.springframework.extensions.config.ConfigElement cfg)
          Parse and validate the parameter string and create a device context object for this instance of the shared device.
 void createDirectory(org.alfresco.jlan.server.SrvSession sess, org.alfresco.jlan.server.filesys.TreeConnection tree, org.alfresco.jlan.server.filesys.FileOpenParams params)
          Create a new directory on this file system.
 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)
          Create a new file on the file system.
 void deleteDirectory(org.alfresco.jlan.server.SrvSession sess, org.alfresco.jlan.server.filesys.TreeConnection tree, java.lang.String dir)
          Delete the directory from the filesystem.
 void deleteFile(org.alfresco.jlan.server.SrvSession sess, org.alfresco.jlan.server.filesys.TreeConnection tree, java.lang.String name)
          Delete the specified file.
 int fileExists(org.alfresco.jlan.server.SrvSession sess, org.alfresco.jlan.server.filesys.TreeConnection tree, java.lang.String name)
          Check if the specified file exists, and whether it is a file or directory.
protected  org.alfresco.jlan.server.filesys.cache.FileState findPseudoState(AVMPath avmPath, AVMContext avmCtx)
          Find the file state for a pseudo folder path
 void flushFile(org.alfresco.jlan.server.SrvSession sess, org.alfresco.jlan.server.filesys.TreeConnection tree, org.alfresco.jlan.server.filesys.NetworkFile file)
          Flush any buffered output for the specified file.
 AuthenticationService getAuthenticationService()
          Return the authentication service
 AVMService getAvmService()
          Return the AVM service
 org.alfresco.jlan.util.StringList getAVMStoreNames()
          Return a list of the available AVM store names
protected  java.util.Map getAVMStoreProperties(java.lang.String storeName)
          Get the properties for a store
 org.alfresco.jlan.server.filesys.FileInfo getFileInformation(org.alfresco.jlan.server.SrvSession sess, org.alfresco.jlan.server.filesys.TreeConnection tree, java.lang.String name)
          Get the file information for the specified file.
 boolean isReadOnly(org.alfresco.jlan.server.SrvSession sess, org.alfresco.jlan.server.core.DeviceContext ctx)
          Determine if the disk device is read-only.
 org.alfresco.jlan.server.filesys.NetworkFile openFile(org.alfresco.jlan.server.SrvSession sess, org.alfresco.jlan.server.filesys.TreeConnection tree, org.alfresco.jlan.server.filesys.FileOpenParams params)
          Open a file on the file system.
 int readFile(org.alfresco.jlan.server.SrvSession sess, org.alfresco.jlan.server.filesys.TreeConnection tree, org.alfresco.jlan.server.filesys.NetworkFile file, byte[] buf, int bufPos, int siz, long filePos)
          Read a block of data from the specified file.
 void registerContext(org.alfresco.jlan.server.core.DeviceContext ctx)
          Register a device context object for this instance of the shared device.
 void renameFile(org.alfresco.jlan.server.SrvSession sess, org.alfresco.jlan.server.filesys.TreeConnection tree, java.lang.String oldName, java.lang.String newName)
          Rename the specified file.
 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)
          Seek to the specified file position.
 void setAuthenticationComponent(AuthenticationComponent authComponent)
          Set the authentication component
 void setAuthenticationService(AuthenticationService authService)
          Set the authentication service
 void setAvmService(AVMService avmService)
          Set the AVM service
 void setCreateStoreListener(CreateStoreTxnListener createStoreListener)
          Set the create store listener
 void setCreateVersionListener(CreateVersionTxnListener createVersionListener)
          Set the create version listener
 void setFileInformation(org.alfresco.jlan.server.SrvSession sess, org.alfresco.jlan.server.filesys.TreeConnection tree, java.lang.String name, org.alfresco.jlan.server.filesys.FileInfo info)
          Set the file information for the specified file.
 void setMimetypeService(org.alfresco.service.cmr.repository.MimetypeService mimetypeService)
          Set the mimetype service
 void setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)
          Set the node service
 void setPurgeStoreListener(PurgeStoreTxnListener purgeStoreListener)
          Set the purge store listener
 void setPurgeVersionListener(PurgeVersionTxnListener purgeVersionListener)
          Set the purge version listener
 void setWebProjectStore(java.lang.String webStore)
          Set the web project store
 org.alfresco.jlan.server.filesys.SearchContext startSearch(org.alfresco.jlan.server.SrvSession sess, org.alfresco.jlan.server.filesys.TreeConnection tree, java.lang.String searchPath, int attrib)
          Start a new search on the filesystem using the specified searchPath that may contain wildcards.
 void treeClosed(org.alfresco.jlan.server.SrvSession sess, org.alfresco.jlan.server.filesys.TreeConnection tree)
          Connection opened to this disk device
 void treeOpened(org.alfresco.jlan.server.SrvSession sess, org.alfresco.jlan.server.filesys.TreeConnection tree)
          Connection closed to this device
 void truncateFile(org.alfresco.jlan.server.SrvSession sess, org.alfresco.jlan.server.filesys.TreeConnection tree, org.alfresco.jlan.server.filesys.NetworkFile file, long siz)
          Truncate a file to the specified size
 int writeFile(org.alfresco.jlan.server.SrvSession sess, org.alfresco.jlan.server.filesys.TreeConnection tree, org.alfresco.jlan.server.filesys.NetworkFile file, byte[] buf, int bufoff, int siz, long fileoff)
          Write a block of data to the file.
 
Methods inherited from class org.alfresco.filesys.alfresco.AlfrescoTxDiskDriver
beginReadTransaction, beginWriteTransaction, doInWriteTransaction, endTransaction
 
Methods inherited from class org.alfresco.filesys.alfresco.AlfrescoDiskDriver
getIoControlHandler, getServiceRegistry, getTransactionService, processIOControl, setIoControlHandler, setServiceRegistry, setTransactionService
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

AVM_SEPERATOR

public static final char AVM_SEPERATOR
See Also:
Constant Field Values

AVM_SEPERATOR_STR

public static final java.lang.String AVM_SEPERATOR_STR
See Also:
Constant Field Values

RoleContentManager

public static final java.lang.String RoleContentManager
See Also:
Constant Field Values

RoleWebProject

public static final java.lang.String RoleWebProject
See Also:
Constant Field Values

RoleNotWebAuthor

public static final java.lang.String RoleNotWebAuthor
See Also:
Constant Field Values

FileUnknown

public static final int FileUnknown
See Also:
Constant Field Values

FileNotExist

public static final int FileNotExist
See Also:
Constant Field Values

FileExists

public static final int FileExists
See Also:
Constant Field Values

DirectoryExists

public static final int DirectoryExists
See Also:
Constant Field Values

CustomFileStatus

public static final int CustomFileStatus
See Also:
Constant Field Values
Constructor Detail

AVMDiskDriver

public AVMDiskDriver()
Default constructor

Method Detail

getAvmService

public final AVMService getAvmService()
Return the AVM service

Returns:
AVMService

getAuthenticationService

public final AuthenticationService getAuthenticationService()
Return the authentication service

Returns:
AuthenticationService

setAvmService

public void setAvmService(AVMService avmService)
Set the AVM service

Parameters:
avmService - AVMService

setAuthenticationComponent

public void setAuthenticationComponent(AuthenticationComponent authComponent)
Set the authentication component

Parameters:
authComponent - AuthenticationComponent

setAuthenticationService

public void setAuthenticationService(AuthenticationService authService)
Set the authentication service

Parameters:
authService - AuthenticationService

setMimetypeService

public void setMimetypeService(org.alfresco.service.cmr.repository.MimetypeService mimetypeService)
Set the mimetype service

Parameters:
mimetypeService - MimetypeService

setNodeService

public void setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)
Set the node service

Parameters:
nodeService - NodeService

setCreateStoreListener

public void setCreateStoreListener(CreateStoreTxnListener createStoreListener)
Set the create store listener

Parameters:
createStoreListener - CreateStoreTxnListener

setPurgeStoreListener

public void setPurgeStoreListener(PurgeStoreTxnListener purgeStoreListener)
Set the purge store listener

Parameters:
purgeStoreListener - PurgeStoreTxnListener

setCreateVersionListener

public void setCreateVersionListener(CreateVersionTxnListener createVersionListener)
Set the create version listener

Parameters:
createVersionListener - CreateVersionTxnListener

setPurgeVersionListener

public void setPurgeVersionListener(PurgeVersionTxnListener purgeVersionListener)
Set the purge version listener

Parameters:
purgeVersionListener - PurgeVersionTxnListener

setWebProjectStore

public void setWebProjectStore(java.lang.String webStore)
Set the web project store

Parameters:
webStore - String

createContext

public org.alfresco.jlan.server.core.DeviceContext createContext(java.lang.String shareName,
                                                                 org.springframework.extensions.config.ConfigElement cfg)
                                                          throws org.alfresco.jlan.server.core.DeviceContextException
Parse and validate the parameter string and create a device context object for this instance of the shared device.

Specified by:
createContext in interface org.alfresco.jlan.server.core.DeviceInterface
Parameters:
shareName - String
cfg - ConfigElement
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
Register a device context object for this instance of the shared device.

Specified by:
registerContext in interface ExtendedDiskInterface
Overrides:
registerContext in class AlfrescoDiskDriver
Parameters:
context - the device context
serverConfig - ServerConfigurationBean
Throws:
org.alfresco.jlan.server.core.DeviceContextException

getAVMStoreNames

public final org.alfresco.jlan.util.StringList getAVMStoreNames()
Return a list of the available AVM store names

Returns:
StringList

getAVMStoreProperties

protected final java.util.Map getAVMStoreProperties(java.lang.String storeName)
Get the properties for a store

Parameters:
storeName - String
Returns:
Map

buildStorePath

protected final AVMPath buildStorePath(AVMContext ctx,
                                       java.lang.String path,
                                       org.alfresco.jlan.server.SrvSession sess)
                                throws org.alfresco.jlan.server.filesys.AccessDeniedException
Build the full store path for a file/folder using the share relative path

Parameters:
ctx - AVMContext
path - String
sess - SrvSession
Returns:
AVMPath
Throws:
org.alfresco.jlan.server.filesys.AccessDeniedException

closeFile

public void closeFile(org.alfresco.jlan.server.SrvSession sess,
                      org.alfresco.jlan.server.filesys.TreeConnection tree,
                      org.alfresco.jlan.server.filesys.NetworkFile file)
               throws java.io.IOException
Close the file.

Specified by:
closeFile in interface org.alfresco.jlan.server.filesys.DiskInterface
Parameters:
sess - Server session
tree - Tree connection.
file - Network file context.
Throws:
java.io.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 java.io.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:
java.io.IOException - If an error occurs.

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 java.io.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:
java.io.IOException - If an error occurs.

deleteDirectory

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

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

deleteFile

public void deleteFile(org.alfresco.jlan.server.SrvSession sess,
                       org.alfresco.jlan.server.filesys.TreeConnection tree,
                       java.lang.String name)
                throws java.io.IOException
Delete the specified file.

Specified by:
deleteFile in interface org.alfresco.jlan.server.filesys.DiskInterface
Parameters:
sess - Server session
tree - Tree connection
file - NetworkFile
Throws:
java.io.IOException - The exception description.

fileExists

public int fileExists(org.alfresco.jlan.server.SrvSession sess,
                      org.alfresco.jlan.server.filesys.TreeConnection tree,
                      java.lang.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:
sess - Server session
tree - Tree connection
name - java.lang.String
Returns:
int
See Also:
FileStatus

flushFile

public void flushFile(org.alfresco.jlan.server.SrvSession sess,
                      org.alfresco.jlan.server.filesys.TreeConnection tree,
                      org.alfresco.jlan.server.filesys.NetworkFile file)
               throws java.io.IOException
Flush any buffered output for the specified file.

Specified by:
flushFile in interface org.alfresco.jlan.server.filesys.DiskInterface
Parameters:
sess - Server session
tree - Tree connection
file - Network file context.
Throws:
java.io.IOException - The exception description.

getFileInformation

public org.alfresco.jlan.server.filesys.FileInfo getFileInformation(org.alfresco.jlan.server.SrvSession sess,
                                                                    org.alfresco.jlan.server.filesys.TreeConnection tree,
                                                                    java.lang.String name)
                                                             throws java.io.IOException
Get the file information for the specified file.

Specified by:
getFileInformation in interface org.alfresco.jlan.server.filesys.DiskInterface
Parameters:
sess - Server session
tree - Tree connection
name - File name/path that information is required for.
Returns:
File information if valid, else null
Throws:
java.io.IOException - The exception description.

isReadOnly

public boolean isReadOnly(org.alfresco.jlan.server.SrvSession sess,
                          org.alfresco.jlan.server.core.DeviceContext ctx)
                   throws java.io.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:
java.io.IOException - If an error occurs.

openFile

public org.alfresco.jlan.server.filesys.NetworkFile openFile(org.alfresco.jlan.server.SrvSession sess,
                                                             org.alfresco.jlan.server.filesys.TreeConnection tree,
                                                             org.alfresco.jlan.server.filesys.FileOpenParams params)
                                                      throws java.io.IOException
Open a file on the file system.

Specified by:
openFile in interface org.alfresco.jlan.server.filesys.DiskInterface
Parameters:
sess - Server session
tree - Tree connection
params - File open parameters
Returns:
NetworkFile
Throws:
java.io.IOException - If an error occurs.

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[] buf,
                    int bufPos,
                    int siz,
                    long filePos)
             throws java.io.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
buf - Buffer to return data to
bufPos - Starting position in the return buffer
siz - Maximum size of data to return
filePos - File offset to read data
Returns:
Number of bytes read
Throws:
java.io.IOException - The exception description.

renameFile

public void renameFile(org.alfresco.jlan.server.SrvSession sess,
                       org.alfresco.jlan.server.filesys.TreeConnection tree,
                       java.lang.String oldName,
                       java.lang.String newName)
                throws java.io.IOException
Rename the specified file.

Specified by:
renameFile in interface org.alfresco.jlan.server.filesys.DiskInterface
Parameters:
sess - Server session
tree - Tree connection
oldName - java.lang.String
newName - java.lang.String
Throws:
java.io.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 java.io.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:
java.io.IOException

setFileInformation

public void setFileInformation(org.alfresco.jlan.server.SrvSession sess,
                               org.alfresco.jlan.server.filesys.TreeConnection tree,
                               java.lang.String name,
                               org.alfresco.jlan.server.filesys.FileInfo info)
                        throws java.io.IOException
Set the file information for the specified file.

Specified by:
setFileInformation in interface org.alfresco.jlan.server.filesys.DiskInterface
Parameters:
sess - Server session
tree - Tree connection
name - java.lang.String
info - FileInfo
Throws:
java.io.IOException - The exception description.

startSearch

public org.alfresco.jlan.server.filesys.SearchContext startSearch(org.alfresco.jlan.server.SrvSession sess,
                                                                  org.alfresco.jlan.server.filesys.TreeConnection tree,
                                                                  java.lang.String searchPath,
                                                                  int attrib)
                                                           throws java.io.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:
sess - Server session
tree - Tree connection
searchPath - File(s) to search for, may include wildcards.
attrib - Attributes of the file(s) to search for, see class SMBFileAttribute.
Returns:
SearchContext
Throws:
java.io.FileNotFoundException - If the search could not be started.

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 siz)
                  throws java.io.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
siz - New file length
Throws:
java.io.IOException - The exception description.

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[] buf,
                     int bufoff,
                     int siz,
                     long fileoff)
              throws java.io.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
buf - byte[] Data to be written
bufoff - Offset within the buffer that the data starts
siz - int Data length
fileoff - Position within the file that the data is to be written.
Returns:
Number of bytes actually written
Throws:
java.io.IOException - The exception description.

treeClosed

public void treeClosed(org.alfresco.jlan.server.SrvSession sess,
                       org.alfresco.jlan.server.filesys.TreeConnection tree)
Connection opened to this disk device

Specified by:
treeClosed in interface org.alfresco.jlan.server.core.DeviceInterface
Parameters:
sess - Server session
tree - Tree connection

treeOpened

public void treeOpened(org.alfresco.jlan.server.SrvSession sess,
                       org.alfresco.jlan.server.filesys.TreeConnection tree)
Connection closed to this device

Specified by:
treeOpened in interface org.alfresco.jlan.server.core.DeviceInterface
Parameters:
sess - Server session
tree - Tree connection

findPseudoState

protected final org.alfresco.jlan.server.filesys.cache.FileState findPseudoState(AVMPath avmPath,
                                                                                 AVMContext avmCtx)
Find the file state for a pseudo folder path

Parameters:
avmPath - AVMPath
avmCtx - AVMContext
Returns:
FileState

addNewStore

protected void addNewStore(AVMContext avmCtx,
                           java.lang.String storeName)
Add a new store to the top level folder list

Parameters:
avmCtx - AVMContext
storeName - String


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.