| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
| <!-- NewPage --> |
| <html lang="en"> |
| <head> |
| <!-- Generated by javadoc (1.8.0_77) on Mon Oct 24 00:05:44 UTC 2016 --> |
| <title>FileWriterPolicy (Edgent v1.0.0)</title> |
| <meta name="date" content="2016-10-24"> |
| <link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style"> |
| <script type="text/javascript" src="../../../../../script.js"></script> |
| </head> |
| <body> |
| <script type="text/javascript"><!-- |
| try { |
| if (location.href.indexOf('is-external=true') == -1) { |
| parent.document.title="FileWriterPolicy (Edgent v1.0.0)"; |
| } |
| } |
| catch(err) { |
| } |
| //--> |
| var methods = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10,"i6":10,"i7":10,"i8":10,"i9":10,"i10":10,"i11":10,"i12":10,"i13":10}; |
| var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]}; |
| var altColor = "altColor"; |
| var rowColor = "rowColor"; |
| var tableTab = "tableTab"; |
| var activeTableTab = "activeTableTab"; |
| </script> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| <!-- ========= START OF TOP NAVBAR ======= --> |
| <div class="topNav"><a name="navbar.top"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> |
| <a name="navbar.top.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../../../overview-summary.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="class-use/FileWriterPolicy.html">Use</a></li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../../../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../../../../index-all.html">Index</a></li> |
| <li><a href="../../../../../help-doc.html">Help</a></li> |
| </ul> |
| </div> |
| <div class="subNav"> |
| <ul class="navList"> |
| <li><a href="../../../../../org/apache/edgent/connectors/file/FileWriterFlushConfig.html" title="class in org.apache.edgent.connectors.file"><span class="typeNameLink">Prev Class</span></a></li> |
| <li><a href="../../../../../org/apache/edgent/connectors/file/FileWriterRetentionConfig.html" title="class in org.apache.edgent.connectors.file"><span class="typeNameLink">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../../../../index.html?org/apache/edgent/connectors/file/FileWriterPolicy.html" target="_top">Frames</a></li> |
| <li><a href="FileWriterPolicy.html" target="_top">No Frames</a></li> |
| </ul> |
| <ul class="navList" id="allclasses_navbar_top"> |
| <li><a href="../../../../../allclasses-noframe.html">All Classes</a></li> |
| </ul> |
| <div> |
| <script type="text/javascript"><!-- |
| allClassesLink = document.getElementById("allclasses_navbar_top"); |
| if(window==top) { |
| allClassesLink.style.display = "block"; |
| } |
| else { |
| allClassesLink.style.display = "none"; |
| } |
| //--> |
| </script> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li>Nested | </li> |
| <li>Field | </li> |
| <li><a href="#constructor.summary">Constr</a> | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li>Field | </li> |
| <li><a href="#constructor.detail">Constr</a> | </li> |
| <li><a href="#method.detail">Method</a></li> |
| </ul> |
| </div> |
| <a name="skip.navbar.top"> |
| <!-- --> |
| </a></div> |
| <!-- ========= END OF TOP NAVBAR ========= --> |
| <!-- ======== START OF CLASS DATA ======== --> |
| <div class="header"> |
| <div class="subTitle">org.apache.edgent.connectors.file</div> |
| <h2 title="Class FileWriterPolicy" class="title">Class FileWriterPolicy<T></h2> |
| </div> |
| <div class="contentContainer"> |
| <ul class="inheritance"> |
| <li>java.lang.Object</li> |
| <li> |
| <ul class="inheritance"> |
| <li>org.apache.edgent.connectors.file.FileWriterPolicy<T></li> |
| </ul> |
| </li> |
| </ul> |
| <div class="description"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <dl> |
| <dt><span class="paramLabel">Type Parameters:</span></dt> |
| <dd><code>T</code> - stream tuple type</dd> |
| </dl> |
| <dl> |
| <dt>All Implemented Interfaces:</dt> |
| <dd>org.apache.edgent.connectors.file.runtime.IFileWriterPolicy<T></dd> |
| </dl> |
| <dl> |
| <dt>Direct Known Subclasses:</dt> |
| <dd><a href="../../../../../org/apache/edgent/connectors/file/CompressedFileWriterPolicy.html" title="class in org.apache.edgent.connectors.file">CompressedFileWriterPolicy</a></dd> |
| </dl> |
| <hr> |
| <br> |
| <pre>public class <span class="typeNameLabel">FileWriterPolicy<T></span> |
| extends java.lang.Object |
| implements org.apache.edgent.connectors.file.runtime.IFileWriterPolicy<T></pre> |
| <div class="block">A full featured <code>IFileWriterPolicy</code> implementation. |
| <p> |
| The policy implements strategies for: |
| <ul> |
| <li>Active and final file pathname control.</li> |
| <li>Active file flush control (via @{link FileWriterFlushControl})</li> |
| <li>Active file cycle control (when to close/finalize the current active file; |
| via @{link FileWriterCycleControl})</li> |
| <li>file retention control (via @{link FileWriterRetentionControl})</li> |
| </ul> |
| The policy is very configurable. If additional flexibility is required |
| the class can be extended and documented "hook" methods overridden, |
| or an alternative full implementation of <code>FileWriterPolicy</code> can be |
| created. |
| <p> |
| Sample use: |
| <pre> |
| FileWriterPolicy<String> policy = new FileWriterPolicy( |
| FileWriterFlushConfig.newImplicitConfig(), |
| FileWriterCycleConfig.newCountBasedConfig(1000), |
| FileWriterRetentionConfig.newCountBasedConfig(10)); |
| String basePathname = "/some/directory/and_base_name"; |
| |
| TStream<String> streamToWrite = ... |
| FileStreams.textFileWriter(streamToWrite, () -> basePathname, () -> policy) |
| </pre></div> |
| <dl> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../../../../org/apache/edgent/connectors/file/FileWriterFlushConfig.html" title="class in org.apache.edgent.connectors.file"><code>FileWriterFlushConfig</code></a>, |
| <a href="../../../../../org/apache/edgent/connectors/file/FileWriterCycleConfig.html" title="class in org.apache.edgent.connectors.file"><code>FileWriterCycleConfig</code></a>, |
| <a href="../../../../../org/apache/edgent/connectors/file/FileWriterRetentionConfig.html" title="class in org.apache.edgent.connectors.file"><code>FileWriterRetentionConfig</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| </div> |
| <div class="summary"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- ======== CONSTRUCTOR SUMMARY ======== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="constructor.summary"> |
| <!-- --> |
| </a> |
| <h3>Constructor Summary</h3> |
| <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation"> |
| <caption><span>Constructors</span><span class="tabEnd"> </span></caption> |
| <tr> |
| <th class="colOne" scope="col">Constructor and Description</th> |
| </tr> |
| <tr class="altColor"> |
| <td class="colOne"><code><span class="memberNameLink"><a href="../../../../../org/apache/edgent/connectors/file/FileWriterPolicy.html#FileWriterPolicy--">FileWriterPolicy</a></span>()</code> |
| <div class="block">Create a new file writer policy instance.</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colOne"><code><span class="memberNameLink"><a href="../../../../../org/apache/edgent/connectors/file/FileWriterPolicy.html#FileWriterPolicy-org.apache.edgent.connectors.file.FileWriterFlushConfig-org.apache.edgent.connectors.file.FileWriterCycleConfig-org.apache.edgent.connectors.file.FileWriterRetentionConfig-">FileWriterPolicy</a></span>(<a href="../../../../../org/apache/edgent/connectors/file/FileWriterFlushConfig.html" title="class in org.apache.edgent.connectors.file">FileWriterFlushConfig</a><<a href="../../../../../org/apache/edgent/connectors/file/FileWriterPolicy.html" title="type parameter in FileWriterPolicy">T</a>> flushConfig, |
| <a href="../../../../../org/apache/edgent/connectors/file/FileWriterCycleConfig.html" title="class in org.apache.edgent.connectors.file">FileWriterCycleConfig</a><<a href="../../../../../org/apache/edgent/connectors/file/FileWriterPolicy.html" title="type parameter in FileWriterPolicy">T</a>> cycleConfig, |
| <a href="../../../../../org/apache/edgent/connectors/file/FileWriterRetentionConfig.html" title="class in org.apache.edgent.connectors.file">FileWriterRetentionConfig</a> retentionConfig)</code> |
| <div class="block">Create a new file writer policy instance.</div> |
| </td> |
| </tr> |
| </table> |
| </li> |
| </ul> |
| <!-- ========== METHOD SUMMARY =========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="method.summary"> |
| <!-- --> |
| </a> |
| <h3>Method Summary</h3> |
| <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation"> |
| <caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd"> </span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd"> </span></span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier and Type</th> |
| <th class="colLast" scope="col">Method and Description</th> |
| </tr> |
| <tr id="i0" class="altColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/edgent/connectors/file/FileWriterPolicy.html#close--">close</a></span>()</code> </td> |
| </tr> |
| <tr id="i1" class="rowColor"> |
| <td class="colFirst"><code>java.nio.file.Path</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/edgent/connectors/file/FileWriterPolicy.html#closeActiveFile-java.nio.file.Path-">closeActiveFile</a></span>(java.nio.file.Path path)</code> </td> |
| </tr> |
| <tr id="i2" class="altColor"> |
| <td class="colFirst"><code><a href="../../../../../org/apache/edgent/connectors/file/FileWriterCycleConfig.html" title="class in org.apache.edgent.connectors.file">FileWriterCycleConfig</a><<a href="../../../../../org/apache/edgent/connectors/file/FileWriterPolicy.html" title="type parameter in FileWriterPolicy">T</a>></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/edgent/connectors/file/FileWriterPolicy.html#getCycleConfig--">getCycleConfig</a></span>()</code> |
| <div class="block">Get the policy's active file cycle configuration</div> |
| </td> |
| </tr> |
| <tr id="i3" class="rowColor"> |
| <td class="colFirst"><code><a href="../../../../../org/apache/edgent/connectors/file/FileWriterFlushConfig.html" title="class in org.apache.edgent.connectors.file">FileWriterFlushConfig</a><<a href="../../../../../org/apache/edgent/connectors/file/FileWriterPolicy.html" title="type parameter in FileWriterPolicy">T</a>></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/edgent/connectors/file/FileWriterPolicy.html#getFlushConfig--">getFlushConfig</a></span>()</code> |
| <div class="block">Get the policy's active file flush configuration</div> |
| </td> |
| </tr> |
| <tr id="i4" class="altColor"> |
| <td class="colFirst"><code>java.nio.file.Path</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/edgent/connectors/file/FileWriterPolicy.html#getNextActiveFilePath--">getNextActiveFilePath</a></span>()</code> </td> |
| </tr> |
| <tr id="i5" class="rowColor"> |
| <td class="colFirst"><code><a href="../../../../../org/apache/edgent/connectors/file/FileWriterRetentionConfig.html" title="class in org.apache.edgent.connectors.file">FileWriterRetentionConfig</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/edgent/connectors/file/FileWriterPolicy.html#getRetentionConfig--">getRetentionConfig</a></span>()</code> |
| <div class="block">Get the policy's retention configuration</div> |
| </td> |
| </tr> |
| <tr id="i6" class="altColor"> |
| <td class="colFirst"><code>protected java.nio.file.Path</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/edgent/connectors/file/FileWriterPolicy.html#hookGenerateFinalFilePath-java.nio.file.Path-">hookGenerateFinalFilePath</a></span>(java.nio.file.Path path)</code> |
| <div class="block">Generate the final file path for the active file.</div> |
| </td> |
| </tr> |
| <tr id="i7" class="rowColor"> |
| <td class="colFirst"><code>protected java.nio.file.Path</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/edgent/connectors/file/FileWriterPolicy.html#hookGenerateNextActiveFilePath--">hookGenerateNextActiveFilePath</a></span>()</code> |
| <div class="block">Generate the path for the next active file.</div> |
| </td> |
| </tr> |
| <tr id="i8" class="altColor"> |
| <td class="colFirst"><code>protected void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/edgent/connectors/file/FileWriterPolicy.html#hookRenameFile-java.nio.file.Path-java.nio.file.Path-">hookRenameFile</a></span>(java.nio.file.Path activePath, |
| java.nio.file.Path finalPath)</code> |
| <div class="block">"Rename" the active file to the final path.</div> |
| </td> |
| </tr> |
| <tr id="i9" class="rowColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/edgent/connectors/file/FileWriterPolicy.html#initialize-java.lang.String-java.io.Flushable-java.io.Closeable-">initialize</a></span>(java.lang.String basePathname, |
| java.io.Flushable flushable, |
| java.io.Closeable closeable)</code> </td> |
| </tr> |
| <tr id="i10" class="altColor"> |
| <td class="colFirst"><code>boolean</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/edgent/connectors/file/FileWriterPolicy.html#shouldCycle--">shouldCycle</a></span>()</code> </td> |
| </tr> |
| <tr id="i11" class="rowColor"> |
| <td class="colFirst"><code>boolean</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/edgent/connectors/file/FileWriterPolicy.html#shouldFlush--">shouldFlush</a></span>()</code> </td> |
| </tr> |
| <tr id="i12" class="altColor"> |
| <td class="colFirst"><code>java.lang.String</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/edgent/connectors/file/FileWriterPolicy.html#toString--">toString</a></span>()</code> </td> |
| </tr> |
| <tr id="i13" class="rowColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/edgent/connectors/file/FileWriterPolicy.html#wrote-T-long-">wrote</a></span>(<a href="../../../../../org/apache/edgent/connectors/file/FileWriterPolicy.html" title="type parameter in FileWriterPolicy">T</a> tuple, |
| long nbytes)</code> </td> |
| </tr> |
| </table> |
| <ul class="blockList"> |
| <li class="blockList"><a name="methods.inherited.from.class.java.lang.Object"> |
| <!-- --> |
| </a> |
| <h3>Methods inherited from class java.lang.Object</h3> |
| <code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait</code></li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| <div class="details"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- ========= CONSTRUCTOR DETAIL ======== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="constructor.detail"> |
| <!-- --> |
| </a> |
| <h3>Constructor Detail</h3> |
| <a name="FileWriterPolicy--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>FileWriterPolicy</h4> |
| <pre>public FileWriterPolicy()</pre> |
| <div class="block">Create a new file writer policy instance. |
| <p> |
| The configuration is: |
| <ul> |
| <li>10 second time based active file flushing</li> |
| <li>1MB file size based active file cycling</li> |
| <li>10 file retention count</li> |
| </ul> |
| The active and final file pathname behavior is specified in |
| <a href="../../../../../org/apache/edgent/connectors/file/FileWriterPolicy.html#FileWriterPolicy-org.apache.edgent.connectors.file.FileWriterFlushConfig-org.apache.edgent.connectors.file.FileWriterCycleConfig-org.apache.edgent.connectors.file.FileWriterRetentionConfig-"><code>FileWriterPolicy(FileWriterFlushConfig, FileWriterCycleConfig, FileWriterRetentionConfig)</code></a></div> |
| </li> |
| </ul> |
| <a name="FileWriterPolicy-org.apache.edgent.connectors.file.FileWriterFlushConfig-org.apache.edgent.connectors.file.FileWriterCycleConfig-org.apache.edgent.connectors.file.FileWriterRetentionConfig-"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>FileWriterPolicy</h4> |
| <pre>public FileWriterPolicy(<a href="../../../../../org/apache/edgent/connectors/file/FileWriterFlushConfig.html" title="class in org.apache.edgent.connectors.file">FileWriterFlushConfig</a><<a href="../../../../../org/apache/edgent/connectors/file/FileWriterPolicy.html" title="type parameter in FileWriterPolicy">T</a>> flushConfig, |
| <a href="../../../../../org/apache/edgent/connectors/file/FileWriterCycleConfig.html" title="class in org.apache.edgent.connectors.file">FileWriterCycleConfig</a><<a href="../../../../../org/apache/edgent/connectors/file/FileWriterPolicy.html" title="type parameter in FileWriterPolicy">T</a>> cycleConfig, |
| <a href="../../../../../org/apache/edgent/connectors/file/FileWriterRetentionConfig.html" title="class in org.apache.edgent.connectors.file">FileWriterRetentionConfig</a> retentionConfig)</pre> |
| <div class="block">Create a new file writer policy instance. |
| <p> |
| <code>flushConfig</code>, <code>cycleConfig</code> and <code>retentionConfig</code> |
| specify the configuration of the various controls. |
| <p> |
| The active file and final file pathnames are based |
| on the <code>basePathname</code> received in |
| <a href="../../../../../org/apache/edgent/connectors/file/FileWriterPolicy.html#initialize-java.lang.String-java.io.Flushable-java.io.Closeable-"><code>initialize(String, Flushable, Closeable)</code></a>. |
| <p> |
| Where <code>parent</code> and <code>baseLeafname</code> are the |
| parent path and file name respectively of <code>basePathname</code>: |
| <ul> |
| <li>the active file is <code>parent/.baseLeafname</code>"</li> |
| <li>final file names are <code>parent/baseLeafname_YYYYMMDD_HHMMSS[_<n>]</code> |
| where the optional <code>_<n></code> suffix is only present if needed |
| to distinguish a file from the previously finalized file. |
| <code><n></code> starts at 1 and is monotonically incremented. |
| </li> |
| </ul></div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>flushConfig</code> - active file flush control configuration</dd> |
| <dd><code>cycleConfig</code> - active file cycle control configuration</dd> |
| <dd><code>retentionConfig</code> - final file retention control configuration</dd> |
| </dl> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| <!-- ============ METHOD DETAIL ========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="method.detail"> |
| <!-- --> |
| </a> |
| <h3>Method Detail</h3> |
| <a name="close--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>close</h4> |
| <pre>public void close()</pre> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> |
| <dd><code>close</code> in interface <code>org.apache.edgent.connectors.file.runtime.IFileWriterPolicy<<a href="../../../../../org/apache/edgent/connectors/file/FileWriterPolicy.html" title="type parameter in FileWriterPolicy">T</a>></code></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getFlushConfig--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getFlushConfig</h4> |
| <pre>public <a href="../../../../../org/apache/edgent/connectors/file/FileWriterFlushConfig.html" title="class in org.apache.edgent.connectors.file">FileWriterFlushConfig</a><<a href="../../../../../org/apache/edgent/connectors/file/FileWriterPolicy.html" title="type parameter in FileWriterPolicy">T</a>> getFlushConfig()</pre> |
| <div class="block">Get the policy's active file flush configuration</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the flush configuration</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getCycleConfig--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getCycleConfig</h4> |
| <pre>public <a href="../../../../../org/apache/edgent/connectors/file/FileWriterCycleConfig.html" title="class in org.apache.edgent.connectors.file">FileWriterCycleConfig</a><<a href="../../../../../org/apache/edgent/connectors/file/FileWriterPolicy.html" title="type parameter in FileWriterPolicy">T</a>> getCycleConfig()</pre> |
| <div class="block">Get the policy's active file cycle configuration</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the cycle configuration</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getRetentionConfig--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getRetentionConfig</h4> |
| <pre>public <a href="../../../../../org/apache/edgent/connectors/file/FileWriterRetentionConfig.html" title="class in org.apache.edgent.connectors.file">FileWriterRetentionConfig</a> getRetentionConfig()</pre> |
| <div class="block">Get the policy's retention configuration</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the retention configuration</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="initialize-java.lang.String-java.io.Flushable-java.io.Closeable-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>initialize</h4> |
| <pre>public void initialize(java.lang.String basePathname, |
| java.io.Flushable flushable, |
| java.io.Closeable closeable)</pre> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> |
| <dd><code>initialize</code> in interface <code>org.apache.edgent.connectors.file.runtime.IFileWriterPolicy<<a href="../../../../../org/apache/edgent/connectors/file/FileWriterPolicy.html" title="type parameter in FileWriterPolicy">T</a>></code></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="wrote-java.lang.Object-long-"> |
| <!-- --> |
| </a><a name="wrote-T-long-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>wrote</h4> |
| <pre>public void wrote(<a href="../../../../../org/apache/edgent/connectors/file/FileWriterPolicy.html" title="type parameter in FileWriterPolicy">T</a> tuple, |
| long nbytes)</pre> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> |
| <dd><code>wrote</code> in interface <code>org.apache.edgent.connectors.file.runtime.IFileWriterPolicy<<a href="../../../../../org/apache/edgent/connectors/file/FileWriterPolicy.html" title="type parameter in FileWriterPolicy">T</a>></code></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="shouldFlush--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>shouldFlush</h4> |
| <pre>public boolean shouldFlush()</pre> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> |
| <dd><code>shouldFlush</code> in interface <code>org.apache.edgent.connectors.file.runtime.IFileWriterPolicy<<a href="../../../../../org/apache/edgent/connectors/file/FileWriterPolicy.html" title="type parameter in FileWriterPolicy">T</a>></code></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="shouldCycle--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>shouldCycle</h4> |
| <pre>public boolean shouldCycle()</pre> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> |
| <dd><code>shouldCycle</code> in interface <code>org.apache.edgent.connectors.file.runtime.IFileWriterPolicy<<a href="../../../../../org/apache/edgent/connectors/file/FileWriterPolicy.html" title="type parameter in FileWriterPolicy">T</a>></code></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getNextActiveFilePath--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getNextActiveFilePath</h4> |
| <pre>public java.nio.file.Path getNextActiveFilePath()</pre> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> |
| <dd><code>getNextActiveFilePath</code> in interface <code>org.apache.edgent.connectors.file.runtime.IFileWriterPolicy<<a href="../../../../../org/apache/edgent/connectors/file/FileWriterPolicy.html" title="type parameter in FileWriterPolicy">T</a>></code></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="closeActiveFile-java.nio.file.Path-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>closeActiveFile</h4> |
| <pre>public java.nio.file.Path closeActiveFile(java.nio.file.Path path) |
| throws java.io.IOException</pre> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> |
| <dd><code>closeActiveFile</code> in interface <code>org.apache.edgent.connectors.file.runtime.IFileWriterPolicy<<a href="../../../../../org/apache/edgent/connectors/file/FileWriterPolicy.html" title="type parameter in FileWriterPolicy">T</a>></code></dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code>java.io.IOException</code></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="hookGenerateFinalFilePath-java.nio.file.Path-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>hookGenerateFinalFilePath</h4> |
| <pre>protected java.nio.file.Path hookGenerateFinalFilePath(java.nio.file.Path path)</pre> |
| <div class="block">Generate the final file path for the active file. |
| <p> |
| The default implementation yields: |
| <br> |
| final file names are <code>basePathname_YYYYMMDD_HHMMSS[_<n>]</code> |
| where the optional <code>_<n></code> suffix is only present if needed |
| to distinguish a file from the previously finalized file. |
| <code><n></code> starts at 1 and is monitonically incremented. |
| <p> |
| This hook method can be overridden. |
| <p> |
| Note, the implementation must handle the unlikely, but happens |
| in tests, case where files are cycling very fast (multiple per sec) |
| and the retention config tosses some within that same second. |
| I.e., avoid generating final path sequences like: |
| <pre> |
| leaf_YYYYMMDD_103099 |
| leaf_YYYYMMDD_103099_1 |
| leaf_YYYYMMDD_103099_2 |
| delete leaf_YYYYMMDD_103099 -- retention cnt was 2 |
| leaf_YYYYMMDD_103099 // should be _3 |
| </pre></div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>path</code> - the active file path to finalize</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>final path for the file</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="hookGenerateNextActiveFilePath--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>hookGenerateNextActiveFilePath</h4> |
| <pre>protected java.nio.file.Path hookGenerateNextActiveFilePath()</pre> |
| <div class="block">Generate the path for the next active file. |
| <p> |
| The default implementation yields <code>parent/.baseLeafname</code> |
| from <code>basePathname</code>. |
| <p> |
| This hook method can be overridden. |
| <p> |
| See <code>IFileWriterPolicy.getNextActiveFilePath()</code> regarding |
| constraints.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>path to use for the next active file.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="hookRenameFile-java.nio.file.Path-java.nio.file.Path-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>hookRenameFile</h4> |
| <pre>protected void hookRenameFile(java.nio.file.Path activePath, |
| java.nio.file.Path finalPath) |
| throws java.io.IOException</pre> |
| <div class="block">"Rename" the active file to the final path. |
| <p> |
| The default implementation uses <code>java.io.File.renameTo()</code> |
| and works for the default <a href="../../../../../org/apache/edgent/connectors/file/FileWriterPolicy.html#hookGenerateNextActiveFilePath--"><code>hookGenerateNextActiveFilePath()</code></a> |
| and <a href="../../../../../org/apache/edgent/connectors/file/FileWriterPolicy.html#hookGenerateFinalFilePath-java.nio.file.Path-"><code>hookGenerateFinalFilePath(Path path)</code></a> implementations. |
| <p> |
| This hook method can be overridden.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>activePath</code> - path of the active file</dd> |
| <dd><code>finalPath</code> - path to the final destination</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code>java.io.IOException</code> - on failure</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="toString--"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>toString</h4> |
| <pre>public java.lang.String toString()</pre> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> |
| <dd><code>toString</code> in class <code>java.lang.Object</code></dd> |
| </dl> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| </div> |
| <!-- ========= END OF CLASS DATA ========= --> |
| <!-- ======= START OF BOTTOM NAVBAR ====== --> |
| <div class="bottomNav"><a name="navbar.bottom"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> |
| <a name="navbar.bottom.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../../../overview-summary.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="class-use/FileWriterPolicy.html">Use</a></li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../../../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../../../../index-all.html">Index</a></li> |
| <li><a href="../../../../../help-doc.html">Help</a></li> |
| </ul> |
| <div class="aboutLanguage"><a href="http://edgent.incubator.apache.org">Apache Edgent (incubating)</a></div> |
| </div> |
| <div class="subNav"> |
| <ul class="navList"> |
| <li><a href="../../../../../org/apache/edgent/connectors/file/FileWriterFlushConfig.html" title="class in org.apache.edgent.connectors.file"><span class="typeNameLink">Prev Class</span></a></li> |
| <li><a href="../../../../../org/apache/edgent/connectors/file/FileWriterRetentionConfig.html" title="class in org.apache.edgent.connectors.file"><span class="typeNameLink">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../../../../index.html?org/apache/edgent/connectors/file/FileWriterPolicy.html" target="_top">Frames</a></li> |
| <li><a href="FileWriterPolicy.html" target="_top">No Frames</a></li> |
| </ul> |
| <ul class="navList" id="allclasses_navbar_bottom"> |
| <li><a href="../../../../../allclasses-noframe.html">All Classes</a></li> |
| </ul> |
| <div> |
| <script type="text/javascript"><!-- |
| allClassesLink = document.getElementById("allclasses_navbar_bottom"); |
| if(window==top) { |
| allClassesLink.style.display = "block"; |
| } |
| else { |
| allClassesLink.style.display = "none"; |
| } |
| //--> |
| </script> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li>Nested | </li> |
| <li>Field | </li> |
| <li><a href="#constructor.summary">Constr</a> | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li>Field | </li> |
| <li><a href="#constructor.detail">Constr</a> | </li> |
| <li><a href="#method.detail">Method</a></li> |
| </ul> |
| </div> |
| <a name="skip.navbar.bottom"> |
| <!-- --> |
| </a></div> |
| <!-- ======== END OF BOTTOM NAVBAR ======= --> |
| <p class="legalCopy"><small>Copyright © 2016 The Apache Software Foundation. All Rights Reserved - 59dfbdf-20161024-0005</small></p> |
| </body> |
| </html> |