Santhosh/Rajaram|modified extensions section in README
This commit is contained in:
42
README
42
README
@@ -108,26 +108,32 @@ There are a few requirements to writing your own plugin:
|
|||||||
# -- Extensions
|
# -- Extensions
|
||||||
|
|
||||||
1) Creating Extensions:
|
1) Creating Extensions:
|
||||||
An example extension exists in ./tests/unit/extensions/foxinsocks.py
|
a) Extension files should be placed under ./extensions folder.
|
||||||
The unit tests in ./tests/unit/test_extensions.py document the complete
|
b) The extension file should have a class with the same name as the filename.
|
||||||
set of extension features supported
|
|
||||||
2) Loading Extension:
|
|
||||||
a) The extension file should have a class with same name as the filename.
|
|
||||||
This class should implement the contract required by the extension framework.
|
This class should implement the contract required by the extension framework.
|
||||||
See ExtensionDescriptor class in ./quantum/common/extensions.py for details
|
See ExtensionDescriptor class in ./quantum/common/extensions.py for details
|
||||||
For an example look at Foxinsocks class in foxinsocks.py
|
c) To stop a file in ./extensions folder from being loaded as an extension,
|
||||||
b) The extension file should be deployed in the ./extensions folder.
|
the filename should start with an "_"
|
||||||
If the filename starts with an "_", it will not be treated as an extension.
|
For an example of an extension file look at Foxinsocks class in
|
||||||
3) Plugins advertizing extension support:
|
./tests/unit/extensions/foxinsocks.py
|
||||||
A Plugin can advertize all the extensions it supports through the
|
The unit tests in ./tests/unit/test_extensions.py document all the ways in
|
||||||
'supported_extension_aliases' attribute. Eg:
|
which you can use extensions
|
||||||
|
|
||||||
class SomePlugin:
|
2) Associating plugins with extensions:
|
||||||
...
|
a) A Plugin can advertize all the extensions it supports through the
|
||||||
supported_extension_aliases = ['extension1_alias',
|
'supported_extension_aliases' attribute. Eg:
|
||||||
|
|
||||||
|
class SomePlugin:
|
||||||
|
...
|
||||||
|
supported_extension_aliases = ['extension1_alias',
|
||||||
'extension2_alias',
|
'extension2_alias',
|
||||||
'extension3_alias']
|
'extension3_alias']
|
||||||
4) Standardizing extensions:
|
Any extension not in this list will not be loaded for the plugin
|
||||||
An extension might be supported by multiple plugins. In such cases, the extension
|
|
||||||
can mandate an interface that all plugins have to support for that extension.
|
b) Extension Interfaces for plugins (optional)
|
||||||
For an example see the FoxInSocksPluginInterface in foxinsocks.py and the QuantumEchoPlugin
|
The extension can mandate an interface that plugins have to support with the
|
||||||
|
'get_plugin_interface' method in the extension.
|
||||||
|
For an example see the FoxInSocksPluginInterface in foxinsocks.py.
|
||||||
|
|
||||||
|
The QuantumEchoPlugin lists foxinsox in its supported_extension_aliases
|
||||||
|
and implements the method from FoxInSocksPluginInterface.
|
||||||
|
|||||||
Reference in New Issue
Block a user