Platform SDK Java 8.5 API Reference

com.genesyslab.platform.apptemplate.lmslogger
Class LmsMessageConveyor

java.lang.Object
  extended by com.genesyslab.platform.apptemplate.lmslogger.LmsMessageConveyor
All Implemented Interfaces:
java.lang.Cloneable

public class LmsMessageConveyor
extends java.lang.Object
implements java.lang.Cloneable

Container of LMS events templates with correspondent LMS file(s) localization.

Usual application configuration supposes to have one instance of LmsMessageConveyor.
It should be created on application start and used for initialization of static LmsLoggerFactory instance with LmsLoggerFactory.createInstance(LmsMessageConveyor).

It is possible to reconfigure active LmsMessageConveyor in runtime, or create new instance and reinitialize static LmsLoggerFactory with it.

See Also:
LmsLoggerFactory, LmsLoggerFactory.createInstance(LmsMessageConveyor), newBuilder(), LmsMessageConveyor.Builder

Nested Class Summary
static class LmsMessageConveyor.Builder
          Builder for LmsMessageConveyor component.
protected static class LmsMessageConveyor.UnknownLmsEvent
          Internal class to represent "unknown" LMS log events.
 
Field Summary
static java.lang.String DEFAULT_MESSAGEFILE_VALUE
           
static java.lang.String LEVEL_REASSIGN_DISABLE_EXT_OPT
          Deprecated.  
static java.lang.String LEVEL_REASSIGN_OPT_PREFIX
          Deprecated.  
static java.lang.String MESSAGEFILE_PROPERTY_NAME
           
 
Constructor Summary
  LmsMessageConveyor()
          Default constructor of LMS events conveyor.
It loads common LMS events templates enumeration CommonLmsEnum, and available generated users' enumerations handled with the AppTemplate annotations processor.
  LmsMessageConveyor(java.lang.Class<E1> enum1)
          Creates LMS messages conveyor by specified templates enumeration.
  LmsMessageConveyor(java.lang.Class<E1> enum1, java.lang.Class<E2> enum2)
          Creates LMS messages conveyor by specified templates enumerations.
protected LmsMessageConveyor(java.util.List<java.lang.Class<?>> lmsEnums, java.lang.Boolean allowUnknownEvents)
          Internal constructor for the conveyor builder.
 
Method Summary
 LmsMessageConveyor clone()
           
protected  LmsMessageTemplate getDefaultEvent(int key, LmsLogLevel level, java.lang.Object... args)
          Internal method to handle "unknown" LMS log event.
 LmsMessageTemplate getLmsEvent(java.lang.Integer key, java.lang.Object... args)
          Returns LMS event definition (template) from the conveyor configuration.
 LmsMessageTemplate getLmsEvent(LmsMessageTemplate key)
          Returns LMS event definition (template) from the conveyor configuration.
 LmsMessageConveyor loadConfiguration(GAppLoggingOptions logOptions)
          Loads and initializes conveyor configuration based on "log" and "log-extended" sections of configuration server application object options.
 LmsMessageConveyor loadConfiguration(IGApplicationConfiguration appConfig)
          Loads and initializes conveyor configuration based on "log" and "log-extended" sections of configuration server application object options.
 LmsMessageConveyor loadConfiguration(KeyValueCollection optsLog, KeyValueCollection optsLogExt)
          Loads and initializes conveyor configuration based on "log" and "log-extended" sections of configuration server application object options.
 LmsMessageConveyor loadConfiguration(java.lang.String messagefiles)
          Loads content and initializes messages IDs mapping of given LMS files.
 LmsMessageConveyor loadConfiguration(java.lang.String messagefiles, java.util.Map<java.lang.Integer,LmsLogLevel> levelsReassign)
          Loads content and initializes messages IDs mapping of given LMS files.
static LmsMessageConveyor.Builder newBuilder()
          Creates and returns new instance of LmsMessageConveyor builder.
protected  LmsFileData readLmsFile(java.lang.String lmsfile)
          Reads single LMS file.
protected  java.util.List<LmsFileData> readLmsFiles(java.lang.String messagefile)
          Reads application LMS file(s).
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MESSAGEFILE_PROPERTY_NAME

public static final java.lang.String MESSAGEFILE_PROPERTY_NAME
See Also:
Constant Field Values

DEFAULT_MESSAGEFILE_VALUE

public static final java.lang.String DEFAULT_MESSAGEFILE_VALUE
See Also:
Constant Field Values

LEVEL_REASSIGN_OPT_PREFIX

@Deprecated
public static final java.lang.String LEVEL_REASSIGN_OPT_PREFIX
Deprecated. 
See Also:
GAppLogExtOptions, GAppLogExtOptions.LEVEL_REASSIGN_OPT_PREFIX, Constant Field Values

LEVEL_REASSIGN_DISABLE_EXT_OPT

@Deprecated
public static final java.lang.String LEVEL_REASSIGN_DISABLE_EXT_OPT
Deprecated. 
See Also:
GAppLogExtOptions, GAppLogExtOptions.LEVEL_REASSIGN_DISABLE_EXT_OPT, Constant Field Values
Constructor Detail

LmsMessageConveyor

public LmsMessageConveyor()
Default constructor of LMS events conveyor.
It loads common LMS events templates enumeration CommonLmsEnum, and available generated users' enumerations handled with the AppTemplate annotations processor.

See Also:
newBuilder()

LmsMessageConveyor

public LmsMessageConveyor(java.lang.Class<E1> enum1)
Creates LMS messages conveyor by specified templates enumeration.

Note: If an application uses own LMS events enumeration and needs to use common CommonLmsEnum as well, it is required to create conveyor specifying all of the enumerations classes including CommonLmsEnum.class.
For example:
LmsMessageConveyor lmsEvents = new LmsMessageConveyor(MyAppLmsEnum.class, CommonLmsEnum.class);

Parameters:
enum1 - class of LmsMessageTemplate based enumeration.
See Also:
newBuilder()

LmsMessageConveyor

public LmsMessageConveyor(java.lang.Class<E1> enum1,
                          java.lang.Class<E2> enum2)
Creates LMS messages conveyor by specified templates enumerations.

Note: If an application uses own LMS events enumeration(-s) and needs to use common CommonLmsEnum as well, it is required to create conveyor specifying all of the enumerations classes including CommonLmsEnum.class.
For example:
LmsMessageConveyor lmsEvents = new LmsMessageConveyor(MyAppLmsEnum.class, CommonLmsEnum.class);

Parameters:
enum1 - class of generated LmsMessageTemplate based enumeration.
enum2 - other class of generated LmsMessageTemplate based enumeration.
See Also:
newBuilder()

LmsMessageConveyor

protected LmsMessageConveyor(java.util.List<java.lang.Class<?>> lmsEnums,
                             java.lang.Boolean allowUnknownEvents)
Internal constructor for the conveyor builder.

See Also:
newBuilder()
Method Detail

newBuilder

public static LmsMessageConveyor.Builder newBuilder()
Creates and returns new instance of LmsMessageConveyor builder.

Returns:
New instance of the builder.
See Also:
LmsMessageConveyor.Builder

clone

public LmsMessageConveyor clone()
Overrides:
clone in class java.lang.Object

loadConfiguration

public LmsMessageConveyor loadConfiguration(IGApplicationConfiguration appConfig)
Loads and initializes conveyor configuration based on "log" and "log-extended" sections of configuration server application object options.

Parameters:
appConfig - the application configuration.
Returns:
Reference to itself.
Throws:
java.lang.NullPointerException - if given application configuration is null, or it does not contain "log" section.

loadConfiguration

public LmsMessageConveyor loadConfiguration(KeyValueCollection optsLog,
                                            KeyValueCollection optsLogExt)
Loads and initializes conveyor configuration based on "log" and "log-extended" sections of configuration server application object options.

Parameters:
optsLog - "log" section of the application options.
optsLogExt - "log-extended" section of the application options.
Returns:
Reference to itself.

loadConfiguration

public LmsMessageConveyor loadConfiguration(GAppLoggingOptions logOptions)
Loads and initializes conveyor configuration based on "log" and "log-extended" sections of configuration server application object options.

Parameters:
logOptions - the logging configuration options of the application options.
Returns:
Reference to itself.
Throws:
java.lang.NullPointerException - if given logging options parameter is null.

loadConfiguration

public LmsMessageConveyor loadConfiguration(java.lang.String messagefiles)
Loads content and initializes messages IDs mapping of given LMS files.

Parameters:
messagefiles - LMS files names separated with semicolon, empty string; or null.
Returns:
Reference to itself.
See Also:
loadConfiguration(String, Map)

loadConfiguration

public LmsMessageConveyor loadConfiguration(java.lang.String messagefiles,
                                            java.util.Map<java.lang.Integer,LmsLogLevel> levelsReassign)
Loads content and initializes messages IDs mapping of given LMS files.

Parameters:
messagefiles - LMS file names separated with semicolon, empty string or null.
levelsReassign - map with events levels reassignments or null.
Returns:
Reference to itself.

readLmsFiles

protected java.util.List<LmsFileData> readLmsFiles(java.lang.String messagefile)
Reads application LMS file(s). Beside the given LMS files list, at the first it tries to read "common.lms".

Parameters:
messagefile - name(s) of LMS files to read (comma separated list).
Returns:
list of successfully read LMS events declarations.

readLmsFile

protected LmsFileData readLmsFile(java.lang.String lmsfile)
Reads single LMS file.

Parameters:
lmsfile - the name of LMS file.
Returns:
Parsed LMS file data, or null if LMS file does not contain valid events declarations, or there was an exception while reading it.

getLmsEvent

public LmsMessageTemplate getLmsEvent(LmsMessageTemplate key)
Returns LMS event definition (template) from the conveyor configuration.

Parameters:
key - the LMS event ID.
Returns:
LMS event template from the conveyor LMS declarations or null.
Throws:
java.lang.NullPointerException - if given key parameter value is null.

getLmsEvent

public LmsMessageTemplate getLmsEvent(java.lang.Integer key,
                                      java.lang.Object... args)
Returns LMS event definition (template) from the conveyor configuration.

Parameters:
key - the LMS event ID.
args - the LMS event parameters.
Returns:
LMS event template or null.
Throws:
java.lang.NullPointerException - if given key parameter value is null.
java.lang.IllegalArgumentException - if no such event declared and unknown events are disallowed.
See Also:
LmsMessageConveyor.Builder.allowUnknownMessages(Boolean)

getDefaultEvent

protected LmsMessageTemplate getDefaultEvent(int key,
                                             LmsLogLevel level,
                                             java.lang.Object... args)
Internal method to handle "unknown" LMS log event.

Parameters:
key - the event ID which was not found in the conveyor configuration.
level - the LMS event level of the message.
args - the parameters of the LMS log event.
Returns:
"unknown" event template or null.
Throws:
java.lang.IllegalArgumentException - if unknown events are disallowed.
See Also:
LmsMessageConveyor.Builder.allowUnknownMessages(Boolean)

Platform SDK Java 8.5 API Reference

Send comments on this topicTechpubs.webadmin@genesys.com.
Document version: 8.5.302.00
Copyright © 2006–2017 Genesys Telecommunications Laboratories, Inc. All rights reserved.