public class FileOutputStreamResource extends AbstractOutputStreamResource
AbstractOutputStreamResource
implementation
that handles file output streams.
Example configuration:
<resource-config selector="order-item"> <resource>org.milyn.io.file.FileOutputStreamResource</resource> <param name="resourceName">resourceName</param> <param name="fileNamePattern">orderitem-${order.orderId}-${order.orderItem.itemId}.xml</param> <param name="destinationDirectoryPattern">order-${order.orderId}</param> <param name="listFileNamePattern">orderitems-${order.orderId}.lst</param> </resource-config> Optional properties (default values shown): <param name="highWaterMark">200</param> <param name="highWaterMarkTimeout">60000</param>
Description of configuration properties:
When does a new file get created?
As soon as an object tries to retrieve the Writer or the OutputStream from this OutputStreamResource and
the Stream isn't open then a new file is created. Using the 'closeOnCondition' property you can control
when a stream get closed. As long as the stream isn't closed, the same file is used to write too. At then
end of the filter process the stream always gets closed. Nothing stays open.
Modifier and Type | Class and Description |
---|---|
static class |
FileOutputStreamResource.SplitFilenameFilter |
RESOURCE_CONTEXT_KEY_PREFIX
Constructor and Description |
---|
FileOutputStreamResource() |
Modifier and Type | Method and Description |
---|---|
protected boolean |
closeCondition(ExecutionContext executionContext) |
protected void |
closeResource(ExecutionContext executionContext)
Close the resource output stream.
|
void |
executeExecutionLifecycleCleanup(ExecutionContext executionContext)
Cleanup the resources allocated by this resource for the specified ExecutionContext.
|
FileOutputStream |
getOutputStream(ExecutionContext executionContext)
Retrieve/create an output stream that is appropriate for the concreate implementation
|
void |
initialize() |
FileOutputStreamResource |
setAppend(boolean append) |
void |
setCloseOnCondition(String closeOnCondition) |
FileOutputStreamResource |
setDestinationDirectoryPattern(String destinationDirectoryPattern) |
FileOutputStreamResource |
setFileNamePattern(String fileNamePattern) |
FileOutputStreamResource |
setHighWaterMark(int highWaterMark) |
FileOutputStreamResource |
setHighWaterMarkPollFrequency(long highWaterMarkPollFrequency) |
FileOutputStreamResource |
setHighWaterMarkTimeout(long highWaterMarkTimeout) |
FileOutputStreamResource |
setListFileNamePattern(String listFileNamePattern) |
FileOutputStreamResource |
setListFileNamePatternCtxKey(String listFileNamePatternCtxKey) |
consumes, executeVisitLifecycleCleanup, getOutputStream, getOutputWriter, getResourceName, getWriterEncoding, setResourceName, setWriterEncoding, visitBefore, visitBefore
public FileOutputStreamResource setFileNamePattern(String fileNamePattern)
public FileOutputStreamResource setDestinationDirectoryPattern(String destinationDirectoryPattern)
public FileOutputStreamResource setListFileNamePattern(String listFileNamePattern)
public FileOutputStreamResource setListFileNamePatternCtxKey(String listFileNamePatternCtxKey)
public FileOutputStreamResource setHighWaterMark(int highWaterMark)
public FileOutputStreamResource setHighWaterMarkTimeout(long highWaterMarkTimeout)
public FileOutputStreamResource setHighWaterMarkPollFrequency(long highWaterMarkPollFrequency)
public void setCloseOnCondition(String closeOnCondition)
public FileOutputStreamResource setAppend(boolean append)
@Initialize public void initialize() throws SmooksConfigurationException
SmooksConfigurationException
public FileOutputStream getOutputStream(ExecutionContext executionContext) throws SmooksRoutingException, IOException
AbstractOutputStreamResource
getOutputStream
in class AbstractOutputStreamResource
executionContext
- Execution Context.SmooksRoutingException
IOException
protected boolean closeCondition(ExecutionContext executionContext)
closeCondition
in class AbstractOutputStreamResource
protected void closeResource(ExecutionContext executionContext)
AbstractOutputStreamResource
closeResource
in class AbstractOutputStreamResource
executionContext
- Smooks ExecutionContextpublic void executeExecutionLifecycleCleanup(ExecutionContext executionContext)
ExecutionLifecycleCleanable
executeExecutionLifecycleCleanup
in interface ExecutionLifecycleCleanable
executeExecutionLifecycleCleanup
in class AbstractOutputStreamResource
executionContext
- The ExecutionContext.Copyright © 2020. All rights reserved.