Package org.opencms.jlan
Class CmsJlanNetworkFile
java.lang.Object
org.alfresco.jlan.server.filesys.NetworkFile
org.opencms.jlan.CmsJlanNetworkFile
This class represents a file for use by the JLAN server component. It currently just
wraps an OpenCms resource.
-
Field Summary
Fields inherited from class org.alfresco.jlan.server.filesys.NetworkFile
ATTRIBUTESONLY, Created, DelayedClose, DelayedWriteError, DeleteOnClose, IOPending, m_accessDate, m_allowedAccess, m_attrib, m_closed, m_createDate, m_dirId, m_fid, m_fileSize, m_fullName, m_grantedAccess, m_modifyDate, m_name, m_streamId, m_streamName, m_uniqueId, m_writeCount, READONLY, READWRITE, WRITEONLY
-
Constructor Summary
ConstructorDescriptionCmsJlanNetworkFile
(CmsObjectWrapper cms, CmsResource resource, String fullName) Creates a new network file instance. -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
delete()
Deletes the file.protected void
Make sure that this resource is locked.void
protected CmsFile
getFile()
Gets the CmsFile instance for this file, or null if the file contents haven'T been loaded already.org.alfresco.jlan.server.filesys.FileInfo
Gets the file information record.protected String
getFullChildPath
(CmsResource child) Adds the name of a child resource to this file's path.protected void
load
(boolean needContent) Loads the file data from the VFS.protected boolean
matchesSearchAttributes
(int attributes) Checks if this file matches the given search attributes.void
Moves this file to a different path.void
openFile
(boolean arg0) int
readFile
(byte[] buffer, int length, int bufferOffset, long fileOffset) Collects all files matching the given name pattern and search attributes.long
seekFile
(long pos, int typ) void
setFileInformation
(org.alfresco.jlan.server.filesys.FileInfo info) Sets the file information.void
truncateFile
(long size) protected void
Copies state information from the internal CmsResource object to this object.void
writeFile
(byte[] data, int len, int pos, long offset) Methods inherited from class org.alfresco.jlan.server.filesys.NetworkFile
addLock, allowsOpenCloseViaNetworkFile, close, getAccessDate, getAccessToken, getAllowedAccess, getCreationDate, getDirectoryId, getFileAttributes, getFileId, getFileSize, getFileSizeInt, getFullName, getFullNameStream, getGrantedAccess, getGrantedAccessAsString, getLockAt, getLockList, getModifyDate, getName, getOpLock, getProtocolId, getStreamId, getStreamName, getUniqueId, getWriteCount, hasAccessDate, hasAccessToken, hasCreationDate, hasDelayedClose, hasDelayedWriteError, hasDeleteOnClose, hasIOPending, hasLocks, hasModifyDate, hasNTAttribute, hasOpLock, incrementWriteCount, isArchived, isClosed, isDirectory, isForce, isHidden, isReadOnly, isStream, isSystem, numberOfLocks, removeAllLocks, removeLock, setAccessDate, setAccessToken, setAllowedAccess, setAttributes, setClosed, setCreationDate, setDelayedClose, setDelayedWriteError, setDeleteOnClose, setDirectoryId, setFileId, setFileSize, setFileSize, setForce, setFullName, setGrantedAccess, setIOPending, setModifyDate, setName, setOpLock, setProtocolId, setStatusFlag, setStreamId, setStreamName, setUniqueId, setUniqueId, setUniqueId, toString, wasCreated
-
Constructor Details
-
CmsJlanNetworkFile
Creates a new network file instance.- Parameters:
cms
- the CMS object wrapper to useresource
- the actual CMS resourcefullName
- the raw repository path
-
-
Method Details
-
closeFile
- Specified by:
closeFile
in classorg.alfresco.jlan.server.filesys.NetworkFile
- Throws:
IOException
- See Also:
-
NetworkFile.closeFile()
-
delete
Deletes the file.- Throws:
IOException
- if something goes wrong
-
flushFile
- Specified by:
flushFile
in classorg.alfresco.jlan.server.filesys.NetworkFile
- Throws:
IOException
- See Also:
-
NetworkFile.flushFile()
-
getFileInfo
Gets the file information record.- Returns:
- the file information for this file
- Throws:
IOException
- if reading the file information fails
-
moveTo
Moves this file to a different path.- Parameters:
cmsNewPath
- the new path- Throws:
CmsException
- if something goes wrong
-
openFile
- Specified by:
openFile
in classorg.alfresco.jlan.server.filesys.NetworkFile
- See Also:
-
NetworkFile.openFile(boolean)
-
readFile
public int readFile(byte[] buffer, int length, int bufferOffset, long fileOffset) throws IOException - Specified by:
readFile
in classorg.alfresco.jlan.server.filesys.NetworkFile
- Throws:
IOException
- See Also:
-
NetworkFile.readFile(byte[], int, int, long)
-
search
Collects all files matching the given name pattern and search attributes.- Parameters:
name
- the name patternsearchAttributes
- the search attributes- Returns:
- the list of file objects which match the given parameters
- Throws:
IOException
- if something goes wrong
-
seekFile
- Specified by:
seekFile
in classorg.alfresco.jlan.server.filesys.NetworkFile
- Throws:
IOException
- See Also:
-
NetworkFile.seekFile(long, int)
-
setFileInformation
Sets the file information.- Parameters:
info
- the file information to set
-
truncateFile
- Specified by:
truncateFile
in classorg.alfresco.jlan.server.filesys.NetworkFile
- Throws:
IOException
- See Also:
-
NetworkFile.truncateFile(long)
-
writeFile
- Specified by:
writeFile
in classorg.alfresco.jlan.server.filesys.NetworkFile
- Throws:
IOException
- See Also:
-
NetworkFile.writeFile(byte[], int, int, long)
-
ensureLock
Make sure that this resource is locked.- Throws:
CmsException
- if something goes wrong
-
getFile
Gets the CmsFile instance for this file, or null if the file contents haven'T been loaded already.- Returns:
- the CmsFile instance
-
getFullChildPath
Adds the name of a child resource to this file's path.- Parameters:
child
- the child resource- Returns:
- the path of the child
-
load
Loads the file data from the VFS.- Parameters:
needContent
- true if we need the file content to be loaded- Throws:
IOException
- if an IO error happensCmsException
- if a CMS operation fails
-
matchesSearchAttributes
Checks if this file matches the given search attributes.- Parameters:
attributes
- the search attributes- Returns:
- true if this file matches the search attributes given
-
updateFromResource
Copies state information from the internal CmsResource object to this object.
-