org.alfresco.filesys.repo
Class ContentNetworkFile

java.lang.Object
  extended by org.alfresco.jlan.server.filesys.NetworkFile
      extended by org.alfresco.filesys.alfresco.AlfrescoNetworkFile
          extended by org.alfresco.filesys.repo.NodeRefNetworkFile
              extended by org.alfresco.filesys.repo.ContentNetworkFile
Direct Known Subclasses:
MSOfficeContentNetworkFile

public class ContentNetworkFile
extends NodeRefNetworkFile

Implementation of the NetworkFile for direct interaction with the channel repository.

This provides the interaction with the Alfresco Content Model file/folder structure.


Field Summary
 
Fields inherited from class org.alfresco.filesys.repo.NodeRefNetworkFile
m_nodeRef
 
Fields inherited from class org.alfresco.jlan.server.filesys.NetworkFile
Created, DelayedWriteError, DeleteOnClose, IOPending, m_accessDate, 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
protected ContentNetworkFile(NodeService nodeService, ContentService contentService, MimetypeService mimetypeService, NodeRef nodeRef, java.lang.String name)
          Class constructor
 
Method Summary
 void closeFile()
          Close the file
static ContentNetworkFile createFile(NodeService nodeService, ContentService contentService, MimetypeService mimetypeService, CifsHelper cifsHelper, NodeRef nodeRef, org.alfresco.jlan.server.filesys.FileOpenParams params)
          Helper method to create a network file given a node reference.
 void flushFile()
          Flush and buffered data for this file
 boolean hasContent()
          Determine if the file content data has been opened
 void openFile(boolean createFlag)
          Open the file
 int readFile(byte[] buffer, int length, int position, long fileOffset)
          Read from the file.
 long seekFile(long pos, int typ)
          Seek to a new position in the file
 java.lang.String toString()
          Return the file details as a string
 void truncateFile(long size)
          Truncate or extend the file to the specified length
 void writeFile(byte[] buffer, int length, int position, long fileOffset)
          Write a block of data to the file.
 
Methods inherited from class org.alfresco.filesys.repo.NodeRefNetworkFile
getNodeRef, setNodeRef
 
Methods inherited from class org.alfresco.filesys.alfresco.AlfrescoNetworkFile
getFileState, setFileState
 
Methods inherited from class org.alfresco.jlan.server.filesys.NetworkFile
addLock, close, getAccessDate, getCreationDate, getDirectoryId, getFileAttributes, getFileId, getFileSize, getFileSizeInt, getFullName, getFullNameStream, getGrantedAccess, getLockAt, getLockList, getModifyDate, getName, getStreamId, getStreamName, getUniqueId, getWriteCount, hasAccessDate, hasCreationDate, hasDelayedWriteError, hasDeleteOnClose, hasIOPending, hasLocks, hasModifyDate, hasNTAttribute, incrementWriteCount, isArchived, isClosed, isDirectory, isHidden, isReadOnly, isStream, isSystem, numberOfLocks, removeAllLocks, removeLock, setAccessDate, setAttributes, setClosed, setCreationDate, setDelayedWriteError, setDeleteOnClose, setDirectoryId, setFileId, setFileSize, setFileSize, setFullName, setGrantedAccess, setIOPending, setModifyDate, setName, setStatusFlag, setStreamId, setStreamName, setUniqueId, setUniqueId, setUniqueId, wasCreated
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ContentNetworkFile

protected ContentNetworkFile(NodeService nodeService,
                             ContentService contentService,
                             MimetypeService mimetypeService,
                             NodeRef nodeRef,
                             java.lang.String name)
Class constructor

Parameters:
transactionService - TransactionService
nodeService - NodeService
contentService - ContentService
nodeRef - NodeRef
name - String
Method Detail

createFile

public static ContentNetworkFile createFile(NodeService nodeService,
                                            ContentService contentService,
                                            MimetypeService mimetypeService,
                                            CifsHelper cifsHelper,
                                            NodeRef nodeRef,
                                            org.alfresco.jlan.server.filesys.FileOpenParams params)
Helper method to create a network file given a node reference.


toString

public java.lang.String toString()
Return the file details as a string

Overrides:
toString in class java.lang.Object
Returns:
String

hasContent

public final boolean hasContent()
Determine if the file content data has been opened

Returns:
boolean

closeFile

public void closeFile()
               throws java.io.IOException
Close the file

Specified by:
closeFile in class org.alfresco.jlan.server.filesys.NetworkFile
Throws:
java.io.IOException

truncateFile

public void truncateFile(long size)
                  throws java.io.IOException
Truncate or extend the file to the specified length

Specified by:
truncateFile in class org.alfresco.jlan.server.filesys.NetworkFile
Parameters:
size - long
Throws:
java.io.IOException

writeFile

public void writeFile(byte[] buffer,
                      int length,
                      int position,
                      long fileOffset)
               throws java.io.IOException
Write a block of data to the file.

Specified by:
writeFile in class org.alfresco.jlan.server.filesys.NetworkFile
Parameters:
buf - byte[]
len - int
pos - int
fileOff - long
Throws:
java.io.IOException

readFile

public int readFile(byte[] buffer,
                    int length,
                    int position,
                    long fileOffset)
             throws java.io.IOException
Read from the file.

Specified by:
readFile in class org.alfresco.jlan.server.filesys.NetworkFile
Parameters:
buf - byte[]
len - int
pos - int
fileOff - long
Returns:
Length of data read.
Throws:
java.io.IOException

openFile

public void openFile(boolean createFlag)
              throws java.io.IOException
Open the file

Specified by:
openFile in class org.alfresco.jlan.server.filesys.NetworkFile
Parameters:
createFlag - boolean
Throws:
java.io.IOException

seekFile

public long seekFile(long pos,
                     int typ)
              throws java.io.IOException
Seek to a new position in the file

Specified by:
seekFile in class org.alfresco.jlan.server.filesys.NetworkFile
Parameters:
pos - long
typ - int
Returns:
long
Throws:
java.io.IOException

flushFile

public void flushFile()
               throws java.io.IOException
Flush and buffered data for this file

Specified by:
flushFile in class org.alfresco.jlan.server.filesys.NetworkFile
Throws:
java.io.IOException


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