Beispiel #1
0
def clientconnector():
    """\   clientconnector() -> returns Graphline
    clientconnector is the peer to KPIClient
    Keyword arguments: None
    """
    return Graphline(authenticator=Authenticator(KPIDBI.getDB("mytree")),
                     notifier=publishTo("KeyManagement"),
                     linkages={
                         ("", "inbox"): ("authenticator", "inbox"),
                         ("authenticator", "outbox"): ("", "outbox"),
                         ("authenticator", "notifyuser"):
                         ("notifier", "inbox"),
                     })
Beispiel #2
0
def clientconnector():
    """\   clientconnector() -> returns Graphline
    clientconnector is the peer to KPIClient
    Keyword arguments: None
    """ 
    return Graphline(
        authenticator = Authenticator(KPIDBI.getDB("mytree")),
        notifier = publishTo("KeyManagement"),
        linkages = {
            ("","inbox") : ("authenticator","inbox"),
            ("authenticator","outbox") : ("","outbox"),
            ("authenticator","notifyuser") : ("notifier","inbox"),
        }
    )
Beispiel #3
0
            index = index + 1


class MyDataSink(Axon.Component.component):
    """ prints received text
    """
    def main(self):
        while 1:
            yield 1
            while self.dataReady("inbox"):
                print "datasink received:", self.recv("inbox")


""" client simulation """
"""Create KPIDB instance"""
kpidb = KPIDBI.getDB("mytree")
""" start the KPI server """
KPIServer(MyDataSource(), kpidb.getKPIKeys())
""" client representing user1 connects to the KPI server"""
Graphline(
    #c=KPIClient("user1", consoleEchoer()),
    c=KPIClient("user1", MyDataSink()),
    cc=clientconnector(),
    linkages={
        ("c", "outbox"): ("cc", "inbox"),
        ("cc", "outbox"): ("c", "inbox"),
    }).activate()
""" client representing user3 connects to the KPI server """
Graphline(
    #c=KPIClient("user3", consoleEchoer()),
    c=KPIClient("user3", MyDataSink()),
Beispiel #4
0

class MyDataSink(Axon.Component.component):
    """ prints received text
    """    
    def main(self):
        while 1:
            yield 1
            while self.dataReady("inbox"):
                print "datasink received:", self.recv("inbox")


""" client simulation """

"""Create KPIDB instance"""
kpidb = KPIDBI.getDB("mytree")
""" start the KPI server """
KPIServer(MyDataSource(), kpidb.getKPIKeys())


""" client representing user1 connects to the KPI server"""
Graphline(
    #c=KPIClient("user1", consoleEchoer()),
    c=KPIClient("user1", MyDataSink()),
    cc = clientconnector(),
    linkages = {
        ("c","outbox") : ("cc","inbox"),
        ("cc","outbox") : ("c","inbox"),        
    }
).activate()
Beispiel #5
0
    """    
    def main(self):
        index = 0
        while 1:
            yield 1
            if index % 1000 == 0:
                data = str(index) + "-helloknr"
                self.send(data, "outbox")
                print "data source sent", data
            else:
                yield 1
            index = index + 1


import sys
if __name__=="__main__":
    if len(sys.argv) != 3:
        print "Usage:", sys.argv[0], "dbfile port"
        print "default values used: dbfile=mytree and port=1256"
        dbfile = "mytree"
        tcpport = 1256
    else:
        dbfile = sys.argv[1]
        tcpport = int(sys.argv[2])
        

    kpidb = KPIDBI.getDB(dbfile)
    KPIServer(MyDataSource(), kpidb.getKPIKeys())    
    server=_SimpleServer(protocol=clientconnector, port=tcpport).activate()
    _scheduler.run.runThreads(slowmo=0)
Beispiel #6
0
    of numbered hello strings
    """
    def main(self):
        index = 0
        while 1:
            yield 1
            if index % 1000 == 0:
                data = str(index) + "-helloknr"
                self.send(data, "outbox")
                print "data source sent", data
            else:
                yield 1
            index = index + 1


import sys
if __name__ == "__main__":
    if len(sys.argv) != 3:
        print "Usage:", sys.argv[0], "dbfile port"
        print "default values used: dbfile=mytree and port=1256"
        dbfile = "mytree"
        tcpport = 1256
    else:
        dbfile = sys.argv[1]
        tcpport = int(sys.argv[2])

    kpidb = KPIDBI.getDB(dbfile)
    KPIServer(MyDataSource(), kpidb.getKPIKeys())
    server = _SimpleServer(protocol=clientconnector, port=tcpport).activate()
    _scheduler.run.runThreads(slowmo=0)