Back to index

plone3  3.1.7
interfaces.py
Go to the documentation of this file.
00001 ##############################################################################
00002 #
00003 # Copyright (c) 2001 Zope Corporation and Contributors. All Rights
00004 # Reserved.
00005 #
00006 # This software is subject to the provisions of the Zope Public License,
00007 # Version 2.0 (ZPL).  A copy of the ZPL should accompany this
00008 # distribution.
00009 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
00010 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00011 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
00012 # FOR A PARTICULAR PURPOSE
00013 #
00014 ##############################################################################
00015 """ PluginRegistry interface declarations
00016 
00017 $Id: interfaces.py 40099 2005-11-14 20:48:24Z tseaver $
00018 """
00019 try:
00020     from zope.interface import Interface
00021 except:  # BBB?
00022     from Interface import Interface
00023     _HAS_Z3_INTERFACES = False
00024 else:
00025     _HAS_Z3_INTERFACES = True
00026 
00027 class IPluginRegistry( Interface ):
00028 
00029 
00030     """ Manage a set of plugin definitions, grouped by type.
00031     """
00032     def listPluginTypeInfo():
00033 
00034         """ Return a sequence of mappings describing our plugin types.
00035 
00036         o Keys for the mappings must include:
00037 
00038           'id' -- a string used to identify the plugin type (should be
00039             the __name__ of the interface)
00040 
00041           'interface' -- the plugin type interface
00042 
00043           'methods' -- the methods expected by the plugin type interface
00044 
00045           'title' -- a display title for the plugin type
00046 
00047           'description' -- a description of what the plugins do
00048         """
00049 
00050     def listPlugins( plugin_type ):
00051 
00052         """ Return a sequence of tuples, one for each plugin of the given type.
00053 
00054         o 'plugin_type' must be one of the known types, else raise KeyError.
00055 
00056         o Tuples will be of the form, '( plugin_id, plugin )'.
00057         """
00058 
00059     def listPluginIds( plugin_type ):
00060 
00061         """ Return a sequence of plugin ids
00062         
00063         o Return ids for each active plugin of the given type.
00064 
00065         o 'plugin_type' must be one of the known types, else raise KeyError.
00066         """
00067 
00068     def activatePlugin( plugin_type, plugin_id ):
00069 
00070         """ Activate a plugin of the given type.
00071 
00072         o 'plugin_type' must be one of the known types, else raise KeyError.
00073 
00074         o 'plugin_id' must be the ID of an available plugin, else raise
00075           KeyError.
00076 
00077         o Append 'plugin_id' to the list of active plugins for the given
00078           'plugin_type'.
00079         """
00080 
00081     def deactivatePlugin( plugin_type, plugin_id ):
00082 
00083         """ Deactivate a plugin of the given type.
00084 
00085         o 'plugin_type' must be one of the known types, else raise KeyError.
00086 
00087         o 'plugin_id' must be an ID of an existing plugin of that type,
00088           else raise KeyError.
00089         """
00090 
00091     def movePluginsUp( plugin_type, ids_to_move ):
00092 
00093         """ Move a set of plugins "up" in their list.
00094 
00095         o 'plugin_type' must be one of the known types, else raise KeyError.
00096 
00097         o 'ids_to_move' must be a sequence of ids of current plugins
00098           for that type.
00099           
00100           - If any item is not the ID of a current plugin, raise ValueError.
00101         """
00102 
00103     def movePluginsDown( plugin_type, ids_to_move ):
00104 
00105         """ Move a set of plugins "down" in their list.
00106 
00107         o 'plugin_type' must be one of the known types, else raise KeyError.
00108 
00109         o 'ids_to_move' must be a sequence of indexes of items in the current
00110           list of plugins for that type.
00111           
00112           - If any item is not the ID of a current plugin, raise ValueError.
00113         """