Class IntradayLoggerFactory
java.lang.Object
com.illumon.iris.db.tables.dataimport.IntradayLoggerFactory
The IntradayLoggerFactory generates the loggers and listeners for tables defined in the database schema.
We run this before build time to generate the logger/listener, and then check in the appropriate logger/listener.
At runtime, the logger is regenerated; and its CRC is compared to the CRC of the logger that was loaded from the build. If the CRCs don't match an exception is thrown and the logger is not instantiated.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionIntradayLoggerFactory(com.fishlib.io.logger.Logger log, com.fishlib.configuration.Configuration configuration, String copyrightNotice, SchemaService schemaService) IntradayLoggerFactory(com.fishlib.io.logger.Logger log, String copyrightNotice, SchemaService schemaService) -
Method Summary
Modifier and TypeMethodDescriptionvoidgenerateLogger(SchemaXml schema) voidgenerateTableListener(SchemaXml schema) voidgenerateTableListener(org.jdom2.Element tableElement, String packageName) static StringgetAdoGetter(com.fishlib.dataobjects.WColumn column) static StringgetColumnNames(LoggerListenerGenerationInfo generationInfo) static com.illumon.compilertools.CompilerTools.ContextRetrieve the compiler context for logger and listener compilations.getInputToTypeMeta(org.jdom2.Element tableDefinition) static TableListenergetListener(com.fishlib.io.logger.Logger log, TableDefinition tableDefinition) Generate a TableListener class from the given TableDefinition.static StringgetListenerClass(org.jdom2.Element element, String tableName) Get the listener class attribute from the listener element, or make up a default one using the tableName.getLoggerBody(org.jdom2.Element tableElement) longgetLoggerChecksum(String schemaStr, String loggerClass) longgetLoggerChecksum(String namespace, String tableName, String loggerClass) static StringgetLoggerClass(org.jdom2.Element element, String tableName) Get the listener class attribute from the listener element, or make up a default one using the tableName.static com.illumon.intradaylogger.IntradayLoggergetLoggerFromTableDefinition(com.fishlib.io.logger.Logger log, TableDefinition tableDefinition, boolean generateLogCalls) Generate the IntradayLogger class from a table definition.static <T extends com.illumon.intradaylogger.IntradayLogger>
TgetLoggerFromTableDefinition(com.fishlib.io.logger.Logger log, TableDefinition tableDefinition, Class<T> loggerType, boolean generateLogCalls) Delegate togetLoggerFromTableDefinition(Logger, TableDefinition, boolean)and then verify the returned value against the given loggerType.static List<LoggerListenerGenerationInfo>getLoggerListenerList(org.jdom2.Element tableElement, boolean relaxedChecking) Retrieve the Logger/Listener listener blocks from a table.static StringgetModuleName(String className, String loggerPackage) static StringgetModuleName(String javaGenerationDirectory, String className, String loggerPackage) static com.illumon.intradaylogger.IntradayLoggergetPrecompiledLogger(SchemaService schemaService, String namespace, String tableName) Deprecated.static StringgetTableListenerPackage(String namespace, org.jdom2.Element listenerElement) Get the listenerPackage attribute, or fabricate one (from properties) if it is not found.static voidstatic <LISTENER_TYPE extends BatchedImportRowBufferProcessor>
LISTENER_TYPEmakeBatchedImportRowBufferProcessor(SchemaXml schema, TableDefinition tableDefinition, int applicationVersion, int rowBatchCapacity, int parallelism) static <LISTENER_TYPE extends BatchedImportRowBufferProcessor>
LISTENER_TYPEmakeBatchedImportRowBufferProcessor(SchemaXml schema, TableDefinition tableDefinition, int applicationVersion, int rowBatchCapacity, int parallelism, com.fishlib.io.logger.Logger log) static LoggerListenerGenerationInfomakeDefaultLoggerListener(org.jdom2.Element tableElement) Generate as generic logger and listener block from this table element, for use as a default starting point in the schema editor.static TableListenermakeSingleRowTableListener(SchemaXml schema, TableDefinition tableDefinition, int applicationVersion) static TableListenermakeSingleRowTableListener(SchemaXml schema, TableDefinition tableDefinition, int applicationVersion, com.fishlib.io.logger.Logger log) static SchemaServicesetDefaultService(SchemaService service) voidsetJavaGenerationDirectory(String javaGenerationDirectory)
-
Field Details
-
GENERATE_LISTENER_ATTRIBUTE
Deprecated.- See Also:
-
-
Constructor Details
-
IntradayLoggerFactory
public IntradayLoggerFactory(com.fishlib.io.logger.Logger log, @NotNull String copyrightNotice, SchemaService schemaService) -
IntradayLoggerFactory
public IntradayLoggerFactory(com.fishlib.io.logger.Logger log, com.fishlib.configuration.Configuration configuration, @NotNull String copyrightNotice, SchemaService schemaService) -
IntradayLoggerFactory
public IntradayLoggerFactory()
-
-
Method Details
-
setJavaGenerationDirectory
-
generateTableListener
- Throws:
IOExceptionClassNotFoundException
-
generateTableListener
public void generateTableListener(org.jdom2.Element tableElement, String packageName) throws IOException - Throws:
IOException
-
getTableListenerPackage
Get the listenerPackage attribute, or fabricate one (from properties) if it is not found.- Parameters:
namespace- use this namespace to generate the listenerPackage value if the attribute is not setlistenerElement- the listener element- Returns:
- the listener package value
-
getLoggerListenerList
public static List<LoggerListenerGenerationInfo> getLoggerListenerList(org.jdom2.Element tableElement, boolean relaxedChecking) Retrieve the Logger/Listener listener blocks from a table.- Parameters:
relaxedChecking- when loading intermediate states; we may want to be more tolerant of certain errors in the XML Document- ApiNote:
- This function is not part of the stable Illumon API; and is subject to change or removal. User code should never reference getLoggerListenerList.
-
makeDefaultLoggerListener
public static LoggerListenerGenerationInfo makeDefaultLoggerListener(org.jdom2.Element tableElement) Generate as generic logger and listener block from this table element, for use as a default starting point in the schema editor.- Parameters:
tableElement- the XML element of the table we are going to generate a default LoggerListener for- Returns:
- a new LoggerListenerGenerationInfo
- ApiNote:
- This function is not part of the stable Illumon API; and is subject to change or removal. User code should never reference makeDefaultLoggerListener.
-
getLoggerFromTableDefinition
public static <T extends com.illumon.intradaylogger.IntradayLogger> T getLoggerFromTableDefinition(com.fishlib.io.logger.Logger log, TableDefinition tableDefinition, Class<T> loggerType, boolean generateLogCalls) Delegate togetLoggerFromTableDefinition(Logger, TableDefinition, boolean)and then verify the returned value against the given loggerType.- Parameters:
log- the Logger instance to log messages during class generationtableDefinition- the table definitionloggerType- the expected class type of the generated loggergenerateLogCalls- if true, generate the log(...) calls, if false then don't generate these calls- Returns:
- the generated IntradayLogger, cast to type T
-
getLoggerFromTableDefinition
public static com.illumon.intradaylogger.IntradayLogger getLoggerFromTableDefinition(com.fishlib.io.logger.Logger log, TableDefinition tableDefinition, boolean generateLogCalls) Generate the IntradayLogger class from a table definition.- Parameters:
log- the Logger instance to log messages during class generationtableDefinition- the table definitiongenerateLogCalls- if true, generate the log(...) calls, if false then don't generate these calls- Returns:
- the generated IntradayLogger
-
getListener
public static TableListener getListener(com.fishlib.io.logger.Logger log, TableDefinition tableDefinition) Generate a TableListener class from the given TableDefinition.- Parameters:
log- the Logger instance to log messages during class generationtableDefinition- the table definition- Returns:
- the TableListener class
-
getPrecompiledLogger
@Deprecated public static com.illumon.intradaylogger.IntradayLogger getPrecompiledLogger(SchemaService schemaService, String namespace, String tableName) throws ClassNotFoundException, IllegalAccessException, InstantiationException Deprecated. -
getLoggerChecksum
-
getLoggerChecksum
-
getLoggerClass
Get the listener class attribute from the listener element, or make up a default one using the tableName.- Parameters:
element- the listener elementtableName- the table name containing the element- Returns:
- the listenerClass value
-
getListenerClass
Get the listener class attribute from the listener element, or make up a default one using the tableName.- Parameters:
element- the listener elementtableName- the table name containing the element- Returns:
- the listenerClass value
-
getLoggerBody
-
getAdoGetter
-
getColumnNames
-
getInputToTypeMeta
-
generateLogger
- Throws:
IOExceptionClassNotFoundException
-
getModuleName
-
getModuleName
-
main
- Throws:
ClassNotFoundExceptionIOException
-
setDefaultService
-
makeSingleRowTableListener
public static TableListener makeSingleRowTableListener(@NotNull SchemaXml schema, @NotNull TableDefinition tableDefinition, int applicationVersion) -
makeSingleRowTableListener
public static TableListener makeSingleRowTableListener(@NotNull SchemaXml schema, @NotNull TableDefinition tableDefinition, int applicationVersion, @Nullable com.fishlib.io.logger.Logger log) -
makeBatchedImportRowBufferProcessor
public static <LISTENER_TYPE extends BatchedImportRowBufferProcessor> LISTENER_TYPE makeBatchedImportRowBufferProcessor(@NotNull SchemaXml schema, @NotNull TableDefinition tableDefinition, int applicationVersion, int rowBatchCapacity, int parallelism) -
makeBatchedImportRowBufferProcessor
public static <LISTENER_TYPE extends BatchedImportRowBufferProcessor> LISTENER_TYPE makeBatchedImportRowBufferProcessor(@NotNull SchemaXml schema, @NotNull TableDefinition tableDefinition, int applicationVersion, int rowBatchCapacity, int parallelism, @Nullable com.fishlib.io.logger.Logger log) -
getCompilerContext
public static com.illumon.compilertools.CompilerTools.Context getCompilerContext()Retrieve the compiler context for logger and listener compilations.- Returns:
- the compiler context used for compilations.
-