Sounds like you want to write a custom component that creates child
components, links them up, unlinks them, creates new ones etc.
How to create ... and destroy links:
http://www.kamaelia.org/Docs/Axon/Axon.Component.html#20
How to create a child component, and how to detect when it has finished,
and then remove it:
http://www.kamaelia.org/Docs/Axon/Axon.Component.html#21
If you want these actions to happen in response to particular messages
coming from one of the child components, then to do that your component
should create an inbox, in the usual way, and link it up to the
appropriate outbox of the component(s) that will be sending those messages.
If what you are after doing is swapping out a single component and
replacing it with a new one, then the Carousel component might help you:
http://www.kamaelia.org/Components/pydoc/Kamaelia.Chassis.Carousel.html
When you create a carousel, you provide it with a function for creating
new child components. When a message is sent to the "next" inbox of the
Carousel, your function is called, and is passed the message as its
argument. The new component that your function returns is activated as a
child of the component and wired up such that the inbox and outbox of the
Carousel component go straight to the inbox and outbox of the new child.
If there was already a child, then it is sent a message to its control
inbox to tell it to shut down, then its linkages are removed, before
activating and linking in the new child.
The Carousel also has a 'requestNext' outbox that sends out a message
whenever the child terminates. You can therefore use this to trigger the
creation of a new component.
*Michael: the relevant cookbook page appears to be borked atm:
http://www.kamaelia.org/Cookbook.html
Hope this helps
Matt
On Mon, 09 Aug 2010 04:32:33 +0100, Gloria W <[email protected]> wrote:
Hi Michael et al,
I am pleased to say that I finally have a freelance contract where I can
make great use of Kamaelia. I am really happy about transitioning my
personal Kamaelia work from toy to tool. This is exciting. The license
change helps greatly.
I have a situation where I want to use a Graphline, but the components
are dynamic. They can become invalid, and new ones can be required, in
realtime. Am I forced to add them as subcomponents? Is using __setattr__
in this capacity considered a kludge?
How do I add and remove linkages? Should I destroy and recreate the
Graphline object each time, instead of all of this manipulation? If so,
is this slow/inefficient?
Many thank yous, and I'm really happy to be back here.
Gloria
--
| Matt Hammond
| Research Engineer, BBC R&D, Centre House, London
| http://www.bbc.co.uk/rd/
--
You received this message because you are subscribed to the Google Groups
"kamaelia" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/kamaelia?hl=en.