1
2 '''
3 Base Publisher object implementation.
4
5 @author: Michael Eddington
6 @version: $Id: Peach.publisher-pysrc.html 1138 2008-08-16 19:39:03Z meddingt $
7 '''
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
38 '''
39 The Publisher object(s) implement a way to send and/or receave
40 data by some means. This could be a TCP connection, a filehandle, or
41 SQL, etc.
42
43 There are two "types" of publishers, stream based and call based. This
44 base class supports both types.
45
46 To support stream based publishing implement everything but "call".
47
48 To support call based publishing implement start, stop, and call.
49
50 Note: A publisher can support both stream and call based publishing.
51 '''
52
54 '''
55 Change state such that send/receave will work. For Tcp this
56 could be connecting to a remote host
57 '''
58 pass
59
61 '''
62 Change state such that send/receave will not work. For Tcp this
63 could be closing a connection, for a file it might be closing the
64 file handle.
65 '''
66 pass
67
68 - def send(self, data):
69 '''
70 Publish some data
71
72 @type data: string
73 @param data: Data to publish
74 '''
75 raise PeachException("Action 'send' not supported by publisher")
76
78 '''
79 Receive some data.
80
81 @type size: integer
82 @param size: Number of bytes to return
83 @rtype: string
84 @return: data received
85 '''
86 raise PeachException("Action 'receive' not supported by publisher")
87
88 - def call(self, method, args):
89 '''
90 Call a method using arguments.
91
92 @type method: string
93 @param method: Method to call
94 @type args: Array
95 @param args: Array of strings as arguments
96 @rtype: string
97 @return: data returned (if any)
98 '''
99 raise PeachException("Action 'call' not supported by publisher")
100
101 - def property(self, property, value = None):
102 '''
103 Get or set property
104
105 @type property: string
106 @param property: Name of method to invoke
107 @type value: object
108 @param value: Value to set. If None, return property instead
109 '''
110 raise PeachException("Action 'property' not supported by publisher")
111
113 '''
114 Accept incoming connection. Blocks until incoming connection
115 occurs.
116 '''
117
118 raise PeachException("Action 'accept' not supported by publisher")
119
121 '''
122 Close current stream/connection.
123 '''
124 raise PeachException("Action 'close' not supported by publisher")
125
126
128 '''
129 Exception thrown if error occurs during start call
130 '''
131 pass
132
134 '''
135 Exception thrown if error occurs during stop call
136 '''
137 pass
138
139 from Peach.Engine.common import *
140
142 '''
143 Recoverable exception occured in the Publisher.
144 '''
145 pass
146
153
154
155