[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/DependencyFramework - Dependable.py:1.1 IDependable.py:1.1 __init__.py:1.1
Jim Fulton
jim@zope.com
Mon, 14 Oct 2002 07:51:05 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/App/DependencyFramework
In directory cvs.zope.org:/tmp/cvs-serv3186
Added Files:
Dependable.py IDependable.py __init__.py
Log Message:
Begining implementation of dependency framework.
=== Added File Zope3/lib/python/Zope/App/DependencyFramework/Dependable.py ===
##############################################################################
#
# Copyright (c) 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""
$Id: Dependable.py,v 1.1 2002/10/14 11:51:05 jim Exp $
"""
__metaclass__ = type
from Persistence import Persistent
from Zope.App.DependencyFramework.IDependable import IDependable
class Dependable:
__doc__ = IDependable.__doc__
__implements__ = IDependable
def __init__(self):
self.__dependents = {}
def addDependent(self, location):
"See Zope.App.DependencyFramework.IDependable.IDependable"
self.__dependents[location] = 1
self._p_changed = 1
def removeDependent(self, location):
"See Zope.App.DependencyFramework.IDependable.IDependable"
del self.__dependents[location]
self._p_changed = 1
def dependents(self):
"See Zope.App.DependencyFramework.IDependable.IDependable"
return list(self.__dependents)
=== Added File Zope3/lib/python/Zope/App/DependencyFramework/IDependable.py ===
##############################################################################
#
# Copyright (c) 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""
$Id: IDependable.py,v 1.1 2002/10/14 11:51:05 jim Exp $
"""
from Interface import Interface
class IDependable(Interface):
"""Objects that can have dependencies
"""
def addDependent(location):
"""Add a dependency to a dependent object by location
The location is the physical path to the object.
"""
def removeDependent(location):
"""Remove a dependency with a dependent object by location.
The location is the physical path to the object.
"""
def dependents():
"""Return a sequence of dependent object locations.
"""
__doc__ = IDependable.__doc__ + __doc__
=== Added File Zope3/lib/python/Zope/App/DependencyFramework/__init__.py ===
##############################################################################
#
# Copyright (c) 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Dependency Framework
Problem
Objects sometimes depend on other objects without the cooperation
of the objects being depended upon. For example, service
directives depend on services. It is important to avoid deleting
services if there are dependent service directives. We want to
avoid adding dependency checks to every service implementation,
Proposal
A generic dependecy framework is proposed. Objects that are
depended on should implement IDependable.
$Id: __init__.py,v 1.1 2002/10/14 11:51:05 jim Exp $
"""
__metaclass__ = type