Platform SDK Java 8.5 API Reference

com.genesyslab.platform.logging.utilities
Class MessageTemplateManager

java.lang.Object
  extended by com.genesyslab.platform.commons.log.AbstractLogEnabled
      extended by com.genesyslab.platform.logging.utilities.MessageTemplateManager
All Implemented Interfaces:
ILogEnabled

public final class MessageTemplateManager
extends AbstractLogEnabled

This class loads and parses *.lms files. Note: This class is not synchronized, so the caller is responsible for the access synchronization.


Constructor Summary
MessageTemplateManager()
           
 
Method Summary
 void add(LmsMessageTemplate template)
          Adds the LmsMessageTemplate.
 void clear()
          Clears the loaded Headers and Log Templates.
 boolean containsTemplate(int id)
          Checks if the template with specified ID loaded.
 java.util.Collection<LmsFileHeader> getHeaders()
          The read-only collection of headers of loaded lms files.
 java.util.List<LmsFileHeader> getLoadedHeadersInternal()
           
 LmsFileLoadPolicy getLoadPolicy()
          See LmsFileLoadPolicy which defines the load policy of manager.
 LmsMessageTemplate getTemplate(int id)
          Gets the LmsMessageTemplate with the specified ID.
 java.util.Collection<LmsMessageTemplate> getTemplates()
          The read-only collection of loaded LmsMessageTemplate.
 void loadFrom(java.io.BufferedReader reader)
          Loads the *.lms file header and log templates from the "reader".
 void loadFrom(java.lang.String fileName)
          Parses the *.lms file into the Header and Message templates.
protected  void onEnableLogging(ILogger logger)
          Called when a new logger is provided by user.
 LmsMessageTemplate remove(int id)
          Removes the value with the specified ID.
 void setLoadPolicy(LmsFileLoadPolicy policy)
           
 
Methods inherited from class com.genesyslab.platform.commons.log.AbstractLogEnabled
enableLogging, getLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MessageTemplateManager

public MessageTemplateManager()
Method Detail

onEnableLogging

protected void onEnableLogging(ILogger logger)
Called when a new logger is provided by user.

Overrides:
onEnableLogging in class AbstractLogEnabled
Parameters:
logger - the new logger

getLoadPolicy

public LmsFileLoadPolicy getLoadPolicy()
See LmsFileLoadPolicy which defines the load policy of manager.

Throws:
java.lang.NullPointerException - thrown if attempt to set null as value detected

setLoadPolicy

public void setLoadPolicy(LmsFileLoadPolicy policy)

getHeaders

public java.util.Collection<LmsFileHeader> getHeaders()
The read-only collection of headers of loaded lms files.


getLoadedHeadersInternal

public java.util.List<LmsFileHeader> getLoadedHeadersInternal()

getTemplates

public java.util.Collection<LmsMessageTemplate> getTemplates()
The read-only collection of loaded LmsMessageTemplate.


loadFrom

public void loadFrom(java.lang.String fileName)
              throws LoggerException
Parses the *.lms file into the Header and Message templates.

Parameters:
fileName - the file to load
Throws:
LoggerException

loadFrom

public void loadFrom(java.io.BufferedReader reader)
              throws LoggerException
Loads the *.lms file header and log templates from the "reader".

Parameters:
reader - the source to be read
Throws:
LoggerException - If reader does not contain the valid lms file header (should be first string).

getTemplate

public LmsMessageTemplate getTemplate(int id)
Gets the LmsMessageTemplate with the specified ID.

Parameters:
id - The ID of LmsMessageTemplate.
Returns:
Found LmsMessageTemplate.
Throws:
java.lang.IllegalArgumentException - If the LmsMessageTemplate with specified ID not found.

containsTemplate

public boolean containsTemplate(int id)
Checks if the template with specified ID loaded.

Parameters:
id - ID of template to check.
Returns:
True, if template with specified ID loaded; otherwise False.

add

public void add(LmsMessageTemplate template)
Adds the LmsMessageTemplate.

Parameters:
template - Template to add.
Throws:
java.lang.IllegalArgumentException - Thrown if template with specified ID was already loaded.

remove

public LmsMessageTemplate remove(int id)
Removes the value with the specified ID.

Parameters:
id - ID of template to remove.
Returns:
Previous value associated with specified ID, or null if there was no mapping for ID.

clear

public void clear()
Clears the loaded Headers and Log Templates.


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.