Class CmsJlanNetworkFile

java.lang.Object
org.alfresco.jlan.server.filesys.NetworkFile
org.opencms.jlan.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
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new network file instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    void
    Deletes the file.
    protected void
    Make sure that this resource is locked.
    void
     
    protected CmsFile
    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
    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(String cmsNewPath)
    Moves this file to a different path.
    void
    openFile(boolean arg0)
     
    int
    readFile(byte[] buffer, int length, int bufferOffset, long fileOffset)
     
    search(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
    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 Details

    • CmsJlanNetworkFile

      public CmsJlanNetworkFile(CmsObjectWrapper cms, CmsResource resource, 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 Details

    • closeFile

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

      public void delete() throws IOException
      Deletes the file.

      Throws:
      IOException - if something goes wrong
    • flushFile

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

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

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

      public void moveTo(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 IOException
      Specified by:
      readFile in class org.alfresco.jlan.server.filesys.NetworkFile
      Throws:
      IOException
      See Also:
      • NetworkFile.readFile(byte[], int, int, long)
    • search

      public List<CmsJlanNetworkFile> search(String name, int searchAttributes) throws 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:
      IOException - if something goes wrong
    • seekFile

      public long seekFile(long pos, int typ) throws IOException
      Specified by:
      seekFile in class org.alfresco.jlan.server.filesys.NetworkFile
      Throws:
      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 IOException
      Specified by:
      truncateFile in class org.alfresco.jlan.server.filesys.NetworkFile
      Throws:
      IOException
      See Also:
      • NetworkFile.truncateFile(long)
    • writeFile

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

      protected void ensureLock() throws CmsException
      Make sure that this resource is locked.

      Throws:
      CmsException - if something goes wrong
    • 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 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 IOException, CmsException
      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 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.