ilabs package¶
Submodules¶
ilabs.adapters module¶
Adapter classes for message processing
- syntazo 1996- 2016
syntazo opensource
coded by: thanos vassilakis
$RCSfile: __init__.py,v $ $Date: 2004/07/16 17:36:28 $ $Revision: 1.3 $
-
class
ilabs.adapters.
Adapter
(source=None)[source]¶ Bases:
ilabs.core.Node
Abstarct adapter. The abtsract adapter is designed to take on input, L{source}.
-
agentClass
¶ alias of
DeliveryAgent
-
pack
(message)[source]¶ pack a message in an L{agentClass}, return the delivery agent Uses agentClass to create an agent instance and gives message to the delivery agent.
@param message: a message extracted by readMessage @return: a delivery agent, with message (usually !?!) @rtype: an agent, some subclass of DeliveryAgent
-
read
(*args)[source]¶ Basic logic of an adapter. Read from source a message, L{pack} it and then send it. Continue until there are no more messages.
@param args: an argument list of what ever you whant to pass to readMessage
-
readMessage
(*args)[source]¶ You should implement this method to extract a single message. @param args: You can use the args to help implement an early low level filtering. @return: a message
-
run
(*args)¶ Basic logic of an adapter. Read from source a message, L{pack} it and then send it. Continue until there are no more messages.
@param args: an argument list of what ever you whant to pass to readMessage
-
source
= None¶
-
-
class
ilabs.adapters.
File
(source=None)[source]¶ Bases:
ilabs.adapters.Adapter
File adapter. Will not send agent containing None messages.
-
destination
= <open file '<stdout>', mode 'w'>¶
-
source
= <open file '<stdin>', mode 'r'>¶
-
ilabs.core module¶
Core classes for message processing
- integrationLabs 1996- 2016
coded by: thanos vassilakis
syntazo opensource
$RCSfile: core.py,v $ $Date: 2004/07/16 17:35:39 $ $Revision: 1.2 $
-
class
ilabs.core.
DeliveryAgent
(wayslip=None, message=None)[source]¶ Bases:
ilabs.core.ilabsObject
Implements a form of Visitor pattern. Its responsibility is to hold a message and deliver it to the correct processor method of the current node.
Use this class to encapsule a business message and control what method processes it at a node.
Was called Envelope - renamed to avoid confusion.
-
processNode
(node)[source]¶ invokes Node.processAgent @param node: The node the message will be delivered to. @type node: Node object @return: a message instance.
-
wayslip
= None¶
-
-
class
ilabs.core.
Node
(name='')[source]¶ Bases:
ilabs.core.ilabsObject
abstract node - don’t use - always subclass implentation of Node - with a single destination
-
connect
(receiver, *args)[source]¶ Must be overridden. - override and always return self @param receiver: the node to receive the processed message @type receiver: Node subclass @param args: a list of args to facilitate the connection. @return: self
-
destination
= None¶
-
disconnect
(receiver=None, *args)[source]¶ disconnects a node to this pipe. @param reciever: the node to be connected. @type receiver: node to be disconnected. @param *args: list of args to facilitate disconnection.
@return: must return self @rtype: Node
-
name
= ''¶
-
process
(message)[source]¶ Override to process message
@param message: the sage to process @return: the message
-
-
class
ilabs.core.
Proxy
(name='', node=None, whenEmpty=True)[source]¶ Bases:
ilabs.core.Node
This is a node place holder or socket. You use this class when you want to be able to replace nodes without rewiring them. a Proxy pattern.
-
UNWIRED
= True¶
-
WIREDTHRU
= False¶
-
connect
(receiver, *args)[source]¶ connects 1st as the pipelines destination and last node of chain to the actual destination @param reciever: the node to be connected. @type receiver: node
@return: must return self @rtype: Node
-
-
class
ilabs.core.
RouteTable
[source]¶ Bases:
ilabs.core.ilabsObject
Implements a default route table as a dictionary.
-
NoRoutes
= []¶
-
addRoute
(route, *criteria)[source]¶ inserts a route for each criterion.
@param route: Node to add to table keyed by criteria @type route: Node @param criteria: criteria by which router chooses the node to route Agent. @type criteria: list of any hashable parameters.
@return: self
-
cache
= {}¶
-
routes
(*criteria)[source]¶ returns a list of routes given a set of criterion.
@param criteria: criteria by which router chooses the node to route Agent. @type criteria: list of any hashable parameters. @return: list of routes
-
tableClass
¶ alias of
dict
-
-
class
ilabs.core.
Router
(name='', table=None, strategy=None)[source]¶ Bases:
ilabs.core.Node
Abstarct message router
tableClass = route table class strategyClass = routing strategy
-
connect
(route, *criteria)[source]¶ - use to added a route with a given criteria
@param route: Node to add to table keyed by criteria @type route: Node @param criteria: criteria by which router chooses the node to route Agent. @type criteria: list of any hashable parameters.
@return: self
-
strategyClass
¶ alias of
RoutingStrategy
-
tableClass
¶ alias of
RouteTable
-
-
class
ilabs.core.
RoutingStrategy
[source]¶ Bases:
ilabs.core.ilabsObject
Abstarct routing strategy.
-
class
ilabs.core.
System
(name='', configurator=None)[source]¶ Bases:
ilabs.core.ilabsObject
ilabs.patterns module¶
integration pattern classes for message processing
- integrationLabs 1996- 2004
coded by: thanos and friends
integrationLabs opensource
$RCSfile: __init__.py,v $ $Date: 2004/07/16 17:31:19 $ $Revision: 1.3 $
-
class
ilabs.patterns.
AllRoutes
[source]¶ Bases:
ilabs.core.RoutingStrategy
-
class
ilabs.patterns.
Distributor
(name='', table=None, strategy=None)[source]¶ Bases:
ilabs.core.Router
-
class
ilabs.patterns.
MessageProcessor
(name='', router=None, concentrator=None)[source]¶ Bases:
ilabs.core.Node
-
concentratorClass
¶ alias of
Node
-
routerClass
¶ alias of
RecipientList
-
-
class
ilabs.patterns.
NodeBank
(name='', *args)[source]¶ Bases:
ilabs.patterns.NodeList
Behaves as a “parallel” bank of Nodes. Received messages are passed to the all the nodes in turn, the resulting messages are then sent on to the destination.
As with PipeLine this can be treated as a list. Use list operations (append, insert, del, setitem, etc) to set the nodes in the bank.
-
class
ilabs.patterns.
NodeList
(name='', *args)[source]¶ Bases:
ilabs.core.Node
-
deferChange
= False¶
-
onChange
= None¶
-
-
class
ilabs.patterns.
PipeLine
(name='', *args)[source]¶ Bases:
ilabs.patterns.NodeList
Behaves as a chained list of Nodes. Received messages are passed to the first node, and the last node in turn sends the message to the destination.
The PipeLine’s process is called before and of the containing nodes. Use list operations (append, insert, del, setitem, etc) to set the nodes in the bank. When Nodes are added, inserted removed they are relinked to maintain the pipeline.
PipeLine = [Node1, Node2.. NodeN] NodeA -> PipeLine -> NodeB Expands to: NodeA -> PipeLine -> Node1 - > Node2 -> ...-> NodeN -> NodeB
-
class
ilabs.patterns.
RecipientList
(name='', table=None, strategy=None)[source]¶ Bases:
ilabs.core.Router
Implements a router that sends a message to each route on the approriate subscription list
-
tableClass
¶ alias of
SubscriptionTable
-
-
class
ilabs.patterns.
RouteList
[source]¶ Bases:
ilabs.core.RouteTable
-
class
ilabs.patterns.
StateMachine
(name, *args)[source]¶ Bases:
ilabs.core.Node
Implements a hierachical state machine. Add attribute the states where states is a tuple of entries. Each entry can be one of: entry := current, message, next entry := current state, message, test, resultset
- current := StateMachine.INIT
- State collection of State StateMachine.ANY
- message := Message
- collection of Message StateMachine.ANY
- next := State
- StateMachine.CURRENT
test := python expression
resultset:= (result, next)+
some simple examples: states=((DrawerClosed, Eject, DrawerOpen),
(DrawerOpen, Eject, CDStopped), (CDStopped, Play, CDPlaying), (CDPlaying, Pause, CDPaused), ((CDPlaying,CDPaused), Stoped, CDStoped), (CDPaused, (Pause,Play) CDPlaying) )states=((DrawerClosed, Eject, DrawerOpen), (DrawerOpen, Eject, “hasCd()”, (False, CDStopped), (True, DrawerClosed)), ((CDStopped, CDPlaying, CDPause), Eject, DrawerOpen), ((CDStopped, CDPause), Play, CDPlaying), (CDPlaying,CDPaused), Stoped, CDStoped), ((CDPlaying,CDPaused), NextTrack, “isLastTrack()”, (False, StateMachine.CURRENT), (True, CDStop)), ((CDPlaying,CDPaused), PrevTrack”, isFirstTrack()”, (False, StateMachine.CURRENT), (True, CDStop)) )
for more and hierachicle see the test code
-
ANY
= ANY¶
-
CURRENT
= CURRENT¶
-
DEFAULT
= <object object>¶
-
INIT
= INIT¶
-
LAST
= LAST¶
-
class
State
(name='')[source]¶ Bases:
ilabs.core.Node
-
StateMachine.
UNDEF
= INIT¶
-
StateMachine.
debug
= False¶
-
StateMachine.
getInitKey
(message, currentState)¶
-
class
ilabs.patterns.
SubscriptionTable
[source]¶ Bases:
ilabs.core.RouteTable
Implements a router table adds subscribing route (node) to an approriate distributer.
ilabs.utils module¶
Module contents¶
- syntazo 1996- 2016
coded by: thanos vassilakis and friends
syntazo integration package/framework
syntazo opensource
$RCSfile: __init__.py,v $ $Date: 2004/07/16 17:36:27 $ $Revision: 1.2 $