Class IntradayLoggerFactory
java.lang.Object
com.illumon.iris.db.tables.dataimport.IntradayLoggerFactory
public class IntradayLoggerFactory extends Object
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 Modifier and Type Field Description static com.illumon.compilertools.CompilerTools.Context
COMPILER_CONTEXT
CompilerTools.Context
used for compilations within the IntradayLoggerFactory, public for use by related classes.static String
GENERATE_LISTENER_ATTRIBUTE
Deprecated. -
Constructor Summary
Constructors Constructor Description IntradayLoggerFactory()
IntradayLoggerFactory(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 Type Method Description void
generateLogger(SchemaXml schema)
void
generateTableListener(SchemaXml schema)
void
generateTableListener(org.jdom2.Element tableElement, String packageName)
static String
getAdoGetter(com.fishlib.dataobjects.WColumn column)
static String
getColumnNames(LoggerListenerGenerationInfo generationInfo)
static Map<String,Object>
getInputToTypeMeta(org.jdom2.Element tableDefinition)
static TableListener
getListener(com.fishlib.io.logger.Logger log, TableDefinition tableDefinition)
Generate a TableListener class from the given TableDefinition.static String
getListenerClass(org.jdom2.Element element, String tableName)
Get the listener class attribute from the listener element, or make up a default one using the tableName.String
getLoggerBody(org.jdom2.Element tableElement)
long
getLoggerChecksum(String schemaStr, String loggerClass)
long
getLoggerChecksum(String namespace, String tableName, String loggerClass)
static String
getLoggerClass(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.IntradayLogger
getLoggerFromTableDefinition(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 String
getModuleName(String className, String loggerPackage)
static String
getModuleName(String javaGenerationDirectory, String className, String loggerPackage)
static com.illumon.intradaylogger.IntradayLogger
getPrecompiledLogger(SchemaService schemaService, String namespace, String tableName)
Deprecated.static String
getTableListenerPackage(String namespace, org.jdom2.Element listenerElement)
Get the listenerPackage attribute, or fabricate one (from properties) if it is not found.static void
main(String[] args)
static <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 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.static TableListener
makeSingleRowTableListener(SchemaXml schema, TableDefinition tableDefinition, int applicationVersion)
static TableListener
makeSingleRowTableListener(SchemaXml schema, TableDefinition tableDefinition, int applicationVersion, com.fishlib.io.logger.Logger log)
static SchemaService
setDefaultService(SchemaService service)
void
setJavaGenerationDirectory(String javaGenerationDirectory)
-
Field Details
-
GENERATE_LISTENER_ATTRIBUTE
Deprecated.- See Also:
- Constant Field Values
-
COMPILER_CONTEXT
public static final com.illumon.compilertools.CompilerTools.Context COMPILER_CONTEXTCompilerTools.Context
used for compilations within the IntradayLoggerFactory, public for use by related classes.
-
-
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:
IOException
ClassNotFoundException
-
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, InstantiationExceptionDeprecated. -
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:
IOException
ClassNotFoundException
-
getModuleName
-
getModuleName
-
main
- Throws:
ClassNotFoundException
IOException
-
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)
-