diff --git a/system/README.txt b/system/README.txt new file mode 100644 index 0000000..dd3acd7 --- /dev/null +++ b/system/README.txt @@ -0,0 +1,53 @@ +=============================================================== +loops - Linked Objects for Organization and Processing Services +=============================================================== + +loops System Management. + + ($Id$) + + +Setting up a loops Site and Utilities +===================================== + +Let's do some basic set up + + >>> from zope import component, interface + >>> from zope.traversing.api import getName + >>> from zope.app.testing.setup import placefulSetUp, placefulTearDown + >>> site = placefulSetUp(True) + +and build a simple loops site with a concept manager and some concepts +(with a relation registry, a catalog, and all the type machinery - what +in real life is done via standard ZCML setup or via local utility +configuration): + + >>> from loops.tests.setup import TestSite + >>> t = TestSite(site) + >>> concepts, resources, views = t.setup() + >>> appRoot = site['loops'] + +In addition to the application site we need a loops system management site. + + >>> from loops.interfaces import ILoops, IConcept + >>> from loops.setup import ISetupManager + >>> from loops.system.setup import SetupManager + >>> component.provideAdapter(SetupManager, (ILoops,), ISetupManager, + ... name='system') + + >>> sysConcepts, sysResources, sysViews = t.siteSetup('loops.system') + >>> systemRoot = site['loops.system'] + + >>> sorted(sysConcepts) + [u'domain', u'file', u'hasType', u'job', u'note', u'predicate', u'query', + u'standard', u'textdocument', u'type'] + + +Agents and Jobs +=============== + + +Fin de partie +============= + + >>> placefulTearDown() diff --git a/system/__init__.py b/system/__init__.py new file mode 100644 index 0000000..4bc90fb --- /dev/null +++ b/system/__init__.py @@ -0,0 +1,4 @@ +""" +$Id$ +""" + diff --git a/system/configure.zcml b/system/configure.zcml new file mode 100644 index 0000000..f69d141 --- /dev/null +++ b/system/configure.zcml @@ -0,0 +1,11 @@ + + + + + + + diff --git a/system/interfaces.py b/system/interfaces.py new file mode 100644 index 0000000..bb16900 --- /dev/null +++ b/system/interfaces.py @@ -0,0 +1,65 @@ +# +# Copyright (c) 2008 Helmut Merz helmutm@cy55.de +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + +""" +System management interfaces. + +$Id$ +""" + +from zope.interface import Interface, Attribute +from zope import interface, component, schema + +from loops.interfaces import IConceptSchema +from loops.util import _ + + +class IJob(IConceptSchema): + """ Specifies/represents a job to be executed by a cybertools.agent + instance. + """ + + identifier = schema.TextLine( + title=_(u'Job Identifier'), + description=_(u'A name/ID unique within the realm of the ' + 'controller.'), + required=True,) + agentId = schema.TextLine( + title=_(u'Agent Identifier'), + description=_(u'The identifier of the agent that will ' + 'execute the job; this identifies also the type ' + 'of job, e.g. a crawling or transport job.') + startTime = schema.Date( + title=_(u'Start Date/Time'), + description=_(u'Date/time at which the job should be ' + 'executed. If omitted the job will be executed ' + 'immediately.'), + required=False,) + + #params = Attribute('Mapping with key/value pairs to be used by ' + # 'the ``execute()`` method.') + #repeat = Attribute('Number of seconds after which the job should be ' + # 'rescheduled. Do not repeat if 0.') + #successors = Attribute('Jobs to execute immediately after this ' + # 'one has been finished.') + + +class IJobManager(IConceptSchema): + """ A container/manager for jobs to be executed by a cybertools.agent + instance. + """ diff --git a/system/setup.py b/system/setup.py new file mode 100644 index 0000000..8da391e --- /dev/null +++ b/system/setup.py @@ -0,0 +1,42 @@ +# +# Copyright (c) 2008 Helmut Merz helmutm@cy55.de +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + +""" +Automatic setup of a loops site for the system package. + +$Id$ +""" + +from zope.component import adapts +from zope.interface import implements, Interface + +from loops.concept import Concept +from loops.interfaces import ITypeConcept +from loops.setup import SetupManager as BaseSetupManager + + +class SetupManager(BaseSetupManager): + + def setup(self): + concepts = self.context.getConceptManager() + type = concepts.getTypeConcept() + predicate = concepts['predicate'] + # type concepts: + job = self.addAndConfigureObject(concepts, Concept, 'job', title=u'Job', + conceptType=type) + diff --git a/system/tests.py b/system/tests.py new file mode 100755 index 0000000..de0915c --- /dev/null +++ b/system/tests.py @@ -0,0 +1,23 @@ +# $Id$ + +import unittest, doctest +from zope.testing.doctestunit import DocFileSuite +from zope.interface.verify import verifyClass +#from loops.versioning import versionable + +class Test(unittest.TestCase): + "Basic tests for the system sub-package." + + def testSomething(self): + pass + + +def test_suite(): + flags = doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS + return unittest.TestSuite(( + unittest.makeSuite(Test), + DocFileSuite('README.txt', optionflags=flags), + )) + +if __name__ == '__main__': + unittest.main(defaultTest='test_suite')