|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.milyn.io.AbstractOutputStreamResource
public abstract class AbstractOutputStreamResource
AbstractOuputStreamResource is the base class for handling output stream resources in Smooks.
Note that aWriter can also be opened on a stream resource. If a Writer
has been opened on a resource, an OutputStream cannot also be opened (and visa versa).
Example configuration:
<resource-config selector="$document">
<resource>org.milyn.io.ConcreateImpl</resource>
<param name="resourceName">resourceName</param>
<param name="writerEncoding">UTF-8</param> <!-- Optional -->
</resource-config>
Description of configuration properties:
resource: should be a concreate implementation of this classresourceName: the name of this resouce. Will be used to identify this resourcewriterEncoding: (Optional) the encoding to be used by any writers opened on this resource (Default is "UTF-8")
| Field Summary | |
|---|---|
protected static String |
RESOURCE_CONTEXT_KEY_PREFIX
|
| Constructor Summary | |
|---|---|
AbstractOutputStreamResource()
|
|
| Method Summary | |
|---|---|
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. |
abstract OutputStream |
getOutputStream(ExecutionContext executionContext)
Retrieve/create an output stream that is appropriate for the concreate implementation |
static OutputStream |
getOutputStream(String resourceName,
ExecutionContext executionContext)
Get an OutputStream to the named Resource. |
static Writer |
getOutputWriter(String resourceName,
ExecutionContext executionContext)
Get a Writer to the named OutputStream Resource. |
String |
getResourceName()
Return the name of this resource |
Charset |
getWriterEncoding()
|
void |
visitAfter(Element element,
ExecutionContext executionContext)
Visit the supplied element after visiting its child elements. |
void |
visitAfter(SAXElement element,
ExecutionContext executionContext)
Visit the supplied element after visiting its child elements. |
void |
visitBefore(Element element,
ExecutionContext executionContext)
Visit the supplied element before visiting its child elements. |
void |
visitBefore(SAXElement element,
ExecutionContext executionContext)
Visit the supplied element before visiting its child elements. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final String RESOURCE_CONTEXT_KEY_PREFIX
| Constructor Detail |
|---|
public AbstractOutputStreamResource()
| Method Detail |
|---|
public abstract OutputStream getOutputStream(ExecutionContext executionContext)
throws IOException
executionContext - Execution Context.
IOExceptionpublic String getResourceName()
String - the name of the resourcepublic Charset getWriterEncoding()
public void visitBefore(SAXElement element,
ExecutionContext executionContext)
throws SmooksException,
IOException
SAXVisitBefore
visitBefore in interface SAXVisitBeforeelement - The SAX element being visited.executionContext - Execution context.
SmooksException - Event processing failure.
IOException - Error writing event to output writer.
public void visitAfter(SAXElement element,
ExecutionContext executionContext)
throws SmooksException,
IOException
SAXVisitAfter
visitAfter in interface SAXVisitAfterelement - The SAX element being visited.executionContext - Execution context.
SmooksException - Event processing failure.
IOException - Error writing event to output writer.
public void visitBefore(Element element,
ExecutionContext executionContext)
throws SmooksException
DOMVisitBefore
visitBefore in interface DOMVisitBeforeelement - The DOM element being visited.executionContext - Request relative instance.
SmooksException - Element processing failure.
public void visitAfter(Element element,
ExecutionContext executionContext)
throws SmooksException
DOMVisitAfter
visitAfter in interface DOMVisitAfterelement - The DOM element being visited.executionContext - Request relative instance.
SmooksException - Element processing failure.public void executeExecutionLifecycleCleanup(ExecutionContext executionContext)
ExecutionLifecycleCleanable
executeExecutionLifecycleCleanup in interface ExecutionLifecycleCleanableexecutionContext - The ExecutionContext.
public static OutputStream getOutputStream(String resourceName,
ExecutionContext executionContext)
throws SmooksException
OutputStream to the named Resource.
resourceName - The resource name.executionContext - The current ExececutionContext.
OutputStream to the named Resource.
SmooksException - Unable to access OutputStream.
public static Writer getOutputWriter(String resourceName,
ExecutionContext executionContext)
throws SmooksException
Writer to the named OutputStream Resource.
Wraps the OutputStream in a Writer. Uses the "writerEncoding"
param to set the encoding on the Writer.
resourceName - The resource name.executionContext - The current ExececutionContext.
Writer to the named OutputStream Resource.
SmooksException - Unable to access OutputStream.protected void closeResource(ExecutionContext executionContext)
executionContext - Smooks ExecutionContext
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||