2016-01-16 22:00:15 -05:00
|
|
|
from .messenger import Messenger
|
2016-03-02 20:53:19 -05:00
|
|
|
from .context import Context
|
2014-03-19 23:07:30 -04:00
|
|
|
|
2016-01-16 22:00:15 -05:00
|
|
|
class Plugin(object):
|
2014-03-19 23:07:30 -04:00
|
|
|
'''
|
|
|
|
Abstract base class for commands that process directives.
|
|
|
|
'''
|
|
|
|
|
2016-03-02 20:53:19 -05:00
|
|
|
def __init__(self, context):
|
|
|
|
self._context = context
|
2014-03-19 23:07:30 -04:00
|
|
|
self._log = Messenger()
|
|
|
|
|
|
|
|
def can_handle(self, directive):
|
|
|
|
'''
|
2016-01-16 22:00:15 -05:00
|
|
|
Returns true if the Plugin can handle the directive.
|
2014-03-19 23:07:30 -04:00
|
|
|
'''
|
|
|
|
raise NotImplementedError
|
|
|
|
|
|
|
|
def handle(self, directive, data):
|
|
|
|
'''
|
|
|
|
Executes the directive.
|
|
|
|
|
2016-01-16 22:00:15 -05:00
|
|
|
Returns true if the Plugin successfully handled the directive.
|
2014-03-19 23:07:30 -04:00
|
|
|
'''
|
|
|
|
raise NotImplementedError
|