Class CmsJlanNetworkFile


  • public class CmsJlanNetworkFile
    extends org.alfresco.jlan.server.filesys.NetworkFile
    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
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void closeFile()  
      void delete()
      Deletes the file.
      protected void ensureLock()
      Make sure that this resource is locked.
      void flushFile()  
      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 getFileInfo()
      Gets the file information record.
      protected java.lang.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 moveTo​(java.lang.String cmsNewPath)
      Moves this file to a different path.
      void openFile​(boolean arg0)  
      int readFile​(byte[] buffer, int length, int bufferOffset, long fileOffset)  
      java.util.List<CmsJlanNetworkFile> search​(java.lang.String name, int searchAttributes)
      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 updateFromResource()
      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
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • CmsJlanNetworkFile

        public CmsJlanNetworkFile​(CmsObjectWrapper cms,
                                  CmsResource resource,
                                  java.lang.String fullName)
        Creates a new network file instance.

        Parameters:
        cms - the CMS object wrapper to use
        resource - the actual CMS resource
        fullName - the raw repository path
    • Method Detail

      • closeFile

        public void closeFile()
                       throws java.io.IOException
        Specified by:
        closeFile in class org.alfresco.jlan.server.filesys.NetworkFile
        Throws:
        java.io.IOException
        See Also:
        NetworkFile.closeFile()
      • delete

        public void delete()
                    throws java.io.IOException
        Deletes the file.

        Throws:
        java.io.IOException - if something goes wrong
      • flushFile

        public void flushFile()
                       throws java.io.IOException
        Specified by:
        flushFile in class org.alfresco.jlan.server.filesys.NetworkFile
        Throws:
        java.io.IOException
        See Also:
        NetworkFile.flushFile()
      • getFileInfo

        public org.alfresco.jlan.server.filesys.FileInfo getFileInfo()
                                                              throws java.io.IOException
        Gets the file information record.

        Returns:
        the file information for this file
        Throws:
        java.io.IOException - if reading the file information fails
      • moveTo

        public void moveTo​(java.lang.String cmsNewPath)
                    throws CmsException
        Moves this file to a different path.

        Parameters:
        cmsNewPath - the new path
        Throws:
        CmsException - if something goes wrong
      • openFile

        public void openFile​(boolean arg0)
        Specified by:
        openFile in class org.alfresco.jlan.server.filesys.NetworkFile
        See Also:
        NetworkFile.openFile(boolean)
      • readFile

        public int readFile​(byte[] buffer,
                            int length,
                            int bufferOffset,
                            long fileOffset)
                     throws java.io.IOException
        Specified by:
        readFile in class org.alfresco.jlan.server.filesys.NetworkFile
        Throws:
        java.io.IOException
        See Also:
        NetworkFile.readFile(byte[], int, int, long)
      • search

        public java.util.List<CmsJlanNetworkFilesearch​(java.lang.String name,
                                                         int searchAttributes)
                                                  throws java.io.IOException
        Collects all files matching the given name pattern and search attributes.

        Parameters:
        name - the name pattern
        searchAttributes - the search attributes
        Returns:
        the list of file objects which match the given parameters
        Throws:
        java.io.IOException - if something goes wrong
      • seekFile

        public long seekFile​(long pos,
                             int typ)
                      throws java.io.IOException
        Specified by:
        seekFile in class org.alfresco.jlan.server.filesys.NetworkFile
        Throws:
        java.io.IOException
        See Also:
        NetworkFile.seekFile(long, int)
      • setFileInformation

        public void setFileInformation​(org.alfresco.jlan.server.filesys.FileInfo info)
        Sets the file information.

        Parameters:
        info - the file information to set
      • truncateFile

        public void truncateFile​(long size)
                          throws java.io.IOException
        Specified by:
        truncateFile in class org.alfresco.jlan.server.filesys.NetworkFile
        Throws:
        java.io.IOException
        See Also:
        NetworkFile.truncateFile(long)
      • writeFile

        public void writeFile​(byte[] data,
                              int len,
                              int pos,
                              long offset)
                       throws java.io.IOException
        Specified by:
        writeFile in class org.alfresco.jlan.server.filesys.NetworkFile
        Throws:
        java.io.IOException
        See Also:
        NetworkFile.writeFile(byte[], int, int, long)
      • getFile

        protected CmsFile getFile()
        Gets the CmsFile instance for this file, or null if the file contents haven'T been loaded already.

        Returns:
        the CmsFile instance
      • getFullChildPath

        protected java.lang.String getFullChildPath​(CmsResource child)
        Adds the name of a child resource to this file's path.

        Parameters:
        child - the child resource
        Returns:
        the path of the child
      • load

        protected void load​(boolean needContent)
                     throws java.io.IOException,
                            CmsException
        Loads the file data from the VFS.

        Parameters:
        needContent - true if we need the file content to be loaded
        Throws:
        java.io.IOException - if an IO error happens
        CmsException - if a CMS operation fails
      • matchesSearchAttributes

        protected boolean matchesSearchAttributes​(int attributes)
        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

        protected void updateFromResource()
        Copies state information from the internal CmsResource object to this object.