================
Stack Definition
================

:Revision: $Id: stackdefinition.txt 30770 2005-12-17 01:15:30Z dkuhlman $

.. sectnum::    :depth: 4
.. contents::   :depth: 4


Stack Definition Introduction
=============================

A stack definition is an object stored within a state definition
object implementing an abstraction layer on a stack object
instance.

A stack definition:

- defines high level accessors and mutators on the stack object.

- defines the policy of roles distributions for the stack elements
  stored within the stack using managed roles expressions. It
  includes as well a specific guard while the stack object doesn't
  contain elements yet.

- defines the default policy for editing and viewing stack
  elements using guards. (Note that a stack element has its own
  guard that may override the default behavior from the stack
  definition).

It may be used as well without any roles policy if the purpose of
the stack is not to distribute local roles. (for instance: adding
a stack of tasks hooked on a given state)


Stack Definition Registry
=========================

If you need to implement a specific behavior, you may register
your own stack definition.

You must implement the IWorkflowStackDefinition interface and
usually you will inherit from the base StackDefinition class in
your child class which is already implementing this interface.

You may use it like this::

  >>> from stackregistries import WorkflowStackDefRegsitry
  >>> from stackdefinition import StackDefinition
  >>>
  >>> class MyStackDefinition(StackDefinition):
  >>> ....# Here implementation
  >>> ....
  >>>
  >>> WorkflowStackDefRegistry.register(MyStackDefinition)
  >>>

Check the API in the ``doc/api/`` sub-folder.


.. Emacs
.. Local Variables:
.. mode: rst
.. End:
.. Vim
.. vim: set filetype=rst:

