version 1.1, 2005/02/14 21:15:34
|
version 1.3, 2005/05/20 21:09:46
|
|
|
#include <Pegasus/Common/CIMType.h> | #include <Pegasus/Common/CIMType.h> |
#include <Pegasus/Common/IndicationFormatter.h> | #include <Pegasus/Common/IndicationFormatter.h> |
| |
#if defined(PEGASUS_USE_SYSLOGS) |
|
#include <syslog.h> |
|
#endif |
|
|
|
#include "SystemLogListenerDestination.h" | #include "SystemLogListenerDestination.h" |
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
|
|
| |
String ident_name = "CIM Indication"; | String ident_name = "CIM Indication"; |
String indicationText; | String indicationText; |
String textFormat = String::EMPTY; |
|
CIMValue textFormatValue; |
|
CIMValue textFormatParamsValue; |
|
|
|
Array<String> textFormatParams = NULL; |
|
| |
try | try |
{ | { |
// get TextFormat from subscription |
// gets formatted indication message |
Uint32 textFormatPos = |
indicationText = IndicationFormatter::getFormattedIndText( |
subscription.findProperty(_PROPERTY_TEXTFORMAT); |
subscription, indication, contentLanguages); |
|
|
// if the property TextFormat is not found, |
|
// indication is constructed with default format |
|
if (textFormatPos == PEG_NOT_FOUND) |
|
{ |
|
indicationText = IndicationFormatter::formatDefaultIndicationText |
|
(indication); |
|
} |
|
else |
|
{ |
|
textFormatValue = subscription.getProperty(textFormatPos). |
|
getValue(); |
|
|
|
// if the value of textFormat is NULL, |
|
// indication is constructed with default format |
|
if (textFormatValue.isNull()) |
|
{ |
|
indicationText = |
|
IndicationFormatter::formatDefaultIndicationText(indication); |
|
} |
|
else |
|
{ |
|
// get TextFormatParameters from subscription |
|
Uint32 textFormatParamsPos = subscription.findProperty( |
|
_PROPERTY_TEXTFORMATPARAMETERS); |
|
|
|
if (textFormatParamsPos != PEG_NOT_FOUND) |
|
{ |
|
textFormatParamsValue = subscription.getProperty( |
|
textFormatParamsPos).getValue(); |
|
} |
|
|
|
// constructs indication with specified format |
|
if ((textFormatValue.getType() == CIMTYPE_STRING) && |
|
!(textFormatValue.isArray())) |
|
{ |
|
textFormatValue.get(textFormat); |
|
if (!textFormatParamsValue.isNull()) |
|
{ |
|
if ((textFormatParamsValue.getType() == |
|
CIMTYPE_STRING) && |
|
(textFormatParamsValue.isArray())) |
|
{ |
|
textFormatParamsValue.get(textFormatParams); |
|
} |
|
} |
|
|
|
indicationText = IndicationFormatter::formatIndicationText |
|
(textFormat, |
|
textFormatParams, |
|
indication, |
|
contentLanguages); |
|
} |
|
else |
|
{ |
|
indicationText = |
|
IndicationFormatter::formatDefaultIndicationText( |
|
indication); |
|
} |
|
} |
|
} |
|
| |
// default severity | // default severity |
Uint32 severity = Logger::INFORMATION; | Uint32 severity = Logger::INFORMATION; |
|
|
| |
#if defined(PEGASUS_USE_SYSLOGS) | #if defined(PEGASUS_USE_SYSLOGS) |
| |
// Open the syslog |
System::syslog(identifier, severity, formattedText.getCString()); |
System::openlog(identifier); |
|
|
|
System::syslog(severity, (const char *)formattedText.getCString()); |
|
|
|
// Close the syslog |
|
System::closelog(); |
|
| |
#else | #else |
| |