DSIMessageSource Class Reference

This class represents an XML reader for a file message source that can be reused provided the XML file follows the standard format. More...

Inherits Simba::Support::IMessageSource, and Simba::Support::SimbaSettingReader::Listener.

List of all members.

Public Member Functions

 DSIMessageSource (bool in_isConcatVendorString=true)
 Constructor.
virtual simba_int32 GetNativeErrorCode (const simba_wstring &in_messageID, simba_int32 in_sourceComponentID)
 Returns the native error code for the given message.
void LoadMessage (const simba_string &in_locale, const simba_wstring &in_messageID, simba_int32 in_sourceComponentID, const std::vector< simba_wstring > &in_messageParams, simba_wstring &out_message, simba_int32 &out_nativeErrCode)
 Retrieves the specified message with its associated error code.
void LoadMessage (const simba_string &in_locale, const simba_wstring &in_messageID, simba_int32 in_sourceComponentID, const std::vector< simba_wstring > &in_messageParams, simba_wstring &out_message)
 Retrieves the specified message with its associated error code.
void LoadMessage (const simba_string &in_locale, const simba_wstring &in_messageID, simba_int32 in_sourceComponentID, simba_wstring &out_message, simba_int32 &out_nativeErrCode)
 Retrieves the specified message with its associated error code.
void LoadMessage (const simba_string &in_locale, const simba_wstring &in_messageID, simba_int32 in_sourceComponentID, simba_wstring &out_message)
 Retrieves the specified message with its associated error code.
void RegisterMessages (const simba_string &in_fileName, simba_int32 in_componentId)
 Registers the given error messages file for handling by DSIMessageSource.
void RegisterMessages (const simba_string &in_fileName, const std::vector< simba_int32 > &in_componentIds)
 Registers the given error messages file for handling by DSIMessageSource.
void SetComponentName (simba_int32 in_componentID, const simba_wstring &in_componentName)
 Override the name used for a component.
void SetVendorName (const simba_wstring &in_vendorName)
 Sets the vendor name that will be prefixed to the beginning of all messages using the format [Vendor Name][Component Name]Message.
void SetVendorStringPrefixed (bool in_isConcatVendorString)
 Forwards to the MessageManager whether to use vendor name in message strings.
virtual ~DSIMessageSource ()
 Destructor.

Protected Member Functions

simba_wstring GetParameterizedMessage (const simba_wstring &in_message, const std::vector< simba_wstring > &in_messageParams) const
 Replaces the parameter identifiers in the message that has been parsed with the values from in_messageParams.

Protected Attributes

AutoPtr< DSIMessageManagerm_messageManager

Detailed Description

This class represents an XML reader for a file message source that can be reused provided the XML file follows the standard format.

DSIMessageSource is designed to seamlessly support localization. Subclasses that have a custom error messages file that follows the same standard format that the SDK error messages uses can take advantage of the localization and caching capabilities of this class.

For example, if you have a custom error messages file called CBMessages, you can RegisterMessages("CBMessages"). NOTE that the ".xml" suffix is not included when registering the name.

The SDK supports two common standards for organizing error message files.

1) Error message files are in subdirectories, with the locale as the name. This is the standard that the SEN SDK uses for its error messages.

2) Error message files have the locale as a suffix and all message files are stored under one directory.

To take advantage of localization, the custom error messages file _MUST_ follow the same xml layout and format as the SDK error messages and use one of the two standards specified above. See <install_dir>\SimbaEngineSDK\10.x\DataAccessComponents\Error Messages.

NOTE that all locales _MUST_ follow the conventions defined in LocaleDefns.h.


Constructor & Destructor Documentation

DSIMessageSource ( bool  in_isConcatVendorString = true  ) 

Constructor.

Parameters:
in_isConcatVendorString True if concatenating the vendor string; false otherwise.
virtual ~DSIMessageSource (  )  [virtual]

Destructor.


Member Function Documentation

virtual simba_int32 GetNativeErrorCode ( const simba_wstring in_messageID,
simba_int32  in_sourceComponentID 
) [virtual]

Returns the native error code for the given message.

Parameters:
in_messageID Unique message identifier.
in_sourceComponentID Source component identifier.
Returns:
The native error code for the given message, DSI_INVALID_ERRORCODE if the message was not found.
simba_wstring GetParameterizedMessage ( const simba_wstring in_message,
const std::vector< simba_wstring > &  in_messageParams 
) const [protected]

Replaces the parameter identifiers in the message that has been parsed with the values from in_messageParams.

Parameters:
in_message The message to be parameterized.
in_messageParams Parameters used to fill in the message.
Returns:
The completed message string.
void LoadMessage ( const simba_string &  in_locale,
const simba_wstring in_messageID,
simba_int32  in_sourceComponentID,
const std::vector< simba_wstring > &  in_messageParams,
simba_wstring out_message,
simba_int32 &  out_nativeErrCode 
)

Retrieves the specified message with its associated error code.

Parameters:
in_locale The locale.
in_messageID Unique message identifier.
in_sourceComponentID Source component identifier.
in_messageParams Parameters used to fill in the message.
out_message The message for the given message and component ID.
out_nativeErrCode The error code for the given message and component ID.
void LoadMessage ( const simba_string &  in_locale,
const simba_wstring in_messageID,
simba_int32  in_sourceComponentID,
const std::vector< simba_wstring > &  in_messageParams,
simba_wstring out_message 
)

Retrieves the specified message with its associated error code.

Parameters:
in_locale The locale.
in_messageID Unique message identifier.
in_sourceComponentID Source component identifier.
in_messageParams Parameters used to fill in the message.
out_message The message for the given message and component ID.
void LoadMessage ( const simba_string &  in_locale,
const simba_wstring in_messageID,
simba_int32  in_sourceComponentID,
simba_wstring out_message,
simba_int32 &  out_nativeErrCode 
)

Retrieves the specified message with its associated error code.

Parameters:
in_locale The locale.
in_messageID Unique message identifier.
in_sourceComponentID Source component identifier.
out_message The message for the given message and component ID.
out_nativeErrCode The error code for the given message and component ID.
void LoadMessage ( const simba_string &  in_locale,
const simba_wstring in_messageID,
simba_int32  in_sourceComponentID,
simba_wstring out_message 
)

Retrieves the specified message with its associated error code.

Parameters:
in_locale The locale.
in_messageID Unique message identifier.
in_sourceComponentID Source component identifier.
out_message The message for the given message and component ID.
void RegisterMessages ( const simba_string &  in_fileName,
simba_int32  in_componentId 
)

Registers the given error messages file for handling by DSIMessageSource.

By default, DSIMessageSource manages the following error message files: ODBCMessages.xml SQLEngineMessages.xml CSCommonMessages.xml ServerMessages.xml

If an error message file has the same format as one of the above files, perform the following:

1) For your DSIDriver implementation, create an instance of DSIMessageSource. 2) Call RegisterMessages() to register your messages for handling by DSIMessageSource. 3) For DSIDriver::GetMessageSource(), return this instance of DSIMessageSource.

NOTES: Your component ids _MUST NOT_ have the same value as one of the component ids defined in SimbaErrorCodes.h.

Parameters:
in_fileName The name of the XML error messages file to open, with no path and no .xml suffix. This fileName should be in the path specified by the ErrorMessagesPath driver setting.
in_componentId The single component id contained in the given file.
void RegisterMessages ( const simba_string &  in_fileName,
const std::vector< simba_int32 > &  in_componentIds 
)

Registers the given error messages file for handling by DSIMessageSource.

By default, DSIMessageSource manages the following error message files: ODBCMessages.xml SQLEngineMessages.xml CSCommonMessages.xml ServerMessages.xml

If an error message file has the same format as one of the above files, perform the following:

1) For your DSIDriver implementation, create an instance of DSIMessageSource. 2) Call RegisterMessages() to register your messages for handling by DSIMessageSource. 3) For DSIDriver::GetMessageSource(), return this instance of DSIMessageSource.

NOTES: Your component ids _MUST NOT_ have the same value as one of the component ids defined in SimbaErrorCodes.h.

Parameters:
in_fileName The name of the XML error messages file to open, with no path and no .xml suffix. This fileName should be in the path specified by the ErrorMessagesPath driver setting.
in_componentIds A list of component ids contained in the given file.
void SetComponentName ( simba_int32  in_componentID,
const simba_wstring in_componentName 
)

Override the name used for a component.

Parameters:
in_componentID The component ID for the component who's name to override.
in_componentName The new name for the component.
void SetVendorName ( const simba_wstring in_vendorName  ) 

Sets the vendor name that will be prefixed to the beginning of all messages using the format [Vendor Name][Component Name]Message.

This function should be called upon construction of a new DSIMessageSource. If the vendor name is not set, the value will default to "Simba".

Parameters:
in_vendorName Vendor name to use as a prefix.
void SetVendorStringPrefixed ( bool  in_isConcatVendorString  ) 

Forwards to the MessageManager whether to use vendor name in message strings.

Parameters:
in_isConcatVendorString Whether to use the vendor name.

Member Data Documentation


The documentation for this class was generated from the following file:

Generated on Wed May 17 14:21:15 2017 for SimbaEngine 10.1.3.1011 by simba