|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.neeve.rog.log.RogLogUtil
public class RogLogUtil
This class contains utility methods that are useful for working with ROG transaction logs.
This class contains unsupported APIs that are subject to change
Nested Class Summary | |
---|---|
static class |
RogLogUtil.AlwaysEqualComparator<T>
A comparator that always considers 2 objects equal. |
static interface |
RogLogUtil.FieldFilter
Allows field paths to the filter for a type. |
static class |
RogLogUtil.FileBasedFieldFilter
A field filter that can be configured with filter information from a text based input stream. |
static class |
RogLogUtil.FilterComparisonFactory
A comparison factory passed to UtlObjectGraph that uses a supplied RogLogUtil.FieldFilter
to allow ignoring fields. |
static class |
RogLogUtil.JsonPrettyPrintStyle
Json pretty printer styles. |
static class |
RogLogUtil.MetadataDisplayPolicy
Enumerates options for displaying object metadata. |
Field Summary | |
---|---|
static String |
DIVERGENCE_FILTERS_RESOUCE_PATH
The search path used to lookup field filters on the class path. |
static String |
JSON_CUSTOM_PRETTY_PRINTER_PROP
The property name used to look up a custom json pretty printer implementation class that implements PrettyPrinter |
static String |
JSON_SORT_PROPERTIES_ALPHABETICALLY_PROP
The property name indicating whether objects dumped in json are sorted alphabetically. |
Constructor Summary | |
---|---|
RogLogUtil()
|
Method Summary | |
---|---|
static boolean |
compareEntries(RogLog source,
RogLog target,
RogLogUtil.FieldFilter filter,
BufferedWriter summary,
int diffLimit,
boolean metadata,
boolean verbose,
UtlTableFormatter.Format format)
Compares entries between the given RogLog s. |
static boolean |
compareRogNodes(IRogNode node1,
IRogNode node2,
RogLogUtil.FieldFilter filter,
StringBuffer diffBuffer)
Compares two nodes to one another. |
static boolean |
compareState(RogLog source,
RogLog target,
RogLogUtil.FieldFilter filter,
BufferedWriter summary,
boolean metadata,
boolean verbose,
UtlTableFormatter.Format format)
Compares state for the given logs. |
static File |
createExecutableArchive(File archiveFolder,
String archiveName,
PrintStream out,
Tracer tracer,
List<String> additionalContent,
RogLog... logs)
Creates an executable uber jar comprised of current classpath with the TransactionLogTool as the Main-Class, and bundled copies of the specified RogLog 's files. |
static File |
createExecutableArchive(File archiveFolder,
String archiveName,
PrintStream out,
Tracer tracer,
RogLog... logs)
Creates an executable uber jar comprised of current classpath with the TransactionLogTool as the Main-Class, and bundled copies of the specified RogLog 's files. |
static void |
dumpLogEntryJson(RogLog.Entry entry,
boolean includeMetadata,
boolean includePayload,
boolean filterUnsetFields,
RogLogUtil.JsonPrettyPrintStyle style,
Writer writer)
Dumps a log entry in json format. |
static void |
dumpObjectAsJson(IRogMetadata metadata,
IStoreObject object,
boolean dumpMetadata,
boolean dumpObject,
boolean filterUnsetFields,
RogLogUtil.JsonPrettyPrintStyle style,
Writer writer)
Dumps an IStoreObject object or its metadata in json format. |
static void |
dumpResultSetRowCsv(RogLogResultSet resultSet,
Writer writer)
Dumps a query result's selected fields in csv format. |
static void |
dumpResultSetRowJson(RogLogResultSet resultSet,
boolean includeMetadata,
boolean includePayload,
boolean filterUnsetFields,
RogLogUtil.JsonPrettyPrintStyle style,
Writer writer)
Dumps the query result set row, rendering the entry object as json. |
static void |
dumpResultSetRowTabular(RogLogResultSet resultSet,
Writer writer)
Dumps a query result's selected fields in tabular format. |
static List<File> |
extractArchivedLogs(PrintStream out,
File extractionFolder)
Extracts archived log files from the current classpath. |
static RogLogUtil.FileBasedFieldFilter |
loadComparisonFilter()
Loads the default field comparison filter from configuration files on the classpath. |
static String |
objectToJson(String prefix,
IRogNode object,
RogLogUtil.MetadataDisplayPolicy metadataDisplay,
boolean filterUnsetFields,
RogLogUtil.JsonPrettyPrintStyle style)
Returns an IRogNode as a json formatted String. |
static void |
traceObjectJson(String prefix,
IRogNode object,
RogLogUtil.MetadataDisplayPolicy metadataDisplay,
boolean filterUnsetFields,
RogLogUtil.JsonPrettyPrintStyle style,
Tracer tracer,
Tracer.Level traceLevel)
Dumps an IRogNode object or its metadata in json format. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String DIVERGENCE_FILTERS_RESOUCE_PATH
RogLogUtil.FileBasedFieldFilter
,
loadComparisonFilter()
,
Constant Field Valuespublic static final String JSON_CUSTOM_PRETTY_PRINTER_PROP
PrettyPrinter
public static final String JSON_SORT_PROPERTIES_ALPHABETICALLY_PROP
Constructor Detail |
---|
public RogLogUtil()
Method Detail |
---|
public static File createExecutableArchive(File archiveFolder, String archiveName, PrintStream out, Tracer tracer, RogLog... logs) throws Exception
RogLog
's files.
archiveFolder
- The directory under which to create the archivearchiveName
- The archive name (which will be suffixed with a timestamp).tracer
- The tracer to use to log output of the archiving operation.logs
- The RogLog
s to include in the archive.
IllegalArgumentException
- If no logs are specified.
IOException
- If the archive can't be created.
Exception
public static File createExecutableArchive(File archiveFolder, String archiveName, PrintStream out, Tracer tracer, List<String> additionalContent, RogLog... logs) throws Exception
RogLog
's files.
archiveFolder
- The directory under which to create the archivearchiveName
- The archive name (which will be suffixed with a timestamp).tracer
- The tracer to use to log output of the archiving operation.additionalContent
- List of logs
- The RogLog
s to include in the archive.
IllegalArgumentException
- If no logs are specified.
IOException
- If the archive can't be created.
Exception
public static List<File> extractArchivedLogs(PrintStream out, File extractionFolder) throws IOException
IOException
- If there is an error extracting log filespublic static final boolean compareEntries(RogLog source, RogLog target, RogLogUtil.FieldFilter filter, BufferedWriter summary, int diffLimit, boolean metadata, boolean verbose, UtlTableFormatter.Format format) throws Exception
RogLog
s.
source
- The source logtarget
- The target logfilter
- A RogLogUtil.FieldFilter
for ignoring fields in the comparisonsummary
- If provided difference are written to this writerdiffLimit
- The maximum number of divergent entries to summarizemetadata
- Whether internal platform data should be considered.verbose
- Enables debug information on the comparison in the output.
Exception
- If there is an error comparing the state.public static final boolean compareState(RogLog source, RogLog target, RogLogUtil.FieldFilter filter, BufferedWriter summary, boolean metadata, boolean verbose, UtlTableFormatter.Format format) throws Exception
source
- The source logtarget
- The target logfilter
- A RogLogUtil.FieldFilter
for ignoring fields in the comparisonsummary
- If provided difference are written to this writermetadata
- Whether internal platform data should be considered.verbose
- Enables debug information on the comparison in the output.
Exception
- If there is an error comparing the state.public static final boolean compareRogNodes(IRogNode node1, IRogNode node2, RogLogUtil.FieldFilter filter, StringBuffer diffBuffer) throws Exception
node1
- The first node.node2
- The second node.filter
- The field filter to ignore fields. If null the default filter will be used.diffBuffer
- An optional buffer into which to dump differences.
Exception
- If a failure occurs comparing the nodes.public static final RogLogUtil.FileBasedFieldFilter loadComparisonFilter() throws IOException
This method searches for field filters on the classpath found at "META-INF/com/neeve/rog/divergence.filters"
IOException
- If there is an error loading the field filters.
IllegalArgumentException
- If there is an error parsing the discovered field filterspublic static final void dumpLogEntryJson(RogLog.Entry entry, boolean includeMetadata, boolean includePayload, boolean filterUnsetFields, RogLogUtil.JsonPrettyPrintStyle style, Writer writer)
entry
- The entry to dump.includeMetadata
- Whether or not to include entry metadata.includePayload
- If false no payload information will be shown.filterUnsetFields
- Whether unset fields should be filtered from the objectstyle
- The json pretty printer style to use.writer
- The writer to write to.public static void dumpResultSetRowJson(RogLogResultSet resultSet, boolean includeMetadata, boolean includePayload, boolean filterUnsetFields, RogLogUtil.JsonPrettyPrintStyle style, Writer writer)
resultSet
- The result set row.includeMetadata
- Whether or not to include entry metadata.includePayload
- If false no payload information will be shown.filterUnsetFields
- Whether unset fields should be filtered from the objectstyle
- The json pretty printer style to use.writer
- The writer to write to.public static void dumpResultSetRowCsv(RogLogResultSet resultSet, Writer writer)
resultSet
- The result set.writer
- The writer to which to dump.public static void dumpResultSetRowTabular(RogLogResultSet resultSet, Writer writer)
resultSet
- The result set.writer
- The writer to which to dump.public static final void traceObjectJson(String prefix, IRogNode object, RogLogUtil.MetadataDisplayPolicy metadataDisplay, boolean filterUnsetFields, RogLogUtil.JsonPrettyPrintStyle style, Tracer tracer, Tracer.Level traceLevel)
IRogNode
object or its metadata in json format.
object
- The object to dumpmetadataDisplay
- How to display object metadatafilterUnsetFields
- Whether unset fields should be filtered from the objectstyle
- The json pretty printer style to use.tracer
- The tracer to trace to.traceLevel
- The traceLevel to use.public static final String objectToJson(String prefix, IRogNode object, RogLogUtil.MetadataDisplayPolicy metadataDisplay, boolean filterUnsetFields, RogLogUtil.JsonPrettyPrintStyle style)
IRogNode
as a json formatted String.
object
- The object to dumpmetadataDisplay
- How to display object metadatafilterUnsetFields
- Whether unset fields should be filtered from the objectstyle
- The json pretty printer style to use.public static final void dumpObjectAsJson(IRogMetadata metadata, IStoreObject object, boolean dumpMetadata, boolean dumpObject, boolean filterUnsetFields, RogLogUtil.JsonPrettyPrintStyle style, Writer writer)
IStoreObject
object or its metadata in json format.
metadata
- The IRogMetadata
for the object.object
- The object to dumpdumpMetadata
- Whether metadata should be dumped.dumpObject
- Whether object payload should be included in the dumpfilterUnsetFields
- Whether unset fields should be filtered from the objectstyle
- The json pretty printer style to use.writer
- The writer to write to.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |