Hi Ken,
Thanks a lot for the response. In the debugger I see the code getting to the
ParentComponent.cpp doMethod...see below
--
if (methodName == "create_child") {
ArgsParentComponentCreate_child ioArgs;
::qpid::types::Variant::Map::const_iterator _i;
if ((_i = inMap.find("childId")) != inMap.end()) {
ioArgs.i_childId = _i->second;
}
status = coreObject->ManagementMethod (METHOD_CREATE_CHILD, ioArgs, text);
outMap["_status_code"] = (uint32_t) status;
outMap["_status_text"] = ::qpid::management::Manageable::StatusText(status,
text);
outMap["childRef"] = ::qpid::types::Variant(ioArgs.o_childRef);
return;
}
--
The line where it says
status = coreObject->ManagementMethod (METHOD_CREATE_CHILD, ioArgs, text);
At this point it returns the status=unknownmethod
Now I see that I'm getting this error because I dont' have an application
level implementation of the create_child method. I have not built any
classes on top of QMF generated managed objects.
I am only trying to model a simple parent child relationship. A single
parent with 0 or more children, and those children also having 0 or more
children. What relationships does QMF model inherently i.e. does not need to
be done by the application?
Thanks.
On Tue, Jul 20, 2010 at 10:50 AM, Ken Giusti <[email protected]> wrote:
> Hi,
>
> > But when I go to run the create_child
> > method
> > it returns: outMap contains status=2 and statusText="UnknownMethod".
> > Why is
> > it an unknown method?
>
> The ParentComponent generated code in ParentComponent.cpp should have a
> method called "doMethod()", which handles the method call on the agent. By
> default, if the method name string passed into this method does not match
> the method name string from the schema definition, doMethod() will return
> that error.
>
> You'll need to take a look - either under a debugger, or by adding log
> messages - at ParentComponent::doMethod() when you invoke your method to see
> the actual method name being passed in.
>
> > Also. in doing some more investigation it
> > appears that
> > in QMF, the object model to support any relationship defined in the
> > schema
> > must be built manually on top of the generated classes i.e. there is
> > no
> > inherent support for this. Is this true?
>
> In most cases, it is true that relationships among the data objects needs
> to be modelled by the application rather than QMF. An example of this would
> be the parent/child relationship given in the qmf-agent example under
> qpid/cpp/examples. Can you explain the specific relationship you are trying
> to model?
>
> > Also, if I am using the
> > Python
> > console classes to access the raw managed objects, it appears that
> > when I
> > query the parent class I would not see the child class. Is this true?
>
> They are independent objects, as far as a QMF query is concerned. This
> relationship would have to be managed by the application. For example, you
> could define a list of child object id's in your parent class. When you
> create a child, your parent's child create method could add the new child's
> object id into that list. Very similar to having the "ParentRef" property
> in the child component class.
>
>
> -K
>
> ----- "QPID User" <[email protected]> wrote:
>
> > Hi all,
> >
> > I am using QMF 2 and I currently have a schema where i have 2 objects
> > defined, a parent and child as follows.
> >
> > <class name="ParentComponent">
> >
> > <property name="parentId" type="int32" access="RC" index="y"/>
> >
> > <property name="parentTypeId" type="int32" access="RC" index="y"/>
> >
> > <property name="Name" type="lstr" access="RO"/>
> >
> > <statistic name="state" type="sstr" desc="Operational state"/>
> >
> > <method name="create_child" desc="Create child object">
> >
> > <arg name="childId" dir="I" type="int32"/>
> >
> > <arg name="childRef" dir="O" type="objId"/>
> >
> > </method>
> >
> > </class>
> >
> >
> >
> > <class name="ChildComponent">
> >
> > <property name="ParentRef" type="objId" references="ParentComponent"
> > access=
> > "RC" index="y" parentRef="y"/>
> >
> > <property name="childId" type="int32" access="RC" index="y"/>
> >
> > <property name="Name" type="lstr" access="RO"/>
> >
> > <statistic name="state" type="sstr" desc="Operational state"/>
> >
> > <method name="delete"/>
> >
> > </class>
> >
> >
> >
> > It successfully generates the necessary managed object files i.e.
> > ParentComponent.h (.cpp) etc. But when I go to run the create_child
> > method
> > it returns: outMap contains status=2 and statusText="UnknownMethod".
> > Why is
> > it an unknown method? Also. in doing some more investigation it
> > appears that
> > in QMF, the object model to support any relationship defined in the
> > schema
> > must be built manually on top of the generated classes i.e. there is
> > no
> > inherent support for this. Is this true? Also, if I am using the
> > Python
> > console classes to access the raw managed objects, it appears that
> > when I
> > query the parent class I would not see the child class. Is this true?
> >
> > Any help is appreciated. Thanks.
>
> ---------------------------------------------------------------------
> Apache Qpid - AMQP Messaging Implementation
> Project: http://qpid.apache.org
> Use/Interact: mailto:[email protected]
>
>