Co-ordinating Assistant TrackerThe co-ordinating assistant tracker is designed to allow components to register services and statistics they wish to make public to the rest of the system. Components can also query the co-ordinating assistant tracker to create linkages to specific services, and for specific global statistics.
Accessing the Co-ordinating Assistant TrackerCo-ordinating assistant trackers are designed to work in a singleton manner; accessible via a local or class interface (though this is not enforced). The simplest way to obtain the global co-ordinating assistant tracker is via the getcat() class (static) method: from Axon.CoordinatingAssistantTracker import coordinatingassistanttracker theCAT = coordinatingassistanttracker.getcat() The first time this method is called, the co-ordinating assistant tracker is created. Subsequent calls, wherever they are made from, return that same instance. ServicesComponents can register a named inbox on a component as a named service. This provides a way for a component to provide a service for other components - an inbox that another component can look up and create a linkage to. Registering a service is simple: theComponent = MyComponentProvidingServiceOnItsInbox() theComponent.activate() theCAT = coordinatingassistanttracker.getcat() theCAT.registerService("MY_SERVICE", theComponent, "inbox") Another component can then retrieve the service: theCAT = coordinatingassistanttracker.getcat() (comp, inboxname) = theCAT.retrieveService("MY_SERVICE") Because services are run by components - these by definition die and so also need to be de-registered: theCAT = coordinatingassistanttracker.getcat() theCAT.deRegisterService("MY_SERVICE") Tracking global statisticsMicroprocesses can also use the co-ordinating assistant tracker to log/retrieve statistics/information. Use the trackValue() method to initially start tracking a value under a given name: value = ... theCAT = coordinatingassistanttracker.getcat() theCAT.trackValue("MY_VALUE", value) This can then be easily retrieved: theCAT = coordinatingassistanttracker.getcat() value= theCAT.retrieveValue("MY_VALUE") Call the updateValue() method (not the trackValue() method) to update the value being tracked: newvalue = ... theCAT = coordinatingassistanttracker.getcat() theCAT.updateValue("MY_VALUE", newvalue) Hierarchy of co-ordinating assistant trackersAlthough at initialisation a parent co-ordinating assistant tracker can be specified; this is not currently used. Test documentationTests passed:
Axon.CoordinatingAssistantTracker.coordinatingassistanttrackerclass coordinatingassistanttracker(object)coordinatingassistanttracker([parent]) -> new coordinatingassistanttracker object. Co-ordinating assistant tracker object tracks values and (component,inboxname) services under names. Keyword arguments:
Methods defined heredeRegisterService(self, service)Deregister a service that was previously registered. Raises Axon.AxonExceptions.MultipleServiceDeletion if the service is not/ no longer registered. informationItemsLogged(self)Returns list of names values are being tracked under. registerService(self, service, thecomponent, inbox)Register a named inbox on a component as willing to offer a service with the specified name. Keyword arguments:
Exceptions that may be raised: retrieveService(self, name)Retrieve the (component, inboxName) service with the specified name. retrieveValue(self, name)Retrieve the value tracked (recorded) under the specified name. Trying to retrieve a value under a name that isn't yet being tracked results in an Axon.AxonExceptions.AccessToUndeclaredTrackedVariable exception being raised. servicesRegistered(self)Returns list of names of registered services trackValue(self, name, value)Track (record) the specified value under the specified name. Once we start tracking a value, we have it's value forever (for now). Trying to track the same named value more than once causes an Axon.AxonExceptions.NamespaceClash exception. This is done to capture problems between interacting components updateValue(self, name, value)Update the value being tracked under the specified name with the new value provided. Trying to update a value under a name that isn't yet being tracked results in an Axon.AxonExceptions.AccessToUndeclaredTrackedVariable exception being raised. FeedbackGot a problem with the documentation? Something unclear that could be clearer? Want to help improve it? Constructive criticism is very welcome - especially if you can suggest a better rewording! Please leave you feedback here in reply to the documentation thread in the Kamaelia blog. -- Automatic documentation generator, 01 Feb 2010 at 04:00:28 UTC/GMT |
Kamaelia
is an open source project originated from and guided by BBC
Research. For more information browse the site or get in
contact.
This is an ongoing community based development site. As a result the contents of this page is the opinions of the contributors of the pages involved not the organisations involved. Specificially, this page may contain personal views which are not the views of the BBC. (the site is powered by a wiki engine)
(C) Copyright 2008 Kamaelia Contributors, including the British Broadcasting Corporation, All Rights Reserved