Total Complexity | 3 |
Total Lines | 52 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | """ |
||
11 | class Message(metaclass=abc.ABCMeta): |
||
12 | """ |
||
13 | Class for messages exchanged between the processes of Enarksh. |
||
14 | """ |
||
15 | |||
16 | # ------------------------------------------------------------------------------------------------------------------ |
||
17 | message_controller = None |
||
18 | """ |
||
19 | The message controller. |
||
20 | |||
21 | :type: None|enarksh.message.MessageController.MessageController |
||
22 | """ |
||
23 | |||
24 | # ------------------------------------------------------------------------------------------------------------------ |
||
25 | def __init__(self, message_type): |
||
26 | """ |
||
27 | Object constructor. |
||
28 | """ |
||
29 | self._message_type = message_type |
||
30 | """ |
||
31 | The type of the message. |
||
32 | |||
33 | :type: str |
||
34 | """ |
||
35 | |||
36 | self.message_source = None |
||
37 | """ |
||
38 | For incoming messages will be set by the message controller. The name of the source of the message. |
||
39 | |||
40 | :type: str |
||
41 | """ |
||
42 | # ------------------------------------------------------------------------------------------------------------------ |
||
43 | @property |
||
44 | def message_type(self): |
||
45 | """ |
||
46 | Returns the message type of this message. |
||
47 | |||
48 | :rtype: str |
||
49 | """ |
||
50 | return self._message_type |
||
51 | |||
52 | # ------------------------------------------------------------------------------------------------------------------ |
||
53 | @abc.abstractmethod |
||
54 | def send_message(self, end_point): |
||
55 | """ |
||
56 | Sends the message to an end point. |
||
57 | |||
58 | :param str end_point: The end point. |
||
59 | |||
60 | :rtype: None|enarksh.message.Message.Message |
||
61 | """ |
||
62 | raise NotImplementedError() |
||
63 | |||
65 |