org.apache.axiom.attachments.lifecycle.impl
Class FileAccessor
java.lang.Object
org.apache.axiom.attachments.lifecycle.impl.FileAccessor
- All Implemented Interfaces:
- LifecycleEventHandler
public class FileAccessor
- extends java.lang.Object
- implements LifecycleEventHandler
FileAccessor wraps the attachment temp file. It is created from PartOnFile.
The idea behind wrapping the file is to give rumtime an ability to track
when the file is accessed with streams or data handler and accordingly trigger
events to handle the the files lifecycle.
Method Summary |
javax.activation.DataHandler |
getDataHandler(java.lang.String contentType)
|
java.io.File |
getFile()
|
java.lang.String |
getFileName()
|
java.io.InputStream |
getInputStream()
|
java.io.OutputStream |
getOutputStream()
|
long |
getSize()
|
void |
handleEvent(int eventId)
When a Event occurs in FileAccessor, execute the LifecycleManager Operation
For example, if the delete behaviour is readOnce and if the inputstream on attachment is read
and closed the first time, the delete operation in LifecycleManager should be executed. |
void |
setFile(java.io.File file)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
log
private static final org.apache.commons.logging.Log log
file
java.io.File file
manager
LifecycleManager manager
DELETE_INTERVAL
private static final int DELETE_INTERVAL
- See Also:
- Constant Field Values
FileAccessor
public FileAccessor(LifecycleManager manager,
java.io.File file)
getDataHandler
public javax.activation.DataHandler getDataHandler(java.lang.String contentType)
throws javax.mail.MessagingException
- Throws:
javax.mail.MessagingException
getFileName
public java.lang.String getFileName()
throws javax.mail.MessagingException
- Throws:
javax.mail.MessagingException
getInputStream
public java.io.InputStream getInputStream()
throws java.io.IOException,
javax.mail.MessagingException
- Throws:
java.io.IOException
javax.mail.MessagingException
getOutputStream
public java.io.OutputStream getOutputStream()
throws java.io.FileNotFoundException
- Throws:
java.io.FileNotFoundException
getSize
public long getSize()
handleEvent
public void handleEvent(int eventId)
throws java.io.IOException
- Description copied from interface:
LifecycleEventHandler
- When a Event occurs in FileAccessor, execute the LifecycleManager Operation
For example, if the delete behaviour is readOnce and if the inputstream on attachment is read
and closed the first time, the delete operation in LifecycleManager should be executed.
- Specified by:
handleEvent
in interface LifecycleEventHandler
- Throws:
java.io.IOException
getFile
public java.io.File getFile()
setFile
public void setFile(java.io.File file)