New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added support to QOS_XML_Handler to parse a string #2439
Conversation
… parsing xml from memory buffer
…cludes, tests), wrong class name in messages, removed virtual from inherited class and changed const char* to ACE_TCHAR in test
@@ -4,6 +4,7 @@ | |||
* | |||
* | |||
* @author Marcel Smit (msmit@remedy.nl) | |||
* @2nd author Danilo C. Zanella (dczanella@gmail.com) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use @author
, @2nd
is not a valid doxygten tag
@@ -29,7 +31,8 @@ OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL | |||
namespace OpenDDS { | |||
namespace DCPS { | |||
|
|||
class OpenDDS_XML_QOS_Handler_Export QOS_XML_File_Handler | |||
class OpenDDS_XML_QOS_Handler_Export QOS_XML_File_Handler : | |||
virtual public QOS_XML_Handler |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it need to be virtual?
|
||
DDS::ReturnCode_t | ||
QOS_XML_Handler::get_datareader_qos(::DDS::DataReaderQos& dr_qos, | ||
const ACE_TCHAR * profile_name, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct indentation of the arguments, all functions
@@ -0,0 +1,228 @@ | |||
|
|||
#include "XML_MemBuf_Intf.h" | |||
//#include "ace/XML_Utils/XML_Typedefs.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove commented out includes
QOS_XML_Handler(), | ||
res_(new XML::XML_Schema_Resolver<XML::Environment_Resolver>()), | ||
eh_(new XML::XML_Error_Handler()) | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initialise parser_ with 0
|
||
//// Check for errors | ||
//if (eh_->getErrors()) | ||
//{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove commented out code
if (DCPS_debug_level > 1) | ||
{ | ||
ACE_ERROR ((LM_ERROR, | ||
ACE_TEXT ("QOS_XML_Stream_Handler::init - ") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrong classname
catch (...) | ||
{ | ||
ACE_ERROR ((LM_ERROR, | ||
ACE_TEXT ("QOS_XML_Stream_Handler::init - ") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wrong class name, check all messages
try | ||
{ | ||
// File name and profile name in respective file | ||
const char * fileName = "qos.xml"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should use ACE_TCHAR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got it.
#include "XML_Intf.h" | ||
#include "dds/DdsDcpsInfrastructureC.h" | ||
#include "OpenDDS_XML_QOS_Handler_Export.h" | ||
#include "ace/XML_Utils/XML_Typedefs.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would prefer to extend the forward declared classes below and don't inlcude XM_Utils in the header, let us now expose any internals to the user
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. I did it.
Hi, I need some help to complete the task. Some checks were not successful and it is not clear for me. |
|
||
DDS::ReturnCode_t | ||
QOS_XML_Handler::get_datawriter_qos(::DDS::DataWriterQos& dw_qos, | ||
const ACE_TCHAR * profile_name, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation strange
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi
Could you be more specific?
Thanks
ACE_TEXT ("Exception message is: <%C>\n"), | ||
message)); | ||
XMLString::release(&message); | ||
return DDS::RETCODE_ERROR; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In case of a failure you don't disable ACE::debug
XMLString::release(&message); | ||
} | ||
|
||
DOMNode * clone = finalDoc_->importNode(ddsNode, true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can clone become 0?
|
||
exit 0; | ||
|
||
#eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove commented out code
QOS_XML_Handler::get_datawriter_qos(::DDS::DataWriterQos& dw_qos, | ||
const ACE_TCHAR * profile_name, | ||
const ACE_TCHAR * topic_name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
QOS_XML_Handler::get_datawriter_qos(::DDS::DataWriterQos& dw_qos, | |
const ACE_TCHAR * profile_name, | |
const ACE_TCHAR * topic_name) | |
QOS_XML_Handler::get_datawriter_qos(::DDS::DataWriterQos& dw_qos, | |
const ACE_TCHAR * profile_name, | |
const ACE_TCHAR * topic_name) |
if (DCPS_debug_level > 1) | ||
{ | ||
char* message = XMLString::transcode(ddsNode->getNodeName()); | ||
ACE_ERROR ((LM_INFO, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be ACE_DEBUG for a debug message
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi
I'll do it, but in QOS_XML_Loader.cpp it uses as I did.
Check following code:
DDS::ReturnCode_t
QOS_XML_Loader::init(const ACE_TCHAR* qos_profile)
{
if (!qos_profile)
{
if (DCPS_debug_level > 5)
{
ACE_ERROR((LM_ERROR,
ACE_TEXT("QOS_XML_Loader::init - ")
ACE_TEXT("Passed an empty qos_profile, returning.\n")));
}
Cheers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACE_ERROR is for logging error messages, ACE_DEBUG for debug/info messages, both could be independently enabled/disabled at compilation time
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another question is:
How can i set the DCPS_debug_level variable? I set grater than 1, but is there some policy to do that?
Cheers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When this is an error you should use LM_ERROR instead of LM_INFO
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another question is:
How can i set the DCPS_debug_level variable? I set grater than 1, but is there some policy to do that?
Cheers
See http://download.objectcomputing.com/OpenDDS/OpenDDS-latest.pdf, chapter 7.6.1
if (ACE_OS::strcmp((*it)->name().c_str(), profileName) == 0) { | ||
ACE_DEBUG((LM_DEBUG, | ||
ACE_TEXT("(%P|%t) DEBUG: QOS_XML_Handler::addQoSProfile - ") | ||
ACE_TEXT("Profile exists or profile name in use.\n"))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Log profile name
It was the solution that I found, because those exceptions haven't ever
been launched.
Could you explain to me better how I can do that?
I didn't find any ACE_ERROR/LM_ERROR problem, did you see anything?
…On Sun, 9 May 2021 at 15:37, Johnny Willemsen ***@***.***> wrote:
Instead of enabling/disabling ACE::debug() why not use DCPS_debug_level
as check as we use more in the OpenDDS core? Also check that all error
messages use ACE_ERROR/LM_ERROR
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#2439 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACJHCVVGQL4QSMK3QKCDRALTM3I7JANCNFSM4YCNOODA>
.
--
Danilo C. Zanella
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some minor comments, in general looks ok
++it) | ||
{ | ||
if (ACE_OS::strcmp((*it)->name().c_str(), profileName) == 0) { | ||
ACE_DEBUG((LM_DEBUG, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be an error
} | ||
ACE_DEBUG((LM_DEBUG, | ||
ACE_TEXT("(%P|%t) ERROR: QOS_XML_Handler::delQoSProfile - ") | ||
ACE_TEXT("Profile doesn't exists or wrong profile name.\n"))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error?
{ | ||
if (DCPS_debug_level > 1) | ||
{ | ||
ACE_DEBUG ((LM_DEBUG, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error?
if (ACE_OS::strcmp((*it)->name().c_str(), profileName) == 0) { | ||
if (DCPS_debug_level > 7) | ||
{ | ||
ACE_DEBUG((LM_DEBUG, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACE_DEBUG((LM_DEBUG, | |
ACE_ERROR((LM_ERROR, |
DDS::ReturnCode_t | ||
QOS_XML_Handler::addQoSProfileSeq(const dds::qosProfile_seq & profiles) | ||
{ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove empty lines at the top and bottom of this operation
|
||
if (ACE_OS::strlen(profileName) == 0) | ||
{ | ||
ACE_ERROR((LM_ERROR, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check debug level here for logging
{ | ||
if (DCPS_debug_level > 1) | ||
{ | ||
ACE_DEBUG ((LM_DEBUG, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACE_DEBUG ((LM_DEBUG, | |
ACE_ERROR ((LM_ERROR, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is confusing to me that this feature is for a "memory buffer." In terms the standard library uses this would be a "string," for example stringstream vs. fstream. The public API seems to be the init(const char*)
method.
I didn't catch that. What is your question?
The idea is to manipulate xml from a sequence of chars besides a file.
Cheers
…On Tue, 25 May 2021 at 11:39, Adam Mitz ***@***.***> wrote:
***@***.**** requested changes on this pull request.
It is confusing to me that this feature is for a "memory buffer." In terms
the standard library uses this would be a "string," for example
stringstream vs. fstream. The public API seems to be the init(const char*)
method.
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#2439 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACJHCVTCYDIVOIZ2DVV7YODTPOZDFANCNFSM4YCNOODA>
.
--
Danilo C. Zanella
|
I think it would be more clear for users if the new class was called something like |
Ok. I got it.
I can do it.
…On Tue, 25 May 2021 at 17:02, Adam Mitz ***@***.***> wrote:
I didn't catch that. What is your question? The idea is to manipulate xml
from a sequence of chars besides a file.
I think it would be more clear for users if the new class was called
something like QOS_XML_String_Handler to go with QOS_XML_File_Handler
just like std::stringstream goes with std::fstream.
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#2439 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACJHCVRQWO3MSPGFELTV6QLTPP66XANCNFSM4YCNOODA>
.
--
Danilo C. Zanella
|
Check if there are more changes needed. Thus I do it once.
Cheers
…On Tue, 25 May 2021 at 18:40, Danilo Zanella ***@***.***> wrote:
Ok. I got it.
I can do it.
On Tue, 25 May 2021 at 17:02, Adam Mitz ***@***.***> wrote:
> I didn't catch that. What is your question? The idea is to manipulate xml
> from a sequence of chars besides a file.
>
> I think it would be more clear for users if the new class was called
> something like QOS_XML_String_Handler to go with QOS_XML_File_Handler
> just like std::stringstream goes with std::fstream.
>
> —
> You are receiving this because you modified the open/close state.
> Reply to this email directly, view it on GitHub
> <#2439 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/ACJHCVRQWO3MSPGFELTV6QLTPP66XANCNFSM4YCNOODA>
> .
>
--
Danilo C. Zanella
--
Danilo C. Zanella
|
I think this should be a straightforward renaming. A side effect of doing another push to the branch is that it will re-run CI testing with the latest updates to how we've set up GitHub Actions. |
Hi
That is good news.
Thanks Adam and Johnny, I have learned a lot with you.
I would like to continue contributing with the project. I solved this small
issue that was related to my job.
If there are more things that I could help I'm wondering.
Cheers
…On Thu, 8 Jul 2021 at 10:43, Adam Mitz ***@***.***> wrote:
***@***.**** approved this pull request.
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#2439 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACJHCVSDSMRJD3PIQMHR7CTTWWTRLANCNFSM4YCNOODA>
.
--
Danilo C. Zanella
|
CI checks are currently running on this pull request. Please take a look when those are done running and address any issues related to changes from this PR. There is already one failure in the "lint" check. |
Maybe #2434, also in the QoS code, some new QoS settings can't be done through XML |
Hi there,
I changed/added some files to include a new functionality by module QOS_XML_Handler to parse not only files, but sequence of characters. This code requires xerces-c library to compile as well QOS_XML_Handler. I tested using xerces-c version 3.2.2.
This code should be ported to OpenDDS version 3.13.3.
Cheers