Package org.opencms.jlan
Class CmsJlanDiskInterface
java.lang.Object
org.opencms.jlan.CmsJlanDiskInterface
- All Implemented Interfaces:
org.alfresco.jlan.server.core.DeviceInterface
,org.alfresco.jlan.server.filesys.DiskInterface
public class CmsJlanDiskInterface
extends Object
implements org.alfresco.jlan.server.filesys.DiskInterface
OpenCms implementation of the JLAN DiskInterface interface.
This class, together with the CmsJlanNetworkFile class, contains the main repository access functionality.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Attribute to control whether we need the filesize or not when reading a resource.static final CmsResourceFilter
The standard resource filter used for reading resources. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
closeFile
(org.alfresco.jlan.server.SrvSession session, org.alfresco.jlan.server.filesys.TreeConnection connection, org.alfresco.jlan.server.filesys.NetworkFile file) static IOException
Tries to convert a CmsException to the matching exception type from JLAN.org.alfresco.jlan.server.core.DeviceContext
createContext
(String shareName, org.springframework.extensions.config.ConfigElement args) void
createDirectory
(org.alfresco.jlan.server.SrvSession session, org.alfresco.jlan.server.filesys.TreeConnection connection, org.alfresco.jlan.server.filesys.FileOpenParams params) org.alfresco.jlan.server.filesys.NetworkFile
createFile
(org.alfresco.jlan.server.SrvSession session, org.alfresco.jlan.server.filesys.TreeConnection connection, org.alfresco.jlan.server.filesys.FileOpenParams params) void
deleteDirectory
(org.alfresco.jlan.server.SrvSession session, org.alfresco.jlan.server.filesys.TreeConnection connection, String path) void
deleteFile
(org.alfresco.jlan.server.SrvSession session, org.alfresco.jlan.server.filesys.TreeConnection connection, String path) int
fileExists
(org.alfresco.jlan.server.SrvSession session, org.alfresco.jlan.server.filesys.TreeConnection connection, String path) void
flushFile
(org.alfresco.jlan.server.SrvSession session, org.alfresco.jlan.server.filesys.TreeConnection connection, org.alfresco.jlan.server.filesys.NetworkFile file) protected CmsObjectWrapper
getCms
(org.alfresco.jlan.server.SrvSession session, org.alfresco.jlan.server.filesys.TreeConnection connection) Creates a CmsObjectWrapper for the current session.protected static String
getCmsPath
(String path) Converts a CIFS path to an OpenCms path by converting backslashes to slashes and translating special characters in the file name.protected CmsJlanNetworkFile
getFileForPath
(org.alfresco.jlan.server.SrvSession session, org.alfresco.jlan.server.filesys.TreeConnection connection, String path) Helper method to get a network file object given a path.protected CmsJlanNetworkFile
getFileForPath
(CmsObjectWrapper cms, org.alfresco.jlan.server.SrvSession session, org.alfresco.jlan.server.filesys.TreeConnection connection, String path) Helper method to get a network file object given a path.org.alfresco.jlan.server.filesys.FileInfo
getFileInformation
(org.alfresco.jlan.server.SrvSession session, org.alfresco.jlan.server.filesys.TreeConnection connection, String path) protected org.alfresco.jlan.server.filesys.NetworkFile
internalCreateFile
(org.alfresco.jlan.server.SrvSession session, org.alfresco.jlan.server.filesys.TreeConnection connection, org.alfresco.jlan.server.filesys.FileOpenParams params, String typeName) Internal method for creating a new file.boolean
isReadOnly
(org.alfresco.jlan.server.SrvSession session, org.alfresco.jlan.server.core.DeviceContext context) org.alfresco.jlan.server.filesys.NetworkFile
openFile
(org.alfresco.jlan.server.SrvSession session, org.alfresco.jlan.server.filesys.TreeConnection connection, org.alfresco.jlan.server.filesys.FileOpenParams params) 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) void
renameFile
(org.alfresco.jlan.server.SrvSession session, org.alfresco.jlan.server.filesys.TreeConnection connection, String oldName, String newName) long
seekFile
(org.alfresco.jlan.server.SrvSession session, org.alfresco.jlan.server.filesys.TreeConnection connection, org.alfresco.jlan.server.filesys.NetworkFile file, long pos, int seekMode) void
setFileInformation
(org.alfresco.jlan.server.SrvSession session, org.alfresco.jlan.server.filesys.TreeConnection connection, String path, org.alfresco.jlan.server.filesys.FileInfo info) org.alfresco.jlan.server.filesys.SearchContext
startSearch
(org.alfresco.jlan.server.SrvSession session, org.alfresco.jlan.server.filesys.TreeConnection connection, String searchPath, int searchAttributes) protected String
translateName
(String path) Translates the last path segment of a path using the configured OpenCms file translations.void
treeClosed
(org.alfresco.jlan.server.SrvSession sess, org.alfresco.jlan.server.filesys.TreeConnection tree) void
treeOpened
(org.alfresco.jlan.server.SrvSession arg0, org.alfresco.jlan.server.filesys.TreeConnection arg1) void
truncateFile
(org.alfresco.jlan.server.SrvSession session, org.alfresco.jlan.server.filesys.TreeConnection connection, org.alfresco.jlan.server.filesys.NetworkFile file, long size) int
writeFile
(org.alfresco.jlan.server.SrvSession session, org.alfresco.jlan.server.filesys.TreeConnection connection, org.alfresco.jlan.server.filesys.NetworkFile file, byte[] data, int bufferOffset, int length, long fileOffset)
-
Field Details
-
NO_FILESIZE_REQUIRED
Attribute to control whether we need the filesize or not when reading a resource.- See Also:
-
STANDARD_FILTER
The standard resource filter used for reading resources.
-
-
Constructor Details
-
CmsJlanDiskInterface
public CmsJlanDiskInterface()
-
-
Method Details
-
convertCmsException
Tries to convert a CmsException to the matching exception type from JLAN.- Parameters:
e
- the exception to convert- Returns:
- the converted exception
-
getCmsPath
Converts a CIFS path to an OpenCms path by converting backslashes to slashes and translating special characters in the file name.- Parameters:
path
- the path to transform- Returns:
- the OpenCms path for the given path
-
closeFile
public void closeFile(org.alfresco.jlan.server.SrvSession session, org.alfresco.jlan.server.filesys.TreeConnection connection, org.alfresco.jlan.server.filesys.NetworkFile file) throws IOException - Specified by:
closeFile
in interfaceorg.alfresco.jlan.server.filesys.DiskInterface
- Throws:
IOException
- See Also:
-
DiskInterface.closeFile(org.alfresco.jlan.server.SrvSession, org.alfresco.jlan.server.filesys.TreeConnection, org.alfresco.jlan.server.filesys.NetworkFile)
-
createContext
public org.alfresco.jlan.server.core.DeviceContext createContext(String shareName, org.springframework.extensions.config.ConfigElement args) - Specified by:
createContext
in interfaceorg.alfresco.jlan.server.core.DeviceInterface
- See Also:
-
DeviceInterface.createContext(java.lang.String, org.springframework.extensions.config.ConfigElement)
-
createDirectory
public void createDirectory(org.alfresco.jlan.server.SrvSession session, org.alfresco.jlan.server.filesys.TreeConnection connection, org.alfresco.jlan.server.filesys.FileOpenParams params) throws IOException - Specified by:
createDirectory
in interfaceorg.alfresco.jlan.server.filesys.DiskInterface
- Throws:
IOException
- See Also:
-
DiskInterface.createDirectory(org.alfresco.jlan.server.SrvSession, org.alfresco.jlan.server.filesys.TreeConnection, org.alfresco.jlan.server.filesys.FileOpenParams)
-
createFile
public org.alfresco.jlan.server.filesys.NetworkFile createFile(org.alfresco.jlan.server.SrvSession session, org.alfresco.jlan.server.filesys.TreeConnection connection, org.alfresco.jlan.server.filesys.FileOpenParams params) throws IOException - Specified by:
createFile
in interfaceorg.alfresco.jlan.server.filesys.DiskInterface
- Throws:
IOException
- See Also:
-
DiskInterface.createFile(org.alfresco.jlan.server.SrvSession, org.alfresco.jlan.server.filesys.TreeConnection, org.alfresco.jlan.server.filesys.FileOpenParams)
-
deleteDirectory
public void deleteDirectory(org.alfresco.jlan.server.SrvSession session, org.alfresco.jlan.server.filesys.TreeConnection connection, String path) throws IOException - Specified by:
deleteDirectory
in interfaceorg.alfresco.jlan.server.filesys.DiskInterface
- Throws:
IOException
- See Also:
-
DiskInterface.deleteDirectory(org.alfresco.jlan.server.SrvSession, org.alfresco.jlan.server.filesys.TreeConnection, java.lang.String)
-
deleteFile
public void deleteFile(org.alfresco.jlan.server.SrvSession session, org.alfresco.jlan.server.filesys.TreeConnection connection, String path) throws IOException - Specified by:
deleteFile
in interfaceorg.alfresco.jlan.server.filesys.DiskInterface
- Throws:
IOException
- See Also:
-
DiskInterface.deleteFile(org.alfresco.jlan.server.SrvSession, org.alfresco.jlan.server.filesys.TreeConnection, java.lang.String)
-
fileExists
public int fileExists(org.alfresco.jlan.server.SrvSession session, org.alfresco.jlan.server.filesys.TreeConnection connection, String path) - Specified by:
fileExists
in interfaceorg.alfresco.jlan.server.filesys.DiskInterface
- See Also:
-
DiskInterface.fileExists(org.alfresco.jlan.server.SrvSession, org.alfresco.jlan.server.filesys.TreeConnection, java.lang.String)
-
flushFile
public void flushFile(org.alfresco.jlan.server.SrvSession session, org.alfresco.jlan.server.filesys.TreeConnection connection, org.alfresco.jlan.server.filesys.NetworkFile file) throws IOException - Specified by:
flushFile
in interfaceorg.alfresco.jlan.server.filesys.DiskInterface
- Throws:
IOException
- See Also:
-
DiskInterface.flushFile(org.alfresco.jlan.server.SrvSession, org.alfresco.jlan.server.filesys.TreeConnection, org.alfresco.jlan.server.filesys.NetworkFile)
-
getFileInformation
public org.alfresco.jlan.server.filesys.FileInfo getFileInformation(org.alfresco.jlan.server.SrvSession session, org.alfresco.jlan.server.filesys.TreeConnection connection, String path) throws IOException - Specified by:
getFileInformation
in interfaceorg.alfresco.jlan.server.filesys.DiskInterface
- Throws:
IOException
- See Also:
-
DiskInterface.getFileInformation(org.alfresco.jlan.server.SrvSession, org.alfresco.jlan.server.filesys.TreeConnection, java.lang.String)
-
isReadOnly
public boolean isReadOnly(org.alfresco.jlan.server.SrvSession session, org.alfresco.jlan.server.core.DeviceContext context) - Specified by:
isReadOnly
in interfaceorg.alfresco.jlan.server.filesys.DiskInterface
- See Also:
-
DiskInterface.isReadOnly(org.alfresco.jlan.server.SrvSession, org.alfresco.jlan.server.core.DeviceContext)
-
openFile
public org.alfresco.jlan.server.filesys.NetworkFile openFile(org.alfresco.jlan.server.SrvSession session, org.alfresco.jlan.server.filesys.TreeConnection connection, org.alfresco.jlan.server.filesys.FileOpenParams params) throws IOException - Specified by:
openFile
in interfaceorg.alfresco.jlan.server.filesys.DiskInterface
- Throws:
IOException
- See Also:
-
DiskInterface.openFile(org.alfresco.jlan.server.SrvSession, org.alfresco.jlan.server.filesys.TreeConnection, org.alfresco.jlan.server.filesys.FileOpenParams)
-
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 IOException - Specified by:
readFile
in interfaceorg.alfresco.jlan.server.filesys.DiskInterface
- Throws:
IOException
- See Also:
-
DiskInterface.readFile(org.alfresco.jlan.server.SrvSession, org.alfresco.jlan.server.filesys.TreeConnection, org.alfresco.jlan.server.filesys.NetworkFile, byte[], int, int, long)
-
renameFile
public void renameFile(org.alfresco.jlan.server.SrvSession session, org.alfresco.jlan.server.filesys.TreeConnection connection, String oldName, String newName) throws IOException - Specified by:
renameFile
in interfaceorg.alfresco.jlan.server.filesys.DiskInterface
- Throws:
IOException
- See Also:
-
DiskInterface.renameFile(org.alfresco.jlan.server.SrvSession, org.alfresco.jlan.server.filesys.TreeConnection, java.lang.String, java.lang.String)
-
seekFile
public long seekFile(org.alfresco.jlan.server.SrvSession session, org.alfresco.jlan.server.filesys.TreeConnection connection, org.alfresco.jlan.server.filesys.NetworkFile file, long pos, int seekMode) throws IOException - Specified by:
seekFile
in interfaceorg.alfresco.jlan.server.filesys.DiskInterface
- Throws:
IOException
- See Also:
-
DiskInterface.seekFile(org.alfresco.jlan.server.SrvSession, org.alfresco.jlan.server.filesys.TreeConnection, org.alfresco.jlan.server.filesys.NetworkFile, long, int)
-
setFileInformation
public void setFileInformation(org.alfresco.jlan.server.SrvSession session, org.alfresco.jlan.server.filesys.TreeConnection connection, String path, org.alfresco.jlan.server.filesys.FileInfo info) throws IOException - Specified by:
setFileInformation
in interfaceorg.alfresco.jlan.server.filesys.DiskInterface
- Throws:
IOException
- See Also:
-
DiskInterface.setFileInformation(org.alfresco.jlan.server.SrvSession, org.alfresco.jlan.server.filesys.TreeConnection, java.lang.String, org.alfresco.jlan.server.filesys.FileInfo)
-
startSearch
public org.alfresco.jlan.server.filesys.SearchContext startSearch(org.alfresco.jlan.server.SrvSession session, org.alfresco.jlan.server.filesys.TreeConnection connection, String searchPath, int searchAttributes) - Specified by:
startSearch
in interfaceorg.alfresco.jlan.server.filesys.DiskInterface
- See Also:
-
DiskInterface.startSearch(org.alfresco.jlan.server.SrvSession, org.alfresco.jlan.server.filesys.TreeConnection, java.lang.String, int)
-
treeClosed
public void treeClosed(org.alfresco.jlan.server.SrvSession sess, org.alfresco.jlan.server.filesys.TreeConnection tree) - Specified by:
treeClosed
in interfaceorg.alfresco.jlan.server.core.DeviceInterface
- See Also:
-
DeviceInterface.treeClosed(org.alfresco.jlan.server.SrvSession, org.alfresco.jlan.server.filesys.TreeConnection)
-
treeOpened
public void treeOpened(org.alfresco.jlan.server.SrvSession arg0, org.alfresco.jlan.server.filesys.TreeConnection arg1) - Specified by:
treeOpened
in interfaceorg.alfresco.jlan.server.core.DeviceInterface
- See Also:
-
DeviceInterface.treeOpened(org.alfresco.jlan.server.SrvSession, org.alfresco.jlan.server.filesys.TreeConnection)
-
truncateFile
public void truncateFile(org.alfresco.jlan.server.SrvSession session, org.alfresco.jlan.server.filesys.TreeConnection connection, org.alfresco.jlan.server.filesys.NetworkFile file, long size) throws IOException - Specified by:
truncateFile
in interfaceorg.alfresco.jlan.server.filesys.DiskInterface
- Throws:
IOException
- See Also:
-
DiskInterface.truncateFile(org.alfresco.jlan.server.SrvSession, org.alfresco.jlan.server.filesys.TreeConnection, org.alfresco.jlan.server.filesys.NetworkFile, long)
-
writeFile
public int writeFile(org.alfresco.jlan.server.SrvSession session, org.alfresco.jlan.server.filesys.TreeConnection connection, org.alfresco.jlan.server.filesys.NetworkFile file, byte[] data, int bufferOffset, int length, long fileOffset) throws IOException - Specified by:
writeFile
in interfaceorg.alfresco.jlan.server.filesys.DiskInterface
- Throws:
IOException
- See Also:
-
DiskInterface.writeFile(org.alfresco.jlan.server.SrvSession, org.alfresco.jlan.server.filesys.TreeConnection, org.alfresco.jlan.server.filesys.NetworkFile, byte[], int, int, long)
-
getCms
protected CmsObjectWrapper getCms(org.alfresco.jlan.server.SrvSession session, org.alfresco.jlan.server.filesys.TreeConnection connection) throws CmsException Creates a CmsObjectWrapper for the current session.- Parameters:
session
- the current sessionconnection
- the tree connection- Returns:
- the correctly configured CmsObjectWrapper for this session
- Throws:
CmsException
- if something goes wrong
-
getFileForPath
protected CmsJlanNetworkFile getFileForPath(CmsObjectWrapper cms, org.alfresco.jlan.server.SrvSession session, org.alfresco.jlan.server.filesys.TreeConnection connection, String path) throws CmsException Helper method to get a network file object given a path.- Parameters:
cms
- the CMS context wrappersession
- the current sessionconnection
- the current connectionpath
- the file path- Returns:
- the network file object for the given path
- Throws:
CmsException
- if something goes wrong
-
getFileForPath
protected CmsJlanNetworkFile getFileForPath(org.alfresco.jlan.server.SrvSession session, org.alfresco.jlan.server.filesys.TreeConnection connection, String path) throws CmsException Helper method to get a network file object given a path.- Parameters:
session
- the current sessionconnection
- the current connectionpath
- the file path- Returns:
- the network file object for the given path
- Throws:
CmsException
- if something goes wrong
-
internalCreateFile
protected org.alfresco.jlan.server.filesys.NetworkFile internalCreateFile(org.alfresco.jlan.server.SrvSession session, org.alfresco.jlan.server.filesys.TreeConnection connection, org.alfresco.jlan.server.filesys.FileOpenParams params, String typeName) throws IOException Internal method for creating a new file.- Parameters:
session
- the sessionconnection
- the tree connectionparams
- the parameters for opening the filetypeName
- the name of the resource type for the new file- Returns:
- a NetworkFile instance representing the newly created file
- Throws:
IOException
- if something goes wrong
-
translateName
Translates the last path segment of a path using the configured OpenCms file translations.- Parameters:
path
- the path for which the last segment should be translated- Returns:
- the path with the translated last segment
-