Esempio n. 1
0
def makeEventAgent(uri=None):
    """
    Make a new event agent value using the supplied URI.
    
    If no URI is supplied, a new value may be generated.
    """
    global EventAgentSequence
    if not uri:
        EventAgentSequence += 1
        seq = EventAgentSequence
        uri = EventAgentBase+uriDate()+"/"+uriTime()+"/"+str(seq)
    return EventAgent(uri)
Esempio n. 2
0
def makeEventAgent(uri=None):
    """
    Make a new event agent value using the supplied URI.
    
    If no URI is supplied, a new value may be generated.
    """
    global EventAgentSequence
    if not uri:
        EventAgentSequence += 1
        seq = EventAgentSequence
        uri = EventAgentBase + uriDate() + "/" + uriTime() + "/" + str(seq)
    return EventAgent(uri)
Esempio n. 3
0
def makeEventHandler(uri=None, handler=None, initSubscription=None, endSubscription=None):
    """
    Make a new event handler value using the supplied URI.
    
    'uri'       is an identifying URI for this handler.
    'handler'   is a function called when a subscribed event is published, with the 
                new event handler itself as its first argument, and the event object
                as its second argument.
    'initSubscription' and 'endSubscription' are called with the new event handler 
                itself as their first argument, and the status code as their second.
                TODO: review this to consider also providing event type/source values
    
    If no URI is supplied, a new value may be generated.
    """
    global EventTargetSequence
    if not uri:
        EventTargetSequence += 1
        seq = EventTargetSequence
        uri = EventTargetBase+uriDate()+"/"+uriTime()+"/"+str(seq)
    return EventHandler(uri, handler, initSubscription, endSubscription)
Esempio n. 4
0
def makeEventHandler(uri=None,
                     handler=None,
                     initSubscription=None,
                     endSubscription=None):
    """
    Make a new event handler value using the supplied URI.
    
    'uri'       is an identifying URI for this handler.
    'handler'   is a function called when a subscribed event is published, with the 
                new event handler itself as its first argument, and the event object
                as its second argument.
    'initSubscription' and 'endSubscription' are called with the new event handler 
                itself as their first argument, and the status code as their second.
                TODO: review this to consider also providing event type/source values
    
    If no URI is supplied, a new value may be generated.
    """
    global EventTargetSequence
    if not uri:
        EventTargetSequence += 1
        seq = EventTargetSequence
        uri = EventTargetBase + uriDate() + "/" + uriTime() + "/" + str(seq)
    return EventHandler(uri, handler, initSubscription, endSubscription)