public class FileBackedMessageFactory extends DefaultMessageFactory
In order to limit the number of temporary files that will exist in the filesystem; FileCleaningTracker is used to monitor all the files that are created by temporary files. These are deleted when the underlying message is garbage collected.
FileBackedMessage
,
DefaultMessageFactory
,
AdaptrisMessageFactory
In the adapter configuration file this class is aliased as file-backed-message-factory which is the preferred alternative to the fully qualified classname when building your configuration.
Constructor and Description |
---|
FileBackedMessageFactory()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
java.io.File |
createTempFile(java.lang.Object marker)
Create a temp file that will be deleted when
marker goes out of scope and garbage collection occurs. |
protected int |
defaultBufferSize() |
protected boolean |
extendedLogging() |
java.lang.Boolean |
getCreateTempDir() |
java.lang.Integer |
getDefaultBufferSize() |
java.lang.Boolean |
getExtendedLogging() |
java.lang.Long |
getMaxMemorySizeBytes() |
java.lang.String |
getTempDirectory() |
java.lang.Boolean |
getUseNio() |
protected long |
maxMemorySizeBytes() |
AdaptrisMessage |
newMessage()
Returns a new
AdaptrisMessage . |
protected com.adaptris.core.lms.StreamWrapper |
newStreamWrapper() |
void |
setCreateTempDir(java.lang.Boolean b)
Specify whether or not to create any configured tempDir.
|
void |
setDefaultBufferSize(java.lang.Integer bufsiz)
Set the default buffersize to use when writing to files.
|
void |
setExtendedLogging(java.lang.Boolean b) |
void |
setMaxMemorySizeBytes(java.lang.Long l)
Set the maximum size before throwing a runtime exception when
AdaptrisMessage.getStringPayload() or
AdaptrisMessage.getPayload() is invoked. |
void |
setTempDirectory(java.lang.String tempDirectory)
Set the temporary directory where files that will be used as the basis of
AdaptrisMessage instances wlil be created.
|
void |
setUseNio(java.lang.Boolean useNio)
Whether or not to use the java NIO
Files.newInputStream(Path, OpenOption[]) method. |
protected java.io.File |
tempDirectory() |
protected boolean |
useNio() |
getDefaultCharEncoding, newMessage, newMessage, newMessage, newMessage, newMessage, newMessage, newMessage, setDefaultCharEncoding
defaultIfNull, getDefaultInstance, getUniqueIdGenerator, setUniqueIdGenerator, uniqueIdGenerator
public FileBackedMessageFactory()
public java.lang.String getTempDirectory()
public java.lang.Integer getDefaultBufferSize()
public void setDefaultBufferSize(java.lang.Integer bufsiz)
bufsiz
- the defaultBufferSize to setprotected int defaultBufferSize()
public java.lang.Long getMaxMemorySizeBytes()
public void setMaxMemorySizeBytes(java.lang.Long l)
AdaptrisMessage.getStringPayload()
or
AdaptrisMessage.getPayload()
is invoked.l
- the max size before exception to setprotected long maxMemorySizeBytes()
public void setTempDirectory(java.lang.String tempDirectory)
tempDirectory
- the tempDirectory to setprotected java.io.File tempDirectory()
public AdaptrisMessage newMessage()
AdaptrisMessageFactory
Returns a new AdaptrisMessage
. Payload and metadata are null.
newMessage
in class DefaultMessageFactory
AdaptrisMessage
with the specified payload and
metadatapublic java.io.File createTempFile(java.lang.Object marker) throws java.io.IOException
marker
goes out of scope and garbage collection occurs.marker
- the marker objectjava.io.IOException
public java.lang.Boolean getCreateTempDir()
public void setCreateTempDir(java.lang.Boolean b)
Generally speaking; if you are using the default java.io.tmpdir
then you can ignore this value.
b
- whether or not to create the temporary directory; defaults to false.public java.lang.Boolean getExtendedLogging()
public void setExtendedLogging(java.lang.Boolean b)
protected boolean extendedLogging()
public java.lang.Boolean getUseNio()
public void setUseNio(java.lang.Boolean useNio)
Files.newInputStream(Path, OpenOption[])
method.useNio
- true to enable, false to use FileInputStream
as always, default if not specified is false.protected boolean useNio()
protected com.adaptris.core.lms.StreamWrapper newStreamWrapper()