Reorganize interfaces and decorators.
authorGunnar Wrobel <p@rdus.de>
Tue, 3 Nov 2009 10:56:09 +0000 (11:56 +0100)
committerGunnar Wrobel <p@rdus.de>
Tue, 3 Nov 2009 10:57:52 +0000 (11:57 +0100)
137 files changed:
framework/Kolab_Server/lib/Horde/Kolab/Server.php [deleted file]
framework/Kolab_Server/lib/Horde/Kolab/Server/Cleaner.php [deleted file]
framework/Kolab_Server/lib/Horde/Kolab/Server/Composite.php [deleted file]
framework/Kolab_Server/lib/Horde/Kolab/Server/Composite/Base.php [new file with mode: 0644]
framework/Kolab_Server/lib/Horde/Kolab/Server/Composite/Interface.php [new file with mode: 0644]
framework/Kolab_Server/lib/Horde/Kolab/Server/Connection.php [deleted file]
framework/Kolab_Server/lib/Horde/Kolab/Server/Connection/Interface.php [new file with mode: 0644]
framework/Kolab_Server/lib/Horde/Kolab/Server/Connection/Mock.php
framework/Kolab_Server/lib/Horde/Kolab/Server/Connection/Mock/Ldap.php
framework/Kolab_Server/lib/Horde/Kolab/Server/Connection/Simpleldap.php
framework/Kolab_Server/lib/Horde/Kolab/Server/Connection/Splittedldap.php
framework/Kolab_Server/lib/Horde/Kolab/Server/Decorator/Clean.php [new file with mode: 0644]
framework/Kolab_Server/lib/Horde/Kolab/Server/Decorator/Count.php [new file with mode: 0644]
framework/Kolab_Server/lib/Horde/Kolab/Server/Decorator/Log.php [new file with mode: 0644]
framework/Kolab_Server/lib/Horde/Kolab/Server/Decorator/Map.php [new file with mode: 0644]
framework/Kolab_Server/lib/Horde/Kolab/Server/Factory.php [deleted file]
framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Base.php
framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Cleaner.php [deleted file]
framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Configuration.php
framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Conn.php [deleted file]
framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Conn/Base.php [deleted file]
framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Conn/Configuration.php [deleted file]
framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Conn/Injector.php [deleted file]
framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Conn/Ldap.php [deleted file]
framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Conn/Mock.php [deleted file]
framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Connection/Base.php [new file with mode: 0644]
framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Connection/Configuration.php [new file with mode: 0644]
framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Connection/Injector.php [new file with mode: 0644]
framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Connection/Interface.php [new file with mode: 0644]
framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Connection/Ldap.php [new file with mode: 0644]
framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Connection/Mock.php [new file with mode: 0644]
framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Constructor.php
framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Decorator/Clean.php [new file with mode: 0644]
framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Decorator/Count.php [new file with mode: 0644]
framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Decorator/Log.php [new file with mode: 0644]
framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Decorator/Map.php [new file with mode: 0644]
framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Injector.php
framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Interface.php [new file with mode: 0644]
framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Logged.php [deleted file]
framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Mapped.php [deleted file]
framework/Kolab_Server/lib/Horde/Kolab/Server/Interface.php [new file with mode: 0644]
framework/Kolab_Server/lib/Horde/Kolab/Server/Ldap.php
framework/Kolab_Server/lib/Horde/Kolab/Server/Ldap/Changes.php
framework/Kolab_Server/lib/Horde/Kolab/Server/Ldap/Filtered.php
framework/Kolab_Server/lib/Horde/Kolab/Server/Ldap/Standard.php
framework/Kolab_Server/lib/Horde/Kolab/Server/List.php [deleted file]
framework/Kolab_Server/lib/Horde/Kolab/Server/List/Interface.php [new file with mode: 0644]
framework/Kolab_Server/lib/Horde/Kolab/Server/Logged.php [deleted file]
framework/Kolab_Server/lib/Horde/Kolab/Server/Mapped.php [deleted file]
framework/Kolab_Server/lib/Horde/Kolab/Server/Object.php [deleted file]
framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Attribute.php [deleted file]
framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Attribute/Base.php
framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Attribute/Decorator.php
framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Attribute/Interface.php [new file with mode: 0644]
framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Attribute/Objectclass.php
framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Base.php
framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Factory.php
framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Groupofnames.php
framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Hash.php
framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Inetorgperson.php
framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Interface.php [new file with mode: 0644]
framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Kolab/User.php
framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Kolabinetorgperson.php
framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Mcached.php
framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Organizationalperson.php
framework/Kolab_Server/lib/Horde/Kolab/Server/Objects.php [deleted file]
framework/Kolab_Server/lib/Horde/Kolab/Server/Objects/Base.php
framework/Kolab_Server/lib/Horde/Kolab/Server/Objects/Interface.php [new file with mode: 0644]
framework/Kolab_Server/lib/Horde/Kolab/Server/Query.php [deleted file]
framework/Kolab_Server/lib/Horde/Kolab/Server/Query/Element.php [deleted file]
framework/Kolab_Server/lib/Horde/Kolab/Server/Query/Element/And.php
framework/Kolab_Server/lib/Horde/Kolab/Server/Query/Element/Approx.php
framework/Kolab_Server/lib/Horde/Kolab/Server/Query/Element/Begins.php
framework/Kolab_Server/lib/Horde/Kolab/Server/Query/Element/Contains.php
framework/Kolab_Server/lib/Horde/Kolab/Server/Query/Element/Ends.php
framework/Kolab_Server/lib/Horde/Kolab/Server/Query/Element/Equals.php
framework/Kolab_Server/lib/Horde/Kolab/Server/Query/Element/Greater.php
framework/Kolab_Server/lib/Horde/Kolab/Server/Query/Element/Group.php
framework/Kolab_Server/lib/Horde/Kolab/Server/Query/Element/Interface.php [new file with mode: 0644]
framework/Kolab_Server/lib/Horde/Kolab/Server/Query/Element/Less.php
framework/Kolab_Server/lib/Horde/Kolab/Server/Query/Element/Mapped.php
framework/Kolab_Server/lib/Horde/Kolab/Server/Query/Element/Not.php
framework/Kolab_Server/lib/Horde/Kolab/Server/Query/Element/Or.php
framework/Kolab_Server/lib/Horde/Kolab/Server/Query/Element/Single.php
framework/Kolab_Server/lib/Horde/Kolab/Server/Query/Interface.php [new file with mode: 0644]
framework/Kolab_Server/lib/Horde/Kolab/Server/Query/Ldap.php
framework/Kolab_Server/lib/Horde/Kolab/Server/Result.php [deleted file]
framework/Kolab_Server/lib/Horde/Kolab/Server/Result/Interface.php [new file with mode: 0644]
framework/Kolab_Server/lib/Horde/Kolab/Server/Result/Ldap.php
framework/Kolab_Server/lib/Horde/Kolab/Server/Schema.php [deleted file]
framework/Kolab_Server/lib/Horde/Kolab/Server/Schema/Base.php
framework/Kolab_Server/lib/Horde/Kolab/Server/Schema/Decorator/Cache.php [new file with mode: 0644]
framework/Kolab_Server/lib/Horde/Kolab/Server/Schema/Interface.php [new file with mode: 0644]
framework/Kolab_Server/lib/Horde/Kolab/Server/Search/Base.php
framework/Kolab_Server/lib/Horde/Kolab/Server/Search/Interface.php
framework/Kolab_Server/lib/Horde/Kolab/Server/Search/Operation/Base.php
framework/Kolab_Server/lib/Horde/Kolab/Server/Search/Operation/Groupsformember.php [new file with mode: 0644]
framework/Kolab_Server/lib/Horde/Kolab/Server/Search/Operation/Guid.php
framework/Kolab_Server/lib/Horde/Kolab/Server/Search/Operation/Restrictgroups.php [new file with mode: 0644]
framework/Kolab_Server/lib/Horde/Kolab/Server/Structure/Base.php
framework/Kolab_Server/lib/Horde/Kolab/Server/Structure/Interface.php
framework/Kolab_Server/lib/Horde/Kolab/Server/Structure/Kolab.php
framework/Kolab_Server/lib/Horde/Kolab/Server/Structure/Ldap.php
framework/Kolab_Server/package.xml
framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/CleanerTest.php [deleted file]
framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Composite/BaseTest.php [new file with mode: 0644]
framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/CompositeTest.php [deleted file]
framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Decorator/CleanTest.php [new file with mode: 0644]
framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Decorator/LogTest.php [new file with mode: 0644]
framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/CleanerTest.php [deleted file]
framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/ConfigurationTest.php
framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/Conn/ConfigurationTest.php [deleted file]
framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/Conn/InjectorTest.php [deleted file]
framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/Conn/LdapTest.php [deleted file]
framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/Conn/MockTest.php [deleted file]
framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/Connection/ConfigurationTest.php [new file with mode: 0644]
framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/Connection/InjectorTest.php [new file with mode: 0644]
framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/Connection/LdapTest.php [new file with mode: 0644]
framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/Connection/MockTest.php [new file with mode: 0644]
framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/ConstructorTest.php
framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/Decorator/CleanTest.php [new file with mode: 0644]
framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/Decorator/LogTest.php [new file with mode: 0644]
framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/Decorator/MapTest.php [new file with mode: 0644]
framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/InjectorTest.php
framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/KolabTest.php
framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/LoggedTest.php [deleted file]
framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/MappedTest.php [deleted file]
framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Ldap/ChangesTest.php
framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/LdapTest.php
framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/LoggedTest.php [deleted file]
framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Object/Attribute/BaseTest.php
framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Object/BaseTest.php
framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Query/LdapTest.php
framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Search/Operation/GuidTest.php
framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Structure/KolabTest.php
framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Structure/LdapTest.php
framework/Kolab_Server/test/Horde/Kolab/Server/TestCase.php

diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server.php b/framework/Kolab_Server/lib/Horde/Kolab/Server.php
deleted file mode 100644 (file)
index d80da8d..0000000
+++ /dev/null
@@ -1,184 +0,0 @@
-<?php
-/**
- * A library for accessing the Kolab user database.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-
-/**
- * This class defines the interface of a generic Kolab user database.
- *
- * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-interface Horde_Kolab_Server
-{
-    /**
-     * Connect to the server.
-     *
-     * @param string $guid The global unique id of the user.
-     * @param string $pass The password.
-     *
-     * @return NULL.
-     *
-     * @throws Horde_Kolab_Server_Exception If the connection failed.
-     */
-    public function connectGuid($guid = '', $pass = '');
-
-    /**
-     * Get the current GUID
-     *
-     * @return string The GUID of the currently connected user.
-     */
-    public function getGuid();
-
-    /**
-     * Get the base GUID of this server
-     *
-     * @return string The base GUID of this server.
-     */
-    public function getBaseGuid();
-
-    /**
-     * Low level access to reading object data.
-     *
-     * This function provides direct access to the Server data.
-     *
-     * Usually you should use
-     *
-     * <code>
-     *   $object = $server->fetch('a server uid');
-     *   $variable = $object['attribute']
-     * </code>
-     *
-     * to access object attributes. This is slower but takes special object
-     * handling into account (e.g. custom attribute parsing).
-     *
-     * @param string $guid The object to retrieve.
-     *
-     * @return array An array of attributes.
-     *
-     * @throws Horde_Kolab_Server_Exception
-     */
-    public function read($guid);
-
-    /**
-     * Low level access to reading some object attributes.
-     *
-     * @param string $guid  The object to retrieve.
-     * @param string $attrs Restrict to these attributes.
-     *
-     * @return array An array of attributes.
-     *
-     * @throws Horde_Kolab_Server_Exception
-     *
-     * @see Horde_Kolab_Server::read
-     */
-    public function readAttributes($guid, array $attrs);
-
-    /**
-     * Finds object data matching a given set of criteria.
-     *
-     * @param string $query  The LDAP search query
-     * @param array  $params Additional search parameters.
-     *
-     * @return Horde_Kolab_Server_Result The result object.
-     *
-     * @throws Horde_Kolab_Server_Exception
-     */
-    public function find($query, array $params = array());
-
-    /**
-     * Finds all object data below a parent matching a given set of criteria.
-     *
-     * @param string $query  The LDAP search query
-     * @param string $parent The parent to search below.
-     * @param array  $params Additional search parameters.
-     *
-     * @return Horde_Kolab_Server_Result The result object.
-     *
-     * @throws Horde_Kolab_Server_Exception
-     */
-    public function findBelow($query, $parent, array $params = array());
-
-    /**
-     * Modify existing object data.
-     *
-     * @param Horde_Kolab_Server_Object $object The object to be modified.
-     * @param array                     $data   The attributes of the object
-     *                                          to be stored.
-     *
-     * @return NULL
-     *
-     * @throws Horde_Kolab_Server_Exception
-     */
-    public function save(Horde_Kolab_Server_Object $object, array $data);
-
-    /**
-     * Add new object data.
-     *
-     * @param Horde_Kolab_Server_Object $object The object to be added.
-     * @param array                     $data   The attributes of the object
-     *                                          to be added.
-     *
-     * @return NULL
-     *
-     * @throws Horde_Kolab_Server_Exception
-     */
-    public function add(Horde_Kolab_Server_Object $object, array $data);
-
-    /**
-     * Delete an object.
-     *
-     * @param string $guid The GUID of the object to be deleted.
-     *
-     * @return NULL
-     *
-     * @throws Horde_Kolab_Server_Exception
-     */
-    public function delete($guid);
-
-    /**
-     * Rename an object.
-     *
-     * @param string $guid The GUID of the object to be renamed.
-     * @param string $new  The new GUID of the object.
-     *
-     * @return NULL
-     *
-     * @throws Horde_Kolab_Server_Exception
-     */
-    public function rename($guid, $new);
-
-    /**
-     * Return the database schema description.
-     *
-     * @return array The schema.
-     *
-     * @throws Horde_Kolab_Server_Exception If retrieval of the schema failed.
-     */
-    public function getSchema();
-
-    /**
-     * Get the parent GUID of this object.
-     *
-     * @param string $guid The GUID of the child.
-     *
-     * @return string the parent GUID of this object.
-     */
-    public function getParentGuid($guid);
-}
\ No newline at end of file
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Cleaner.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Cleaner.php
deleted file mode 100644 (file)
index 9df64e5..0000000
+++ /dev/null
@@ -1,263 +0,0 @@
-<?php
-/**
- * A cleanup decoration for Kolab Servers that allows to remove all added
- * objects.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-
-/**
- * A cleanup decoration for Kolab Servers that allows to remove all added
- * objects.
- *
- * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-class Horde_Kolab_Server_Cleaner implements Horde_Kolab_Server
-{
-    /**
-     * The server we delegate to.
-     *
-     * @var Horde_Kolab_Server
-     */
-    private $_server;
-
-    /**
-     * The objects added.
-     *
-     * @var array
-     */
-    private $_added = array();
-
-    /**
-     * Constructor.
-     *
-     * @param Horde_Kolab_Server $server The base server connection.
-     */
-    public function __construct(Horde_Kolab_Server $server)
-    {
-        $this->_server = $server;
-    }
-
-    /**
-     * Connect to the server.
-     *
-     * @param string $guid The global unique id of the user.
-     * @param string $pass The password.
-     *
-     * @return NULL.
-     *
-     * @throws Horde_Kolab_Server_Exception If the connection failed.
-     */
-    public function connectGuid($guid = null, $pass = null)
-    {
-        $this->_server->connectGuid($guid, $pass);
-    }
-
-    /**
-     * Get the current GUID
-     *
-     * @return string The GUID of the connected user.
-     */
-    public function getGuid()
-    {
-        return $this->_server->getGuid();
-    }
-
-    /**
-     * Get the base GUID of this server
-     *
-     * @return string The base GUID of this server.
-     */
-    public function getBaseGuid()
-    {
-        return $this->_server->getBaseGuid();
-    }
-
-    /**
-     * Low level access to reading object data.
-     *
-     * @param string $guid  The object to retrieve.
-     * @param array  $attrs Restrict to these attributes.
-     *
-     * @return array An array of attributes.
-     *
-     * @throws Horde_Kolab_Server_Exception If the search operation hit an error
-     *                                      or returned no result.
-     */
-    public function read($guid, array $attrs = array())
-    {
-        return $this->_server->read($guid);
-    }
-
-    /**
-     * Low level access to reading some object attributes.
-     *
-     * @param string $guid  The object to retrieve.
-     * @param string $attrs Restrict to these attributes.
-     *
-     * @return array An array of attributes.
-     *
-     * @throws Horde_Kolab_Server_Exception
-     *
-     * @see Horde_Kolab_Server::read
-     */
-    public function readAttributes($guid, array $attrs)
-    {
-        return $this->_server->readAttributes($guid, $attrs);
-    }
-
-    /**
-     * Finds object data matching a given set of criteria.
-     *
-     * @param string $query  The LDAP search query
-     * @param array  $params Additional search parameters.
-     *
-     * @return Horde_Kolab_Server_Result The result object.
-     *
-     * @throws Horde_Kolab_Server_Exception
-     */
-    public function find($query, array $params = array())
-    {
-        return $this->_server->find($query, $params);
-    }
-
-    /**
-     * Finds all object data below a parent matching a given set of criteria.
-     *
-     * @param string $query  The LDAP search query
-     * @param string $parent The parent to search below.
-     * @param array  $params Additional search parameters.
-     *
-     * @return Horde_Kolab_Server_Result The result object.
-     *
-     * @throws Horde_Kolab_Server_Exception
-     */
-    public function findBelow($query, $parent, array $params = array())
-    {
-        return $this->_server->findBelow($query, $parent, $params);
-    }
-
-    /**
-     * Modify existing object data.
-     *
-     * @param Horde_Kolab_Server_Object $object The object to be modified.
-     * @param array                     $data   The attributes of the object
-     *                                          to be stored.
-     *
-     * @return NULL
-     *
-     * @throws Horde_Kolab_Server_Exception
-     */
-    public function save(Horde_Kolab_Server_Object $object, array $data)
-    {
-        $this->_server->save($object, $data);
-    }
-
-    /**
-     * Add new object data.
-     *
-     * @param Horde_Kolab_Server_Object $object The object to be added.
-     * @param array                     $data   The attributes of the object
-     *                                          to be added.
-     *
-     * @return NULL
-     *
-     * @throws Horde_Kolab_Server_Exception
-     */
-    public function add(Horde_Kolab_Server_Object $object, array $data)
-    {
-        $this->_server->add($object, $data);
-        $this->_added[] = $object->getGuid();
-    }
-
-    /**
-     * Delete an object.
-     *
-     * @param string $guid The GUID of the object to be deleted.
-     *
-     * @return NULL
-     *
-     * @throws Horde_Kolab_Server_Exception
-     */
-    public function delete($guid)
-    {
-        $this->_server->delete($guid);
-        if (in_array($guid, $this->_added)) {
-            $this->_added = array_diff($this->_added, array($guid));
-        }
-    }
-
-    /**
-     * Rename an object.
-     *
-     * @param string $guid The GUID of the object to be renamed.
-     * @param string $new  The new GUID of the object.
-     *
-     * @return NULL
-     *
-     * @throws Horde_Kolab_Server_Exception
-     */
-    public function rename($guid, $new)
-    {
-        $this->_server->rename($guid, $new);
-    }
-
-    /**
-     * Return the ldap schema.
-     *
-     * @return Net_LDAP2_Schema The LDAP schema.
-     *
-     * @throws Horde_Kolab_Server_Exception If retrieval of the schema failed.
-     */
-    public function getSchema()
-    {
-        return $this->_server->getSchema();
-    }
-
-    /**
-     * Get the parent GUID of this object.
-     *
-     * @param string $guid The GUID of the child.
-     *
-     * @return string the parent GUID of this object.
-     */
-    public function getParentGuid($guid)
-    {
-        return $this->_server->getParentGuid($guid);
-    }
-
-    /**
-     * Cleanup the server.
-     *
-     * @return NULL
-     */
-    public function cleanup()
-    {
-        foreach ($this->_added as $guid) {
-            $this->delete($guid);
-        }
-    }
-
-    /**
-     * Destructor.
-     */
-    public function __destruct()
-    {
-        $this->cleanup();
-    }
-}
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Composite.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Composite.php
deleted file mode 100644 (file)
index 78bec71..0000000
+++ /dev/null
@@ -1,129 +0,0 @@
-<?php
-/**
- * A simple composition of server functionality.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-
-/**
- * A simple composition of server functionality.
- *
- * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-class Horde_Kolab_Server_Composite
-{
-    /**
-     * The server.
-     *
-     * @var Horde_Kolab_Server
-     */
-    private $_server;
-
-    /**
-     * The structure handler for this server.
-     *
-     * @var Horde_Kolab_Server_Structure
-     */
-    private $_structure;
-
-    /**
-     * The search handler for this server.
-     *
-     * @var Horde_Kolab_Server_Search
-     */
-    private $_search;
-
-    /**
-     * The object handler for this server.
-     *
-     * @var Horde_Kolab_Server_Objects
-     */
-    private $_objects;
-
-    /**
-     * The schema handler for this server.
-     *
-     * @var Horde_Kolab_Server_Schema
-     */
-    private $_schema;
-
-    /**
-     * Construct a new Horde_Kolab_Server object.
-     *
-     * @param array $params Parameter array.
-     */
-    public function __construct(
-        Horde_Kolab_Server $server,
-        Horde_Kolab_Server_Objects $objects,
-        Horde_Kolab_Server_Structure_Interface $structure,
-        Horde_Kolab_Server_Search_Interface $search,
-        Horde_Kolab_Server_Schema $schema
-    ) {
-        $this->_server    = $server;
-        $this->_objects   = $objects;
-        $this->_structure = $structure;
-        $this->_search    = $search;
-        $this->_schema    = $schema;
-
-        $structure->setComposite($this);
-        $search->setComposite($this);
-        $schema->setComposite($this);
-        $objects->setComposite($this);
-    }
-
-    /**
-     * Retrieve an object attribute.
-     *
-     * @param string $key The name of the attribute.
-     *
-     * @return mixed The atribute value.
-     *
-     * @throws Horde_Kolab_Server_Exception If the attribute does not exist.
-     */
-    public function __get($key)
-    {
-        $public = array('server', 'objects', 'structure', 'search', 'schema');
-        if (in_array($key, $public)) {
-            $priv_key = '_' . $key;
-            return $this->$priv_key;
-        }
-        throw new Horde_Kolab_Server_Exception(
-            sprintf('Attribute %s not supported!', $key)
-        );
-    }
-
-    /**
-     * Connect to the server. Use this method if the user name you can provide
-     * does not match a DN. In this case it will be required to map this user
-     * name first.
-     *
-     * @param string $user The user name.
-     * @param string $pass The password.
-     *
-     * @return NULL.
-     *
-     * @throws Horde_Kolab_Server_Exception If the connection failed.
-     */
-    public function connect($user = null, $pass = null)
-    {
-        /** Bind anonymously first. */
-        $this->server->connectGuid();
-        $guid = $this->search->searchGuidForUidOrMail($user);
-        $this->server->connectGuid($guid, $pass);
-    }
-}
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Composite/Base.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Composite/Base.php
new file mode 100644 (file)
index 0000000..369b530
--- /dev/null
@@ -0,0 +1,130 @@
+<?php
+/**
+ * A simple composition of server functionality.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+
+/**
+ * A simple composition of server functionality.
+ *
+ * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+class Horde_Kolab_Server_Composite_Base
+implements Horde_Kolab_Server_Composite_Interface
+{
+    /**
+     * The server.
+     *
+     * @var Horde_Kolab_Server_Interface
+     */
+    private $_server;
+
+    /**
+     * The structure handler for this server.
+     *
+     * @var Horde_Kolab_Server_Structure_Interface
+     */
+    private $_structure;
+
+    /**
+     * The search handler for this server.
+     *
+     * @var Horde_Kolab_Server_Search_Interface
+     */
+    private $_search;
+
+    /**
+     * The object handler for this server.
+     *
+     * @var Horde_Kolab_Server_Objects_Interface
+     */
+    private $_objects;
+
+    /**
+     * The schema handler for this server.
+     *
+     * @var Horde_Kolab_Server_Schema_Interface
+     */
+    private $_schema;
+
+    /**
+     * Construct a new Horde_Kolab_Server object.
+     *
+     * @param array $params Parameter array.
+     */
+    public function __construct(
+        Horde_Kolab_Server_Interface $server,
+        Horde_Kolab_Server_Objects_Interface $objects,
+        Horde_Kolab_Server_Structure_Interface $structure,
+        Horde_Kolab_Server_Search_Interface $search,
+        Horde_Kolab_Server_Schema_Interface $schema
+    ) {
+        $this->_server    = $server;
+        $this->_objects   = $objects;
+        $this->_structure = $structure;
+        $this->_search    = $search;
+        $this->_schema    = $schema;
+
+        $structure->setComposite($this);
+        $search->setComposite($this);
+        $schema->setComposite($this);
+        $objects->setComposite($this);
+    }
+
+    /**
+     * Retrieve an object attribute.
+     *
+     * @param string $key The name of the attribute.
+     *
+     * @return mixed The atribute value.
+     *
+     * @throws Horde_Kolab_Server_Exception If the attribute does not exist.
+     */
+    public function __get($key)
+    {
+        $public = array('server', 'objects', 'structure', 'search', 'schema');
+        if (in_array($key, $public)) {
+            $priv_key = '_' . $key;
+            return $this->$priv_key;
+        }
+        throw new Horde_Kolab_Server_Exception(
+            sprintf('Attribute %s not supported!', $key)
+        );
+    }
+
+    /**
+     * Connect to the server. Use this method if the user name you can provide
+     * does not match a DN. In this case it will be required to map this user
+     * name first.
+     *
+     * @param string $user The user name.
+     * @param string $pass The password.
+     *
+     * @return NULL.
+     *
+     * @throws Horde_Kolab_Server_Exception If the connection failed.
+     */
+    public function connect($user = null, $pass = null)
+    {
+        /** Bind anonymously first. */
+        $this->server->connectGuid();
+        $guid = $this->search->searchGuidForUidOrMail($user);
+        $this->server->connectGuid($guid, $pass);
+    }
+}
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Composite/Interface.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Composite/Interface.php
new file mode 100644 (file)
index 0000000..6016b4a
--- /dev/null
@@ -0,0 +1,43 @@
+<?php
+/**
+ * Marks composite server instances.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+
+/**
+ * Marks composite server instances.
+ *
+ * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+interface Horde_Kolab_Server_Composite_Interface
+{
+    /**
+     * Connect to the server. Use this method if the user name you can provide
+     * does not match a DN. In this case it will be required to map this user
+     * name first.
+     *
+     * @param string $user The user name.
+     * @param string $pass The password.
+     *
+     * @return NULL.
+     *
+     * @throws Horde_Kolab_Server_Exception If the connection failed.
+     */
+    public function connect($user = null, $pass = null);
+}
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Connection.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Connection.php
deleted file mode 100644 (file)
index 2da34a2..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-<?php
-/**
- * Interface for connection handling.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-
-/**
- * Interface for connection handling.
- *
- * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-interface Horde_Kolab_Server_Connection
-{
-    /**
-     * Get the server read connection.
-     *
-     * @return mixed The connection for reading data.
-     */
-    public function getRead();
-
-    /**
-     * Get the server write connection.
-     *
-     * @return mixed The connection for writing data.
-     */
-    public function getWrite();
-}
\ No newline at end of file
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Connection/Interface.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Connection/Interface.php
new file mode 100644 (file)
index 0000000..b9e8689
--- /dev/null
@@ -0,0 +1,43 @@
+<?php
+/**
+ * Interface for connection handling.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+
+/**
+ * Interface for connection handling.
+ *
+ * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+interface Horde_Kolab_Server_Connection_Interface
+{
+    /**
+     * Get the server read connection.
+     *
+     * @return mixed The connection for reading data.
+     */
+    public function getRead();
+
+    /**
+     * Get the server write connection.
+     *
+     * @return mixed The connection for writing data.
+     */
+    public function getWrite();
+}
\ No newline at end of file
index e78597f..c3b8b99 100644 (file)
@@ -26,7 +26,7 @@
  * @link     http://pear.horde.org/index.php?package=Kolab_Server
  */
 class Horde_Kolab_Server_Connection_Mock
-implements Horde_Kolab_Server_Connection
+implements Horde_Kolab_Server_Connection_Interface
 {
     /**
      * The LDAP connection handle.
index c97c671..ac08fe9 100644 (file)
@@ -88,13 +88,13 @@ class Horde_Kolab_Server_Connection_Mock_Ldap
                 throw new Horde_Kolab_Server_Exception('User does not exist!');
             }
 
-            if (!isset($this->_data[$dn]['userPassword'][0])) {
+            if (!isset($this->_data[$dn]['data']['userPassword'][0])) {
                 throw new Horde_Kolab_Server_Exception('User has no password entry!');
             }
-            if ($this->_data[$dn]['userPassword'][0] != $pw) {
+            if ($this->_data[$dn]['data']['userPassword'][0] != $pw) {
                 throw new Horde_Kolab_Server_Exception('Incorrect password!');
             }
-        } else if (!empty($this->params_['no_anonymous_bind'])) {
+        } else if (!empty($this->_params['no_anonymous_bind'])) {
             throw new Horde_Kolab_Server_Exception('Anonymous bind is not allowed!');
         }
 
@@ -163,7 +163,7 @@ class Horde_Kolab_Server_Connection_Mock_Ldap
             if (isset($params['scope'])) {
                 if ($params['scope'] == 'base') {
                     if (isset($this->_data[$base])) {
-                        $result = $this->_data[$base];
+                        $result[] = $this->_data[$base];
                     } else {
                         $result = array();
                     }
@@ -213,7 +213,7 @@ class Horde_Kolab_Server_Connection_Mock_Ldap
         if (!empty($base)) {
             $subtree = array();
             foreach ($result as $entry) {
-                if (strpos($entry['dn'], $base)) {
+                if (strpos($entry['dn'], $base) !== false) {
                     $subtree[] = $entry;
                 }
             }
index 73c903f..b308ed9 100644 (file)
@@ -26,7 +26,7 @@
  * @link     http://pear.horde.org/index.php?package=Kolab_Server
  */
 class Horde_Kolab_Server_Connection_Simpleldap
-implements Horde_Kolab_Server_Connection
+implements Horde_Kolab_Server_Connection_Interface
 {
     /**
      * The LDAP connection handle.
index b5781a7..7fb6872 100644 (file)
@@ -26,7 +26,7 @@
  * @link     http://pear.horde.org/index.php?package=Kolab_Server
  */
 class Horde_Kolab_Server_Connection_Splittedldap
-implements Horde_Kolab_Server_Connection
+implements Horde_Kolab_Server_Connection_Interface
 {
     /**
      * LDAP read connection handle.
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Decorator/Clean.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Decorator/Clean.php
new file mode 100644 (file)
index 0000000..5352d74
--- /dev/null
@@ -0,0 +1,269 @@
+<?php
+/**
+ * A cleanup decoration for Kolab Servers that allows to remove all added
+ * objects.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+
+/**
+ * A cleanup decoration for Kolab Servers that allows to remove all added
+ * objects.
+ *
+ * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+class Horde_Kolab_Server_Decorator_Clean
+implements Horde_Kolab_Server_Interface
+{
+    /**
+     * The server we delegate to.
+     *
+     * @var Horde_Kolab_Server
+     */
+    private $_server;
+
+    /**
+     * The objects added.
+     *
+     * @var array
+     */
+    private $_added = array();
+
+    /**
+     * Constructor.
+     *
+     * @param Horde_Kolab_Server $server The base server connection.
+     */
+    public function __construct(
+        Horde_Kolab_Server_Interface $server
+    ) {
+        $this->_server = $server;
+    }
+
+    /**
+     * Connect to the server.
+     *
+     * @param string $guid The global unique id of the user.
+     * @param string $pass The password.
+     *
+     * @return NULL.
+     *
+     * @throws Horde_Kolab_Server_Exception If the connection failed.
+     */
+    public function connectGuid($guid = null, $pass = null)
+    {
+        $this->_server->connectGuid($guid, $pass);
+    }
+
+    /**
+     * Get the current GUID
+     *
+     * @return string The GUID of the connected user.
+     */
+    public function getGuid()
+    {
+        return $this->_server->getGuid();
+    }
+
+    /**
+     * Get the base GUID of this server
+     *
+     * @return string The base GUID of this server.
+     */
+    public function getBaseGuid()
+    {
+        return $this->_server->getBaseGuid();
+    }
+
+    /**
+     * Low level access to reading object data.
+     *
+     * @param string $guid  The object to retrieve.
+     * @param array  $attrs Restrict to these attributes.
+     *
+     * @return array An array of attributes.
+     *
+     * @throws Horde_Kolab_Server_Exception If the search operation hit an error
+     *                                      or returned no result.
+     */
+    public function read($guid, array $attrs = array())
+    {
+        return $this->_server->read($guid);
+    }
+
+    /**
+     * Low level access to reading some object attributes.
+     *
+     * @param string $guid  The object to retrieve.
+     * @param string $attrs Restrict to these attributes.
+     *
+     * @return array An array of attributes.
+     *
+     * @throws Horde_Kolab_Server_Exception
+     *
+     * @see Horde_Kolab_Server::read
+     */
+    public function readAttributes($guid, array $attrs)
+    {
+        return $this->_server->readAttributes($guid, $attrs);
+    }
+
+    /**
+     * Finds object data matching a given set of criteria.
+     *
+     * @param string $query  The LDAP search query
+     * @param array  $params Additional search parameters.
+     *
+     * @return Horde_Kolab_Server_Result The result object.
+     *
+     * @throws Horde_Kolab_Server_Exception
+     */
+    public function find($query, array $params = array())
+    {
+        return $this->_server->find($query, $params);
+    }
+
+    /**
+     * Finds all object data below a parent matching a given set of criteria.
+     *
+     * @param string $query  The LDAP search query
+     * @param string $parent The parent to search below.
+     * @param array  $params Additional search parameters.
+     *
+     * @return Horde_Kolab_Server_Result The result object.
+     *
+     * @throws Horde_Kolab_Server_Exception
+     */
+    public function findBelow($query, $parent, array $params = array())
+    {
+        return $this->_server->findBelow($query, $parent, $params);
+    }
+
+    /**
+     * Modify existing object data.
+     *
+     * @param Horde_Kolab_Server_Object $object The object to be modified.
+     * @param array                     $data   The attributes of the object
+     *                                          to be stored.
+     *
+     * @return NULL
+     *
+     * @throws Horde_Kolab_Server_Exception
+     */
+    public function save(
+        Horde_Kolab_Server_Object_Interface $object,
+        array $data
+    ) {
+        $this->_server->save($object, $data);
+    }
+
+    /**
+     * Add new object data.
+     *
+     * @param Horde_Kolab_Server_Object $object The object to be added.
+     * @param array                     $data   The attributes of the object
+     *                                          to be added.
+     *
+     * @return NULL
+     *
+     * @throws Horde_Kolab_Server_Exception
+     */
+    public function add(
+        Horde_Kolab_Server_Object_Interface $object,
+        array $data
+    ) {
+        $this->_server->add($object, $data);
+        $this->_added[] = $object->getGuid();
+    }
+
+    /**
+     * Delete an object.
+     *
+     * @param string $guid The GUID of the object to be deleted.
+     *
+     * @return NULL
+     *
+     * @throws Horde_Kolab_Server_Exception
+     */
+    public function delete($guid)
+    {
+        $this->_server->delete($guid);
+        if (in_array($guid, $this->_added)) {
+            $this->_added = array_diff($this->_added, array($guid));
+        }
+    }
+
+    /**
+     * Rename an object.
+     *
+     * @param string $guid The GUID of the object to be renamed.
+     * @param string $new  The new GUID of the object.
+     *
+     * @return NULL
+     *
+     * @throws Horde_Kolab_Server_Exception
+     */
+    public function rename($guid, $new)
+    {
+        $this->_server->rename($guid, $new);
+    }
+
+    /**
+     * Return the ldap schema.
+     *
+     * @return Net_LDAP2_Schema The LDAP schema.
+     *
+     * @throws Horde_Kolab_Server_Exception If retrieval of the schema failed.
+     */
+    public function getSchema()
+    {
+        return $this->_server->getSchema();
+    }
+
+    /**
+     * Get the parent GUID of this object.
+     *
+     * @param string $guid The GUID of the child.
+     *
+     * @return string the parent GUID of this object.
+     */
+    public function getParentGuid($guid)
+    {
+        return $this->_server->getParentGuid($guid);
+    }
+
+    /**
+     * Cleanup the server.
+     *
+     * @return NULL
+     */
+    public function cleanup()
+    {
+        foreach ($this->_added as $guid) {
+            $this->delete($guid);
+        }
+    }
+
+    /**
+     * Destructor.
+     */
+    public function __destruct()
+    {
+        $this->cleanup();
+    }
+}
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Decorator/Count.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Decorator/Count.php
new file mode 100644 (file)
index 0000000..712110b
--- /dev/null
@@ -0,0 +1,283 @@
+<?php
+/**
+ * A server decorator that counts the number of database calls and
+ * reports them via a logger.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+
+/**
+ * A server decorator that counts the number of database calls and
+ * reports them via a logger.
+ *
+ * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+class Horde_Kolab_Server_Decorator_Count
+implements Horde_Kolab_Server_Interface
+{
+    /**
+     * The server we delegate to.
+     *
+     * @var Horde_Kolab_Server
+     */
+    private $_server;
+
+    /**
+     * The log handler.
+     *
+     * @var Horde_Log_Logger
+     */
+    private $_logger;
+
+    /**
+     * The statistic.
+     *
+     * @var array
+     */
+    private $_count = array();
+
+    /**
+     * Constructor.
+     *
+     * @param Horde_Kolab_Server $server The base server connection.
+     * @param mixed              $logger The log handler. The class must at
+     *                                   least provide the info() method.
+     */
+    public function __construct(
+        Horde_Kolab_Server_Interface $server,
+        $logger
+    ) {
+        $this->_server = $server;
+        $this->_logger = $logger;
+    }
+
+    /**
+     * Destructor.
+     *
+     * Logs the counted events.
+     */
+    public function __destruct()
+    {
+        foreach ($this->_count as $method => $count) {
+            $this->_logger->info(
+                sprintf(
+                    'Horde_Kolab_Server: Method %s called %s times.',
+                    $method, $count
+                )
+            );
+        }
+    }
+
+    /**
+     * Connect to the server.
+     *
+     * @param string $guid The global unique id of the user.
+     * @param string $pass The password.
+     *
+     * @return NULL.
+     *
+     * @throws Horde_Kolab_Server_Exception If the connection failed.
+     */
+    public function connectGuid($guid = null, $pass = null)
+    {
+        $this->_server->connectGuid($guid, $pass);
+        $this->_count['connectGuid']++;
+    }
+
+    /**
+     * Get the current GUID
+     *
+     * @return string The GUID of the connected user.
+     */
+    public function getGuid()
+    {
+        return $this->_server->getGuid();
+    }
+
+    /**
+     * Get the base GUID of this server
+     *
+     * @return string The base GUID of this server.
+     */
+    public function getBaseGuid()
+    {
+        return $this->_server->getBaseGuid();
+    }
+
+    /**
+     * Low level access to reading object data.
+     *
+     * @param string $guid  The object to retrieve.
+     * @param array  $attrs Restrict to these attributes.
+     *
+     * @return array An array of attributes.
+     *
+     * @throws Horde_Kolab_Server_Exception If the search operation hit an error
+     *                                      or returned no result.
+     */
+    public function read($guid, array $attrs = array())
+    {
+        return $this->_server->read($guid);
+        $this->_count['read']++;
+    }
+
+    /**
+     * Low level access to reading some object attributes.
+     *
+     * @param string $guid  The object to retrieve.
+     * @param string $attrs Restrict to these attributes.
+     *
+     * @return array An array of attributes.
+     *
+     * @throws Horde_Kolab_Server_Exception
+     *
+     * @see Horde_Kolab_Server::read
+     */
+    public function readAttributes($guid, array $attrs)
+    {
+        return $this->_server->readAttributes($guid, $attrs);
+        $this->_count['readAttributes']++;
+    }
+
+    /**
+     * Finds object data matching a given set of criteria.
+     *
+     * @param string $query  The LDAP search query
+     * @param array  $params Additional search parameters.
+     *
+     * @return Horde_Kolab_Server_Result The result object.
+     *
+     * @throws Horde_Kolab_Server_Exception
+     */
+    public function find($query, array $params = array())
+    {
+        return $this->_server->find($query, $params);
+        $this->_count['find']++;
+    }
+
+    /**
+     * Finds all object data below a parent matching a given set of criteria.
+     *
+     * @param string $query  The LDAP search query
+     * @param string $parent The parent to search below.
+     * @param array  $params Additional search parameters.
+     *
+     * @return Horde_Kolab_Server_Result The result object.
+     *
+     * @throws Horde_Kolab_Server_Exception
+     */
+    public function findBelow($query, $parent, array $params = array())
+    {
+        return $this->_server->findBelow($query, $parent, $params);
+        $this->_count['findBelow']++;
+    }
+
+    /**
+     * Modify existing object data.
+     *
+     * @param Horde_Kolab_Server_Object $object The object to be modified.
+     * @param array                     $data   The attributes of the object
+     *                                          to be stored.
+     *
+     * @return NULL
+     *
+     * @throws Horde_Kolab_Server_Exception
+     */
+    public function save(
+        Horde_Kolab_Server_Object_Interface $object,
+        array $data
+    ) {
+        $this->_server->save($object, $data);
+        $this->_count['save']++;
+    }
+
+    /**
+     * Add new object data.
+     *
+     * @param Horde_Kolab_Server_Object $object The object to be added.
+     * @param array                     $data   The attributes of the object
+     *                                          to be added.
+     *
+     * @return NULL
+     *
+     * @throws Horde_Kolab_Server_Exception
+     */
+    public function add(
+        Horde_Kolab_Server_Object_Interface $object,
+        array $data
+    ) {
+        $this->_server->add($object, $data);
+        $this->_count['add']++;
+    }
+
+    /**
+     * Delete an object.
+     *
+     * @param string $guid The GUID of the object to be deleted.
+     *
+     * @return NULL
+     *
+     * @throws Horde_Kolab_Server_Exception
+     */
+    public function delete($guid)
+    {
+        $this->_server->delete($guid);
+        $this->_count['delete']++;
+    }
+
+    /**
+     * Rename an object.
+     *
+     * @param string $guid The GUID of the object to be renamed.
+     * @param string $new  The new GUID of the object.
+     *
+     * @return NULL
+     *
+     * @throws Horde_Kolab_Server_Exception
+     */
+    public function rename($guid, $new)
+    {
+        $this->_server->rename($guid, $new);
+        $this->_count['rename']++;
+    }
+
+    /**
+     * Return the ldap schema.
+     *
+     * @return Net_LDAP2_Schema The LDAP schema.
+     *
+     * @throws Horde_Kolab_Server_Exception If retrieval of the schema failed.
+     */
+    public function getSchema()
+    {
+        return $this->_server->getSchema();
+        $this->_count['getSchema']++;
+    }
+
+    /**
+     * Get the parent GUID of this object.
+     *
+     * @param string $guid The GUID of the child.
+     *
+     * @return string the parent GUID of this object.
+     */
+    public function getParentGuid($guid)
+    {
+        return $this->_server->getParentGuid($guid);
+    }
+}
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Decorator/Log.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Decorator/Log.php
new file mode 100644 (file)
index 0000000..8d94900
--- /dev/null
@@ -0,0 +1,324 @@
+<?php
+/**
+ * A server delegation that logs server access via Horde_Log_Logger.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+
+/**
+ * A server delegation that logs server access via Horde_Log_Logger.
+ *
+ * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+class Horde_Kolab_Server_Decorator_Log
+implements Horde_Kolab_Server_Interface
+{
+    /**
+     * The server we delegate to.
+     *
+     * @var Horde_Kolab_Server
+     */
+    private $_server;
+
+    /**
+     * The log handler.
+     *
+     * @var Horde_Log_Logger
+     */
+    private $_logger;
+
+    /**
+     * Constructor.
+     *
+     * @param Horde_Kolab_Server $server The base server connection.
+     * @param mixed              $logger The log handler. The class must at
+     *                                   least provide the info() method.
+     */
+    public function __construct(
+        Horde_Kolab_Server_Interface $server,
+        $logger
+    ) {
+        $this->_server = $server;
+        $this->_logger = $logger;
+    }
+
+    /**
+     * Connect to the server.
+     *
+     * @param string $guid The global unique id of the user.
+     * @param string $pass The password.
+     *
+     * @return NULL.
+     *
+     * @throws Horde_Kolab_Server_Exception If the connection failed.
+     */
+    public function connectGuid($guid = null, $pass = null)
+    {
+        try {
+            $this->_server->connectGuid($guid, $pass);
+            $this->_logger->info(
+                sprintf(
+                    "Successfully connected to the Kolab Server as \"%s\".",
+                    $guid
+                )
+            );
+        } catch (Horde_Kolab_Server_Exception $e) {
+            $this->_logger->info(
+                sprintf(
+                    "Failed saving object \"%s\"! Error: %s",
+                    $object->getGuid(), $e->getMessage()
+                )
+            );
+        }
+    }
+
+    /**
+     * Get the current GUID
+     *
+     * @return string The GUID of the connected user.
+     */
+    public function getGuid()
+    {
+        return $this->_server->getGuid();
+    }
+
+    /**
+     * Get the base GUID of this server
+     *
+     * @return string The base GUID of this server.
+     */
+    public function getBaseGuid()
+    {
+        return $this->_server->getBaseGuid();
+    }
+
+    /**
+     * Low level access to reading object data.
+     *
+     * @param string $guid  The object to retrieve.
+     * @param array  $attrs Restrict to these attributes.
+     *
+     * @return array An array of attributes.
+     *
+     * @throws Horde_Kolab_Server_Exception If the search operation hit an error
+     *                                      or returned no result.
+     */
+    public function read($guid, array $attrs = array())
+    {
+        return $this->_server->read($guid);
+    }
+
+    /**
+     * Low level access to reading some object attributes.
+     *
+     * @param string $guid  The object to retrieve.
+     * @param string $attrs Restrict to these attributes.
+     *
+     * @return array An array of attributes.
+     *
+     * @throws Horde_Kolab_Server_Exception
+     *
+     * @see Horde_Kolab_Server::read
+     */
+    public function readAttributes($guid, array $attrs)
+    {
+        return $this->_server->readAttributes($guid, $attrs);
+    }
+
+    /**
+     * Finds object data matching a given set of criteria.
+     *
+     * @param string $query  The LDAP search query
+     * @param array  $params Additional search parameters.
+     *
+     * @return Horde_Kolab_Server_Result The result object.
+     *
+     * @throws Horde_Kolab_Server_Exception
+     */
+    public function find($query, array $params = array())
+    {
+        return $this->_server->find($query, $params);
+    }
+
+    /**
+     * Finds all object data below a parent matching a given set of criteria.
+     *
+     * @param string $query  The LDAP search query
+     * @param string $parent The parent to search below.
+     * @param array  $params Additional search parameters.
+     *
+     * @return Horde_Kolab_Server_Result The result object.
+     *
+     * @throws Horde_Kolab_Server_Exception
+     */
+    public function findBelow($query, $parent, array $params = array())
+    {
+        return $this->_server->findBelow($query, $parent, $params);
+    }
+
+    /**
+     * Modify existing object data.
+     *
+     * @param Horde_Kolab_Server_Object $object The object to be modified.
+     * @param array                     $data   The attributes of the object
+     *                                          to be stored.
+     *
+     * @return NULL
+     *
+     * @throws Horde_Kolab_Server_Exception
+     */
+    public function save(
+        Horde_Kolab_Server_Object_Interface $object,
+        array $data
+    ) {
+        try {
+            $this->_server->save($object, $data);
+            $this->_logger->info(
+                sprintf(
+                    "The object \"%s\" has been successfully saved!",
+                    $object->getGuid()
+                )
+            );
+        } catch (Horde_Kolab_Server_Exception $e) {
+            $this->_logger->info(
+                sprintf(
+                    "Failed saving object \"%s\"! Error: %s",
+                    $object->getGuid(), $e->getMessage()
+                )
+            );
+
+        }
+    }
+
+    /**
+     * Add new object data.
+     *
+     * @param Horde_Kolab_Server_Object $object The object to be added.
+     * @param array                     $data   The attributes of the object
+     *                                          to be added.
+     *
+     * @return NULL
+     *
+     * @throws Horde_Kolab_Server_Exception
+     */
+    public function add(
+        Horde_Kolab_Server_Object_Interface $object,
+        array $data
+    ) {
+        try {
+            $this->_server->add($object, $data);
+            $this->_logger->info(
+                sprintf(
+                    "The object \"%s\" has been successfully added!",
+                    $object->getGuid()
+                )
+            );
+        } catch (Horde_Kolab_Server_Exception $e) {
+            $this->_logger->info(
+                sprintf(
+                    "Failed adding object \"%s\"! Error: %s",
+                    $object->getGuid(), $e->getMessage()
+                )
+            );
+
+        }
+    }
+
+    /**
+     * Delete an object.
+     *
+     * @param string $guid The GUID of the object to be deleted.
+     *
+     * @return NULL
+     *
+     * @throws Horde_Kolab_Server_Exception
+     */
+    public function delete($guid)
+    {
+        try {
+            $this->_server->delete($guid);
+            $this->_logger->info(
+                sprintf("The object \"%s\" has been successfully deleted!", $guid)
+            );
+        } catch (Horde_Kolab_Server_Exception $e) {
+            $this->_logger->info(
+                sprintf(
+                    "Failed deleting object \"%s\"! Error: %s",
+                    $object->getGuid(), $e->getMessage()
+                )
+            );
+
+        }
+
+    }
+
+    /**
+     * Rename an object.
+     *
+     * @param string $guid The GUID of the object to be renamed.
+     * @param string $new  The new GUID of the object.
+     *
+     * @return NULL
+     *
+     * @throws Horde_Kolab_Server_Exception
+     */
+    public function rename($guid, $new)
+    {
+        try {
+            $this->_server->rename($guid, $new);
+            $this->_logger->info(
+                sprintf(
+                    "The object \"%s\" has been successfully renamed to \"%s\"!",
+                    $guid, $new
+                )
+            );
+        } catch (Horde_Kolab_Server_Exception $e) {
+            $this->_logger->info(
+                sprintf(
+                    "Failed saving object \"%s\"! Error: %s",
+                    $object->getGuid(), $e->getMessage()
+                )
+            );
+
+        }
+    }
+
+    /**
+     * Return the ldap schema.
+     *
+     * @return Net_LDAP2_Schema The LDAP schema.
+     *
+     * @throws Horde_Kolab_Server_Exception If retrieval of the schema failed.
+     */
+    public function getSchema()
+    {
+        return $this->_server->getSchema();
+    }
+
+    /**
+     * Get the parent GUID of this object.
+     *
+     * @param string $guid The GUID of the child.
+     *
+     * @return string the parent GUID of this object.
+     */
+    public function getParentGuid($guid)
+    {
+        return $this->_server->getParentGuid($guid);
+    }
+}
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Decorator/Map.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Decorator/Map.php
new file mode 100644 (file)
index 0000000..f5ce4ff
--- /dev/null
@@ -0,0 +1,352 @@
+<?php
+/**
+ * A server delegation that maps object attributes.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+
+/**
+ * A server delegation that maps object attributes.
+ *
+ * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+class Horde_Kolab_Server_Decorator_Map
+implements Horde_Kolab_Server_Interface
+{
+    /**
+     * The server we delegate to.
+     *
+     * @var Horde_Kolab_Server
+     */
+    private $_server;
+
+    /**
+     * The attribute mapping.
+     *
+     * @var array
+     */
+    private $_mapping;
+
+    /**
+     * Constructor.
+     *
+     * @param Horde_Kolab_Server $server  The base server connection.
+     * @param array              $mapping The attribute mapping.
+     */
+    public function __construct(
+        Horde_Kolab_Server_Interface $server,
+        array $mapping
+    ) {
+        $this->_server  = $server;
+        $this->_mapping = $mapping;
+    }
+
+    /**
+     * Connect to the server. Use this method if the user name you can provide
+     * does not match a GUID. In this case it will be required to map this user
+     * name first.
+     *
+     * @param string $user The user name.
+     * @param string $pass The password.
+     *
+     * @return NULL.
+     *
+     * @throws Horde_Kolab_Server_Exception If the connection failed.
+     */
+    public function connect($user = null, $pass = null)
+    {
+        $this->_server->connect($user, $pass);
+    }
+
+    /**
+     * Connect to the server.
+     *
+     * @param string $guid The global unique id of the user.
+     * @param string $pass The password.
+     *
+     * @return NULL.
+     *
+     * @throws Horde_Kolab_Server_Exception If the connection failed.
+     */
+    public function connectGuid($guid = '', $pass = '')
+    {
+         $this->_server->connectGuid($guid, $pass);
+    }
+
+    /**
+     * Get the current GUID
+     *
+     * @return string The GUID of the connected user.
+     */
+    public function getGuid()
+    {
+        $this->_server->getGuid();
+    }
+
+    /**
+     * Get the base GUID of this server
+     *
+     * @return string The base GUID of this server.
+     */
+    public function getBaseGuid()
+    {
+        $this->_server->getBaseGuid();
+    }
+
+    /**
+     * Low level access to reading object data.
+     *
+     * @param string $guid  The object to retrieve.
+     * @param array  $attrs Restrict to these attributes.
+     *
+     * @return array An array of attributes.
+     *
+     * @throws Horde_Kolab_Server_Exception If the search operation hit an error
+     *                                      or returned no result.
+     */
+    public function read($guid, array $attrs = array())
+    {
+        $data = $this->_server->read($guid);
+        $this->unmapAttributes($data);
+        return $data;
+    }
+
+    /**
+     * Low level access to reading some object attributes.
+     *
+     * @param string $guid  The object to retrieve.
+     * @param string $attrs Restrict to these attributes.
+     *
+     * @return array An array of attributes.
+     *
+     * @throws Horde_Kolab_Server_Exception
+     *
+     * @see Horde_Kolab_Server::read
+     */
+    public function readAttributes($guid, array $attrs)
+    {
+        $this->mapKeys($attrs);
+        $data = $this->_server->readAttributes($guid, $attrs);
+        $this->unmapAttributes($data);
+        return $data;
+    }
+
+    /**
+     * Finds object data matching a given set of criteria.
+     *
+     * @param string $query  The LDAP search query
+     * @param array  $params Additional search parameters.
+     *
+     * @return array The result array.
+     *
+     * @throws Horde_Kolab_Server_Exception
+     */
+    public function find($query, array $params = array())
+    {
+        $criteria = new Horde_Kolab_Server_Query_Element_Mapped($criteria, $this);
+        $data = $this->_server->find($criteria, $params);
+        $this->unmapAttributes($data);
+        return $data;
+    }
+
+    /**
+     * Finds all object data below a parent matching a given set of criteria.
+     *
+     * @param string $query  The LDAP search query
+     * @param string $parent The parent to search below.
+     * @param array  $params Additional search parameters.
+     *
+     * @return array The result array.
+     *
+     * @throws Horde_Kolab_Server_Exception
+     */
+    public function findBelow($query, $parent, array $params = array())
+    {
+        $criteria = new Horde_Kolab_Server_Query_Element_Mapped($criteria, $this);
+        $data = $this->_server->findBelow($criteria, $parent, $params);
+        $this->unmapAttributes($data);
+        return $data;
+    }
+
+
+    /**
+     * Modify existing object data.
+     *
+     * @param string $guid The GUID of the object to be added.
+     * @param array  $data The attributes of the object to be added.
+     *
+     * @return NULL
+     *
+     * @throws Horde_Kolab_Server_Exception
+     */
+    public function save(
+        Horde_Kolab_Server_Object_Interface $object,
+        array $data
+    ) {
+        //@todo: This will not work this way as we need to map internal
+        // attributes.
+        $this->mapAttributes($data);
+        $this->_server->save($object, $data);
+    }
+
+    /**
+     * Add new object data.
+     *
+     * @param string $guid The GUID of the object to be added.
+     * @param array  $data The attributes of the object to be added.
+     *
+     * @return NULL
+     *
+     * @throws Horde_Kolab_Server_Exception
+     */
+    public function add(
+        Horde_Kolab_Server_Object_Interface $object,
+        array $data
+    ) {
+        //@todo: This will not work this way as we need to map internal
+        // attributes.
+        $this->mapAttributes($data);
+        $this->_server->add($object, $data);
+    }
+
+    /**
+     * Delete an object.
+     *
+     * @param string $guid The GUID of the object to be deleted.
+     *
+     * @return NULL
+     *
+     * @throws Horde_Kolab_Server_Exception
+     */
+    public function delete($guid)
+    {
+        $this->_server->delete($guid);
+    }
+
+    /**
+     * Rename an object.
+     *
+     * @param string $guid The GUID of the object to be renamed.
+     * @param string $new  The new GUID of the object.
+     *
+     * @return NULL
+     *
+     * @throws Horde_Kolab_Server_Exception
+     */
+    public function rename($guid, $new)
+    {
+         $this->_server->rename($guid, $new);
+    }
+
+    /**
+     * Return the ldap schema.
+     *
+     * @return Net_LDAP2_Schema The LDAP schema.
+     *
+     * @throws Horde_Kolab_Server_Exception If retrieval of the schema failed.
+     */
+    public function getSchema()
+    {
+        return $this->_server->getSchema();
+    }
+
+
+    /**
+     * Map attributes defined within this library to their real world
+     * counterparts.
+     *
+     * @param array &$data The data that has been read and needs to be mapped.
+     *
+     * @return NULL
+     */
+    protected function unmapAttributes(&$data)
+    {
+        foreach ($data as &$element) {
+            foreach ($this->mapping as $attribute => $map) {
+                if (isset($element[$map])) {
+                    $element[$attribute] = $element[$map];
+                    unset($element[$map]);
+                }
+            }
+        }
+    }
+
+    /**
+     * Map attributes defined within this library into their real world
+     * counterparts.
+     *
+     * @param array &$data The data to be written.
+     *
+     * @return NULL
+     */
+    protected function mapAttributes(&$data)
+    {
+        foreach ($this->mapping as $attribute => $map) {
+            if (isset($data[$attribute])) {
+                $data[$map] = $data[$attribute];
+                unset($data[$attribute]);
+            }
+        }
+    }
+
+    /**
+     * Map attribute keys defined within this library into their real world
+     * counterparts.
+     *
+     * @param array &$keys The attribute keys.
+     *
+     * @return NULL
+     */
+    protected function mapKeys(&$keys)
+    {
+        foreach ($this->mapping as $attribute => $map) {
+            $key = array_search($attribute, $keys);
+            if ($key !== false) {
+                $keys[$key] = $map;
+            }
+        }
+    }
+
+    /**
+     * Map a single attribute key defined within this library into its real
+     * world counterpart.
+     *
+     * @param array $field The attribute name.
+     *
+     * @return The real name of this attribute on the server we connect to.
+     */
+    public function mapField($field)
+    {
+        if (isset($this->mapping[$field])) {
+            return $this->mapping[$field];
+        }
+        return $field;
+    }
+
+    /**
+     * Get the parent GUID of this object.
+     *
+     * @param string $guid The GUID of the child.
+     *
+     * @return string the parent GUID of this object.
+     */
+    public function getParentGuid($guid)
+    {
+        return $this->_server->getParentGuid($guid);
+    }
+}
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory.php
deleted file mode 100644 (file)
index ec2a895..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-<?php
-/**
- * The interface of Kolab server factories.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-
-/**
- * The interface of Kolab server factories.
- *
- * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-interface Horde_Kolab_Server_Factory
-{
-    /**
-     * Returns a concrete Horde_Kolab_Server_Composite instance.
-     *
-     * @return Horde_Kolab_Server_Composite The newly created concrete
-     *                                      Horde_Kolab_Server_Composite
-     *                                      instance.
-     */
-    public function getComposite();
-
-    /**
-     * Returns the conn factory.
-     *
-     * @return Horde_Kolab_Server_Factory_Conn The connection factory.
-     */
-    public function getConnectionFactory();
-
-    /**
-     * Returns the server configuration parameters.
-     *
-     * @return array The configuration parameters.
-     */
-    public function getConfiguration();
-
-    /**
-     * Return the server connection that should be used.
-     *
-     * @return Horde_Kolab_Server The Horde_Kolab_Server connection.
-     */
-    public function getServer();
-
-    /**
-     * Return the server that should be used.
-     *
-     * @return Horde_Kolab_Server_Connection The connection.
-     */
-    public function getConnection();
-
-    /**
-     * Return the object handler that should be used.
-     *
-     * @return Horde_Kolab_Server_Objects The handler for objects on the server.
-     */
-    public function getObjects();
-
-    /**
-     * Return the structural representation that should be used.
-     *
-     * @return Horde_Kolab_Server_Structure The representation of the db
-     *                                      structure.
-     */
-    public function getStructure();
-
-    /**
-     * Return the search handler that should be used.
-     *
-     * @return Horde_Kolab_Server_Search The search handler.
-     */
-    public function getSearch();
-
-    /**
-     * Return the db schema representation that should be used.
-     *
-     * @return Horde_Kolab_Server_Schema The db schema representation.
-     */
-    public function getSchema();
-}
\ No newline at end of file
index 2f22f3d..5c4597e 100644 (file)
@@ -26,7 +26,7 @@
  * @link     http://pear.horde.org/index.php?package=Kolab_Server
  */
 abstract class Horde_Kolab_Server_Factory_Base
-implements Horde_Kolab_Server_Factory
+implements Horde_Kolab_Server_Factory_Interface
 {
     /**
      * The connection factory.
@@ -52,7 +52,7 @@ implements Horde_Kolab_Server_Factory
      *                                                 server.
      */
     public function __construct(
-        Horde_Kolab_Server_Factory_Conn $factory,
+        Horde_Kolab_Server_Factory_Connection_Interface $factory,
         array $config
     ) {
         $this->_conn_factory  = $factory;
@@ -129,7 +129,7 @@ implements Horde_Kolab_Server_Factory
      */
     public function getComposite()
     {
-        $composite = new Horde_Kolab_Server_Composite(
+        $composite = new Horde_Kolab_Server_Composite_Base(
             $this->getServer(),
             $this->getObjects(),
             $this->getStructure(),
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Cleaner.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Cleaner.php
deleted file mode 100644 (file)
index 9c79108..0000000
+++ /dev/null
@@ -1,143 +0,0 @@
-<?php
-/**
- * A factory decorator that adds cleaning to the generated instances.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-
-/**
- * A factory decorator that adds cleaning to the generated instances.
- *
- * Copyright 2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-class Horde_Kolab_Server_Factory_Cleaner
-implements Horde_Kolab_Server_Factory
-{
-    /**
-     * The factory used for creating the instances.
-     *
-     * @var Horde_Kolab_Server_Factory
-     */
-    private $_factory;
-
-    /**
-     * Constructor.
-     *
-     * @param Horde_Kolab_Server_Factory $factory The base factory.
-     */
-    public function __construct(Horde_Kolab_Server_Factory $factory)
-    {
-        $this->_factory = $factory;
-    }
-
-    /**
-     * Returns the conn factory.
-     *
-     * @return Horde_Kolab_Server_Factory_Conn The connection factory.
-     */
-    public function getConnectionFactory()
-    {
-        return $this->_factory->getConnectionFactory();
-    }
-
-    /**
-     * Returns the server configuration parameters.
-     *
-     * @return array The configuration parameters.
-     */
-    public function getConfiguration()
-    {
-        return $this->_factory->getConfiguration();
-    }
-
-    /**
-     * Return the server connection that should be used.
-     *
-     * @return Horde_Kolab_Server The Horde_Kolab_Server connection.
-     */
-    public function getServer()
-    {
-        $server = $this->_factory->getServer();
-        $server = new Horde_Kolab_Server_Cleaner($server);
-        return $server;
-    }
-
-    /**
-     * Return the server that should be used.
-     *
-     * @return Horde_Kolab_Server_Connection The connection.
-     */
-    public function getConnection()
-    {
-        return $this->_factory->getConnection();
-    }
-
-    /**
-     * Returns a concrete Horde_Kolab_Server_Composite instance.
-     *
-     * @return Horde_Kolab_Server_Composite The newly created concrete
-     *                                      Horde_Kolab_Server_Composite
-     *                                      instance.
-     */
-    public function getComposite()
-    {
-        return $this->_factory->getComposite();
-    }
-
-    /**
-     * Return the object handler that should be used.
-     *
-     * @return Horde_Kolab_Server_Objects The handler for objects on the server.
-     */
-    public function getObjects()
-    {
-        return $this->_factory->getObjects();
-    }
-
-    /**
-     * Return the structural representation that should be used.
-     *
-     * @return Horde_Kolab_Server_Structure The representation of the db
-     *                                      structure.
-     */
-    public function getStructure()
-    {
-        return $this->_factory->getStructure();
-    }
-
-    /**
-     * Return the search handler that should be used.
-     *
-     * @return Horde_Kolab_Server_Search The search handler.
-     */
-    public function getSearch()
-    {
-        return $this->_factory->getSearch();
-    }
-
-    /**
-     * Return the db schema representation that should be used.
-     *
-     * @return Horde_Kolab_Server_Schema The db schema representation.
-     */
-    public function getSchema()
-    {
-        return $this->_factory->getSchema();
-    }
-
-}
\ No newline at end of file
index b031dd9..3bf6964 100644 (file)
@@ -26,7 +26,7 @@
  * @link     http://pear.horde.org/index.php?package=Kolab_Server
  */
 class Horde_Kolab_Server_Factory_Configuration
-implements Horde_Kolab_Server_Factory
+implements Horde_Kolab_Server_Factory_Interface
 {
     /**
      * Configuration parameters for the server.
@@ -49,7 +49,7 @@ implements Horde_Kolab_Server_Factory
     {
         $this->_configuration = $config;
 
-        $connection_factory = new Horde_Kolab_Server_Factory_Conn_Configuration(
+        $connection_factory = new Horde_Kolab_Server_Factory_Connection_Configuration(
             $config
         );
         $factory = new Horde_Kolab_Server_Factory_Kolab(
@@ -57,19 +57,19 @@ implements Horde_Kolab_Server_Factory
         );
 
         if (isset($config['logger'])) {
-            $factory = new Horde_Kolab_Server_Factory_Logged(
+            $factory = new Horde_Kolab_Server_Factory_Decorator_Log(
                 $factory, $config['logger']
             );
         }
 
         if (isset($config['map'])) {
-            $factory = new Horde_Kolab_Server_Factory_Mapped(
+            $factory = new Horde_Kolab_Server_Factory_Decorator_Map(
                 $factory, $config['map']
             );
         }
 
         if (!empty($config['cleanup'])) {
-            $factory = new Horde_Kolab_Server_Factory_Cleaner(
+            $factory = new Horde_Kolab_Server_Factory_Decorator_Clean(
                 $factory
             );
         }
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Conn.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Conn.php
deleted file mode 100644 (file)
index 3e2e7d7..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-<?php
-/**
- * The interface of Kolab server connection factories.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-
-/**
- * The interface of Kolab server connection factories.
- *
- * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-interface Horde_Kolab_Server_Factory_Conn
-{
-    /**
-     * Get the connection configuration.
-     *
-     * @return array $configuration The configuration parameters.
-     */
-    public function getConfiguration();
-
-    /**
-     * Set the connection configuration.
-     *
-     * @param array $configuration The configuration parameters.
-     *
-     * @return NULL
-     */
-    public function setConfiguration(array $configuration);
-
-    /**
-     * Return the server connection that should be used.
-     *
-     * @return Horde_Kolab_Server_Connection The server connection.
-     */
-    public function getConnection();
-}
\ No newline at end of file
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Conn/Base.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Conn/Base.php
deleted file mode 100644 (file)
index 1336cbd..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-<?php
-/**
- * A base connection factory definition.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-
-/**
- * A base connection factory definition.
- *
- * Copyright 2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-abstract class Horde_Kolab_Server_Factory_Conn_Base
-implements Horde_Kolab_Server_Factory_Conn
-{
-    /**
-     * Connection parameters.
-     *
-     * @var array
-     */
-    private $_configuration;
-
-    /**
-     * Get the connection configuration.
-     *
-     * @return array $configuration The configuration parameters.
-     */
-    public function getConfiguration()
-    {
-        if (!isset($this->_configuration)) {
-            throw new Horde_Kolab_Server_Exception(
-                'The configuration has not been set!'
-            ); 
-        }
-        return $this->_configuration;
-    }
-
-    /**
-     * Set the connection configuration.
-     *
-     * @param array $configuration The configuration parameters.
-     *
-     * @return NULL
-     */
-    public function setConfiguration(array $configuration)
-    {
-        $this->_configuration = $configuration;
-    }
-}
\ No newline at end of file
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Conn/Configuration.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Conn/Configuration.php
deleted file mode 100644 (file)
index 6f4dba1..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-<?php
-/**
- * A factory that receives all required details via configuration parameters.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-
-/**
- * A factory that receives all required details via configuration parameters.
- *
- * Copyright 2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-class Horde_Kolab_Server_Factory_Conn_Configuration
-extends Horde_Kolab_Server_Factory_Conn_Base
-{
-    /**
-     * Configuration parameters for the connection.
-     *
-     * @var array
-     */
-    private $_configuration;
-
-    /**
-     * The factory used for creating the instances.
-     *
-     * @var Horde_Kolab_Server_Factory
-     */
-    private $_factory;
-
-    /**
-     * Constructor.
-     */
-    public function __construct(array $config)
-    {
-        $this->setConfiguration($config);
-    }
-
-    /**
-     * Get the connection configuration.
-     *
-     * @return array $configuration The configuration parameters.
-     */
-    public function getConfiguration()
-    {
-        return $this->_configuration;
-    }
-
-    /**
-     * Set the connection configuration.
-     *
-     * @param array $configuration The configuration parameters.
-     *
-     * @return NULL
-     */
-    public function setConfiguration(array $configuration)
-    {
-        $this->_configuration = $configuration;
-
-        if (empty($configuration['mock'])) {
-            $this->_factory = new Horde_Kolab_Server_Factory_Conn_Ldap();
-        } else {
-            $this->_factory = new Horde_Kolab_Server_Factory_Conn_Mock();
-        }
-
-        $this->_factory->setConfiguration($configuration);
-    }
-
-    /**
-     * Return the server connection that should be used.
-     *
-     * @return Horde_Kolab_Server_Connection The server connection.
-     */
-    public function getConnection()
-    {
-        return $this->_factory->getConnection();
-    }
-}
\ No newline at end of file
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Conn/Injector.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Conn/Injector.php
deleted file mode 100644 (file)
index 9027b9a..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-<?php
-/**
- * A factory that generates connections using the Horde_Injector.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-
-/**
- * A factory that generates connections using the Horde_Injector.
- *
- * Copyright 2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-class Horde_Kolab_Server_Factory_Conn_Injector
-extends Horde_Kolab_Server_Factory_Conn_Base
-{
-    /**
-     * The injector providing our context.
-     *
-     * @var Horde_Injector
-     */
-    private $_injector;
-
-    /**
-     * Constructor.
-     *
-     * @param Horde_Injector The injector to use.
-     */
-    public function __construct(Horde_Injector $injector)
-    {
-        $this->_injector = $injector;
-    }
-
-    /**
-     * Return the server connection that should be used.
-     *
-     * @return Horde_Kolab_Server_Connection The server connection.
-     */
-    public function getConnection()
-    {
-        $factory = $this->_injector->getInstance(
-            'Horde_Kolab_Server_Factory_Conn'
-        );
-        $factory->setConfiguration(
-            $this->_injector->getInstance(
-                'Horde_Kolab_Server_Configuration'
-            )
-        );
-        $connection = $factory->getConnection();
-        return $connection;
-    }
-}
\ No newline at end of file
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Conn/Ldap.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Conn/Ldap.php
deleted file mode 100644 (file)
index f483de8..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-<?php
-/**
- * A factory that generates LDAP connections.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-
-/**
- * A factory that generates LDAP connections.
- *
- * Copyright 2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-class Horde_Kolab_Server_Factory_Conn_Ldap
-extends Horde_Kolab_Server_Factory_Conn_Base
-{
-    /**
-     * Set the connection configuration.
-     *
-     * @param array $configuration The configuration parameters.
-     *
-     * @return NULL
-     */
-    public function setConfiguration(array $configuration)
-    {
-        if (!isset($configuration['basedn'])) {
-            throw new Horde_Kolab_Server_Exception('The base DN is missing!');
-        }
-
-        if (isset($configuration['server'])) {
-            $configuration['host'] = $configuration['server'];
-            unset($configuration['server']);
-        }
-
-        if (isset($configuration['phpdn'])) {
-            $configuration['binddn'] = $configuration['phpdn'];
-            unset($configuration['phpdn']);
-        }
-
-        if (isset($configuration['phppw'])) {
-            $configuration['bindpw'] = $configuration['phppw'];
-            unset($configuration['phppw']);
-        }
-
-        parent::setConfiguration($configuration);
-    }
-
-    /**
-     * Return the server connection that should be used.
-     *
-     * @return Horde_Kolab_Server_Connection The server connection.
-     */
-    public function getConnection()
-    {
-        $configuration = $this->getConfiguration();
-        $ldap_read = new Net_LDAP2($configuration);
-        if (isset($configuration['host_master'])) {
-            $configuration['host'] = $configuration['host_master'];
-            $ldap_write = new Net_LDAP2($configuration);
-            $connection = new Horde_Kolab_Server_Connection_Splittedldap(
-                $ldap_read, $ldap_write
-            );
-        } else {
-            $connection = new Horde_Kolab_Server_Connection_Simpleldap(
-                $ldap_read
-            );
-        }
-        return $connection;
-    }
-}
\ No newline at end of file
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Conn/Mock.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Conn/Mock.php
deleted file mode 100644 (file)
index 2538211..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-<?php
-/**
- * A factory that generates mock connections.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-
-/**
- * A factory that generates mock connections.
- *
- * Copyright 2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-class Horde_Kolab_Server_Factory_Conn_Mock
-extends Horde_Kolab_Server_Factory_Conn_Base
-{
-    /**
-     * Return the server connection that should be used.
-     *
-     * @return Horde_Kolab_Server_Connection The server connection.
-     */
-    public function getConnection()
-    {
-        $config = $this->getConfiguration();
-        if (isset($config['data'])) {
-            $data = $config['data'];
-        } else {
-            $data = array();
-        }
-        $connection = new Horde_Kolab_Server_Connection_Mock(
-            new Horde_Kolab_Server_Connection_Mock_Ldap(
-                $config, $data
-            )
-        );
-        return $connection;
-    }
-}
\ No newline at end of file
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Connection/Base.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Connection/Base.php
new file mode 100644 (file)
index 0000000..3e1119a
--- /dev/null
@@ -0,0 +1,64 @@
+<?php
+/**
+ * A base connection factory definition.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+
+/**
+ * A base connection factory definition.
+ *
+ * Copyright 2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+abstract class Horde_Kolab_Server_Factory_Connection_Base
+implements Horde_Kolab_Server_Factory_Connection_Interface
+{
+    /**
+     * Connection parameters.
+     *
+     * @var array
+     */
+    private $_configuration;
+
+    /**
+     * Get the connection configuration.
+     *
+     * @return array $configuration The configuration parameters.
+     */
+    public function getConfiguration()
+    {
+        if (!isset($this->_configuration)) {
+            throw new Horde_Kolab_Server_Exception(
+                'The configuration has not been set!'
+            ); 
+        }
+        return $this->_configuration;
+    }
+
+    /**
+     * Set the connection configuration.
+     *
+     * @param array $configuration The configuration parameters.
+     *
+     * @return NULL
+     */
+    public function setConfiguration(array $configuration)
+    {
+        $this->_configuration = $configuration;
+    }
+}
\ No newline at end of file
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Connection/Configuration.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Connection/Configuration.php
new file mode 100644 (file)
index 0000000..c64573e
--- /dev/null
@@ -0,0 +1,92 @@
+<?php
+/**
+ * A factory that receives all required details via configuration parameters.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+
+/**
+ * A factory that receives all required details via configuration parameters.
+ *
+ * Copyright 2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+class Horde_Kolab_Server_Factory_Connection_Configuration
+extends Horde_Kolab_Server_Factory_Connection_Base
+{
+    /**
+     * Configuration parameters for the connection.
+     *
+     * @var array
+     */
+    private $_configuration;
+
+    /**
+     * The factory used for creating the instances.
+     *
+     * @var Horde_Kolab_Server_Factory
+     */
+    private $_factory;
+
+    /**
+     * Constructor.
+     */
+    public function __construct(array $config)
+    {
+        $this->setConfiguration($config);
+    }
+
+    /**
+     * Get the connection configuration.
+     *
+     * @return array $configuration The configuration parameters.
+     */
+    public function getConfiguration()
+    {
+        return $this->_configuration;
+    }
+
+    /**
+     * Set the connection configuration.
+     *
+     * @param array $configuration The configuration parameters.
+     *
+     * @return NULL
+     */
+    public function setConfiguration(array $configuration)
+    {
+        $this->_configuration = $configuration;
+
+        if (empty($configuration['mock'])) {
+            $this->_factory = new Horde_Kolab_Server_Factory_Connection_Ldap();
+        } else {
+            $this->_factory = new Horde_Kolab_Server_Factory_Connection_Mock();
+        }
+
+        $this->_factory->setConfiguration($configuration);
+    }
+
+    /**
+     * Return the server connection that should be used.
+     *
+     * @return Horde_Kolab_Server_Connection The server connection.
+     */
+    public function getConnection()
+    {
+        return $this->_factory->getConnection();
+    }
+}
\ No newline at end of file
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Connection/Injector.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Connection/Injector.php
new file mode 100644 (file)
index 0000000..2daf760
--- /dev/null
@@ -0,0 +1,66 @@
+<?php
+/**
+ * A factory that generates connections using the Horde_Injector.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+
+/**
+ * A factory that generates connections using the Horde_Injector.
+ *
+ * Copyright 2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+class Horde_Kolab_Server_Factory_Connection_Injector
+extends Horde_Kolab_Server_Factory_Connection_Base
+{
+    /**
+     * The injector providing our context.
+     *
+     * @var Horde_Injector
+     */
+    private $_injector;
+
+    /**
+     * Constructor.
+     *
+     * @param Horde_Injector The injector to use.
+     */
+    public function __construct(Horde_Injector $injector)
+    {
+        $this->_injector = $injector;
+    }
+
+    /**
+     * Return the server connection that should be used.
+     *
+     * @return Horde_Kolab_Server_Connection The server connection.
+     */
+    public function getConnection()
+    {
+        $factory = $this->_injector->getInstance(
+            'Horde_Kolab_Server_Factory_Connection_Interface'
+        );
+        $factory->setConfiguration(
+            $this->_injector->getInstance(
+                'Horde_Kolab_Server_Configuration'
+            )
+        );
+        $connection = $factory->getConnection();
+        return $connection;
+    }
+}
\ No newline at end of file
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Connection/Interface.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Connection/Interface.php
new file mode 100644 (file)
index 0000000..94c50f4
--- /dev/null
@@ -0,0 +1,52 @@
+<?php
+/**
+ * The interface of Kolab server connection factories.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+
+/**
+ * The interface of Kolab server connection factories.
+ *
+ * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+interface Horde_Kolab_Server_Factory_Connection_Interface
+{
+    /**
+     * Get the connection configuration.
+     *
+     * @return array $configuration The configuration parameters.
+     */
+    public function getConfiguration();
+
+    /**
+     * Set the connection configuration.
+     *
+     * @param array $configuration The configuration parameters.
+     *
+     * @return NULL
+     */
+    public function setConfiguration(array $configuration);
+
+    /**
+     * Return the server connection that should be used.
+     *
+     * @return Horde_Kolab_Server_Connection The server connection.
+     */
+    public function getConnection();
+}
\ No newline at end of file
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Connection/Ldap.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Connection/Ldap.php
new file mode 100644 (file)
index 0000000..6bd28fd
--- /dev/null
@@ -0,0 +1,84 @@
+<?php
+/**
+ * A factory that generates LDAP connections.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+
+/**
+ * A factory that generates LDAP connections.
+ *
+ * Copyright 2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+class Horde_Kolab_Server_Factory_Connection_Ldap
+extends Horde_Kolab_Server_Factory_Connection_Base
+{
+    /**
+     * Set the connection configuration.
+     *
+     * @param array $configuration The configuration parameters.
+     *
+     * @return NULL
+     */
+    public function setConfiguration(array $configuration)
+    {
+        if (!isset($configuration['basedn'])) {
+            throw new Horde_Kolab_Server_Exception('The base DN is missing!');
+        }
+
+        if (isset($configuration['server'])) {
+            $configuration['host'] = $configuration['server'];
+            unset($configuration['server']);
+        }
+
+        if (isset($configuration['phpdn'])) {
+            $configuration['binddn'] = $configuration['phpdn'];
+            unset($configuration['phpdn']);
+        }
+
+        if (isset($configuration['phppw'])) {
+            $configuration['bindpw'] = $configuration['phppw'];
+            unset($configuration['phppw']);
+        }
+
+        parent::setConfiguration($configuration);
+    }
+
+    /**
+     * Return the server connection that should be used.
+     *
+     * @return Horde_Kolab_Server_Connection The server connection.
+     */
+    public function getConnection()
+    {
+        $configuration = $this->getConfiguration();
+        $ldap_read = new Net_LDAP2($configuration);
+        if (isset($configuration['host_master'])) {
+            $configuration['host'] = $configuration['host_master'];
+            $ldap_write = new Net_LDAP2($configuration);
+            $connection = new Horde_Kolab_Server_Connection_Splittedldap(
+                $ldap_read, $ldap_write
+            );
+        } else {
+            $connection = new Horde_Kolab_Server_Connection_Simpleldap(
+                $ldap_read
+            );
+        }
+        return $connection;
+    }
+}
\ No newline at end of file
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Connection/Mock.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Connection/Mock.php
new file mode 100644 (file)
index 0000000..67ec0bf
--- /dev/null
@@ -0,0 +1,51 @@
+<?php
+/**
+ * A factory that generates mock connections.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+
+/**
+ * A factory that generates mock connections.
+ *
+ * Copyright 2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+class Horde_Kolab_Server_Factory_Connection_Mock
+extends Horde_Kolab_Server_Factory_Connection_Base
+{
+    /**
+     * Return the server connection that should be used.
+     *
+     * @return Horde_Kolab_Server_Connection The server connection.
+     */
+    public function getConnection()
+    {
+        $config = $this->getConfiguration();
+        if (isset($config['data'])) {
+            $data = $config['data'];
+        } else {
+            $data = array();
+        }
+        $connection = new Horde_Kolab_Server_Connection_Mock(
+            new Horde_Kolab_Server_Connection_Mock_Ldap(
+                $config, $data
+            )
+        );
+        return $connection;
+    }
+}
\ No newline at end of file
index 0762abc..1d80028 100644 (file)
@@ -74,11 +74,11 @@ extends Horde_Kolab_Server_Factory_Base
      *                                                   server.
      */
     public function __construct(
-        Horde_Kolab_Server_Factory_Conn $factory,
-        Horde_Kolab_Server_Objects $objects,
+        Horde_Kolab_Server_Factory_Connection_Interface $factory,
+        Horde_Kolab_Server_Objects_Interface $objects,
         Horde_Kolab_Server_Structure_Interface $structure,
         Horde_Kolab_Server_Search_Interface $search,
-        Horde_Kolab_Server_Schema $schema,
+        Horde_Kolab_Server_Schema_Interface $schema,
         array $config
     ) {
         parent::__construct($factory, $config);
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Decorator/Clean.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Decorator/Clean.php
new file mode 100644 (file)
index 0000000..7c021cc
--- /dev/null
@@ -0,0 +1,144 @@
+<?php
+/**
+ * A factory decorator that adds cleaning to the generated instances.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+
+/**
+ * A factory decorator that adds cleaning to the generated instances.
+ *
+ * Copyright 2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+class Horde_Kolab_Server_Factory_Decorator_Clean
+implements Horde_Kolab_Server_Factory_Interface
+{
+    /**
+     * The factory used for creating the instances.
+     *
+     * @var Horde_Kolab_Server_Factory
+     */
+    private $_factory;
+
+    /**
+     * Constructor.
+     *
+     * @param Horde_Kolab_Server_Factory $factory The base factory.
+     */
+    public function __construct(
+        Horde_Kolab_Server_Factory_Interface $factory
+    ) {
+        $this->_factory = $factory;
+    }
+
+    /**
+     * Returns the conn factory.
+     *
+     * @return Horde_Kolab_Server_Factory_Conn The connection factory.
+     */
+    public function getConnectionFactory()
+    {
+        return $this->_factory->getConnectionFactory();
+    }
+
+    /**
+     * Returns the server configuration parameters.
+     *
+     * @return array The configuration parameters.
+     */
+    public function getConfiguration()
+    {
+        return $this->_factory->getConfiguration();
+    }
+
+    /**
+     * Return the server connection that should be used.
+     *
+     * @return Horde_Kolab_Server The Horde_Kolab_Server connection.
+     */
+    public function getServer()
+    {
+        $server = $this->_factory->getServer();
+        $server = new Horde_Kolab_Server_Decorator_Clean($server);
+        return $server;
+    }
+
+    /**
+     * Return the server that should be used.
+     *
+     * @return Horde_Kolab_Server_Connection The connection.
+     */
+    public function getConnection()
+    {
+        return $this->_factory->getConnection();
+    }
+
+    /**
+     * Returns a concrete Horde_Kolab_Server_Composite instance.
+     *
+     * @return Horde_Kolab_Server_Composite The newly created concrete
+     *                                      Horde_Kolab_Server_Composite
+     *                                      instance.
+     */
+    public function getComposite()
+    {
+        return $this->_factory->getComposite();
+    }
+
+    /**
+     * Return the object handler that should be used.
+     *
+     * @return Horde_Kolab_Server_Objects The handler for objects on the server.
+     */
+    public function getObjects()
+    {
+        return $this->_factory->getObjects();
+    }
+
+    /**
+     * Return the structural representation that should be used.
+     *
+     * @return Horde_Kolab_Server_Structure The representation of the db
+     *                                      structure.
+     */
+    public function getStructure()
+    {
+        return $this->_factory->getStructure();
+    }
+
+    /**
+     * Return the search handler that should be used.
+     *
+     * @return Horde_Kolab_Server_Search The search handler.
+     */
+    public function getSearch()
+    {
+        return $this->_factory->getSearch();
+    }
+
+    /**
+     * Return the db schema representation that should be used.
+     *
+     * @return Horde_Kolab_Server_Schema The db schema representation.
+     */
+    public function getSchema()
+    {
+        return $this->_factory->getSchema();
+    }
+
+}
\ No newline at end of file
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Decorator/Count.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Decorator/Count.php
new file mode 100644 (file)
index 0000000..ef7ecde
--- /dev/null
@@ -0,0 +1,156 @@
+<?php
+/**
+ * A factory decorator that adds counting to the generated instances.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+
+/**
+ * A factory decorator that adds counting to the generated instances.
+ *
+ * Copyright 2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+class Horde_Kolab_Server_Factory_Decorator_Count
+implements Horde_Kolab_Server_Factory_Interface
+{
+    /**
+     * The factory used for creating the instances.
+     *
+     * @var Horde_Kolab_Server_Factory
+     */
+    private $_factory;
+
+    /**
+     * The logger.
+     *
+     * @var mixed
+     */
+    private $_logger;
+
+    /**
+     * Constructor.
+     *
+     * @param Horde_Kolab_Server_Factory $factory The base factory.
+     * @param mixed                       $logger  The logger isntance.
+     */
+    public function __construct(
+        Horde_Kolab_Server_Factory_Interface $factory,
+        $logger
+    ) {
+        $this->_factory = $factory;
+        $this->_logger  = $logger;
+    }
+
+    /**
+     * Returns the conn factory.
+     *
+     * @return Horde_Kolab_Server_Factory_Conn The connection factory.
+     */
+    public function getConnectionFactory()
+    {
+        return $this->_factory->getConnectionFactory();
+    }
+
+    /**
+     * Returns the server configuration parameters.
+     *
+     * @return array The configuration parameters.
+     */
+    public function getConfiguration()
+    {
+        return $this->_factory->getConfiguration();
+    }
+
+    /**
+     * Return the server connection that should be used.
+     *
+     * @return Horde_Kolab_Server The Horde_Kolab_Server connection.
+     */
+    public function getServer()
+    {
+        $server = $this->_factory->getServer();
+        $server = new Horde_Kolab_Server_Decorator_Count(
+            $server, $this->_logger
+        );
+        return $server;
+    }
+
+    /**
+     * Return the server that should be used.
+     *
+     * @return Horde_Kolab_Server_Connection The connection.
+     */
+    public function getConnection()
+    {
+        return $this->_factory->getConnection();
+    }
+
+    /**
+     * Returns a concrete Horde_Kolab_Server_Composite instance.
+     *
+     * @return Horde_Kolab_Server_Composite The newly created concrete
+     *                                      Horde_Kolab_Server_Composite
+     *                                      instance.
+     */
+    public function getComposite()
+    {
+        return $this->_factory->getComposite();
+    }
+
+    /**
+     * Return the object handler that should be used.
+     *
+     * @return Horde_Kolab_Server_Objects The handler for objects on the server.
+     */
+    public function getObjects()
+    {
+        return $this->_factory->getObjects();
+    }
+
+    /**
+     * Return the structural representation that should be used.
+     *
+     * @return Horde_Kolab_Server_Structure The representation of the db
+     *                                      structure.
+     */
+    public function getStructure()
+    {
+        return $this->_factory->getStructure();
+    }
+
+    /**
+     * Return the search handler that should be used.
+     *
+     * @return Horde_Kolab_Server_Search The search handler.
+     */
+    public function getSearch()
+    {
+        return $this->_factory->getSearch();
+    }
+
+    /**
+     * Return the db schema representation that should be used.
+     *
+     * @return Horde_Kolab_Server_Schema The db schema representation.
+     */
+    public function getSchema()
+    {
+        return $this->_factory->getSchema();
+    }
+
+}
\ No newline at end of file
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Decorator/Log.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Decorator/Log.php
new file mode 100644 (file)
index 0000000..f2227c3
--- /dev/null
@@ -0,0 +1,156 @@
+<?php
+/**
+ * A factory decorator that adds logging to the generated instances.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+
+/**
+ * A factory decorator that adds logging to the generated instances.
+ *
+ * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+class Horde_Kolab_Server_Factory_Decorator_Log
+implements Horde_Kolab_Server_Factory_Interface
+{
+    /**
+     * The factory used for creating the instances.
+     *
+     * @var Horde_Kolab_Server_Factory
+     */
+    private $_factory;
+
+    /**
+     * The logger.
+     *
+     * @var mixed
+     */
+    private $_logger;
+
+    /**
+     * Constructor.
+     *
+     * @param Horde_Kolab_Server_Factory $factory The base factory.
+     * @param mixed                       $logger  The logger isntance.
+     */
+    public function __construct(
+        Horde_Kolab_Server_Factory_Interface $factory,
+        $logger
+    ) {
+        $this->_factory = $factory;
+        $this->_logger  = $logger;
+    }
+
+    /**
+     * Returns the conn factory.
+     *
+     * @return Horde_Kolab_Server_Factory_Conn The connection factory.
+     */
+    public function getConnectionFactory()
+    {
+        return $this->_factory->getConnectionFactory();
+    }
+
+    /**
+     * Returns the server configuration parameters.
+     *
+     * @return array The configuration parameters.
+     */
+    public function getConfiguration()
+    {
+        return $this->_factory->getConfiguration();
+    }
+
+    /**
+     * Return the server connection that should be used.
+     *
+     * @return Horde_Kolab_Server The Horde_Kolab_Server connection.
+     */
+    public function getServer()
+    {
+        $server = $this->_factory->getServer();
+        $server = new Horde_Kolab_Server_Decorator_Log(
+            $server, $this->_logger
+        );
+        return $server;
+    }
+
+    /**
+     * Return the server that should be used.
+     *
+     * @return Horde_Kolab_Server_Connection The connection.
+     */
+    public function getConnection()
+    {
+        return $this->_factory->getConnection();
+    }
+
+    /**
+     * Returns a concrete Horde_Kolab_Server_Composite instance.
+     *
+     * @return Horde_Kolab_Server_Composite The newly created concrete
+     *                                      Horde_Kolab_Server_Composite
+     *                                      instance.
+     */
+    public function getComposite()
+    {
+        return $this->_factory->getComposite();
+    }
+
+    /**
+     * Return the object handler that should be used.
+     *
+     * @return Horde_Kolab_Server_Objects The handler for objects on the server.
+     */
+    public function getObjects()
+    {
+        return $this->_factory->getObjects();
+    }
+
+    /**
+     * Return the structural representation that should be used.
+     *
+     * @return Horde_Kolab_Server_Structure The representation of the db
+     *                                      structure.
+     */
+    public function getStructure()
+    {
+        return $this->_factory->getStructure();
+    }
+
+    /**
+     * Return the search handler that should be used.
+     *
+     * @return Horde_Kolab_Server_Search The search handler.
+     */
+    public function getSearch()
+    {
+        return $this->_factory->getSearch();
+    }
+
+    /**
+     * Return the db schema representation that should be used.
+     *
+     * @return Horde_Kolab_Server_Schema The db schema representation.
+     */
+    public function getSchema()
+    {
+        return $this->_factory->getSchema();
+    }
+
+}
\ No newline at end of file
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Decorator/Map.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Decorator/Map.php
new file mode 100644 (file)
index 0000000..2e08623
--- /dev/null
@@ -0,0 +1,156 @@
+<?php
+/**
+ * A factory decorator that adds mapping to the generated instances.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+
+/**
+ * A factory decorator that adds mapping to the generated instances.
+ *
+ * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+class Horde_Kolab_Server_Factory_Decorator_Map
+implements Horde_Kolab_Server_Factory_Interface
+{
+    /**
+     * The factory used for creating the instances.
+     *
+     * @var Horde_Kolab_Server_Factory
+     */
+    private $_factory;
+
+    /**
+     * The attribute mapping.
+     *
+     * @var array
+     */
+    private $_mapping;
+
+    /**
+     * Constructor.
+     *
+     * @param Horde_Kolab_Server_Factory $factory The base factory.
+     * @param array                      $mapping The attribute mapping.
+     */
+    public function __construct(
+        Horde_Kolab_Server_Factory_Interface $factory,
+        array $mapping)
+    {
+        $this->_factory = $factory;
+        $this->_mapping = $mapping;
+    }
+
+    /**
+     * Returns the conn factory.
+     *
+     * @return Horde_Kolab_Server_Factory_Conn The connection factory.
+     */
+    public function getConnectionFactory()
+    {
+        return $this->_factory->getConnectionFactory();
+    }
+
+    /**
+     * Returns the server configuration parameters.
+     *
+     * @return array The configuration parameters.
+     */
+    public function getConfiguration()
+    {
+        return $this->_factory->getConfiguration();
+    }
+
+    /**
+     * Return the server connection that should be used.
+     *
+     * @return Horde_Kolab_Server The Horde_Kolab_Server connection.
+     */
+    public function getServer()
+    {
+        $server = $this->_factory->getServer();
+        $server = new Horde_Kolab_Server_Decorator_Map(
+            $server, $this->_mapping
+        );
+        return $server;
+    }
+
+    /**
+     * Return the server that should be used.
+     *
+     * @return Horde_Kolab_Server_Connection The connection.
+     */
+    public function getConnection()
+    {
+        return $this->_factory->getConnection();
+    }
+
+    /**
+     * Returns a concrete Horde_Kolab_Server_Composite instance.
+     *
+     * @return Horde_Kolab_Server_Composite The newly created concrete
+     *                                      Horde_Kolab_Server_Composite
+     *                                      instance.
+     */
+    public function getComposite()
+    {
+        return $this->_factory->getComposite();
+    }
+
+    /**
+     * Return the object handler that should be used.
+     *
+     * @return Horde_Kolab_Server_Objects The handler for objects on the server.
+     */
+    public function getObjects()
+    {
+        return $this->_factory->getObjects();
+    }
+
+    /**
+     * Return the structural representation that should be used.
+     *
+     * @return Horde_Kolab_Server_Structure The representation of the db
+     *                                      structure.
+     */
+    public function getStructure()
+    {
+        return $this->_factory->getStructure();
+    }
+
+    /**
+     * Return the search handler that should be used.
+     *
+     * @return Horde_Kolab_Server_Search The search handler.
+     */
+    public function getSearch()
+    {
+        return $this->_factory->getSearch();
+    }
+
+    /**
+     * Return the db schema representation that should be used.
+     *
+     * @return Horde_Kolab_Server_Schema The db schema representation.
+     */
+    public function getSchema()
+    {
+        return $this->_factory->getSchema();
+    }
+
+}
\ No newline at end of file
index e3b3ba1..df92422 100644 (file)
@@ -26,7 +26,7 @@
  * @link     http://pear.horde.org/index.php?package=Kolab_Server
  */
 class Horde_Kolab_Server_Factory_Injector
-implements Horde_Kolab_Server_Factory
+implements Horde_Kolab_Server_Factory_Interface
 {
     /**
      * The injector.
@@ -97,7 +97,7 @@ implements Horde_Kolab_Server_Factory
         Horde_Injector $injector
     ) {
         $injector->bindImplementation(
-            'Horde_Kolab_Server_Factory_Conn', $factory
+            'Horde_Kolab_Server_Factory_Connection_Interface', $factory
         );
     }
 
@@ -125,7 +125,7 @@ implements Horde_Kolab_Server_Factory
     private function _setupObjects()
     {
         $this->_injector->bindImplementation(
-            'Horde_Kolab_Server_Objects',
+            'Horde_Kolab_Server_Objects_Interface',
             'Horde_Kolab_Server_Objects_Base'
         );
     }
@@ -151,7 +151,7 @@ implements Horde_Kolab_Server_Factory
     private function _setupSchema()
     {
         $this->_injector->bindImplementation(
-            'Horde_Kolab_Server_Schema',
+            'Horde_Kolab_Server_Schema_Interface',
             'Horde_Kolab_Server_Schema_Base'
         );
     }
@@ -183,8 +183,8 @@ implements Horde_Kolab_Server_Factory
     private function _setupConnection()
     {
         $this->_injector->bindFactory(
-            'Horde_Kolab_Server_Connection',
-            'Horde_Kolab_Server_Factory_Conn_Injector',
+            'Horde_Kolab_Server_Connection_Interface',
+            'Horde_Kolab_Server_Factory_Connection_Injector',
             'getConnection'
         );
     }
@@ -197,7 +197,7 @@ implements Horde_Kolab_Server_Factory
     private function _setupServer()
     {
         $this->_injector->bindFactory(
-            'Horde_Kolab_Server',
+            'Horde_Kolab_Server_Interface',
             'Horde_Kolab_Server_Factory_Injector',
             'getServer'
         );
@@ -210,9 +210,10 @@ implements Horde_Kolab_Server_Factory
      */
     private function _setupComposite()
     {
-        /**
-         * Nothing to do here for now as class and interface name are the same.
-         */
+        $this->_injector->bindImplementation(
+            'Horde_Kolab_Server_Composite_Interface',
+            'Horde_Kolab_Server_Composite_Base'
+        );
     }
 
     /**
@@ -222,7 +223,9 @@ implements Horde_Kolab_Server_Factory
      */
     public function getConnectionFactory()
     {
-        return $this->_injector->getInstance('Horde_Kolab_Server_Factory_Conn');
+        return $this->_injector->getInstance(
+            'Horde_Kolab_Server_Factory_Connection_Interface'
+        );
     }
 
     /**
@@ -232,7 +235,9 @@ implements Horde_Kolab_Server_Factory
      */
     public function getConnection()
     {
-        return $this->_injector->getInstance('Horde_Kolab_Server_Connection');
+        return $this->_injector->getInstance(
+            'Horde_Kolab_Server_Connection_Interface'
+        );
     }
 
     /**
@@ -281,7 +286,9 @@ implements Horde_Kolab_Server_Factory
      */
     public function getObjects()
     {
-        return $this->_injector->getInstance('Horde_Kolab_Server_Objects');
+        return $this->_injector->getInstance(
+            'Horde_Kolab_Server_Objects_Interface'
+        );
     }
 
     /**
@@ -292,7 +299,9 @@ implements Horde_Kolab_Server_Factory
      */
     public function getStructure()
     {
-        return $this->_injector->getInstance('Horde_Kolab_Server_Structure_Interface');
+        return $this->_injector->getInstance(
+            'Horde_Kolab_Server_Structure_Interface'
+        );
     }
 
     /**
@@ -302,7 +311,9 @@ implements Horde_Kolab_Server_Factory
      */
     public function getSearch()
     {
-        return $this->_injector->getInstance('Horde_Kolab_Server_Search_Interface');
+        return $this->_injector->getInstance(
+            'Horde_Kolab_Server_Search_Interface'
+        );
     }
 
     /**
@@ -312,7 +323,9 @@ implements Horde_Kolab_Server_Factory
      */
     public function getSchema()
     {
-        return $this->_injector->getInstance('Horde_Kolab_Server_Schema');
+        return $this->_injector->getInstance(
+            'Horde_Kolab_Server_Schema_Interface'
+        );
     }
 
     /**
@@ -324,6 +337,8 @@ implements Horde_Kolab_Server_Factory
      */
     public function getComposite()
     {
-        return $this->_injector->getInstance('Horde_Kolab_Server_Composite');
+        return $this->_injector->getInstance(
+            'Horde_Kolab_Server_Composite_Interface'
+        );
     }
 }
\ No newline at end of file
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Interface.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Interface.php
new file mode 100644 (file)
index 0000000..9b2259a
--- /dev/null
@@ -0,0 +1,95 @@
+<?php
+/**
+ * The interface of Kolab server factories.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+
+/**
+ * The interface of Kolab server factories.
+ *
+ * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+interface Horde_Kolab_Server_Factory_Interface
+{
+    /**
+     * Returns a concrete Horde_Kolab_Server_Composite instance.
+     *
+     * @return Horde_Kolab_Server_Composite The newly created concrete
+     *                                      Horde_Kolab_Server_Composite
+     *                                      instance.
+     */
+    public function getComposite();
+
+    /**
+     * Returns the conn factory.
+     *
+     * @return Horde_Kolab_Server_Factory_Conn The connection factory.
+     */
+    public function getConnectionFactory();
+
+    /**
+     * Returns the server configuration parameters.
+     *
+     * @return array The configuration parameters.
+     */
+    public function getConfiguration();
+
+    /**
+     * Return the server connection that should be used.
+     *
+     * @return Horde_Kolab_Server The Horde_Kolab_Server connection.
+     */
+    public function getServer();
+
+    /**
+     * Return the server that should be used.
+     *
+     * @return Horde_Kolab_Server_Connection The connection.
+     */
+    public function getConnection();
+
+    /**
+     * Return the object handler that should be used.
+     *
+     * @return Horde_Kolab_Server_Objects The handler for objects on the server.
+     */
+    public function getObjects();
+
+    /**
+     * Return the structural representation that should be used.
+     *
+     * @return Horde_Kolab_Server_Structure The representation of the db
+     *                                      structure.
+     */
+    public function getStructure();
+
+    /**
+     * Return the search handler that should be used.
+     *
+     * @return Horde_Kolab_Server_Search The search handler.
+     */
+    public function getSearch();
+
+    /**
+     * Return the db schema representation that should be used.
+     *
+     * @return Horde_Kolab_Server_Schema The db schema representation.
+     */
+    public function getSchema();
+}
\ No newline at end of file
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Logged.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Logged.php
deleted file mode 100644 (file)
index b177ed3..0000000
+++ /dev/null
@@ -1,154 +0,0 @@
-<?php
-/**
- * A factory decorator that adds logging to the generated instances.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-
-/**
- * A factory decorator that adds logging to the generated instances.
- *
- * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-class Horde_Kolab_Server_Factory_Logged
-implements Horde_Kolab_Server_Factory
-{
-    /**
-     * The factory used for creating the instances.
-     *
-     * @var Horde_Kolab_Server_Factory
-     */
-    private $_factory;
-
-    /**
-     * The logger.
-     *
-     * @var mixed
-     */
-    private $_logger;
-
-    /**
-     * Constructor.
-     *
-     * @param Horde_Kolab_Server_Factory $factory The base factory.
-     * @param mixed                       $logger  The logger isntance.
-     */
-    public function __construct(Horde_Kolab_Server_Factory $factory, $logger)
-    {
-        $this->_factory = $factory;
-        $this->_logger  = $logger;
-    }
-
-    /**
-     * Returns the conn factory.
-     *
-     * @return Horde_Kolab_Server_Factory_Conn The connection factory.
-     */
-    public function getConnectionFactory()
-    {
-        return $this->_factory->getConnectionFactory();
-    }
-
-    /**
-     * Returns the server configuration parameters.
-     *
-     * @return array The configuration parameters.
-     */
-    public function getConfiguration()
-    {
-        return $this->_factory->getConfiguration();
-    }
-
-    /**
-     * Return the server connection that should be used.
-     *
-     * @return Horde_Kolab_Server The Horde_Kolab_Server connection.
-     */
-    public function getServer()
-    {
-        $server = $this->_factory->getServer();
-        $server = new Horde_Kolab_Server_Logged(
-            $server, $this->_logger
-        );
-        return $server;
-    }
-
-    /**
-     * Return the server that should be used.
-     *
-     * @return Horde_Kolab_Server_Connection The connection.
-     */
-    public function getConnection()
-    {
-        return $this->_factory->getConnection();
-    }
-
-    /**
-     * Returns a concrete Horde_Kolab_Server_Composite instance.
-     *
-     * @return Horde_Kolab_Server_Composite The newly created concrete
-     *                                      Horde_Kolab_Server_Composite
-     *                                      instance.
-     */
-    public function getComposite()
-    {
-        return $this->_factory->getComposite();
-    }
-
-    /**
-     * Return the object handler that should be used.
-     *
-     * @return Horde_Kolab_Server_Objects The handler for objects on the server.
-     */
-    public function getObjects()
-    {
-        return $this->_factory->getObjects();
-    }
-
-    /**
-     * Return the structural representation that should be used.
-     *
-     * @return Horde_Kolab_Server_Structure The representation of the db
-     *                                      structure.
-     */
-    public function getStructure()
-    {
-        return $this->_factory->getStructure();
-    }
-
-    /**
-     * Return the search handler that should be used.
-     *
-     * @return Horde_Kolab_Server_Search The search handler.
-     */
-    public function getSearch()
-    {
-        return $this->_factory->getSearch();
-    }
-
-    /**
-     * Return the db schema representation that should be used.
-     *
-     * @return Horde_Kolab_Server_Schema The db schema representation.
-     */
-    public function getSchema()
-    {
-        return $this->_factory->getSchema();
-    }
-
-}
\ No newline at end of file
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Mapped.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Mapped.php
deleted file mode 100644 (file)
index 4424405..0000000
+++ /dev/null
@@ -1,154 +0,0 @@
-<?php
-/**
- * A factory decorator that adds mapping to the generated instances.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-
-/**
- * A factory decorator that adds mapping to the generated instances.
- *
- * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-class Horde_Kolab_Server_Factory_Mapped
-implements Horde_Kolab_Server_Factory
-{
-    /**
-     * The factory used for creating the instances.
-     *
-     * @var Horde_Kolab_Server_Factory
-     */
-    private $_factory;
-
-    /**
-     * The attribute mapping.
-     *
-     * @var array
-     */
-    private $_mapping;
-
-    /**
-     * Constructor.
-     *
-     * @param Horde_Kolab_Server_Factory $factory The base factory.
-     * @param array                      $mapping The attribute mapping.
-     */
-    public function __construct(
-        Horde_Kolab_Server_Factory $factory,
-        array $mapping)
-    {
-        $this->_factory = $factory;
-        $this->_mapping = $mapping;
-    }
-
-    /**
-     * Returns the conn factory.
-     *
-     * @return Horde_Kolab_Server_Factory_Conn The connection factory.
-     */
-    public function getConnectionFactory()
-    {
-        return $this->_factory->getConnectionFactory();
-    }
-
-    /**
-     * Returns the server configuration parameters.
-     *
-     * @return array The configuration parameters.
-     */
-    public function getConfiguration()
-    {
-        return $this->_factory->getConfiguration();
-    }
-
-    /**
-     * Return the server connection that should be used.
-     *
-     * @return Horde_Kolab_Server The Horde_Kolab_Server connection.
-     */
-    public function getServer()
-    {
-        $server = $this->_factory->getServer();
-        $server = new Horde_Kolab_Server_Mapped($server, $this->_mapping);
-        return $server;
-    }
-
-    /**
-     * Return the server that should be used.
-     *
-     * @return Horde_Kolab_Server_Connection The connection.
-     */
-    public function getConnection()
-    {
-        return $this->_factory->getConnection();
-    }
-
-    /**
-     * Returns a concrete Horde_Kolab_Server_Composite instance.
-     *
-     * @return Horde_Kolab_Server_Composite The newly created concrete
-     *                                      Horde_Kolab_Server_Composite
-     *                                      instance.
-     */
-    public function getComposite()
-    {
-        return $this->_factory->getComposite();
-    }
-
-    /**
-     * Return the object handler that should be used.
-     *
-     * @return Horde_Kolab_Server_Objects The handler for objects on the server.
-     */
-    public function getObjects()
-    {
-        return $this->_factory->getObjects();
-    }
-
-    /**
-     * Return the structural representation that should be used.
-     *
-     * @return Horde_Kolab_Server_Structure The representation of the db
-     *                                      structure.
-     */
-    public function getStructure()
-    {
-        return $this->_factory->getStructure();
-    }
-
-    /**
-     * Return the search handler that should be used.
-     *
-     * @return Horde_Kolab_Server_Search The search handler.
-     */
-    public function getSearch()
-    {
-        return $this->_factory->getSearch();
-    }
-
-    /**
-     * Return the db schema representation that should be used.
-     *
-     * @return Horde_Kolab_Server_Schema The db schema representation.
-     */
-    public function getSchema()
-    {
-        return $this->_factory->getSchema();
-    }
-
-}
\ No newline at end of file
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Interface.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Interface.php
new file mode 100644 (file)
index 0000000..0b06ce1
--- /dev/null
@@ -0,0 +1,190 @@
+<?php
+/**
+ * A library for accessing the Kolab user database.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+
+/**
+ * This class defines the interface of a generic Kolab user database.
+ *
+ * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+interface Horde_Kolab_Server_Interface
+{
+    /**
+     * Connect to the server.
+     *
+     * @param string $guid The global unique id of the user.
+     * @param string $pass The password.
+     *
+     * @return NULL.
+     *
+     * @throws Horde_Kolab_Server_Exception If the connection failed.
+     */
+    public function connectGuid($guid = '', $pass = '');
+
+    /**
+     * Get the current GUID
+     *
+     * @return string The GUID of the currently connected user.
+     */
+    public function getGuid();
+
+    /**
+     * Get the base GUID of this server
+     *
+     * @return string The base GUID of this server.
+     */
+    public function getBaseGuid();
+
+    /**
+     * Low level access to reading object data.
+     *
+     * This function provides direct access to the Server data.
+     *
+     * Usually you should use
+     *
+     * <code>
+     *   $object = $server->fetch('a server uid');
+     *   $variable = $object['attribute']
+     * </code>
+     *
+     * to access object attributes. This is slower but takes special object
+     * handling into account (e.g. custom attribute parsing).
+     *
+     * @param string $guid The object to retrieve.
+     *
+     * @return array An array of attributes.
+     *
+     * @throws Horde_Kolab_Server_Exception
+     */
+    public function read($guid);
+
+    /**
+     * Low level access to reading some object attributes.
+     *
+     * @param string $guid  The object to retrieve.
+     * @param string $attrs Restrict to these attributes.
+     *
+     * @return array An array of attributes.
+     *
+     * @throws Horde_Kolab_Server_Exception
+     *
+     * @see Horde_Kolab_Server::read
+     */
+    public function readAttributes($guid, array $attrs);
+
+    /**
+     * Finds object data matching a given set of criteria.
+     *
+     * @param string $query  The LDAP search query
+     * @param array  $params Additional search parameters.
+     *
+     * @return Horde_Kolab_Server_Result The result object.
+     *
+     * @throws Horde_Kolab_Server_Exception
+     */
+    public function find($query, array $params = array());
+
+    /**
+     * Finds all object data below a parent matching a given set of criteria.
+     *
+     * @param string $query  The LDAP search query
+     * @param string $parent The parent to search below.
+     * @param array  $params Additional search parameters.
+     *
+     * @return Horde_Kolab_Server_Result The result object.
+     *
+     * @throws Horde_Kolab_Server_Exception
+     */
+    public function findBelow($query, $parent, array $params = array());
+
+    /**
+     * Modify existing object data.
+     *
+     * @param Horde_Kolab_Server_Object $object The object to be modified.
+     * @param array                     $data   The attributes of the object
+     *                                          to be stored.
+     *
+     * @return NULL
+     *
+     * @throws Horde_Kolab_Server_Exception
+     */
+    public function save(
+        Horde_Kolab_Server_Object_Interface $object,
+        array $data
+    );
+
+    /**
+     * Add new object data.
+     *
+     * @param Horde_Kolab_Server_Object $object The object to be added.
+     * @param array                     $data   The attributes of the object
+     *                                          to be added.
+     *
+     * @return NULL
+     *
+     * @throws Horde_Kolab_Server_Exception
+     */
+    public function add(
+        Horde_Kolab_Server_Object_Interface $object,
+        array $data
+    );
+
+    /**
+     * Delete an object.
+     *
+     * @param string $guid The GUID of the object to be deleted.
+     *
+     * @return NULL
+     *
+     * @throws Horde_Kolab_Server_Exception
+     */
+    public function delete($guid);
+
+    /**
+     * Rename an object.
+     *
+     * @param string $guid The GUID of the object to be renamed.
+     * @param string $new  The new GUID of the object.
+     *
+     * @return NULL
+     *
+     * @throws Horde_Kolab_Server_Exception
+     */
+    public function rename($guid, $new);
+
+    /**
+     * Return the database schema description.
+     *
+     * @return array The schema.
+     *
+     * @throws Horde_Kolab_Server_Exception If retrieval of the schema failed.
+     */
+    public function getSchema();
+
+    /**
+     * Get the parent GUID of this object.
+     *
+     * @param string $guid The GUID of the child.
+     *
+     * @return string the parent GUID of this object.
+     */
+    public function getParentGuid($guid);
+}
\ No newline at end of file
index c40f964..1adfdd5 100644 (file)
@@ -26,7 +26,8 @@
  * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
  * @link     http://pear.horde.org/index.php?package=Kolab_Server
  */
-abstract class Horde_Kolab_Server_Ldap implements Horde_Kolab_Server
+abstract class Horde_Kolab_Server_Ldap
+implements Horde_Kolab_Server_Interface
 {
     /**
      * The GUID of the current user.
@@ -58,7 +59,7 @@ abstract class Horde_Kolab_Server_Ldap implements Horde_Kolab_Server
      *                                                  to all queries.
      */
     public function __construct(
-        Horde_Kolab_Server_Connection $connection,
+        Horde_Kolab_Server_Connection_Interface $connection,
         $base_dn
     ) {
         $this->_conn    = $connection;
@@ -190,8 +191,10 @@ abstract class Horde_Kolab_Server_Ldap implements Horde_Kolab_Server
      *
      * @throws Horde_Kolab_Server_Exception
      */
-    public function save(Horde_Kolab_Server_Object $object, array $data)
-    {
+    public function save(
+        Horde_Kolab_Server_Object_Interface $object,
+        array $data
+    ) {
         $changes = new Horde_Kolab_Server_Ldap_Changes($object, $data);
         $entry  = $this->_conn->getWrite()->getEntry(
             $object->getGuid(), array_keys($data)
@@ -214,8 +217,10 @@ abstract class Horde_Kolab_Server_Ldap implements Horde_Kolab_Server
      *
      * @throws Horde_Kolab_Server_Exception
      */
-    public function add(Horde_Kolab_Server_Object $object, array $data)
-    {
+    public function add(
+        Horde_Kolab_Server_Object_Interface $object,
+        array $data
+    ) {
         $entry  = Net_LDAP2_Entry::createFresh($object->getGuid(), $data);
         $this->_handleError($entry, Horde_Kolab_Server_Exception::SYSTEM);
         $this->_handleError(
index 2599775..f9c38ef 100644 (file)
@@ -48,8 +48,10 @@ class Horde_Kolab_Server_Ldap_Changes
      * @param array                     $data   The attributes of the object
      *                                          to be stored.
      */
-    public function __construct(Horde_Kolab_Server_Object $object, array $data)
-    {
+    public function __construct(
+        Horde_Kolab_Server_Object_Interface $object,
+        array $data
+    ) {
         $this->_object = $object;
         $this->_data   = $data;
     }
index e172f6f..54c897a 100644 (file)
@@ -44,7 +44,7 @@ class Horde_Kolab_Server_Ldap_Filtered extends Horde_Kolab_Server_Ldap
      *                                                  to all queries.
      */
     public function __construct(
-        Horde_Kolab_Server_Connection $connection,
+        Horde_Kolab_Server_Connection_Interface $connection,
         $base_dn,
         $filter = null
     ) {
index cc740a3..23f4238 100644 (file)
@@ -41,6 +41,6 @@ class Horde_Kolab_Server_Ldap_Standard extends Horde_Kolab_Server_Ldap
      */
     public function findBelow($query, $parent, array $params = array())
     {
-        return $this->_search((string) $query, $params, $parent);
+        return $this->_search($query, $params, $parent);
     }
 }
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/List.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/List.php
deleted file mode 100644 (file)
index 7a9ad87..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-<?php
-/**
- * Interface for server lists.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-
-/**
- * Interface for server lists.
- *
- * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-interface Horde_Kolab_Server_List
-{
-    /**
-     * List all objects of a specific type.
-     *
-     * @param string $type   The type of the objects to be listed
-     * @param array  $params Additional parameters.
-     *
-     * @return array An array of Kolab objects.
-     *
-     * @throws Horde_Kolab_Server_Exception
-     *
-     * @todo Sorting
-     */
-    public function listObjects($type, $params = null);
-}
\ No newline at end of file
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/List/Interface.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/List/Interface.php
new file mode 100644 (file)
index 0000000..7a9ad87
--- /dev/null
@@ -0,0 +1,43 @@
+<?php
+/**
+ * Interface for server lists.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+
+/**
+ * Interface for server lists.
+ *
+ * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+interface Horde_Kolab_Server_List
+{
+    /**
+     * List all objects of a specific type.
+     *
+     * @param string $type   The type of the objects to be listed
+     * @param array  $params Additional parameters.
+     *
+     * @return array An array of Kolab objects.
+     *
+     * @throws Horde_Kolab_Server_Exception
+     *
+     * @todo Sorting
+     */
+    public function listObjects($type, $params = null);
+}
\ No newline at end of file
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Logged.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Logged.php
deleted file mode 100644 (file)
index c71e5f5..0000000
+++ /dev/null
@@ -1,317 +0,0 @@
-<?php
-/**
- * A server delegation that logs server access via Horde_Log_Logger.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-
-/**
- * A server delegation that logs server access via Horde_Log_Logger.
- *
- * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-class Horde_Kolab_Server_Logged implements Horde_Kolab_Server
-{
-    /**
-     * The server we delegate to.
-     *
-     * @var Horde_Kolab_Server
-     */
-    private $_server;
-
-    /**
-     * The log handler.
-     *
-     * @var Horde_Log_Logger
-     */
-    private $_logger;
-
-    /**
-     * Constructor.
-     *
-     * @param Horde_Kolab_Server $server The base server connection.
-     * @param mixed              $logger The log handler. The class must at
-     *                                   least provide the info() method.
-     */
-    public function __construct(Horde_Kolab_Server $server, $logger)
-    {
-        $this->_server = $server;
-        $this->_logger = $logger;
-    }
-
-    /**
-     * Connect to the server.
-     *
-     * @param string $guid The global unique id of the user.
-     * @param string $pass The password.
-     *
-     * @return NULL.
-     *
-     * @throws Horde_Kolab_Server_Exception If the connection failed.
-     */
-    public function connectGuid($guid = null, $pass = null)
-    {
-        try {
-            $this->_server->connectGuid($guid, $pass);
-            $this->_logger->info(
-                sprintf(
-                    "Successfully connected to the Kolab Server as \"%s\".",
-                    $guid
-                )
-            );
-        } catch (Horde_Kolab_Server_Exception $e) {
-            $this->_logger->info(
-                sprintf(
-                    "Failed saving object \"%s\"! Error: %s",
-                    $object->getGuid(), $e->getMessage()
-                )
-            );
-        }
-    }
-
-    /**
-     * Get the current GUID
-     *
-     * @return string The GUID of the connected user.
-     */
-    public function getGuid()
-    {
-        return $this->_server->getGuid();
-    }
-
-    /**
-     * Get the base GUID of this server
-     *
-     * @return string The base GUID of this server.
-     */
-    public function getBaseGuid()
-    {
-        return $this->_server->getBaseGuid();
-    }
-
-    /**
-     * Low level access to reading object data.
-     *
-     * @param string $guid  The object to retrieve.
-     * @param array  $attrs Restrict to these attributes.
-     *
-     * @return array An array of attributes.
-     *
-     * @throws Horde_Kolab_Server_Exception If the search operation hit an error
-     *                                      or returned no result.
-     */
-    public function read($guid, array $attrs = array())
-    {
-        return $this->_server->read($guid);
-    }
-
-    /**
-     * Low level access to reading some object attributes.
-     *
-     * @param string $guid  The object to retrieve.
-     * @param string $attrs Restrict to these attributes.
-     *
-     * @return array An array of attributes.
-     *
-     * @throws Horde_Kolab_Server_Exception
-     *
-     * @see Horde_Kolab_Server::read
-     */
-    public function readAttributes($guid, array $attrs)
-    {
-        return $this->_server->readAttributes($guid, $attrs);
-    }
-
-    /**
-     * Finds object data matching a given set of criteria.
-     *
-     * @param string $query  The LDAP search query
-     * @param array  $params Additional search parameters.
-     *
-     * @return Horde_Kolab_Server_Result The result object.
-     *
-     * @throws Horde_Kolab_Server_Exception
-     */
-    public function find($query, array $params = array())
-    {
-        return $this->_server->find($query, $params);
-    }
-
-    /**
-     * Finds all object data below a parent matching a given set of criteria.
-     *
-     * @param string $query  The LDAP search query
-     * @param string $parent The parent to search below.
-     * @param array  $params Additional search parameters.
-     *
-     * @return Horde_Kolab_Server_Result The result object.
-     *
-     * @throws Horde_Kolab_Server_Exception
-     */
-    public function findBelow($query, $parent, array $params = array())
-    {
-        return $this->_server->findBelow($query, $parent, $params);
-    }
-
-    /**
-     * Modify existing object data.
-     *
-     * @param Horde_Kolab_Server_Object $object The object to be modified.
-     * @param array                     $data   The attributes of the object
-     *                                          to be stored.
-     *
-     * @return NULL
-     *
-     * @throws Horde_Kolab_Server_Exception
-     */
-    public function save(Horde_Kolab_Server_Object $object, array $data)
-    {
-        try {
-            $this->_server->save($object, $data);
-            $this->_logger->info(
-                sprintf(
-                    "The object \"%s\" has been successfully saved!",
-                    $object->getGuid()
-                )
-            );
-        } catch (Horde_Kolab_Server_Exception $e) {
-            $this->_logger->info(
-                sprintf(
-                    "Failed saving object \"%s\"! Error: %s",
-                    $object->getGuid(), $e->getMessage()
-                )
-            );
-
-        }
-    }
-
-    /**
-     * Add new object data.
-     *
-     * @param Horde_Kolab_Server_Object $object The object to be added.
-     * @param array                     $data   The attributes of the object
-     *                                          to be added.
-     *
-     * @return NULL
-     *
-     * @throws Horde_Kolab_Server_Exception
-     */
-    public function add(Horde_Kolab_Server_Object $object, array $data)
-    {
-        try {
-            $this->_server->add($object, $data);
-            $this->_logger->info(
-                sprintf(
-                    "The object \"%s\" has been successfully added!",
-                    $object->getGuid()
-                )
-            );
-        } catch (Horde_Kolab_Server_Exception $e) {
-            $this->_logger->info(
-                sprintf(
-                    "Failed adding object \"%s\"! Error: %s",
-                    $object->getGuid(), $e->getMessage()
-                )
-            );
-
-        }
-    }
-
-    /**
-     * Delete an object.
-     *
-     * @param string $guid The GUID of the object to be deleted.
-     *
-     * @return NULL
-     *
-     * @throws Horde_Kolab_Server_Exception
-     */
-    public function delete($guid)
-    {
-        try {
-            $this->_server->delete($guid);
-            $this->_logger->info(
-                sprintf("The object \"%s\" has been successfully deleted!", $guid)
-            );
-        } catch (Horde_Kolab_Server_Exception $e) {
-            $this->_logger->info(
-                sprintf(
-                    "Failed deleting object \"%s\"! Error: %s",
-                    $object->getGuid(), $e->getMessage()
-                )
-            );
-
-        }
-
-    }
-
-    /**
-     * Rename an object.
-     *
-     * @param string $guid The GUID of the object to be renamed.
-     * @param string $new  The new GUID of the object.
-     *
-     * @return NULL
-     *
-     * @throws Horde_Kolab_Server_Exception
-     */
-    public function rename($guid, $new)
-    {
-        try {
-            $this->_server->rename($guid, $new);
-            $this->_logger->info(
-                sprintf(
-                    "The object \"%s\" has been successfully renamed to \"%s\"!",
-                    $guid, $new
-                )
-            );
-        } catch (Horde_Kolab_Server_Exception $e) {
-            $this->_logger->info(
-                sprintf(
-                    "Failed saving object \"%s\"! Error: %s",
-                    $object->getGuid(), $e->getMessage()
-                )
-            );
-
-        }
-    }
-
-    /**
-     * Return the ldap schema.
-     *
-     * @return Net_LDAP2_Schema The LDAP schema.
-     *
-     * @throws Horde_Kolab_Server_Exception If retrieval of the schema failed.
-     */
-    public function getSchema()
-    {
-        return $this->_server->getSchema();
-    }
-
-    /**
-     * Get the parent GUID of this object.
-     *
-     * @param string $guid The GUID of the child.
-     *
-     * @return string the parent GUID of this object.
-     */
-    public function getParentGuid($guid)
-    {
-        return $this->_server->getParentGuid($guid);
-    }
-}
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Mapped.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Mapped.php
deleted file mode 100644 (file)
index f911d74..0000000
+++ /dev/null
@@ -1,345 +0,0 @@
-<?php
-/**
- * A server delegation that maps object attributes.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-
-/**
- * A server delegation that maps object attributes.
- *
- * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-class Horde_Kolab_Server_Mapped implements Horde_Kolab_Server
-{
-    /**
-     * The server we delegate to.
-     *
-     * @var Horde_Kolab_Server
-     */
-    private $_server;
-
-    /**
-     * The attribute mapping.
-     *
-     * @var array
-     */
-    private $_mapping;
-
-    /**
-     * Constructor.
-     *
-     * @param Horde_Kolab_Server $server  The base server connection.
-     * @param array              $mapping The attribute mapping.
-     */
-    public function __construct(Horde_Kolab_Server $server, array $mapping)
-    {
-        $this->_server  = $server;
-        $this->_mapping = $mapping;
-    }
-
-    /**
-     * Connect to the server. Use this method if the user name you can provide
-     * does not match a GUID. In this case it will be required to map this user
-     * name first.
-     *
-     * @param string $user The user name.
-     * @param string $pass The password.
-     *
-     * @return NULL.
-     *
-     * @throws Horde_Kolab_Server_Exception If the connection failed.
-     */
-    public function connect($user = null, $pass = null)
-    {
-        $this->_server->connect($user, $pass);
-    }
-
-    /**
-     * Connect to the server.
-     *
-     * @param string $guid The global unique id of the user.
-     * @param string $pass The password.
-     *
-     * @return NULL.
-     *
-     * @throws Horde_Kolab_Server_Exception If the connection failed.
-     */
-    public function connectGuid($guid = '', $pass = '')
-    {
-         $this->_server->connectGuid($guid, $pass);
-    }
-
-    /**
-     * Get the current GUID
-     *
-     * @return string The GUID of the connected user.
-     */
-    public function getGuid()
-    {
-        $this->_server->getGuid();
-    }
-
-    /**
-     * Get the base GUID of this server
-     *
-     * @return string The base GUID of this server.
-     */
-    public function getBaseGuid()
-    {
-        $this->_server->getBaseGuid();
-    }
-
-    /**
-     * Low level access to reading object data.
-     *
-     * @param string $guid  The object to retrieve.
-     * @param array  $attrs Restrict to these attributes.
-     *
-     * @return array An array of attributes.
-     *
-     * @throws Horde_Kolab_Server_Exception If the search operation hit an error
-     *                                      or returned no result.
-     */
-    public function read($guid, array $attrs = array())
-    {
-        $data = $this->_server->read($guid);
-        $this->unmapAttributes($data);
-        return $data;
-    }
-
-    /**
-     * Low level access to reading some object attributes.
-     *
-     * @param string $guid  The object to retrieve.
-     * @param string $attrs Restrict to these attributes.
-     *
-     * @return array An array of attributes.
-     *
-     * @throws Horde_Kolab_Server_Exception
-     *
-     * @see Horde_Kolab_Server::read
-     */
-    public function readAttributes($guid, array $attrs)
-    {
-        $this->mapKeys($attrs);
-        $data = $this->_server->readAttributes($guid, $attrs);
-        $this->unmapAttributes($data);
-        return $data;
-    }
-
-    /**
-     * Finds object data matching a given set of criteria.
-     *
-     * @param string $query  The LDAP search query
-     * @param array  $params Additional search parameters.
-     *
-     * @return array The result array.
-     *
-     * @throws Horde_Kolab_Server_Exception
-     */
-    public function find($query, array $params = array())
-    {
-        $criteria = new Horde_Kolab_Server_Query_Element_Mapped($criteria, $this);
-        $data = $this->_server->find($criteria, $params);
-        $this->unmapAttributes($data);
-        return $data;
-    }
-
-    /**
-     * Finds all object data below a parent matching a given set of criteria.
-     *
-     * @param string $query  The LDAP search query
-     * @param string $parent The parent to search below.
-     * @param array  $params Additional search parameters.
-     *
-     * @return array The result array.
-     *
-     * @throws Horde_Kolab_Server_Exception
-     */
-    public function findBelow($query, $parent, array $params = array())
-    {
-        $criteria = new Horde_Kolab_Server_Query_Element_Mapped($criteria, $this);
-        $data = $this->_server->findBelow($criteria, $parent, $params);
-        $this->unmapAttributes($data);
-        return $data;
-    }
-
-
-    /**
-     * Modify existing object data.
-     *
-     * @param string $guid The GUID of the object to be added.
-     * @param array  $data The attributes of the object to be added.
-     *
-     * @return NULL
-     *
-     * @throws Horde_Kolab_Server_Exception
-     */
-    public function save(Horde_Kolab_Server_Object $object, array $data)
-    {
-        //@todo: This will not work this way as we need to map internal
-        // attributes.
-        $this->mapAttributes($data);
-        $this->_server->save($object, $data);
-    }
-
-    /**
-     * Add new object data.
-     *
-     * @param string $guid The GUID of the object to be added.
-     * @param array  $data The attributes of the object to be added.
-     *
-     * @return NULL
-     *
-     * @throws Horde_Kolab_Server_Exception
-     */
-    public function add(Horde_Kolab_Server_Object $object, array $data)
-    {
-        //@todo: This will not work this way as we need to map internal
-        // attributes.
-        $this->mapAttributes($data);
-        $this->_server->add($object, $data);
-    }
-
-    /**
-     * Delete an object.
-     *
-     * @param string $guid The GUID of the object to be deleted.
-     *
-     * @return NULL
-     *
-     * @throws Horde_Kolab_Server_Exception
-     */
-    public function delete($guid)
-    {
-        $this->_server->delete($guid);
-    }
-
-    /**
-     * Rename an object.
-     *
-     * @param string $guid The GUID of the object to be renamed.
-     * @param string $new  The new GUID of the object.
-     *
-     * @return NULL
-     *
-     * @throws Horde_Kolab_Server_Exception
-     */
-    public function rename($guid, $new)
-    {
-         $this->_server->rename($guid, $new);
-    }
-
-    /**
-     * Return the ldap schema.
-     *
-     * @return Net_LDAP2_Schema The LDAP schema.
-     *
-     * @throws Horde_Kolab_Server_Exception If retrieval of the schema failed.
-     */
-    public function getSchema()
-    {
-        return $this->_server->getSchema();
-    }
-
-
-    /**
-     * Map attributes defined within this library to their real world
-     * counterparts.
-     *
-     * @param array &$data The data that has been read and needs to be mapped.
-     *
-     * @return NULL
-     */
-    protected function unmapAttributes(&$data)
-    {
-        foreach ($data as &$element) {
-            foreach ($this->mapping as $attribute => $map) {
-                if (isset($element[$map])) {
-                    $element[$attribute] = $element[$map];
-                    unset($element[$map]);
-                }
-            }
-        }
-    }
-
-    /**
-     * Map attributes defined within this library into their real world
-     * counterparts.
-     *
-     * @param array &$data The data to be written.
-     *
-     * @return NULL
-     */
-    protected function mapAttributes(&$data)
-    {
-        foreach ($this->mapping as $attribute => $map) {
-            if (isset($data[$attribute])) {
-                $data[$map] = $data[$attribute];
-                unset($data[$attribute]);
-            }
-        }
-    }
-
-    /**
-     * Map attribute keys defined within this library into their real world
-     * counterparts.
-     *
-     * @param array &$keys The attribute keys.
-     *
-     * @return NULL
-     */
-    protected function mapKeys(&$keys)
-    {
-        foreach ($this->mapping as $attribute => $map) {
-            $key = array_search($attribute, $keys);
-            if ($key !== false) {
-                $keys[$key] = $map;
-            }
-        }
-    }
-
-    /**
-     * Map a single attribute key defined within this library into its real
-     * world counterpart.
-     *
-     * @param array $field The attribute name.
-     *
-     * @return The real name of this attribute on the server we connect to.
-     */
-    public function mapField($field)
-    {
-        if (isset($this->mapping[$field])) {
-            return $this->mapping[$field];
-        }
-        return $field;
-    }
-
-    /**
-     * Get the parent GUID of this object.
-     *
-     * @param string $guid The GUID of the child.
-     *
-     * @return string the parent GUID of this object.
-     */
-    public function getParentGuid($guid)
-    {
-        return $this->_server->getParentGuid($guid);
-    }
-}
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Object.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Object.php
deleted file mode 100644 (file)
index bd13a29..0000000
+++ /dev/null
@@ -1,138 +0,0 @@
-<?php
-/**
- * Interface describing Kolab objects stored in the server database.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-
-/**
- * Interface describing Kolab objects stored in the server database.
- *
- * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-interface Horde_Kolab_Server_Object
-{
-    /**
-     * Get the GUID of this object
-     *
-     * @return string the GUID of this object
-     */
-    public function getGuid();
-
-    /**
-     * Get the external attributes supported by this object.
-     *
-     * @return array The external attributes supported by this object. This is a
-     * list of abbreviated attribute class names.
-     */
-    public function getExternalAttributes();
-
-    /**
-     * Get the internal attributes supported by this object.
-     *
-     * @return array The internal attributes supported by this object. This is
-     * an association of internal attribute names an the correspodning attribute
-     * class names.
-     */
-    public function getInternalAttributes();
-
-    /**
-     * Does the object exist?
-     *
-     * @return boolean True if the object exists, false otherwise.
-     */
-    public function exists();
-
-    /**
-     * Read the object into the cache
-     *
-     * @return array The read data.
-     */
-    public function readInternal();
-
-    /**
-     * Get the specified attribute of this object
-     *
-     * @param string $attr The attribute to read
-     *
-     * @return array The value(s) of this attribute
-     */
-    public function getInternal($attr);
-
-    /**
-     * Get the specified attribute of this object.
-     *
-     * @param string $attr The attribute to read.
-     *
-     * @return mixed The value of this attribute.
-     */
-    public function getExternal($attr);
-
-    /**
-     * Saves object information. This may either create a new entry or modify an
-     * existing entry.
-     *
-     * Please note that fields with multiple allowed values require the callee
-     * to provide the full set of values for the field. Any old values that are
-     * not resubmitted will be considered to be deleted.
-     *
-     * @param array $info The information about the object.
-     *
-     * @return NULL
-     *
-     * @throws Horde_Kolab_Server_Exception If saving the data failed.
-     */
-    public function save(array $info);
-
-    /**
-     * Delete this object.
-     *
-     * @return NULL
-     *
-     * @throws Horde_Kolab_Server_Exception If deleting the object failed.
-     */
-    public function delete();
-
-    /**
-     * Generates an ID for the given information.
-     *
-     * @param array &$info The data of the object.
-     *
-     * @return string The ID.
-     */
-    public function generateId(array &$info);
-
-    /**
-     * Distill the server side object information to save.
-     *
-     * @param array &$info The information about the object.
-     *
-     * @return NULL.
-     *
-     * @throws Horde_Kolab_Server_Exception If the given information contains errors.
-     */
-    public function prepareObjectInformation(array &$info);
-
-    /**
-     * Returns the set of actions supported by this object type.
-     *
-     * @return array An array of supported actions.
-     */
-    public function getActions();
-
-}
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Attribute.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Attribute.php
deleted file mode 100644 (file)
index 6d6b38e..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-<?php
-/**
- * The interface representing Kolab object attributes.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-
-/**
- * The interface representing Kolab object attributes.
- *
- * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-interface Horde_Kolab_Server_Object_Attribute
-{
-    /**
-     * Return the value of this attribute.
-     *
-     * @return array The value(s) of this attribute.
-     *
-     * @throws Horde_Kolab_Server_Exception If retrieval of the value failed.
-     */
-    public function value();
-
-    /**
-     * Return the new internal state for this attribute.
-     *
-     * @param array $changes The object data that should be updated.
-     *
-     * @return array The resulting internal state.
-     *
-     * @throws Horde_Kolab_Server_Exception If storing the value failed.
-     */
-    public function update(array $changes);
-
-    /**
-     * Return the object this attribute belongs to.
-     *
-     * @return Horde_Kolab_Server_Object The object.
-     */
-    public function getObject();
-
-    /**
-     * Return the internal name of this attribute.
-     *
-     * @return string The name of this object.
-     */
-    public function getInternalName();
-
-    /**
-     * Return the external name of this attribute.
-     *
-     * @return string The name of this object.
-     */
-    public function getExternalName();
-
-    /**
-     * Return if this attribute is undefined in the given data array.
-     *
-     * @param array $changes The data array to test.
-     *
-     * @return string The name of this object.
-     */
-    public function isEmpty(array $changes);
-
-    /**
-     * Indicate that a value will be saved by deleting it from the original data
-     * array.
-     *
-     * @param array &$changes The object data that should be changed.
-     *
-     * @return NULL
-     */
-    public function consume(array &$changes);
-}
\ No newline at end of file
index c3e63b2..3ed439d 100644 (file)
@@ -26,7 +26,7 @@
  * @link     http://pear.horde.org/index.php?package=Kolab_Server
  */
 abstract class Horde_Kolab_Server_Object_Attribute_Base
-implements Horde_Kolab_Server_Object_Attribute
+implements Horde_Kolab_Server_Object_Attribute_Interface
 {
     /**
      * The attribute name on the internal side.
@@ -65,15 +65,15 @@ implements Horde_Kolab_Server_Object_Attribute
      * @param string                       $name      The name of this attribute.
      */
     public function __construct(
-        Horde_Kolab_Server_Object $object,
-        Horde_Kolab_Server_Composite $composite,
+        Horde_Kolab_Server_Object_Interface $object,
+        Horde_Kolab_Server_Composite_Interface $composite,
         $external
     ) {
         $this->_object    = $object;
         $this->_composite = $composite;
         $this->_external  = $external;
 
-        $this->_internal  = $this->_composite->structure->getInternalAttribute(
+        $this->_internal  = $this->_composite->structure->mapExternalToInternalAttribute(
             $this->_external
         );
     }
index 2142c5e..5e78849 100644 (file)
@@ -26,7 +26,7 @@
  * @link     http://pear.horde.org/index.php?package=Kolab_Server
  */
 class Horde_Kolab_Server_Object_Attribute_Decorator
-implements Horde_Kolab_Server_Object_Attribute
+implements Horde_Kolab_Server_Object_Attribute_Interface
 {
     /**
      * The decorated attribute.
@@ -42,7 +42,7 @@ implements Horde_Kolab_Server_Object_Attribute
      *                                                       attribute.
      */
     public function __construct(
-        Horde_Kolab_Server_Object_Attribute $attribute
+        Horde_Kolab_Server_Object_Attribute_Interface $attribute
     ) {
         $this->_attribute = $attribute;
     }
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Attribute/Interface.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Attribute/Interface.php
new file mode 100644 (file)
index 0000000..5e3b8eb
--- /dev/null
@@ -0,0 +1,89 @@
+<?php
+/**
+ * The interface representing Kolab object attributes.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+
+/**
+ * The interface representing Kolab object attributes.
+ *
+ * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+interface Horde_Kolab_Server_Object_Attribute_Interface
+{
+    /**
+     * Return the value of this attribute.
+     *
+     * @return array The value(s) of this attribute.
+     *
+     * @throws Horde_Kolab_Server_Exception If retrieval of the value failed.
+     */
+    public function value();
+
+    /**
+     * Return the new internal state for this attribute.
+     *
+     * @param array $changes The object data that should be updated.
+     *
+     * @return array The resulting internal state.
+     *
+     * @throws Horde_Kolab_Server_Exception If storing the value failed.
+     */
+    public function update(array $changes);
+
+    /**
+     * Return the object this attribute belongs to.
+     *
+     * @return Horde_Kolab_Server_Object The object.
+     */
+    public function getObject();
+
+    /**
+     * Return the internal name of this attribute.
+     *
+     * @return string The name of this object.
+     */
+    public function getInternalName();
+
+    /**
+     * Return the external name of this attribute.
+     *
+     * @return string The name of this object.
+     */
+    public function getExternalName();
+
+    /**
+     * Return if this attribute is undefined in the given data array.
+     *
+     * @param array $changes The data array to test.
+     *
+     * @return string The name of this object.
+     */
+    public function isEmpty(array $changes);
+
+    /**
+     * Indicate that a value will be saved by deleting it from the original data
+     * array.
+     *
+     * @param array &$changes The object data that should be changed.
+     *
+     * @return NULL
+     */
+    public function consume(array &$changes);
+}
\ No newline at end of file
index eed3ebd..aed9a9f 100644 (file)
@@ -36,8 +36,8 @@ extends Horde_Kolab_Server_Object_Attribute_Decorator
      * @param Horde_Kolab_Server_Composite $composite The link to the server.
      */
     public function __construct(
-        Horde_Kolab_Server_Object $object,
-        Horde_Kolab_Server_Composite $composite
+        Horde_Kolab_Server_Object_Interface $object,
+        Horde_Kolab_Server_Composite_Interface $composite
     ) {
         $this->_attribute = new Horde_Kolab_Server_Object_Attribute_Required(
             new Horde_Kolab_Server_Object_Attribute_Locked(
index 17e6d14..cf89916 100644 (file)
@@ -28,7 +28,7 @@
  * @link     http://pear.horde.org/index.php?package=Kolab_Server
  */
 abstract class Horde_Kolab_Server_Object_Base
-implements Horde_Kolab_Server_Object
+implements Horde_Kolab_Server_Object_Interface
 {
     /**
      * Link to the Kolab server.
@@ -51,7 +51,7 @@ implements Horde_Kolab_Server_Object
      * @param string                       $guid      GUID of the object.
      */
     public function __construct(
-        Horde_Kolab_Server_Composite $composite,
+        Horde_Kolab_Server_Composite_Interface $composite,
         $guid = null
     ) {
         $this->_composite = $composite;
index 0115076..da6ef99 100644 (file)
@@ -34,16 +34,17 @@ class Horde_Kolab_Server_Object_Factory
      * @param mixed  $type     The type of the Horde_Kolab_Server_Object subclass
      *                         to return.
      * @param string $uid      UID of the object
-     * @param array  &$storage A link to the Kolab_Server class handling read/write.
+     * @param array  $storage A link to the Kolab_Server class handling read/write.
      * @param array  $data     A possible array of data for the object
      *
      * @return Horde_Kolab_Server_Object|PEAR_Error The newly created concrete
      *                                 Horde_Kolab_Server_Object instance.
      */
-    static public function &factory($type, $uid, &$storage, $data = null)
-    {
-        $result = Horde_Kolab_Server_Object::loadClass($type);
-
+    static public function factory(
+        $type, $uid,
+        Horde_Kolab_Server_Composite $storage,
+        $data = null
+    ) {
         if (class_exists($type)) {
             $object = new $type($storage, $uid, $data);
         } else {
@@ -53,6 +54,7 @@ class Horde_Kolab_Server_Object_Factory
         return $object;
     }
 
+
     /**
      * Attempts to load the concrete Horde_Kolab_Server_Object class based on
      * $type.
@@ -69,5 +71,4 @@ class Horde_Kolab_Server_Object_Factory
             throw new Horde_Kolab_Server_Exception('Class definition of ' . $type . ' not found.');
         }
     }
-
 }
index 8749799..ac82299 100644 (file)
@@ -27,6 +27,9 @@
  */
 class Horde_Kolab_Server_Object_Groupofnames extends Horde_Kolab_Server_Object_Top
 {
+    /** The specific object class of this object type */
+    const OBJECTCLASS_GROUPOFNAMES = 'groupOfNames';
+
     /** Define attributes specific to this object type */
 
     /** The common name */
@@ -35,9 +38,6 @@ class Horde_Kolab_Server_Object_Groupofnames extends Horde_Kolab_Server_Object_T
     /** The members of this group */
     const ATTRIBUTE_MEMBER = 'member';
 
-    /** The specific object class of this object type */
-    const OBJECTCLASS_GROUPOFNAMES = 'groupOfNames';
-
     /**
      * A structure to initialize the attribute structure for this class.
      *
@@ -159,71 +159,4 @@ class Horde_Kolab_Server_Object_Groupofnames extends Horde_Kolab_Server_Object_T
             return true;
         }
     }
-
-    /**
-     * Returns the set of search operations supported by this object type.
-     *
-     * @return array An array of supported search operations.
-     */
-    static public function getSearchOperations()
-    {
-        $searches = array(
-/*             'gidForSearch', */
-/*             'getGroups', */
-        );
-        return $searches;
-    }
-
-    /**
-     * @todo: This method belongs somewhere where we are aware of groups
-     * Identify the GID for the first group found using the specified
-     * search criteria
-     *
-     * @param array $criteria The search parameters as array.
-     * @param int   $restrict A Horde_Kolab_Server::RESULT_* result restriction.
-     *
-     * @return boolean|string|array The GID(s) or false if there was no result.
-     *
-     * @throws Horde_Kolab_Server_Exception
-     */
-    static public function gidForSearch($server, $criteria,
-                                        $restrict = 0)
-    {
-        $groups = array('field' => self::ATTRIBUTE_OC,
-                        'op'    => '=',
-                        'test'  => self::OBJECTCLASS_GROUPOFNAMES);
-        if (!empty($criteria)) {
-            $criteria = array('AND' => array($groups, $criteria));
-        } else {
-            $criteria = array('AND' => array($groups));
-        }
-        return self::basicUidForSearch($server, $criteria, $restrict);
-    }
-
-    /**
-     * Get the groups for this object.
-     *
-     * @param string $uid The UID of the object to fetch.
-     *
-     * @return array An array of group ids.
-     *
-     * @throws Horde_Kolab_Server_Exception
-     */
-    static public function getGroups($server, $uid)
-    {
-        $criteria = array('AND' =>
-                          array(
-                              array('field' => self::ATTRIBUTE_MEMBER,
-                                    'op'    => '=',
-                                    'test'  => $uid),
-                          ),
-        );
-
-        $result = self::gidForSearch($server, $criteria, self::RESULT_MANY);
-        if (empty($result)) {
-            return array();
-        }
-        return $result;
-    }
-
 }
index c5e38f9..c8486b9 100644 (file)
@@ -26,7 +26,7 @@
  * @link     http://pear.horde.org/index.php?package=Kolab_Server
  */
 class Horde_Kolab_Server_Object_Hash
-implements Horde_Kolab_Server_Object
+implements Horde_Kolab_Server_Object_Interface
 //@todo: Implement ArrayAccess
 {
     /**
index 408f995..8255c5f 100644 (file)
@@ -88,105 +88,105 @@ class Horde_Kolab_Server_Object_Inetorgperson extends Horde_Kolab_Server_Object_
      *
      * @var array
      */
-    static public $init_attributes = array(
-        'defined' => array(
-            self::ATTRIBUTE_SID,
-            self::ATTRIBUTE_GIVENNAME,
-            self::ATTRIBUTE_MAIL,
-            self::ATTRIBUTE_LABELEDURI,
-            self::ATTRIBUTE_HOMEPOSTALADDRESS,
-            self::ATTRIBUTE_ORGANIZATION,
-            self::ATTRIBUTE_BUSINESSCATEGORY,
-            self::ATTRIBUTE_HOMEPHONE,
-            self::ATTRIBUTE_MOBILE,
-            self::ATTRIBUTE_PHOTO,
-            self::ATTRIBUTE_JPEGPHOTO,
-            self::ATTRIBUTE_SMIMECERTIFICATE,
-        ),
-        'derived' => array(
-            self::ATTRARRAY_HOMEPOSTALADDRESS => array(
-                'base' => array(
-                    self::ATTRIBUTE_HOMEPOSTALADDRESS,
-                    self::ATTRIBUTE_GIVENNAME,
-                    self::ATTRIBUTE_SN
-                ),
-                'method' => 'getHomePostalAddressHash',
-            ),
-            self::ATTRARRAY_LABELEDURI => array(
-                'base' => array(
-                    self::ATTRIBUTE_LABELEDURI,
-                ),
-                'method' => 'getLabeledUriHash',
-            ),
-            self::ATTRIBUTE_GIVENNAME => array(
-                'base' => array(
-                    self::ATTRIBUTE_GIVENNAME,
-                ),
-                'method' => 'getField',
-                'args' => array(
-                    self::ATTRIBUTE_GIVENNAME,
-                    0,
-                    ' '
-                ),
-            ),
-            self::ATTRIBUTE_MIDDLENAMES => array(
-                'base' => array(
-                    self::ATTRIBUTE_GIVENNAME,
-                ),
-                'method' => 'getField',
-                'args' => array(
-                    self::ATTRIBUTE_GIVENNAME,
-                    1,
-                    ' ',
-                    2
-                ),
-            ),
-            self::ATTRIBUTE_FNLN => array(
-                'base' => array(
-                    self::ATTRIBUTE_GIVENNAME,
-                    self::ATTRIBUTE_SN
-                ),
-                'method' => 'getFnLn',
-            ),
-            self::ATTRIBUTE_LNFN => array(
-                'base' => array(
-                    self::ATTRIBUTE_GIVENNAME,
-                    self::ATTRIBUTE_SN
-                ),
-                'method' => 'getLnFn',
-            ),
-        ),
-        'collapsed' => array(
-            self::ATTRIBUTE_GIVENNAME => array(
-                'base' => array(
-                    self::ATTRIBUTE_GIVENNAME,
-                    self::ATTRIBUTE_MIDDLENAMES,
-                ),
-                'method' => 'setField',
-                'args' => array(
-                    ' ',
-                ),
-            ),
-            self::ATTRIBUTE_LABELEDURI => array(
-                'base' => array(
-                    self::ATTRARRAY_LABELEDURI,
-                ),
-                'method' => 'setLabeledUriHash',
-            ),
-            self::ATTRIBUTE_HOMEPOSTALADDRESS => array(
-                'base' => array(
-                    self::ATTRARRAY_HOMEPOSTALADDRESS,
-                ),
-                'method' => 'setHomePostalAddressHash',
-            ),
-        ),
-        'locked' => array(
-            self::ATTRIBUTE_MAIL,
-        ),
-        'object_classes' => array(
-            self::OBJECTCLASS_INETORGPERSON,
-        ),
-    );
+/*     static public $init_attributes = array( */
+/*         'defined' => array( */
+/*             self::ATTRIBUTE_SID, */
+/*             self::ATTRIBUTE_GIVENNAME, */
+/*             self::ATTRIBUTE_MAIL, */
+/*             self::ATTRIBUTE_LABELEDURI, */
+/*             self::ATTRIBUTE_HOMEPOSTALADDRESS, */
+/*             self::ATTRIBUTE_ORGANIZATION, */
+/*             self::ATTRIBUTE_BUSINESSCATEGORY, */
+/*             self::ATTRIBUTE_HOMEPHONE, */
+/*             self::ATTRIBUTE_MOBILE, */
+/*             self::ATTRIBUTE_PHOTO, */
+/*             self::ATTRIBUTE_JPEGPHOTO, */
+/*             self::ATTRIBUTE_SMIMECERTIFICATE, */
+/*         ), */
+/*         'derived' => array( */
+/*             self::ATTRARRAY_HOMEPOSTALADDRESS => array( */
+/*                 'base' => array( */
+/*                     self::ATTRIBUTE_HOMEPOSTALADDRESS, */
+/*                     self::ATTRIBUTE_GIVENNAME, */
+/*                     self::ATTRIBUTE_SN */
+/*                 ), */
+/*                 'method' => 'getHomePostalAddressHash', */
+/*             ), */
+/*             self::ATTRARRAY_LABELEDURI => array( */
+/*                 'base' => array( */
+/*                     self::ATTRIBUTE_LABELEDURI, */
+/*                 ), */
+/*                 'method' => 'getLabeledUriHash', */
+/*             ), */
+/*             self::ATTRIBUTE_GIVENNAME => array( */
+/*                 'base' => array( */
+/*                     self::ATTRIBUTE_GIVENNAME, */
+/*                 ), */
+/*                 'method' => 'getField', */
+/*                 'args' => array( */
+/*                     self::ATTRIBUTE_GIVENNAME, */
+/*                     0, */
+/*                     ' ' */
+/*                 ), */
+/*             ), */
+/*             self::ATTRIBUTE_MIDDLENAMES => array( */
+/*                 'base' => array( */
+/*                     self::ATTRIBUTE_GIVENNAME, */
+/*                 ), */
+/*                 'method' => 'getField', */
+/*                 'args' => array( */
+/*                     self::ATTRIBUTE_GIVENNAME, */
+/*                     1, */
+/*                     ' ', */
+/*                     2 */
+/*                 ), */
+/*             ), */
+/*             self::ATTRIBUTE_FNLN => array( */
+/*                 'base' => array( */
+/*                     self::ATTRIBUTE_GIVENNAME, */
+/*                     self::ATTRIBUTE_SN */
+/*                 ), */
+/*                 'method' => 'getFnLn', */
+/*             ), */
+/*             self::ATTRIBUTE_LNFN => array( */
+/*                 'base' => array( */
+/*                     self::ATTRIBUTE_GIVENNAME, */
+/*                     self::ATTRIBUTE_SN */
+/*                 ), */
+/*                 'method' => 'getLnFn', */
+/*             ), */
+/*         ), */
+/*         'collapsed' => array( */
+/*             self::ATTRIBUTE_GIVENNAME => array( */
+/*                 'base' => array( */
+/*                     self::ATTRIBUTE_GIVENNAME, */
+/*                     self::ATTRIBUTE_MIDDLENAMES, */
+/*                 ), */
+/*                 'method' => 'setField', */
+/*                 'args' => array( */
+/*                     ' ', */
+/*                 ), */
+/*             ), */
+/*             self::ATTRIBUTE_LABELEDURI => array( */
+/*                 'base' => array( */
+/*                     self::ATTRARRAY_LABELEDURI, */
+/*                 ), */
+/*                 'method' => 'setLabeledUriHash', */
+/*             ), */
+/*             self::ATTRIBUTE_HOMEPOSTALADDRESS => array( */
+/*                 'base' => array( */
+/*                     self::ATTRARRAY_HOMEPOSTALADDRESS, */
+/*                 ), */
+/*                 'method' => 'setHomePostalAddressHash', */
+/*             ), */
+/*         ), */
+/*         'locked' => array( */
+/*             self::ATTRIBUTE_MAIL, */
+/*         ), */
+/*         'object_classes' => array( */
+/*             self::OBJECTCLASS_INETORGPERSON, */
+/*         ), */
+/*     ); */
 
     /**
      * Return the filter string to retrieve this object type.
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Interface.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Interface.php
new file mode 100644 (file)
index 0000000..c82fc53
--- /dev/null
@@ -0,0 +1,138 @@
+<?php
+/**
+ * Interface describing Kolab objects stored in the server database.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+
+/**
+ * Interface describing Kolab objects stored in the server database.
+ *
+ * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+interface Horde_Kolab_Server_Object_Interface
+{
+    /**
+     * Get the GUID of this object
+     *
+     * @return string the GUID of this object
+     */
+    public function getGuid();
+
+    /**
+     * Get the external attributes supported by this object.
+     *
+     * @return array The external attributes supported by this object. This is a
+     * list of abbreviated attribute class names.
+     */
+    public function getExternalAttributes();
+
+    /**
+     * Get the internal attributes supported by this object.
+     *
+     * @return array The internal attributes supported by this object. This is
+     * an association of internal attribute names an the correspodning attribute
+     * class names.
+     */
+    public function getInternalAttributes();
+
+    /**
+     * Does the object exist?
+     *
+     * @return boolean True if the object exists, false otherwise.
+     */
+    public function exists();
+
+    /**
+     * Read the object into the cache
+     *
+     * @return array The read data.
+     */
+    public function readInternal();
+
+    /**
+     * Get the specified attribute of this object
+     *
+     * @param string $attr The attribute to read
+     *
+     * @return array The value(s) of this attribute
+     */
+    public function getInternal($attr);
+
+    /**
+     * Get the specified attribute of this object.
+     *
+     * @param string $attr The attribute to read.
+     *
+     * @return mixed The value of this attribute.
+     */
+    public function getExternal($attr);
+
+    /**
+     * Saves object information. This may either create a new entry or modify an
+     * existing entry.
+     *
+     * Please note that fields with multiple allowed values require the callee
+     * to provide the full set of values for the field. Any old values that are
+     * not resubmitted will be considered to be deleted.
+     *
+     * @param array $info The information about the object.
+     *
+     * @return NULL
+     *
+     * @throws Horde_Kolab_Server_Exception If saving the data failed.
+     */
+    public function save(array $info);
+
+    /**
+     * Delete this object.
+     *
+     * @return NULL
+     *
+     * @throws Horde_Kolab_Server_Exception If deleting the object failed.
+     */
+    public function delete();
+
+    /**
+     * Generates an ID for the given information.
+     *
+     * @param array &$info The data of the object.
+     *
+     * @return string The ID.
+     */
+    public function generateId(array &$info);
+
+    /**
+     * Distill the server side object information to save.
+     *
+     * @param array &$info The information about the object.
+     *
+     * @return NULL.
+     *
+     * @throws Horde_Kolab_Server_Exception If the given information contains errors.
+     */
+    public function prepareObjectInformation(array &$info);
+
+    /**
+     * Returns the set of actions supported by this object type.
+     *
+     * @return array An array of supported actions.
+     */
+    public function getActions();
+
+}
index 344afda..d962f83 100644 (file)
@@ -48,15 +48,15 @@ class Horde_Kolab_Server_Object_Kolab_User extends Horde_Kolab_Server_Object_Kol
      *
      * @var array
      */
-    static public $init_attributes = array(
-        'derived' => array(
-            self::ATTRIBUTE_USERTYPE => array(),
-            self::ATTRIBUTE_FN => array(),
-        ),
-        'required' => array(
-            self::ATTRIBUTE_USERPASSWORD,
-        ),
-    );
+/*     static public $init_attributes = array( */
+/*         'derived' => array( */
+/*             self::ATTRIBUTE_USERTYPE => array(), */
+/*             self::ATTRIBUTE_FN => array(), */
+/*         ), */
+/*         'required' => array( */
+/*             self::ATTRIBUTE_USERPASSWORD, */
+/*         ), */
+/*     ); */
 
     /**
      * Return the filter string to retrieve this object type.
index 9f4e850..9a4c3a1 100644 (file)
@@ -59,66 +59,66 @@ class Horde_Kolab_Server_Object_Kolabinetorgperson extends Horde_Kolab_Server_Ob
      *
      * @var array
      */
-    static public $init_attributes = array(
-        'defined' => array(
-            self::ATTRIBUTE_ALIAS,
-            self::ATTRIBUTE_DELEGATE,
-            self::ATTRIBUTE_DELETED,
-            self::ATTRIBUTE_FBFUTURE,
-            self::ATTRIBUTE_HOMESERVER,
-            self::ATTRIBUTE_FREEBUSYHOST,
-            self::ATTRIBUTE_IMAPHOST,
-            self::ATTRIBUTE_IPOLICY,
-            self::ATTRIBUTE_SALUTATION,
-            self::ATTRIBUTE_GENDER,
-            self::ATTRIBUTE_MARITALSTATUS,
-            self::ATTRIBUTE_HOMEFAX,
-            self::ATTRIBUTE_GERMANTAXID,
-            self::ATTRIBUTE_COUNTRY,
-            self::ATTRIBUTE_QUOTA,
-            self::ATTRIBUTE_ALLOWEDRECIPIENTS,
-            self::ATTRIBUTE_ALLOWEDFROM,
-            self::ATTRIBUTE_DATEOFBIRTH,
-            self::ATTRIBUTE_PLACEOFBIRTH,
-            self::ATTRIBUTE_BIRTHNAME,
-            self::ATTRIBUTE_PSEUDONYM,
-            self::ATTRIBUTE_COUNTRYCITIZENSHIP,
-            self::ATTRIBUTE_LEGALFORM,
-            self::ATTRIBUTE_REGISTEREDCAPITAL,
-            self::ATTRIBUTE_BYLAWURI,
-            self::ATTRIBUTE_DATEOFINCORPORATION,
-            self::ATTRIBUTE_LEGALREPRESENTATIVE,
-            self::ATTRIBUTE_COMMERCIALPROCURATION,
-            self::ATTRIBUTE_LEGALREPRESENTATIONPOLICY,
-            self::ATTRIBUTE_ACTINGDEPUTY,
-            self::ATTRIBUTE_VATNUMBER,
-            self::ATTRIBUTE_OTHERLEGAL,
-            self::ATTRIBUTE_INLIQUIDATION,
-            self::ATTRIBUTE_TRTYPE,
-            self::ATTRIBUTE_TRLOCATION,
-            self::ATTRIBUTE_TRIDENTIFIER,
-            self::ATTRIBUTE_TRURI,
-            self::ATTRIBUTE_TRLASTCHANGED,
-            self::ATTRIBUTE_DC,
-        ),
-        'locked' => array(
-            self::ATTRIBUTE_MAIL,
-        ),
-        /**
-         * Derived attributes are calculated based on other attribute values.
-         */
-        'derived' => array(
-            self::ATTRDATE_DATEOFBIRTH => array(
-                'method' => 'getDate',
-                'args' => array(
-                    self::ATTRIBUTE_DATEOFBIRTH,
-                ),
-            ),
-        ),
-        'object_classes' => array(
-            self::OBJECTCLASS_KOLABINETORGPERSON,
-        ),
-    );
+/*     static public $init_attributes = array( */
+/*         'defined' => array( */
+/*             self::ATTRIBUTE_ALIAS, */
+/*             self::ATTRIBUTE_DELEGATE, */
+/*             self::ATTRIBUTE_DELETED, */
+/*             self::ATTRIBUTE_FBFUTURE, */
+/*             self::ATTRIBUTE_HOMESERVER, */
+/*             self::ATTRIBUTE_FREEBUSYHOST, */
+/*             self::ATTRIBUTE_IMAPHOST, */
+/*             self::ATTRIBUTE_IPOLICY, */
+/*             self::ATTRIBUTE_SALUTATION, */
+/*             self::ATTRIBUTE_GENDER, */
+/*             self::ATTRIBUTE_MARITALSTATUS, */
+/*             self::ATTRIBUTE_HOMEFAX, */
+/*             self::ATTRIBUTE_GERMANTAXID, */
+/*             self::ATTRIBUTE_COUNTRY, */
+/*             self::ATTRIBUTE_QUOTA, */
+/*             self::ATTRIBUTE_ALLOWEDRECIPIENTS, */
+/*             self::ATTRIBUTE_ALLOWEDFROM, */
+/*             self::ATTRIBUTE_DATEOFBIRTH, */
+/*             self::ATTRIBUTE_PLACEOFBIRTH, */
+/*             self::ATTRIBUTE_BIRTHNAME, */
+/*             self::ATTRIBUTE_PSEUDONYM, */
+/*             self::ATTRIBUTE_COUNTRYCITIZENSHIP, */
+/*             self::ATTRIBUTE_LEGALFORM, */
+/*             self::ATTRIBUTE_REGISTEREDCAPITAL, */
+/*             self::ATTRIBUTE_BYLAWURI, */
+/*             self::ATTRIBUTE_DATEOFINCORPORATION, */
+/*             self::ATTRIBUTE_LEGALREPRESENTATIVE, */
+/*             self::ATTRIBUTE_COMMERCIALPROCURATION, */
+/*             self::ATTRIBUTE_LEGALREPRESENTATIONPOLICY, */
+/*             self::ATTRIBUTE_ACTINGDEPUTY, */
+/*             self::ATTRIBUTE_VATNUMBER, */
+/*             self::ATTRIBUTE_OTHERLEGAL, */
+/*             self::ATTRIBUTE_INLIQUIDATION, */
+/*             self::ATTRIBUTE_TRTYPE, */
+/*             self::ATTRIBUTE_TRLOCATION, */
+/*             self::ATTRIBUTE_TRIDENTIFIER, */
+/*             self::ATTRIBUTE_TRURI, */
+/*             self::ATTRIBUTE_TRLASTCHANGED, */
+/*             self::ATTRIBUTE_DC, */
+/*         ), */
+/*         'locked' => array( */
+/*             self::ATTRIBUTE_MAIL, */
+/*         ), */
+/*         /\** */
+/*          * Derived attributes are calculated based on other attribute values. */
+/*          *\/ */
+/*         'derived' => array( */
+/*             self::ATTRDATE_DATEOFBIRTH => array( */
+/*                 'method' => 'getDate', */
+/*                 'args' => array( */
+/*                     self::ATTRIBUTE_DATEOFBIRTH, */
+/*                 ), */
+/*             ), */
+/*         ), */
+/*         'object_classes' => array( */
+/*             self::OBJECTCLASS_KOLABINETORGPERSON, */
+/*         ), */
+/*     ); */
 
     /**
      * Generates an ID for the given information.
index ae57cfc..74eeaba 100644 (file)
@@ -26,7 +26,7 @@
  * @link     http://pear.horde.org/index.php?package=Kolab_Server
  */
 class Horde_Kolab_Server_Object_Mcached
-implements Horde_Kolab_Server_Object
+implements Horde_Kolab_Server_Object_Interface
 {
     /**
      * Link to the decorated object.
index 9f864a8..5845076 100644 (file)
@@ -58,32 +58,32 @@ class Horde_Kolab_Server_Object_Organizationalperson extends Horde_Kolab_Server_
      *
      * @var array
      */
-    static public $init_attributes = array(
-        'defined' => array(
-            self::ATTRIBUTE_JOBTITLE,
-            self::ATTRIBUTE_STREET,
-            self::ATTRIBUTE_POSTOFFICEBOX,
-            self::ATTRIBUTE_POSTALCODE,
-            self::ATTRIBUTE_CITY,
-            self::ATTRIBUTE_FAX,
-            self::ATTRIBUTE_POSTALADDRESS,
-        ),
-        'collapsed' => array(
-            self::ATTRIBUTE_POSTALADDRESS => array(
-                'base' => array(
-                    self::ATTRIBUTE_SN,
-                    self::ATTRIBUTE_STREET,
-                    self::ATTRIBUTE_POSTOFFICEBOX,
-                    self::ATTRIBUTE_POSTALCODE,
-                    self::ATTRIBUTE_CITY,
-                ),
-                'method' => 'setPostalAddress',
-            ),
-        ),
-        'object_classes' => array(
-            self::OBJECTCLASS_ORGANIZATIONALPERSON,
-        ),
-    );
+/*     static public $init_attributes = array( */
+/*         'defined' => array( */
+/*             self::ATTRIBUTE_JOBTITLE, */
+/*             self::ATTRIBUTE_STREET, */
+/*             self::ATTRIBUTE_POSTOFFICEBOX, */
+/*             self::ATTRIBUTE_POSTALCODE, */
+/*             self::ATTRIBUTE_CITY, */
+/*             self::ATTRIBUTE_FAX, */
+/*             self::ATTRIBUTE_POSTALADDRESS, */
+/*         ), */
+/*         'collapsed' => array( */
+/*             self::ATTRIBUTE_POSTALADDRESS => array( */
+/*                 'base' => array( */
+/*                     self::ATTRIBUTE_SN, */
+/*                     self::ATTRIBUTE_STREET, */
+/*                     self::ATTRIBUTE_POSTOFFICEBOX, */
+/*                     self::ATTRIBUTE_POSTALCODE, */
+/*                     self::ATTRIBUTE_CITY, */
+/*                 ), */
+/*                 'method' => 'setPostalAddress', */
+/*             ), */
+/*         ), */
+/*         'object_classes' => array( */
+/*             self::OBJECTCLASS_ORGANIZATIONALPERSON, */
+/*         ), */
+/*     ); */
 
     /**
      * Return the filter string to retrieve this object type.
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Objects.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Objects.php
deleted file mode 100644 (file)
index 5b941e5..0000000
+++ /dev/null
@@ -1,120 +0,0 @@
-<?php
-/**
- * A library for accessing the Kolab user database.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-
-/**
- * Interface for a server object list.
- *
- * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-interface Horde_Kolab_Server_Objects
-{
-    /**
-     * Set the composite server reference for this object.
-     *
-     * @param Horde_Kolab_Server_Composite $composite A link to the composite
-     *                                                server handler.
-     */
-    public function setComposite(Horde_Kolab_Server_Composite $composite);
-
-    /**
-     * Add a Kolab object.
-     *
-     * @param array $info The object to store.
-     *
-     * @return Kolab_Object The newly created Kolab object.
-     *
-     * @throws Horde_Kolab_Server_Exception If the type of the object to add has
-     *                                      been left undefined or the object
-     *                                      already exists.
-     */
-    public function add(array $info);
-
-    /**
-     * Fetch a Kolab object.
-     *
-     * This method will not retrieve any data from the server
-     * immediately. Instead it will simply generate a new instance for the
-     * desired object.
-     *
-     * The server data will only be accessed once you start reading the object
-     * data.
-     *
-     * This method can also be used in order to fetch non-existing objects that
-     * will be saved later. This is however not recommended and you should
-     * rather use the add($info) method for that.
-     *
-     * If you do not provide the object type the server will try to determine it
-     * automatically based on the uid. As this requires reading data from the
-     * server it is recommended to specify the object type whenever it is known.
-     *
-     * If you do not specify a uid the object corresponding to the user bound to
-     * the server will be returned.
-     *
-     * @param string $uid  The UID of the object to fetch.
-     * @param string $type The type of the object to fetch.
-     *
-     * @return Kolab_Object The corresponding Kolab object.
-     *
-     * @throws Horde_Kolab_Server_Exception
-     */
-    public function fetch($uid = null, $type = null);
-
-    /**
-     * List all objects of a specific type
-     *
-     * @param string $type   The type of the objects to be listed
-     * @param array  $params Additional parameters.
-     *
-     * @return array An array of Kolab objects.
-     *
-     * @throws Horde_Kolab_Server_Exception
-     */
-    public function listObjects($type, $params = null);
-
-    /**
-     * Generate a hash representation for a list of objects.
-     *
-     * The approach taken here is somewhat slow as the server data gets fetched
-     * into objects first which are then converted to hashes again. Since a
-     * server search will usually deliver the result as a hash the intermediate
-     * object conversion is inefficient.
-     *
-     * But as the object classes are able to treat the attributes returned from
-     * the server with custom parsing, this is currently the preferred
-     * method. Especially for large result sets it would be better if this
-     * method would call a static object class function that operate on the
-     * result array returned from the server without using objects.
-     *
-     * @param string $type   The type of the objects to be listed
-     * @param array  $params Additional parameters.
-     *
-     * @return array An array of Kolab objects.
-     *
-     * @throws Horde_Kolab_Server_Exception
-     *
-     * @todo The LDAP driver needs a more efficient version of this call as it
-     *       is not required to generate objects before returning data as a
-     *       hash. It can be derived directly from the LDAP result.
-     */
-    public function listHash($type, $params = null);
-
-}
\ No newline at end of file
index 1c38fbd..6d58d60 100644 (file)
@@ -26,7 +26,8 @@
  * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
  * @link     http://pear.horde.org/index.php?package=Kolab_Server
  */
-class Horde_Kolab_Server_Objects_Base implements Horde_Kolab_Server_Objects
+class Horde_Kolab_Server_Objects_Base
+implements Horde_Kolab_Server_Objects_Interface
 {
     /**
      * A link to the composite server handler.
@@ -43,8 +44,9 @@ class Horde_Kolab_Server_Objects_Base implements Horde_Kolab_Server_Objects
      *
      * @return NULL
      */
-    public function setComposite(Horde_Kolab_Server_Composite $composite)
-    {
+    public function setComposite(
+        Horde_Kolab_Server_Composite_Interface $composite
+    ) {
         $this->_composite = $composite;
     }
 
@@ -85,8 +87,8 @@ class Horde_Kolab_Server_Objects_Base implements Horde_Kolab_Server_Objects
             $type = $this->_composite->structure->determineType($guid);
         }
 
-        $object = &Horde_Kolab_Server_Object_Factory::factory(
-            $type, $guid, $this->_composite->server
+        $object = Horde_Kolab_Server_Object_Factory::factory(
+            $type, $guid, $this->_composite
         );
         return $object;
     }
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Objects/Interface.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Objects/Interface.php
new file mode 100644 (file)
index 0000000..7e1e2a4
--- /dev/null
@@ -0,0 +1,122 @@
+<?php
+/**
+ * A library for accessing the Kolab user database.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+
+/**
+ * Interface for a server object list.
+ *
+ * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+interface Horde_Kolab_Server_Objects_Interface
+{
+    /**
+     * Set the composite server reference for this object.
+     *
+     * @param Horde_Kolab_Server_Composite $composite A link to the composite
+     *                                                server handler.
+     */
+    public function setComposite(
+        Horde_Kolab_Server_Composite_Interface $composite
+    );
+
+    /**
+     * Add a Kolab object.
+     *
+     * @param array $info The object to store.
+     *
+     * @return Kolab_Object The newly created Kolab object.
+     *
+     * @throws Horde_Kolab_Server_Exception If the type of the object to add has
+     *                                      been left undefined or the object
+     *                                      already exists.
+     */
+    public function add(array $info);
+
+    /**
+     * Fetch a Kolab object.
+     *
+     * This method will not retrieve any data from the server
+     * immediately. Instead it will simply generate a new instance for the
+     * desired object.
+     *
+     * The server data will only be accessed once you start reading the object
+     * data.
+     *
+     * This method can also be used in order to fetch non-existing objects that
+     * will be saved later. This is however not recommended and you should
+     * rather use the add($info) method for that.
+     *
+     * If you do not provide the object type the server will try to determine it
+     * automatically based on the uid. As this requires reading data from the
+     * server it is recommended to specify the object type whenever it is known.
+     *
+     * If you do not specify a uid the object corresponding to the user bound to
+     * the server will be returned.
+     *
+     * @param string $uid  The UID of the object to fetch.
+     * @param string $type The type of the object to fetch.
+     *
+     * @return Kolab_Object The corresponding Kolab object.
+     *
+     * @throws Horde_Kolab_Server_Exception
+     */
+    public function fetch($uid = null, $type = null);
+
+    /**
+     * List all objects of a specific type
+     *
+     * @param string $type   The type of the objects to be listed
+     * @param array  $params Additional parameters.
+     *
+     * @return array An array of Kolab objects.
+     *
+     * @throws Horde_Kolab_Server_Exception
+     */
+    public function listObjects($type, $params = null);
+
+    /**
+     * Generate a hash representation for a list of objects.
+     *
+     * The approach taken here is somewhat slow as the server data gets fetched
+     * into objects first which are then converted to hashes again. Since a
+     * server search will usually deliver the result as a hash the intermediate
+     * object conversion is inefficient.
+     *
+     * But as the object classes are able to treat the attributes returned from
+     * the server with custom parsing, this is currently the preferred
+     * method. Especially for large result sets it would be better if this
+     * method would call a static object class function that operate on the
+     * result array returned from the server without using objects.
+     *
+     * @param string $type   The type of the objects to be listed
+     * @param array  $params Additional parameters.
+     *
+     * @return array An array of Kolab objects.
+     *
+     * @throws Horde_Kolab_Server_Exception
+     *
+     * @todo The LDAP driver needs a more efficient version of this call as it
+     *       is not required to generate objects before returning data as a
+     *       hash. It can be derived directly from the LDAP result.
+     */
+    public function listHash($type, $params = null);
+
+}
\ No newline at end of file
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Query.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Query.php
deleted file mode 100644 (file)
index 706e2eb..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-<?php
-/**
- * Interface for server queries.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-
-/**
- * Interface for server queries.
- *
- * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-interface Horde_Kolab_Server_Query
-{
-    /**
-     * Return the query as a string.
-     *
-     * @return string The query in string format.
-     */
-    public function __toString();
-
-    /**
-     * Convert the equals element to query format.
-     *
-     * @param Horde_Kolab_Server_Query_Element_Single $single The element to convert.
-     *
-     * @return mixed The query element in query format.
-     */
-    public function convertEquals(Horde_Kolab_Server_Query_Element_Equals $equals);
-
-    /**
-     * Convert the begins element to query format.
-     *
-     * @param Horde_Kolab_Server_Query_Element_Single $single The element to convert.
-     *
-     * @return mixed The query element in query format.
-     */
-    public function convertBegins(Horde_Kolab_Server_Query_Element_Begins $begins);
-
-    /**
-     * Convert the ends element to query format.
-     *
-     * @param Horde_Kolab_Server_Query_Element_Single $single The element to convert.
-     *
-     * @return mixed The query element in query format.
-     */
-    public function convertEnds(Horde_Kolab_Server_Query_Element_Ends $ends);
-
-    /**
-     * Convert the contains element to query format.
-     *
-     * @param Horde_Kolab_Server_Query_Element_Single $single The element to convert.
-     *
-     * @return mixed The query element in query format.
-     */
-    public function convertContains(Horde_Kolab_Server_Query_Element_Contains $contains);
-
-    /**
-     * Convert the less element to query format.
-     *
-     * @param Horde_Kolab_Server_Query_Element_Single $single The element to convert.
-     *
-     * @return mixed The query element in query format.
-     */
-    public function convertLess(Horde_Kolab_Server_Query_Element_Less $less);
-
-    /**
-     * Convert the greater element to query format.
-     *
-     * @param Horde_Kolab_Server_Query_Element_Single $single The element to convert.
-     *
-     * @return mixed The query element in query format.
-     */
-    public function convertGreater(Horde_Kolab_Server_Query_Element_Greater $greater);
-
-    /**
-     * Convert the approx element to query format.
-     *
-     * @param Horde_Kolab_Server_Query_Element_Single $single The element to convert.
-     *
-     * @return mixed The query element in query format.
-     */
-    public function convertApprox(Horde_Kolab_Server_Query_Element_Approx $approx);
-
-    /**
-     * Convert the not element to query format.
-     *
-     * @param Horde_Kolab_Server_Query_Element_Group $group The element to convert.
-     *
-     * @return mixed The query element in query format.
-     */
-    public function convertNot(Horde_Kolab_Server_Query_Element_Not $not);
-
-    /**
-     * Convert the and element to query format.
-     *
-     * @param Horde_Kolab_Server_Query_Element_Group $group The element to convert.
-     *
-     * @return mixed The query element in query format.
-     */
-    public function convertAnd(Horde_Kolab_Server_Query_Element_And $and);
-
-    /**
-     * Convert the or element to query format.
-     *
-     * @param Horde_Kolab_Server_Query_Element_Group $group The element to convert.
-     *
-     * @return mixed The query element in query format.
-     */
-    public function convertOr(Horde_Kolab_Server_Query_Element_Group $or);
-}
\ No newline at end of file
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Query/Element.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Query/Element.php
deleted file mode 100644 (file)
index 3071c6a..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-<?php
-/**
- * Interface for server query elements.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-
-/**
- * Interface for server query elements.
- *
- * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-interface Horde_Kolab_Server_Query_Element
-{
-    /**
-     * Return the query element name.
-     *
-     * @return string The name of the query element.
-     */
-    public function getName();
-
-    /**
-     * Return the value of this element.
-     *
-     * @return mixed The query value.
-     */
-    public function getValue();
-
-    /**
-     * Return the elements of this group.
-     *
-     * @return mixed The group elements.
-     */
-    public function getElements();
-
-    /**
-     * Convert this element to a query element.
-     *
-     * @return mixedd The element as query.
-     */
-    public function convert(Horde_Kolab_Server_Query $writer);
-
-}
\ No newline at end of file
index abe52ba..a6621ea 100644 (file)
@@ -33,8 +33,9 @@ extends Horde_Kolab_Server_Query_Element_Group
      *
      * @return mixed The element as query.
      */
-    public function convert(Horde_Kolab_Server_Query $writer)
-    {
+    public function convert(
+        Horde_Kolab_Server_Query_Interface $writer
+    ) {
         return $writer->convertAnd($this);
     }
 }
\ No newline at end of file
index 486ce56..de52227 100644 (file)
@@ -33,8 +33,9 @@ extends Horde_Kolab_Server_Query_Element_Single
      *
      * @return mixed The element as query.
      */
-    public function convert(Horde_Kolab_Server_Query $writer)
-    {
+    public function convert(
+        Horde_Kolab_Server_Query_Interface $writer
+    ) {
         return $writer->convertApprox($this);
     }
 }
\ No newline at end of file
index 3686bc3..2d33036 100644 (file)
@@ -33,8 +33,9 @@ extends Horde_Kolab_Server_Query_Element_Single
      *
      * @return mixed The element as query.
      */
-    public function convert(Horde_Kolab_Server_Query $writer)
-    {
+    public function convert(
+        Horde_Kolab_Server_Query_Interface $writer
+    ) {
         return $writer->convertBegins($this);
     }
 }
\ No newline at end of file
index 224d187..480e1b8 100644 (file)
@@ -33,8 +33,9 @@ extends Horde_Kolab_Server_Query_Element_Single
      *
      * @return mixed The element as query.
      */
-    public function convert(Horde_Kolab_Server_Query $writer)
-    {
+    public function convert(
+        Horde_Kolab_Server_Query_Interface $writer
+    ) {
         return $writer->convertContains($this);
     }
 }
\ No newline at end of file
index 742f9ba..035b589 100644 (file)
@@ -33,8 +33,9 @@ extends Horde_Kolab_Server_Query_Element_Single
      *
      * @return mixed The element as query.
      */
-    public function convert(Horde_Kolab_Server_Query $writer)
-    {
+    public function convert(
+        Horde_Kolab_Server_Query_Interface $writer
+    ) {
         return $writer->convertEnds($this);
     }
 }
\ No newline at end of file
index c8164ae..2f24224 100644 (file)
@@ -33,8 +33,9 @@ extends Horde_Kolab_Server_Query_Element_Single
      *
      * @return mixed The element as query.
      */
-    public function convert(Horde_Kolab_Server_Query $writer)
-    {
+    public function convert(
+        Horde_Kolab_Server_Query_Interface $writer
+    ) {
         return $writer->convertEquals($this);
     }
 }
\ No newline at end of file
index a7f843c..9ca0001 100644 (file)
@@ -33,8 +33,9 @@ extends Horde_Kolab_Server_Query_Element_Single
      *
      * @return mixed The element as query.
      */
-    public function convert(Horde_Kolab_Server_Query $writer)
-    {
+    public function convert(
+        Horde_Kolab_Server_Query_Interface $writer
+    ) {
         return $writer->convertGreater($this);
     }
 }
\ No newline at end of file
index d861d1a..9038af0 100644 (file)
@@ -26,7 +26,7 @@
  * @link     http://pear.horde.org/index.php?package=Kolab_Server
  */
 abstract class Horde_Kolab_Server_Query_Element_Group
-implements Horde_Kolab_Server_Query_Element
+implements Horde_Kolab_Server_Query_Element_Interface
 {
     /**
      * The group elements.
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Query/Element/Interface.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Query/Element/Interface.php
new file mode 100644 (file)
index 0000000..0c4a256
--- /dev/null
@@ -0,0 +1,59 @@
+<?php
+/**
+ * Interface for server query elements.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+
+/**
+ * Interface for server query elements.
+ *
+ * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+interface Horde_Kolab_Server_Query_Element_Interface
+{
+    /**
+     * Return the query element name.
+     *
+     * @return string The name of the query element.
+     */
+    public function getName();
+
+    /**
+     * Return the value of this element.
+     *
+     * @return mixed The query value.
+     */
+    public function getValue();
+
+    /**
+     * Return the elements of this group.
+     *
+     * @return mixed The group elements.
+     */
+    public function getElements();
+
+    /**
+     * Convert this element to a query element.
+     *
+     * @return mixedd The element as query.
+     */
+    public function convert(
+        Horde_Kolab_Server_Query_Interface $writer
+    );
+}
\ No newline at end of file
index 00df41f..6c37b05 100644 (file)
@@ -33,8 +33,9 @@ extends Horde_Kolab_Server_Query_Element_Single
      *
      * @return mixed The element as query.
      */
-    public function convert(Horde_Kolab_Server_Query $writer)
-    {
+    public function convert(
+        Horde_Kolab_Server_Query_Interface $writer
+    ) {
         return $writer->convertLess($this);
     }
 }
\ No newline at end of file
index 2cd6123..fb01c87 100644 (file)
@@ -26,7 +26,7 @@
  * @link     http://pear.horde.org/index.php?package=Kolab_Server
  */
 class Horde_Kolab_Server_Query_Element_Mapped
-implements Horde_Kolab_Server_Query_Element
+implements Horde_Kolab_Server_Query_Element_Interface
 {
     /**
      * Delegated element.
@@ -49,8 +49,8 @@ implements Horde_Kolab_Server_Query_Element
      * @param Horde_Kolab_Server_Mapped        $mapper  The mapping handler.
      */
     public function __construct(
-        Horde_Kolab_Server_Query_Element $element,
-        Horde_Kolab_Server_Mapped $mapper
+        Horde_Kolab_Server_Query_Element_Interface $element,
+        Horde_Kolab_Server_Decorator_Map $mapper
     ) {
         $this->_element = $element;
         $this->_mapper  = $mapper;
@@ -97,8 +97,9 @@ implements Horde_Kolab_Server_Query_Element
      *
      * @return string The query string of the element.
      */
-    public function convert(Horde_Kolab_Server_Query $writer)
-    {
+    public function convert(
+        Horde_Kolab_Server_Query_Interface $writer
+    ) {
         return $this->_element->convert($writer);
     }
 }
\ No newline at end of file
index 2f7340d..e5e7492 100644 (file)
@@ -33,7 +33,9 @@ extends Horde_Kolab_Server_Query_Element_Group
      *
      * @param array  $elements The group elements.
      */
-    public function __construct(Horde_Kolab_Server_Query_Element $element) {
+    public function __construct(
+        Horde_Kolab_Server_Query_Element_Interface $element
+    ) {
         parent::__construct(array($element));
     }
 
@@ -42,8 +44,9 @@ extends Horde_Kolab_Server_Query_Element_Group
      *
      * @return mixed The element as query.
      */
-    public function convert(Horde_Kolab_Server_Query $writer)
-    {
+    public function convert(
+        Horde_Kolab_Server_Query_Interface $writer
+    ) {
         return $writer->convertNot($this);
     }
 }
\ No newline at end of file
index 6e89b28..3879755 100644 (file)
@@ -33,8 +33,9 @@ extends Horde_Kolab_Server_Query_Element_Group
      *
      * @return mixed The element as query.
      */
-    public function convert(Horde_Kolab_Server_Query $writer)
-    {
+    public function convert(
+        Horde_Kolab_Server_Query_Interface $writer
+    ) {
         return $writer->convertOr($this);
     }
 }
\ No newline at end of file
index 59b6cc5..ea90675 100644 (file)
@@ -26,7 +26,7 @@
  * @link     http://pear.horde.org/index.php?package=Kolab_Server
  */
 abstract class Horde_Kolab_Server_Query_Element_Single
-implements Horde_Kolab_Server_Query_Element
+implements Horde_Kolab_Server_Query_Element_Interface
 {
     /**
      * The element name.
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Query/Interface.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Query/Interface.php
new file mode 100644 (file)
index 0000000..b1e65e3
--- /dev/null
@@ -0,0 +1,126 @@
+<?php
+/**
+ * Interface for server queries.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+
+/**
+ * Interface for server queries.
+ *
+ * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+interface Horde_Kolab_Server_Query_Interface
+{
+    /**
+     * Return the query as a string.
+     *
+     * @return string The query in string format.
+     */
+    public function __toString();
+
+    /**
+     * Convert the equals element to query format.
+     *
+     * @param Horde_Kolab_Server_Query_Element_Single $single The element to convert.
+     *
+     * @return mixed The query element in query format.
+     */
+    public function convertEquals(Horde_Kolab_Server_Query_Element_Equals $equals);
+
+    /**
+     * Convert the begins element to query format.
+     *
+     * @param Horde_Kolab_Server_Query_Element_Single $single The element to convert.
+     *
+     * @return mixed The query element in query format.
+     */
+    public function convertBegins(Horde_Kolab_Server_Query_Element_Begins $begins);
+
+    /**
+     * Convert the ends element to query format.
+     *
+     * @param Horde_Kolab_Server_Query_Element_Single $single The element to convert.
+     *
+     * @return mixed The query element in query format.
+     */
+    public function convertEnds(Horde_Kolab_Server_Query_Element_Ends $ends);
+
+    /**
+     * Convert the contains element to query format.
+     *
+     * @param Horde_Kolab_Server_Query_Element_Single $single The element to convert.
+     *
+     * @return mixed The query element in query format.
+     */
+    public function convertContains(Horde_Kolab_Server_Query_Element_Contains $contains);
+
+    /**
+     * Convert the less element to query format.
+     *
+     * @param Horde_Kolab_Server_Query_Element_Single $single The element to convert.
+     *
+     * @return mixed The query element in query format.
+     */
+    public function convertLess(Horde_Kolab_Server_Query_Element_Less $less);
+
+    /**
+     * Convert the greater element to query format.
+     *
+     * @param Horde_Kolab_Server_Query_Element_Single $single The element to convert.
+     *
+     * @return mixed The query element in query format.
+     */
+    public function convertGreater(Horde_Kolab_Server_Query_Element_Greater $greater);
+
+    /**
+     * Convert the approx element to query format.
+     *
+     * @param Horde_Kolab_Server_Query_Element_Single $single The element to convert.
+     *
+     * @return mixed The query element in query format.
+     */
+    public function convertApprox(Horde_Kolab_Server_Query_Element_Approx $approx);
+
+    /**
+     * Convert the not element to query format.
+     *
+     * @param Horde_Kolab_Server_Query_Element_Group $group The element to convert.
+     *
+     * @return mixed The query element in query format.
+     */
+    public function convertNot(Horde_Kolab_Server_Query_Element_Not $not);
+
+    /**
+     * Convert the and element to query format.
+     *
+     * @param Horde_Kolab_Server_Query_Element_Group $group The element to convert.
+     *
+     * @return mixed The query element in query format.
+     */
+    public function convertAnd(Horde_Kolab_Server_Query_Element_And $and);
+
+    /**
+     * Convert the or element to query format.
+     *
+     * @param Horde_Kolab_Server_Query_Element_Group $group The element to convert.
+     *
+     * @return mixed The query element in query format.
+     */
+    public function convertOr(Horde_Kolab_Server_Query_Element_Group $or);
+}
\ No newline at end of file
index ae24422..51815c3 100644 (file)
@@ -25,7 +25,8 @@
  * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
  * @link     http://pear.horde.org/index.php?package=Kolab_Server
  */
-class Horde_Kolab_Server_Query_Ldap implements Horde_Kolab_Server_Query
+class Horde_Kolab_Server_Query_Ldap
+implements Horde_Kolab_Server_Query_Interface
 {
     /**
      * The query criteria.
@@ -47,7 +48,7 @@ class Horde_Kolab_Server_Query_Ldap implements Horde_Kolab_Server_Query
      * @param array $criteria The query criteria.
      */
     public function __construct(
-        Horde_Kolab_Server_Query_Element $criteria,
+        Horde_Kolab_Server_Query_Element_Interface $criteria,
         Horde_Kolab_Server_Structure_Interface $structure
     ) {
         $this->_criteria  = $criteria;
@@ -185,7 +186,9 @@ class Horde_Kolab_Server_Query_Ldap implements Horde_Kolab_Server_Query
         $operator
     ) {
         $result = Net_LDAP2_Filter::create(
-            $this->_structure->getInternalAttribute($single->getName()),
+            $this->_structure->mapExternalToInternalAttribute(
+                $single->getName()
+            ),
             $operator,
             $single->getValue()
         );
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Result.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Result.php
deleted file mode 100644 (file)
index bf365fd..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-<?php
-/**
- * Interface for query results.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-
-/**
- * Interface for query results.
- *
- * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-interface Horde_Kolab_Server_Result
-{
-    /**
-     * The number of result entries.
-     *
-     * @return int The number of elements.
-     */
-    public function count();
-
-    /**
-     * Test if the last search exceeded the size limit.
-     *
-     * @return boolean True if the last search exceeded the size limit.
-     */
-    public function sizeLimitExceeded();
-
-    /**
-     * Return the result as an array.
-     *
-     * @return array The resulting array.
-     */
-    public function asArray();
-}
\ No newline at end of file
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Result/Interface.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Result/Interface.php
new file mode 100644 (file)
index 0000000..cfb28b8
--- /dev/null
@@ -0,0 +1,50 @@
+<?php
+/**
+ * Interface for query results.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+
+/**
+ * Interface for query results.
+ *
+ * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+interface Horde_Kolab_Server_Result_Interface
+{
+    /**
+     * The number of result entries.
+     *
+     * @return int The number of elements.
+     */
+    public function count();
+
+    /**
+     * Test if the last search exceeded the size limit.
+     *
+     * @return boolean True if the last search exceeded the size limit.
+     */
+    public function sizeLimitExceeded();
+
+    /**
+     * Return the result as an array.
+     *
+     * @return array The resulting array.
+     */
+    public function asArray();
+}
\ No newline at end of file
index 7494569..ecab135 100644 (file)
@@ -25,7 +25,8 @@
  * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
  * @link     http://pear.horde.org/index.php?package=Kolab_Server
  */
-class Horde_Kolab_Server_Result_Ldap implements Horde_Kolab_Server_Result
+class Horde_Kolab_Server_Result_Ldap
+implements Horde_Kolab_Server_Result_Interface
 {
     /**
      * The search result.
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Schema.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Schema.php
deleted file mode 100644 (file)
index 0d2dda9..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-<?php
-/**
- * A library for accessing the Kolab user database.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-
-/**
- * Interface for the structural handler of a Kolab database.
- *
- * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-interface Horde_Kolab_Server_Schema
-{
-    /**
-     * Set the composite server reference for this object.
-     *
-     * @param Horde_Kolab_Server_Composite $composite A link to the composite
-     *                                                server handler.
-     */
-    public function setComposite(Horde_Kolab_Server_Composite $composite);
-
-    /**
-     * Return the schema for the given objectClass.
-     *
-     * @param string $objectclass Fetch the schema for this objectClass.
-     *
-     * @return array The schema for the given objectClass.
-     *
-     * @throws Horde_Kolab_Server_Exception If retrieval of the schema failed.
-     */
-    public function getObjectclassSchema($objectclass);
-
-    /**
-     * Return the schema for the given attribute.
-     *
-     * @param string $attribute Fetch the schema for this attribute.
-     *
-     * @return array The schema for the given attribute.
-     *
-     * @throws Horde_Kolab_Server_Exception If retrieval of the schema failed.
-     */
-    public function getAttributeSchema($attribute);
-
-    /**
-     * Return the external attributes supported by the given object class.
-     *
-     * @param Horde_Kolab_Server_Object $object Determine the external
-     *                                          attributes for this class.
-     *
-     * @return array The supported attributes.
-     *
-     * @throws Horde_Kolab_Server_Exception If the schema analysis fails.
-     */
-    public function getExternalAttributes($object);
-
-    /**
-     * Return the internal attributes supported by the given object class.
-     *
-     * @param Horde_Kolab_Server_Object $object Determine the internal
-     *                                          attributes for this class.
-     *
-     * @return array The supported attributes.
-     *
-     * @throws Horde_Kolab_Server_Exception If the schema analysis fails.
-     */
-    public function getInternalAttributes($object);
-}
\ No newline at end of file
index 4193e93..5ac063d 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * A library for accessing the Kolab user database.
+ * This class handles the db schema.
  *
  * PHP version 5
  *
@@ -12,8 +12,7 @@
  */
 
 /**
- * This class provides methods to deal with Kolab objects stored in
- * the Kolab object db.
+ * This class handles the db schema.
  *
  * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
  *
  * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
  * @link     http://pear.horde.org/index.php?package=Kolab_Server
  */
-class Horde_Kolab_Server_Schema_Base implements Horde_Kolab_Server_Schema
+class Horde_Kolab_Server_Schema_Base
+implements Horde_Kolab_Server_Schema_Interface
 {
     /** Maximum accepted level for the object class hierarchy */
     const MAX_HIERARCHY = 100;
 
     /**
-     * A cache for object attribute definitions.
-     *
-     * @var array
-     */
-    protected $attributes;
-
-    /**
      * A link to the composite server handler.
      *
      * @var Horde_Kolab_Server_Composite
@@ -53,8 +46,9 @@ class Horde_Kolab_Server_Schema_Base implements Horde_Kolab_Server_Schema
      *
      * @return NULL
      */
-    public function setComposite(Horde_Kolab_Server_Composite $composite)
-    {
+    public function setComposite(
+        Horde_Kolab_Server_Composite_Interface $composite
+    ) {
         $this->composite = $composite;
     }
 
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Schema/Decorator/Cache.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Schema/Decorator/Cache.php
new file mode 100644 (file)
index 0000000..ef2bfc6
--- /dev/null
@@ -0,0 +1,280 @@
+<?php
+/**
+ * This class handles the db schema.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+
+/**
+ * This class handles the db schema.
+ *
+ * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+class Horde_Kolab_Server_Schema_Base
+implements Horde_Kolab_Server_Schema_Interface
+{
+    /** Maximum accepted level for the object class hierarchy */
+    const MAX_HIERARCHY = 100;
+
+    /**
+     * A cache for object attribute definitions.
+     *
+     * @var array
+     */
+    protected $attributes;
+
+    /**
+     * A link to the composite server handler.
+     *
+     * @var Horde_Kolab_Server_Composite
+     */
+    protected $composite;
+
+    /**
+     * Set the composite server reference for this object.
+     *
+     * @param Horde_Kolab_Server_Composite $composite A link to the composite
+     *                                                server handler.
+     *
+     * @return NULL
+     */
+    public function setComposite(Horde_Kolab_Server_Composite $composite)
+    {
+        $this->composite = $composite;
+    }
+
+    /**
+     * Return the schema for the given objectClass.
+     *
+     * @param string $objectclass Fetch the schema for this objectClass.
+     *
+     * @return array The schema for the given objectClass.
+     *
+     * @throws Horde_Kolab_Server_Exception If retrieval of the schema failed.
+     */
+    public function getObjectclassSchema($objectclass)
+    {
+        if (!empty($this->_config['schema_support'])) {
+            $schema = $this->_getSchema();
+            $info = $schema->get('objectclass', $objectclass);
+            $this->_handleError($info, Horde_Kolab_Server_Exception::SYSTEM);
+            return $info;
+        }
+        return parent::getObjectclassSchema($objectclass);
+    }
+
+    /**
+     * Return the schema for the given attribute.
+     *
+     * @param string $attribute Fetch the schema for this attribute.
+     *
+     * @return array The schema for the given attribute.
+     *
+     * @throws Horde_Kolab_Server_Exception If retrieval of the schema failed.
+     */
+    public function getAttributeSchema($attribute)
+    {
+        if (!empty($this->_config['schema_support'])) {
+            $schema = $this->_getSchema();
+            $info = $schema->get('attribute', $attribute);
+            $this->_handleError($info, Horde_Kolab_Server_Exception::SYSTEM);
+            return $info;
+        }
+        return parent::getAttributeSchema($attribute);
+    }
+
+    /**
+     * Return the attributes supported by the given object class.
+     *
+     * @param string $class Determine the attributes for this class.
+     *
+     * @return array The supported attributes.
+     *
+     * @throws Horde_Kolab_Server_Exception If the schema analysis fails.
+     */
+    public function getExternalAttributes($class)
+    {
+        if (!isset($this->attributes)) {
+            if (isset($this->cache)) {
+                register_shutdown_function(array($this, 'shutdown'));
+            }
+        }
+        if (empty($this->attributes[$class])) {
+
+            if (isset($this->cache)) {
+                $this->attributes[$class] = @unserialize($cache->get('attributes_' . $class,
+                                                                     $this->params['cache_lifetime']));
+            }
+
+            if (empty($this->attributes[$class])) {
+
+                $childclass = $class;
+                $classes    = array();
+                $level      = 0;
+                while ($childclass != 'Horde_Kolab_Server_Object'
+                       && $level < self::MAX_HIERARCHY) {
+                    $classes[]  = $childclass;
+                    $childclass = get_parent_class($childclass);
+                    $level++;
+                }
+
+                /** Finally add the basic object class */
+                $classes[] = $childclass;
+
+                if ($level == self::MAX_HIERARCHY) {
+                    if (isset($this->logger)) {
+                        $logger->err(sprintf('The maximal level of the object hierarchy has been exceeded for class \"%s\"!',
+                                             $class));
+                    }
+                }
+
+                /**
+                 * Collect attributes from bottom to top.
+                 */
+                $classes = array_reverse($classes);
+
+                $types = array('defined', 'required', 'derived', 'collapsed',
+                               'defaults', 'locked', 'object_classes');
+                foreach ($types as $type) {
+                    $$type = array();
+                }
+
+                foreach ($classes as $childclass) {
+                    $vars = get_class_vars($childclass);
+                    if (isset($vars['init_attributes'])) {
+                        foreach ($types as $type) {
+                            /**
+                             * If the user wishes to adhere to the schema
+                             * information from the server we will skip the
+                             * attributes defined within the object class here.
+                             */
+                            if (!empty($this->params['schema_override'])
+                                && in_array($type, 'defined', 'required')) {
+                                continue;
+                            }
+                            if (isset($vars['init_attributes'][$type])) {
+                                $$type = array_merge($$type,
+                                                     $vars['init_attributes'][$type]);
+                            }
+                        }
+                    }
+                }
+
+                $attrs = array();
+
+                foreach ($object_classes as $object_class) {
+                    $info = $this->getObjectclassSchema($object_class);
+                    if (isset($info['may'])) {
+                        $defined = array_merge($defined, $info['may']);
+                    }
+                    if (isset($info['must'])) {
+                        $defined  = array_merge($defined, $info['must']);
+                        $required = array_merge($required, $info['must']);
+                    }
+                    foreach ($defined as $attribute) {
+                        try {
+                            $attrs[$attribute] = $this->getAttributeSchema($attribute);
+                        } catch (Horde_Kolab_Server_Exception $e) {
+                            /**
+                             * If the server considers the attribute to be
+                             * invalid we mark it.
+                             */
+                            $attrs[$attribute] = array('invalid' => true);
+                        }
+                    }
+                    foreach ($required as $attribute) {
+                        $attrs[$attribute]['required'] = true;
+                    }
+                    foreach ($locked as $attribute) {
+                        $attrs[$attribute]['locked'] = true;
+                    }
+                    foreach ($defaults as $attribute => $default) {
+                        $attrs[$attribute]['default'] = $default;
+                    }
+                    $attrs[Horde_Kolab_Server_Object::ATTRIBUTE_OC]['default'] = $object_classes;
+                }
+                foreach ($derived as $key => $attributes) {
+                    $supported = true;
+                    if (isset($attributes['base'])) {
+                        foreach ($attributes['base'] as $attribute) {
+                            /**
+                             * Usually derived attribute are determined on basis
+                             * of one or more attributes. If any of these is not
+                             * supported the derived attribute should not be
+                             * included into the set of supported attributes.
+                             */
+                            if (!isset($attrs[$attribute])) {
+                                unset($derived[$attribute]);
+                                $supported = false;
+                                break;
+                            }
+                        }
+                    }
+                    if ($supported) {
+                        $attrs[$key] = $attributes;
+                    }
+                }
+                $check_collapsed = $collapsed;
+                foreach ($check_collapsed as $key => $attributes) {
+                    if (isset($attributes['base'])) {
+                        foreach ($attributes['base'] as $attribute) {
+                            /**
+                             * Usually collapsed attribute are determined on basis
+                             * of one or more attributes. If any of these is not
+                             * supported the collapsed attribute should not be
+                             * included into the set of supported attributes.
+                             */
+                            if (!isset($attrs[$attribute])) {
+                                unset($collapsed[$attribute]);
+                            }
+                        }
+                    }
+                }
+                $this->attributes[$class] = array($attrs,
+                                                  array(
+                                                      'derived'   => array_keys($derived),
+                                                      'collapsed' => $collapsed,
+                                                      'locked'    => $locked,
+                                                      'required'  => $required));
+            }
+        }
+        return $this->attributes[$class];
+    }
+
+    public function getInternalAttributes($class)
+    {
+    }
+
+    /**
+     * Stores the attribute definitions in the cache.
+     *
+     * @return Horde_Kolab_Server The concrete Horde_Kolab_Server reference.
+     */
+    public function shutdown()
+    {
+        if (isset($this->attributes)) {
+            if (isset($this->cache)) {
+                foreach ($this->attributes as $key => $value) {
+                    $this->cache->set('attributes_' . $key, @serialize($value));
+                }
+            }
+        }
+    }
+
+
+}
\ No newline at end of file
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Schema/Interface.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Schema/Interface.php
new file mode 100644 (file)
index 0000000..23b26a7
--- /dev/null
@@ -0,0 +1,85 @@
+<?php
+/**
+ * Interface for the schema handler of a Kolab database.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+
+/**
+ * Interface for the schema handler of a Kolab database.
+ *
+ * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+interface Horde_Kolab_Server_Schema_Interface
+{
+    /**
+     * Set the composite server reference for this object.
+     *
+     * @param Horde_Kolab_Server_Composite $composite A link to the composite
+     *                                                server handler.
+     */
+    public function setComposite(
+        Horde_Kolab_Server_Composite_Interface $composite
+    );
+
+    /**
+     * Return the schema for the given objectClass.
+     *
+     * @param string $objectclass Fetch the schema for this objectClass.
+     *
+     * @return array The schema for the given objectClass.
+     *
+     * @throws Horde_Kolab_Server_Exception If retrieval of the schema failed.
+     */
+    public function getObjectclassSchema($objectclass);
+
+    /**
+     * Return the schema for the given attribute.
+     *
+     * @param string $attribute Fetch the schema for this attribute.
+     *
+     * @return array The schema for the given attribute.
+     *
+     * @throws Horde_Kolab_Server_Exception If retrieval of the schema failed.
+     */
+    public function getAttributeSchema($attribute);
+
+    /**
+     * Return the external attributes supported by the given object class.
+     *
+     * @param Horde_Kolab_Server_Object $object Determine the external
+     *                                          attributes for this class.
+     *
+     * @return array The supported attributes.
+     *
+     * @throws Horde_Kolab_Server_Exception If the schema analysis fails.
+     */
+    public function getExternalAttributes($object);
+
+    /**
+     * Return the internal attributes supported by the given object class.
+     *
+     * @param Horde_Kolab_Server_Object $object Determine the internal
+     *                                          attributes for this class.
+     *
+     * @return array The supported attributes.
+     *
+     * @throws Horde_Kolab_Server_Exception If the schema analysis fails.
+     */
+    public function getInternalAttributes($object);
+}
\ No newline at end of file
index 0f3042a..40b94c9 100644 (file)
@@ -52,8 +52,9 @@ implements Horde_Kolab_Server_Search_Interface
      *
      * @return NULL
      */
-    public function setComposite(Horde_Kolab_Server_Composite $composite)
-    {
+    public function setComposite(
+        Horde_Kolab_Server_Composite_Interface $composite
+    ) {
         $this->_composite = $composite;
         $this->_searches = $this->_getSearchOperations();
     }
index 740b494..281c0ef 100644 (file)
@@ -33,7 +33,9 @@ interface Horde_Kolab_Server_Search_Interface
      * @param Horde_Kolab_Server_Composite $composite A link to the composite
      *                                                server handler.
      */
-    public function setComposite(Horde_Kolab_Server_Composite $composite);
+    public function setComposite(
+        Horde_Kolab_Server_Composite_Interface $composite
+    );
 
     /**
      * Returns the set of search operations supported by this server type.
index 17df4fb..7f4b44f 100644 (file)
@@ -65,8 +65,9 @@ implements Horde_Kolab_Server_Search_Operation_Interface
      *
      * @return boolean|array The GUID(s) or false if there was no result.
      */
-    protected function guidFromResult(Horde_Kolab_Server_Result $result)
-    {
+    protected function guidFromResult(
+        Horde_Kolab_Server_Result_Interface $result
+    ) {
         return array_keys($result->asArray());
     }
 }
\ No newline at end of file
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Search/Operation/Groupsformember.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Search/Operation/Groupsformember.php
new file mode 100644 (file)
index 0000000..ff27eef
--- /dev/null
@@ -0,0 +1,47 @@
+<?php
+/**
+ * Return the groups for the given member element.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+
+/**
+ * Return the groups for the given member element.
+ *
+ * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+class Horde_Kolab_Server_Search_Operation_Groupsformember
+extends Horde_Kolab_Server_Search_Operation_Restrictgroups
+{
+    /**
+     * Return the groups for the given member element.
+     *
+     * @param string $guid  The guid of the member.
+     *
+     * @return array The group GUID(s).
+     *
+     * @throws Horde_Kolab_Server_Exception
+     */
+    public function searchGroupsForMember($guid)
+    {
+        $criteria = new Horde_Kolab_Server_Query_Element_Equals(
+                'member', $guid
+            );
+        return parent::searchRestrictGroups($criteria);
+    }
+}
\ No newline at end of file
index d0049bc..ffc6466 100644 (file)
@@ -35,8 +35,9 @@ extends Horde_Kolab_Server_Search_Operation_Base
      *
      * @return array The search result.
      */
-    public function searchGuid(Horde_Kolab_Server_Query_Element $criteria)
-    {
+    public function searchGuid(
+        Horde_Kolab_Server_Query_Element_Interface $criteria
+    ) {
         $params = array(
             'attributes' => 'Guid'
         );
diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Search/Operation/Restrictgroups.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Search/Operation/Restrictgroups.php
new file mode 100644 (file)
index 0000000..942727a
--- /dev/null
@@ -0,0 +1,54 @@
+<?php
+/**
+ * Restrict a search to groupOfNames.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+
+/**
+ * Restrict a search to groupOfNames.
+ *
+ * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+class Horde_Kolab_Server_Search_Operation_Restrictgroups
+extends Horde_Kolab_Server_Search_Operation_Guid
+{
+    /**
+     * Restrict a search to groupOfNames.
+     *
+     * @param Horde_Kolab_Server_Query_Element $criteria The search criteria.
+     *
+     * @return array The GUID(s).
+     *
+     * @throws Horde_Kolab_Server_Exception
+     */
+    public function searchRestrictGroups(
+        Horde_Kolab_Server_Query_Element $criteria
+    ) {
+        $criteria = new Horde_Kolab_Server_Query_Element_And(
+            array(
+                new Horde_Kolab_Server_Query_Element_Equals(
+                    'Objectclass',
+                    Horde_Kolab_Server_Object_Groupofnames::OBJECTCLASS_GROUPOFNAMES
+                ),
+                $criteria
+            )
+        );
+        return parent::searchGuid($criteria);
+    }
+}
\ No newline at end of file
index a851db8..565b4a6 100644 (file)
@@ -46,7 +46,7 @@ implements Horde_Kolab_Server_Structure_Interface
      * @throws Horde_Kolab_Server_Exception
      */
     public function find(
-        Horde_Kolab_Server_Query_Element $criteria,
+        Horde_Kolab_Server_Query_Element_Interface $criteria,
         array $params = array()
     ) {
         $query = new Horde_Kolab_Server_Query_Ldap($criteria, $this);
@@ -67,7 +67,7 @@ implements Horde_Kolab_Server_Structure_Interface
      * @throws Horde_Kolab_Server_Exception
      */
     public function findBelow(
-        Horde_Kolab_Server_Query_Element $criteria,
+        Horde_Kolab_Server_Query_Element_Interface $criteria,
         $parent,
         array $params = array()
     ) {
@@ -85,8 +85,9 @@ implements Horde_Kolab_Server_Structure_Interface
      *
      * @return NULL
      */
-    public function setComposite(Horde_Kolab_Server_Composite $composite)
-    {
+    public function setComposite(
+        Horde_Kolab_Server_Composite_Interface $composite
+    ) {
         $this->_composite = $composite;
     }
 
index 01f2d12..a6a2ebc 100644 (file)
@@ -39,7 +39,7 @@ interface Horde_Kolab_Server_Structure_Interface
      * @throws Horde_Kolab_Server_Exception
      */
     public function find(
-        Horde_Kolab_Server_Query_Element $criteria,
+        Horde_Kolab_Server_Query_Element_Interface $criteria,
         array $params = array()
     );
 
@@ -55,7 +55,7 @@ interface Horde_Kolab_Server_Structure_Interface
      * @throws Horde_Kolab_Server_Exception
      */
     public function findBelow(
-        Horde_Kolab_Server_Query_Element $criteria,
+        Horde_Kolab_Server_Query_Element_Interface $criteria,
         $parent,
         array $params = array()
     );
@@ -68,7 +68,9 @@ interface Horde_Kolab_Server_Structure_Interface
      *
      * @return NULL
      */
-    public function setComposite(Horde_Kolab_Server_Composite $composite);
+    public function setComposite(
+        Horde_Kolab_Server_Composite_Interface $composite
+    );
 
     /**
      * Returns the set of objects supported by this structure.
@@ -91,7 +93,7 @@ interface Horde_Kolab_Server_Structure_Interface
      *
      * @return string The internal attribute name.
      */
-    public function getInternalAttribute($external);
+    public function mapExternalToInternalAttribute($external);
 
     /**
      * Determine the type of an object by its tree position and other
index 819a9b9..e763b35 100644 (file)
@@ -77,6 +77,7 @@ class Horde_Kolab_Server_Structure_Kolab extends Horde_Kolab_Server_Structure_Ld
             'Horde_Kolab_Server_Search_Operation_Guidforuidormailoralias',
             'Horde_Kolab_Server_Search_Operation_Mailforuidormail',
             'Horde_Kolab_Server_Search_Operation_Addressesforuidormail',
+            'Horde_Kolab_Server_Search_Operation_Groupsformember',
         );
         return $searches;
     }
@@ -111,7 +112,7 @@ class Horde_Kolab_Server_Structure_Kolab extends Horde_Kolab_Server_Structure_Ld
             return parent::_determineType($guid, $ocs);
         }
 
-        $groups = $this->getComposite()->search->getGroups($guid);
+        $groups = $this->getComposite()->search->searchGroupsForMember($guid);
         if (!empty($groups)) {
             $base = $this->getComposite()->server->getBaseGuid();
             if (in_array('cn=admin,cn=internal,' . $base, $groups)) {
index 64f0f02..bf047c2 100644 (file)
@@ -154,7 +154,7 @@ class Horde_Kolab_Server_Structure_Ldap extends Horde_Kolab_Server_Structure_Bas
      *
      * @return string The internal attribute name.
      */
-    public function getInternalAttribute($external)
+    public function mapExternalToInternalAttribute($external)
     {
         switch ($external) {
         case 'Objectclass':
index 898267f..89d8a10 100644 (file)
@@ -59,13 +59,14 @@ http://pear.php.net/dtd/package-2.0.xsd">
    <dir name="lib">
     <dir name="Horde">
      <dir name="Kolab">
-      <file name="Server.php" role="php" />
       <dir name="Server">
-       <file name="Cleaner.php" role="php" />
-       <file name="Composite.php" role="php" />
-       <file name="Connection.php" role="php" />
+       <dir name="Composite">
+        <file name="Base.php" role="php" />
+        <file name="Interface.php" role="php" />
+       </dir> <!-- /lib/Horde/Kolab/Server/Composite -->
        <dir name="Connection">
         <file name="File.php" role="php" />
+        <file name="Interface.php" role="php" />
         <file name="Mock.php" role="php" />
         <dir name="Mock">
          <file name="Ldap.php" role="php" />
@@ -74,41 +75,47 @@ http://pear.php.net/dtd/package-2.0.xsd">
         <file name="Simpleldap.php" role="php" />
         <file name="Splittedldap.php" role="php" />
        </dir> <!-- /lib/Horde/Kolab/Server/Connection -->
+       <dir name="Decorator">
+        <file name="Clean.php" role="php" />
+        <file name="Count.php" role="php" />
+        <file name="Log.php" role="php" />
+        <file name="Map.php" role="php" />
+       </dir> <!-- /lib/Horde/Kolab/Server/Decorator -->
        <file name="Exception.php" role="php" />
        <dir name="Exception">
         <file name="Novalue.php" role="php" />
        </dir> <!-- /lib/Horde/Kolab/Server/Exception -->
-       <file name="Factory.php" role="php" />
        <dir name="Factory">
         <file name="Base.php" role="php" />
-        <file name="Cleaner.php" role="php" />
         <file name="Configuration.php" role="php" />
-        <file name="Conn.php" role="php" />
-        <dir name="Conn">
+        <dir name="Connection">
          <file name="Base.php" role="php" />
          <file name="Configuration.php" role="php" />
          <file name="Injector.php" role="php" />
+         <file name="Interface.php" role="php" />
          <file name="Ldap.php" role="php" />
          <file name="Mock.php" role="php" />
-        </dir> <!-- /lib/Horde/Kolab/Server/Factory/Conn -->
+        </dir> <!-- /lib/Horde/Kolab/Server/Factory/Connection -->
         <file name="Constructor.php" role="php" />
+        <dir name="Decorator">
+         <file name="Clean.php" role="php" />
+         <file name="Count.php" role="php" />
+         <file name="Log.php" role="php" />
+         <file name="Map.php" role="php" />
+        </dir> <!-- /lib/Horde/Kolab/Server/Factory/Decorator -->
         <file name="Default.php" role="php" />
         <file name="Injector.php" role="php" />
+        <file name="Interface.php" role="php" />
         <file name="Kolab.php" role="php" />
-        <file name="Logged.php" role="php" />
-        <file name="Mapped.php" role="php" />
        </dir> <!-- /lib/Horde/Kolab/Server/Factory -->
+       <file name="Interface.php" role="php" />
        <file name="Ldap.php" role="php" />
        <dir name="Ldap">
         <file name="Changes.php" role="php" />
         <file name="Filtered.php" role="php" />
         <file name="Standard.php" role="php" />
        </dir> <!-- /lib/Horde/Kolab/Server/Ldap -->
-       <file name="Logged.php" role="php" />
-       <file name="Mapped.php" role="php" />
-       <file name="Object.php" role="php" />
        <dir name="Object">
-        <file name="Attribute.php" role="php" />
         <dir name="Attribute">
          <file name="Base.php" role="php" />
          <file name="Createtimestampdate.php" role="php" />
@@ -118,6 +125,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
          <file name="Guid.php" role="php" />
          <file name="Id.php" role="php" />
          <file name="Internal.php" role="php" />
+         <file name="Interface.php" role="php" />
          <file name="Locked.php" role="php" />
          <file name="Modifytimestampdate.php" role="php" />
          <file name="Modifytimestamp.php" role="php" />
@@ -132,6 +140,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
         <file name="Factory.php" role="php" />
         <file name="Groupofnames.php" role="php" />
         <file name="Inetorgperson.php" role="php" />
+        <file name="Interface.php" role="php" />
         <file name="Kolab.php" role="php" />
         <file name="Kolabgermanbankarrangement.php" role="php" />
         <file name="Kolabgroupofnames.php" role="php" />
@@ -152,13 +161,11 @@ http://pear.php.net/dtd/package-2.0.xsd">
          <file name="User.php" role="php" />
         </dir> <!-- /lib/Horde/Kolab/Server/Object/Kolab -->
        </dir> <!-- /lib/Horde/Kolab/Server/Object -->
-       <file name="Objects.php" role="php" />
        <dir name="Objects">
         <file name="Base.php" role="php" />
+        <file name="Interface.php" role="php" />
        </dir> <!-- /lib/Horde/Kolab/Server/Objects -->
-       <file name="Query.php" role="php" />
        <dir name="Query">
-        <file name="Element.php" role="php" />
         <dir name="Element">
          <file name="And.php" role="php" />
          <file name="Approx.php" role="php" />
@@ -168,21 +175,23 @@ http://pear.php.net/dtd/package-2.0.xsd">
          <file name="Equals.php" role="php" />
          <file name="Greater.php" role="php" />
          <file name="Group.php" role="php" />
+         <file name="Interface.php" role="php" />
          <file name="Less.php" role="php" />
          <file name="Mapped.php" role="php" />
          <file name="Not.php" role="php" />
          <file name="Or.php" role="php" />
          <file name="Single.php" role="php" />
         </dir> <!-- /lib/Horde/Kolab/Server/Element -->
+        <file name="Interface.php" role="php" />
         <file name="Ldap.php" role="php" />
        </dir> <!-- /lib/Horde/Kolab/Server/Query -->
-       <file name="Result.php" role="php" />
        <dir name="Result">
         <file name="Ldap.php" role="php" />
+        <file name="Interface.php" role="php" />
        </dir> <!-- /lib/Horde/Kolab/Server/Result -->
-       <file name="Schema.php" role="php" />
        <dir name="Schema">
         <file name="Base.php" role="php" />
+        <file name="Interface.php" role="php" />
        </dir> <!-- /lib/Horde/Kolab/Server/Schema -->
        <dir name="Search">
         <file name="Base.php" role="php" />
@@ -196,6 +205,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
           <file name="Single.php" role="php" />
           <file name="Strict.php" role="php" />
          </dir> <!-- /lib/Horde/Kolab/Server/Search/Operation/Constraint -->
+         <file name="Groupsformember.php" role="php" />
          <file name="Guid.php" role="php" />
          <file name="Guidforalias.php" role="php" />
          <file name="Guidforcn.php" role="php" />
@@ -207,6 +217,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
          <file name="Guidforuid.php" role="php" />
          <file name="Interface.php" role="php" />
          <file name="Mailforuidormail.php" role="php" />
+         <file name="Restrictgroups.php" role="php" />
          <file name="Restrictkolab.php" role="php" />
         </dir> <!-- /lib/Horde/Kolab/Server/Search/Operation -->
        </dir> <!-- /lib/Horde/Kolab/Server/Search -->
@@ -236,12 +247,12 @@ http://pear.php.net/dtd/package-2.0.xsd">
          <dir name="Factory">
           <file name="CleanerTest.php" role="test" />
           <file name="ConfigurationTest.php" role="test" />
-          <dir name="Conn">
+          <dir name="Connection">
            <file name="ConfigurationTest.php" role="test" />
            <file name="InjectorTest.php" role="test" />
            <file name="LdapTest.php" role="test" />
            <file name="MockTest.php" role="test" />
-          </dir> <!-- /test/Horde/Kolab/Server/Class/Server/Factory/Conn -->
+          </dir> <!-- /test/Horde/Kolab/Server/Class/Server/Factory/Connection -->
           <file name="ConstructorTest.php" role="test" />
           <file name="InjectorTest.php" role="test" />
           <file name="KolabTest.php" role="test" />
@@ -332,42 +343,43 @@ http://pear.php.net/dtd/package-2.0.xsd">
  </dependencies>
  <phprelease>
   <filelist>
-   <install name="lib/Horde/Kolab/Server.php" as="Horde/Kolab/Server.php" />
-   <install name="lib/Horde/Kolab/Server/Cleaner.php" as="Horde/Kolab/Server/Cleaner.php" />
-   <install name="lib/Horde/Kolab/Server/Composite.php" as="Horde/Kolab/Server/Composite.php" />
-   <install name="lib/Horde/Kolab/Server/Connection.php" as="Horde/Kolab/Server/Connection.php" />
+   <install name="lib/Horde/Kolab/Server/Composite/Base.php" as="Horde/Kolab/Server/Composite/Base.php" />
+   <install name="lib/Horde/Kolab/Server/Composite/Interface.php" as="Horde/Kolab/Server/Composite/Interface.php" />
    <install name="lib/Horde/Kolab/Server/Connection/File.php" as="Horde/Kolab/Server/Connection/File.php" />
+   <install name="lib/Horde/Kolab/Server/Connection/Interface.php" as="Horde/Kolab/Server/Connection/Interface.php" />
    <install name="lib/Horde/Kolab/Server/Connection/Mock.php" as="Horde/Kolab/Server/Connection/Mock.php" />
    <install name="lib/Horde/Kolab/Server/Connection/Mock/Ldap.php" as="Horde/Kolab/Server/Connection/Mock/Ldap.php" />
    <install name="lib/Horde/Kolab/Server/Connection/Mock/Search.php" as="Horde/Kolab/Server/Connection/Mock/Search.php" />
    <install name="lib/Horde/Kolab/Server/Connection/Simpleldap.php" as="Horde/Kolab/Server/Connection/Simpleldap.php" />
    <install name="lib/Horde/Kolab/Server/Connection/Splittedldap.php" as="Horde/Kolab/Server/Connection/Splittedldap.php" />
+   <install name="lib/Horde/Kolab/Server/Decorator/Clean.php" as="Horde/Kolab/Server/Decorator/Clean.php" />
+   <install name="lib/Horde/Kolab/Server/Decorator/Count.php" as="Horde/Kolab/Server/Decorator/Count.php" />
+   <install name="lib/Horde/Kolab/Server/Decorator/Log.php" as="Horde/Kolab/Server/Decorator/Log.php" />
+   <install name="lib/Horde/Kolab/Server/Decorator/Map.php" as="Horde/Kolab/Server/Decorator/Map.php" />
    <install name="lib/Horde/Kolab/Server/Exception.php" as="Horde/Kolab/Server/Exception.php" />
    <install name="lib/Horde/Kolab/Server/Exception/Novalue.php" as="Horde/Kolab/Server/Exception/Novalue.php" />
-   <install name="lib/Horde/Kolab/Server/Factory.php" as="Horde/Kolab/Server/Factory.php" />
    <install name="lib/Horde/Kolab/Server/Factory/Base.php" as="Horde/Kolab/Server/Factory/Base.php" />
-   <install name="lib/Horde/Kolab/Server/Factory/Cleaner.php" as="Horde/Kolab/Server/Factory/Cleaner.php" />
    <install name="lib/Horde/Kolab/Server/Factory/Configuration.php" as="Horde/Kolab/Server/Factory/Configuration.php" />
-   <install name="lib/Horde/Kolab/Server/Factory/Conn.php" as="Horde/Kolab/Server/Factory/Conn.php" />
-   <install name="lib/Horde/Kolab/Server/Factory/Conn/Base.php" as="Horde/Kolab/Server/Factory/Conn/Base.php" />
-   <install name="lib/Horde/Kolab/Server/Factory/Conn/Configuration.php" as="Horde/Kolab/Server/Factory/Conn/Configuration.php" />
-   <install name="lib/Horde/Kolab/Server/Factory/Conn/Injector.php" as="Horde/Kolab/Server/Factory/Conn/Injector.php" />
-   <install name="lib/Horde/Kolab/Server/Factory/Conn/Ldap.php" as="Horde/Kolab/Server/Factory/Conn/Ldap.php" />
-   <install name="lib/Horde/Kolab/Server/Factory/Conn/Mock.php" as="Horde/Kolab/Server/Factory/Conn/Mock.php" />
+   <install name="lib/Horde/Kolab/Server/Factory/Connection/Base.php" as="Horde/Kolab/Server/Factory/Connection/Base.php" />
+   <install name="lib/Horde/Kolab/Server/Factory/Connection/Configuration.php" as="Horde/Kolab/Server/Factory/Connection/Configuration.php" />
+   <install name="lib/Horde/Kolab/Server/Factory/Connection/Injector.php" as="Horde/Kolab/Server/Factory/Connection/Injector.php" />
+   <install name="lib/Horde/Kolab/Server/Factory/Connection/Interface.php" as="Horde/Kolab/Server/Factory/Connection/Interface.php" />
+   <install name="lib/Horde/Kolab/Server/Factory/Connection/Ldap.php" as="Horde/Kolab/Server/Factory/Connection/Ldap.php" />
+   <install name="lib/Horde/Kolab/Server/Factory/Connection/Mock.php" as="Horde/Kolab/Server/Factory/Connection/Mock.php" />
    <install name="lib/Horde/Kolab/Server/Factory/Constructor.php" as="Horde/Kolab/Server/Factory/Constructor.php" />
+   <install name="lib/Horde/Kolab/Server/Factory/Decorator/Clean.php" as="Horde/Kolab/Server/Factory/Decorator/Clean.php" />
+   <install name="lib/Horde/Kolab/Server/Factory/Decorator/Count.php" as="Horde/Kolab/Server/Factory/Decorator/Count.php" />
+   <install name="lib/Horde/Kolab/Server/Factory/Decorator/Log.php" as="Horde/Kolab/Server/Factory/Decorator/Log.php" />
+   <install name="lib/Horde/Kolab/Server/Factory/Decorator/Map.php" as="Horde/Kolab/Server/Factory/Decorator/Map.php" />
    <install name="lib/Horde/Kolab/Server/Factory/Default.php" as="Horde/Kolab/Server/Factory/Default.php" />
    <install name="lib/Horde/Kolab/Server/Factory/Injector.php" as="Horde/Kolab/Server/Factory/Injector.php" />
+   <install name="lib/Horde/Kolab/Server/Factory/Interface.php" as="Horde/Kolab/Server/Factory/Interface.php" />
    <install name="lib/Horde/Kolab/Server/Factory/Kolab.php" as="Horde/Kolab/Server/Factory/Kolab.php" />
-   <install name="lib/Horde/Kolab/Server/Factory/Logged.php" as="Horde/Kolab/Server/Factory/Logged.php" />
-   <install name="lib/Horde/Kolab/Server/Factory/Mapped.php" as="Horde/Kolab/Server/Factory/Mapped.php" />
+   <install name="lib/Horde/Kolab/Server/Interface.php" as="Horde/Kolab/Server/Interface.php" />
    <install name="lib/Horde/Kolab/Server/Ldap.php" as="Horde/Kolab/Server/Ldap.php" />
    <install name="lib/Horde/Kolab/Server/Ldap/Changes.php" as="Horde/Kolab/Server/Ldap/Changes.php" />
    <install name="lib/Horde/Kolab/Server/Ldap/Filtered.php" as="Horde/Kolab/Server/Ldap/Filtered.php" />
    <install name="lib/Horde/Kolab/Server/Ldap/Standard.php" as="Horde/Kolab/Server/Ldap/Standard.php" />
-   <install name="lib/Horde/Kolab/Server/Logged.php" as="Horde/Kolab/Server/Logged.php" />
-   <install name="lib/Horde/Kolab/Server/Mapped.php" as="Horde/Kolab/Server/Mapped.php" />
-   <install name="lib/Horde/Kolab/Server/Object.php" as="Horde/Kolab/Server/Object.php" />
-   <install name="lib/Horde/Kolab/Server/Object/Attribute.php" as="Horde/Kolab/Server/Object/Attribute.php" />
    <install name="lib/Horde/Kolab/Server/Object/Attribute/Base.php" as="Horde/Kolab/Server/Object/Attribute/Base.php" />
    <install name="lib/Horde/Kolab/Server/Object/Attribute/Createtimestampdate.php" as="Horde/Kolab/Server/Object/Attribute/Createtimestampdate.php" />
    <install name="lib/Horde/Kolab/Server/Object/Attribute/Createtimestamp.php" as="Horde/Kolab/Server/Object/Attribute/Createtimestamp.php" />
@@ -375,6 +387,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
    <install name="lib/Horde/Kolab/Server/Object/Attribute/External.php" as="Horde/Kolab/Server/Object/Attribute/External.php" />
    <install name="lib/Horde/Kolab/Server/Object/Attribute/Guid.php" as="Horde/Kolab/Server/Object/Attribute/Guid.php" />
    <install name="lib/Horde/Kolab/Server/Object/Attribute/Id.php" as="Horde/Kolab/Server/Object/Attribute/Id.php" />
+   <install name="lib/Horde/Kolab/Server/Object/Attribute/Interface.php" as="Horde/Kolab/Server/Object/Attribute/Interface.php" />
    <install name="lib/Horde/Kolab/Server/Object/Attribute/Internal.php" as="Horde/Kolab/Server/Object/Attribute/Internal.php" />
    <install name="lib/Horde/Kolab/Server/Object/Attribute/Locked.php" as="Horde/Kolab/Server/Object/Attribute/Locked.php" />
    <install name="lib/Horde/Kolab/Server/Object/Attribute/Modifytimestampdate.php" as="Horde/Kolab/Server/Object/Attribute/Modifytimestampdate.php" />
@@ -389,6 +402,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
    <install name="lib/Horde/Kolab/Server/Object/Factory.php" as="Horde/Kolab/Server/Object/Factory.php" />
    <install name="lib/Horde/Kolab/Server/Object/Groupofnames.php" as="Horde/Kolab/Server/Object/Groupofnames.php" />
    <install name="lib/Horde/Kolab/Server/Object/Inetorgperson.php" as="Horde/Kolab/Server/Object/Inetorgperson.php" />
+   <install name="lib/Horde/Kolab/Server/Object/Interface.php" as="Horde/Kolab/Server/Object/Interface.php" />
    <install name="lib/Horde/Kolab/Server/Object/Kolab.php" as="Horde/Kolab/Server/Object/Kolab.php" />
    <install name="lib/Horde/Kolab/Server/Object/Kolabgermanbankarrangement.php" as="Horde/Kolab/Server/Object/Kolabgermanbankarrangement.php" />
    <install name="lib/Horde/Kolab/Server/Object/Kolabgroupofnames.php" as="Horde/Kolab/Server/Object/Kolabgroupofnames.php" />
@@ -406,10 +420,8 @@ http://pear.php.net/dtd/package-2.0.xsd">
    <install name="lib/Horde/Kolab/Server/Object/Person.php" as="Horde/Kolab/Server/Object/Person.php" />
    <install name="lib/Horde/Kolab/Server/Object/Searches.php" as="Horde/Kolab/Server/Object/Searches.php" />
    <install name="lib/Horde/Kolab/Server/Object/Top.php" as="Horde/Kolab/Server/Object/Top.php" />
-   <install name="lib/Horde/Kolab/Server/Objects.php" as="Horde/Kolab/Server/Objects.php" />
    <install name="lib/Horde/Kolab/Server/Objects/Base.php" as="Horde/Kolab/Server/Objects/Base.php" />
-   <install name="lib/Horde/Kolab/Server/Query.php" as="Horde/Kolab/Server/Query.php" />
-   <install name="lib/Horde/Kolab/Server/Query/Element.php" as="Horde/Kolab/Server/Query/Element.php" />
+   <install name="lib/Horde/Kolab/Server/Objects/Interface.php" as="Horde/Kolab/Server/Objects/Interface.php" />
    <install name="lib/Horde/Kolab/Server/Query/Element/And.php" as="Horde/Kolab/Server/Query/Element/And.php" />
    <install name="lib/Horde/Kolab/Server/Query/Element/Approx.php" as="Horde/Kolab/Server/Query/Element/Approx.php" />
    <install name="lib/Horde/Kolab/Server/Query/Element/Begins.php" as="Horde/Kolab/Server/Query/Element/Begins.php" />
@@ -418,16 +430,18 @@ http://pear.php.net/dtd/package-2.0.xsd">
    <install name="lib/Horde/Kolab/Server/Query/Element/Equals.php" as="Horde/Kolab/Server/Query/Element/Equals.php" />
    <install name="lib/Horde/Kolab/Server/Query/Element/Greater.php" as="Horde/Kolab/Server/Query/Element/Greater.php" />
    <install name="lib/Horde/Kolab/Server/Query/Element/Group.php" as="Horde/Kolab/Server/Query/Element/Group.php" />
+   <install name="lib/Horde/Kolab/Server/Query/Element/Interface.php" as="Horde/Kolab/Server/Query/Element/Interface.php" />
    <install name="lib/Horde/Kolab/Server/Query/Element/Less.php" as="Horde/Kolab/Server/Query/Element/Less.php" />
    <install name="lib/Horde/Kolab/Server/Query/Element/Mapped.php" as="Horde/Kolab/Server/Query/Element/Mapped.php" />
    <install name="lib/Horde/Kolab/Server/Query/Element/Not.php" as="Horde/Kolab/Server/Query/Element/Not.php" />
    <install name="lib/Horde/Kolab/Server/Query/Element/Or.php" as="Horde/Kolab/Server/Query/Element/Or.php" />
    <install name="lib/Horde/Kolab/Server/Query/Element/Single.php" as="Horde/Kolab/Server/Query/Element/Single.php" />
    <install name="lib/Horde/Kolab/Server/Query/Ldap.php" as="Horde/Kolab/Server/Query/Ldap.php" />
-   <install name="lib/Horde/Kolab/Server/Result.php" as="Horde/Kolab/Server/Result.php" />
+   <install name="lib/Horde/Kolab/Server/Query/Interface.php" as="Horde/Kolab/Server/Query/Interface.php" />
    <install name="lib/Horde/Kolab/Server/Result/Ldap.php" as="Horde/Kolab/Server/Result/Ldap.php" />
-   <install name="lib/Horde/Kolab/Server/Schema.php" as="Horde/Kolab/Server/Schema.php" />
+   <install name="lib/Horde/Kolab/Server/Result/Interface.php" as="Horde/Kolab/Server/Result/Interface.php" />
    <install name="lib/Horde/Kolab/Server/Schema/Base.php" as="Horde/Kolab/Server/Schema/Base.php" />
+   <install name="lib/Horde/Kolab/Server/Schema/Interface.php" as="Horde/Kolab/Server/Schema/Interface.php" />
    <install name="lib/Horde/Kolab/Server/Search/Base.php" as="Horde/Kolab/Server/Search/Base.php" />
    <install name="lib/Horde/Kolab/Server/Search/Interface.php" as="Horde/Kolab/Server/Search/Interface.php" />
    <install name="lib/Horde/Kolab/Server/Search/Operation/Addressesforuidormail.php" as="Horde/Kolab/Server/Search/Operation/Addressesforuidormail.php" />
@@ -436,6 +450,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
    <install name="lib/Horde/Kolab/Server/Search/Operation/Children.php" as="Horde/Kolab/Server/Search/Operation/Children.php" />
    <install name="lib/Horde/Kolab/Server/Search/Operation/Constraint/Single.php" as="Horde/Kolab/Server/Search/Operation/Constraint/Single.php" />
    <install name="lib/Horde/Kolab/Server/Search/Operation/Constraint/Strict.php" as="Horde/Kolab/Server/Search/Operation/Constraint/Strict.php" />
+   <install name="lib/Horde/Kolab/Server/Search/Operation/Groupsformember.php" as="Horde/Kolab/Server/Search/Operation/Groupsformember.php" />
    <install name="lib/Horde/Kolab/Server/Search/Operation/Guid.php" as="Horde/Kolab/Server/Search/Operation/Guid.php" />
    <install name="lib/Horde/Kolab/Server/Search/Operation/Guidforalias.php" as="Horde/Kolab/Server/Search/Operation/Guidforalias.php" />
    <install name="lib/Horde/Kolab/Server/Search/Operation/Guidforcn.php" as="Horde/Kolab/Server/Search/Operation/Guidforcn.php" />
@@ -447,6 +462,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
    <install name="lib/Horde/Kolab/Server/Search/Operation/Guidforuid.php" as="Horde/Kolab/Server/Search/Operation/Guidforuid.php" />
    <install name="lib/Horde/Kolab/Server/Search/Operation/Interface.php" as="Horde/Kolab/Server/Search/Operation/Interface.php" />
    <install name="lib/Horde/Kolab/Server/Search/Operation/Mailforuidormail.php" as="Horde/Kolab/Server/Search/Operation/Mailforuidormail.php" />
+   <install name="lib/Horde/Kolab/Server/Search/Operation/Restrictgroups.php" as="Horde/Kolab/Server/Search/Operation/Restrictgroups.php" />
    <install name="lib/Horde/Kolab/Server/Search/Operation/Restrictkolab.php" as="Horde/Kolab/Server/Search/Operation/Restrictkolab.php" />
    <install name="lib/Horde/Kolab/Server/Structure/Base.php" as="Horde/Kolab/Server/Structure/Base.php" />
    <install name="lib/Horde/Kolab/Server/Structure/Interface.php" as="Horde/Kolab/Server/Structure/Interface.php" />
@@ -461,10 +477,10 @@ http://pear.php.net/dtd/package-2.0.xsd">
    <install name="test/Horde/Kolab/Server/Class/Server/Connection/SplittedldapTest.php" as="Horde/Kolab/Server/Class/Server/Connection/SplittedldapTest.php" />
    <install name="test/Horde/Kolab/Server/Class/Server/Factory/CleanerTest.php" as="Horde/Kolab/Server/Class/Server/Factory/CleanerTest.php" />
    <install name="test/Horde/Kolab/Server/Class/Server/Factory/ConfigurationTest.php" as="Horde/Kolab/Server/Class/Server/Factory/ConfigurationTest.php" />
-   <install name="test/Horde/Kolab/Server/Class/Server/Factory/Conn/ConfigurationTest.php" as="Horde/Kolab/Server/Class/Server/Factory/Conn/ConfigurationTest.php" />
-   <install name="test/Horde/Kolab/Server/Class/Server/Factory/Conn/InjectorTest.php" as="Horde/Kolab/Server/Class/Server/Factory/Conn/InjectorTest.php" />
-   <install name="test/Horde/Kolab/Server/Class/Server/Factory/Conn/LdapTest.php" as="Horde/Kolab/Server/Class/Server/Factory/Conn/LdapTest.php" />
-   <install name="test/Horde/Kolab/Server/Class/Server/Factory/Conn/MockTest.php" as="Horde/Kolab/Server/Class/Server/Factory/Conn/MockTest.php" />
+   <install name="test/Horde/Kolab/Server/Class/Server/Factory/Connection/ConfigurationTest.php" as="Horde/Kolab/Server/Class/Server/Factory/Connection/ConfigurationTest.php" />
+   <install name="test/Horde/Kolab/Server/Class/Server/Factory/Connection/InjectorTest.php" as="Horde/Kolab/Server/Class/Server/Factory/Connection/InjectorTest.php" />
+   <install name="test/Horde/Kolab/Server/Class/Server/Factory/Connection/LdapTest.php" as="Horde/Kolab/Server/Class/Server/Factory/Connection/LdapTest.php" />
+   <install name="test/Horde/Kolab/Server/Class/Server/Factory/Connection/MockTest.php" as="Horde/Kolab/Server/Class/Server/Factory/Connection/MockTest.php" />
    <install name="test/Horde/Kolab/Server/Class/Server/Factory/ConstructorTest.php" as="Horde/Kolab/Server/Class/Server/Factory/ConstructorTest.php" />
    <install name="test/Horde/Kolab/Server/Class/Server/Factory/InjectorTest.php" as="Horde/Kolab/Server/Class/Server/Factory/InjectorTest.php" />
    <install name="test/Horde/Kolab/Server/Class/Server/Factory/KolabTest.php" as="Horde/Kolab/Server/Class/Server/Factory/KolabTest.php" />
diff --git a/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/CleanerTest.php b/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/CleanerTest.php
deleted file mode 100644 (file)
index cf72621..0000000
+++ /dev/null
@@ -1,210 +0,0 @@
-<?php
-/**
- * Test the cleanup decorator for the server.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-
-/**
- * Prepare the test setup.
- */
-require_once dirname(__FILE__) . '/../../Autoload.php';
-
-/**
- * Test the cleanup decorator for the server.
- *
- * Copyright 2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-class Horde_Kolab_Server_Class_Server_CleanerTest extends PHPUnit_Framework_TestCase
-{
-    public function setUp()
-    {
-        parent::setUp();
-
-        $this->server = $this->getMock('Horde_Kolab_Server');
-        $this->cleaner = new Horde_Kolab_Server_Cleaner($this->server);
-    }
-
-    public function testMethodGetbaseguidHasPostconditionThatTheCallWasDelegatedToTheServer()
-    {
-        $this->server->expects($this->exactly(1))
-            ->method('getBaseGuid')
-            ->will($this->returnValue('base'));
-        $this->assertEquals('base', $this->cleaner->getBaseGuid());
-    }
-
-    public function testMethodGetuidHasPostconditionThatTheCallWasDelegatedToTheServer()
-    {
-        $this->server->expects($this->exactly(1))
-            ->method('getGuid')
-            ->will($this->returnValue('guid'));
-        $this->assertEquals('guid', $this->cleaner->getGuid());
-    }
-
-    public function testMethodConnectguidHasPostconditionThatTheCallWasDelegatedToTheServer()
-    {
-        $this->server->expects($this->exactly(1))
-            ->method('connectGuid')
-            ->with('user', 'pass');
-        $this->cleaner->connectGuid('user', 'pass');
-    }
-
-    public function testMethodReadHasPostconditionThatTheCallWasDelegatedToTheServer()
-    {
-        $this->server->expects($this->exactly(1))
-            ->method('read')
-            ->with('guid')
-            ->will($this->returnValue(array()));
-        $this->assertEquals(array(), $this->cleaner->read('guid'));
-    }
-
-    public function testMethodReadattributesHasPostconditionThatTheCallWasDelegatedToTheServer()
-    {
-        $this->server->expects($this->exactly(1))
-            ->method('readAttributes')
-            ->with('guid', array('a'))
-            ->will($this->returnValue(array()));
-        $this->assertEquals(
-            array(), $this->cleaner->readAttributes('guid', array('a'))
-        );
-    }
-
-    public function testMethodFindHasPostconditionThatTheCallWasDelegatedToTheServer()
-    {
-        $result = $this->getMock('Horde_Kolab_Server_Result');
-        $query = $this->getMock(
-            'Horde_Kolab_Server_Query_Element', array(), array(), '', false
-        );
-        $this->server->expects($this->exactly(1))
-            ->method('find')
-            ->with($query)
-            ->will($this->returnValue($result));
-        $this->assertType(
-            'Horde_Kolab_Server_Result',
-            $this->cleaner->find($query)
-        );
-    }
-
-    public function testMethodFindbelowHasPostconditionThatTheCallWasDelegatedToTheServer()
-    {
-        $result = $this->getMock('Horde_Kolab_Server_Result');
-        $query = $this->getMock(
-            'Horde_Kolab_Server_Query_Element', array(), array(), '', false
-        );
-        $this->server->expects($this->exactly(1))
-            ->method('findBelow')
-            ->with($query, 'none')
-            ->will($this->returnValue($result));
-        $this->assertType(
-            'Horde_Kolab_Server_Result',
-            $this->cleaner->findBelow($query, 'none')
-        );
-    }
-
-    public function testMethodSaveHasPostconditionThatTheCallWasDelegatedToTheServer()
-    {
-        $object = $this->getMock(
-            'Horde_Kolab_Server_Object', array(), array(), '', false
-        );
-        $this->server->expects($this->exactly(1))
-            ->method('save')
-            ->with($object, array('a' => 'a'));
-        $this->cleaner->save($object, array('a' => 'a'));
-    }
-
-    public function testMethodAddHasPostconditionThatTheCallWasDelegatedToTheServer()
-    {
-        $object = $this->getMock(
-            'Horde_Kolab_Server_Object', array(), array(), '', false
-        );
-        $this->server->expects($this->exactly(1))
-            ->method('add')
-            ->with($object, array('a' => 'a'));
-        $this->cleaner->add($object, array('a' => 'a'));
-    }
-
-    public function testMethodDeleteHasPostconditionThatTheCallWasDelegatedToTheServer()
-    {
-        $this->server->expects($this->exactly(1))
-            ->method('delete')
-            ->with('a');
-        $this->cleaner->delete('a');
-    }
-
-    public function testMethodRenameHasPostconditionThatTheCallWasDelegatedToTheServer()
-    {
-        $this->server->expects($this->exactly(1))
-            ->method('rename')
-            ->with('a', 'b');
-        $this->cleaner->rename('a', 'b');
-    }
-
-    public function testMethodGetschemaHasPostconditionThatTheCallWasDelegatedToTheServer()
-    {
-        $this->server->expects($this->exactly(1))
-            ->method('getSchema');
-        $this->cleaner->getSchema();
-    }
-
-    public function testMethodGetparentguidHasPostconditionThatTheCallWasDelegatedToTheServer()
-    {
-        $this->server->expects($this->exactly(1))
-            ->method('getParentGuid')
-            ->will($this->returnValue('parent'));
-        $this->assertEquals('parent', $this->cleaner->getParentGuid('child'));
-    }
-
-    public function testMethodAddHasPostconditionThatTheGuidOfTheAddedObjectIsRememberedAndDeletedOnDestruction()
-    {
-        $object = $this->getMock(
-            'Horde_Kolab_Server_Object', array(), array(), '', false
-        );
-        $object->expects($this->exactly(1))
-            ->method('getGuid')
-            ->will($this->returnValue('a'));
-        $this->server->expects($this->exactly(1))
-            ->method('add')
-            ->with($object, array('a' => 'a'));
-        $this->server->expects($this->exactly(1))
-            ->method('delete')
-            ->with('a');
-        $this->cleaner->add($object, array('a' => 'a'));
-        unset($this->cleaner);
-    }
-
-    public function testMethodAddHasPostconditionThatTheGuidOfTheAddedObjectIsNotDeletedOnDestructionIfItWasDeletedBefore()
-    {
-        $object = $this->getMock(
-            'Horde_Kolab_Server_Object', array(), array(), '', false
-        );
-        $object->expects($this->exactly(1))
-            ->method('getGuid')
-            ->will($this->returnValue('a'));
-        $this->server->expects($this->exactly(1))
-            ->method('add')
-            ->with($object, array('a' => 'a'));
-        $this->server->expects($this->exactly(1))
-            ->method('delete')
-            ->with('a');
-        $this->cleaner->add($object, array('a' => 'a'));
-        $this->cleaner->delete('a');
-        unset($this->cleaner);
-    }
-
-
-}
\ No newline at end of file
diff --git a/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Composite/BaseTest.php b/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Composite/BaseTest.php
new file mode 100644 (file)
index 0000000..74a6088
--- /dev/null
@@ -0,0 +1,63 @@
+<?php
+/**
+ * Test the composite server.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+
+/**
+ * Prepare the test setup.
+ */
+require_once dirname(__FILE__) . '/../../../TestCase.php';
+
+/**
+ * Test the composite server.
+ *
+ * Copyright 2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+class Horde_Kolab_Server_Class_Server_Composite_BaseTest extends Horde_Kolab_Server_TestCase
+{
+    public function testMethodGetReturnsServerElement()
+    {
+        $composite = $this->getMockedComposite();
+        $this->assertType('Horde_Kolab_Server_Interface', $composite->server);
+        $this->assertType('Horde_Kolab_Server_Objects_Interface', $composite->objects);
+        $this->assertType('Horde_Kolab_Server_Structure_Interface', $composite->structure);
+        $this->assertType('Horde_Kolab_Server_Search_Interface', $composite->search);
+        $this->assertType('Horde_Kolab_Server_Schema_Interface', $composite->schema);
+        try {
+            $a = $composite->something;
+            $this->fail('No exception!');
+        } catch (Horde_Kolab_Server_Exception $e) {
+            $this->assertEquals(
+                'Attribute something not supported!', $e->getMessage()
+            );
+        }
+    }
+
+    public function testMethodConnectHasPostconditionThatTheServerIsBound()
+    {
+        $composite = $this->getMockedComposite();
+        $composite->server->expects($this->exactly(2))
+            ->method('connectGuid');
+        $composite->search->expects($this->exactly(1))
+            ->method('__call')
+            ->with('searchGuidForUidOrMail', array('user'));
+        $composite->connect('user', 'pass');
+    }
+}
\ No newline at end of file
diff --git a/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/CompositeTest.php b/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/CompositeTest.php
deleted file mode 100644 (file)
index dcdabf5..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-<?php
-/**
- * Test the composite server.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-
-/**
- * Prepare the test setup.
- */
-require_once dirname(__FILE__) . '/../../TestCase.php';
-
-/**
- * Test the composite server.
- *
- * Copyright 2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-class Horde_Kolab_Server_Class_Server_CompositeTest extends Horde_Kolab_Server_TestCase
-{
-    public function testMethodGetReturnsServerElement()
-    {
-        $composite = $this->getMockedComposite();
-        $this->assertType('Horde_Kolab_Server', $composite->server);
-        $this->assertType('Horde_Kolab_Server_Objects', $composite->objects);
-        $this->assertType('Horde_Kolab_Server_Structure_Interface', $composite->structure);
-        $this->assertType('Horde_Kolab_Server_Search_Interface', $composite->search);
-        $this->assertType('Horde_Kolab_Server_Schema', $composite->schema);
-        try {
-            $a = $composite->something;
-            $this->fail('No exception!');
-        } catch (Horde_Kolab_Server_Exception $e) {
-            $this->assertEquals(
-                'Attribute something not supported!', $e->getMessage()
-            );
-        }
-    }
-
-    public function testMethodConnectHasPostconditionThatTheServerIsBound()
-    {
-        $composite = $this->getMockedComposite();
-        $composite->server->expects($this->exactly(2))
-            ->method('connectGuid');
-        $composite->search->expects($this->exactly(1))
-            ->method('__call')
-            ->with('searchGuidForUidOrMail', array('user'));
-        $composite->connect('user', 'pass');
-    }
-}
\ No newline at end of file
diff --git a/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Decorator/CleanTest.php b/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Decorator/CleanTest.php
new file mode 100644 (file)
index 0000000..0b61e09
--- /dev/null
@@ -0,0 +1,202 @@
+<?php
+/**
+ * Test the cleanup decorator for the server.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+
+/**
+ * Prepare the test setup.
+ */
+require_once dirname(__FILE__) . '/../../../Autoload.php';
+
+/**
+ * Test the cleanup decorator for the server.
+ *
+ * Copyright 2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+class Horde_Kolab_Server_Class_Server_Decorator_CleanTest extends PHPUnit_Framework_TestCase
+{
+    public function setUp()
+    {
+        parent::setUp();
+
+        $this->server = $this->getMock('Horde_Kolab_Server_Interface');
+        $this->cleaner = new Horde_Kolab_Server_Decorator_Clean($this->server);
+    }
+
+    public function testMethodGetbaseguidHasPostconditionThatTheCallWasDelegatedToTheServer()
+    {
+        $this->server->expects($this->exactly(1))
+            ->method('getBaseGuid')
+            ->will($this->returnValue('base'));
+        $this->assertEquals('base', $this->cleaner->getBaseGuid());
+    }
+
+    public function testMethodGetuidHasPostconditionThatTheCallWasDelegatedToTheServer()
+    {
+        $this->server->expects($this->exactly(1))
+            ->method('getGuid')
+            ->will($this->returnValue('guid'));
+        $this->assertEquals('guid', $this->cleaner->getGuid());
+    }
+
+    public function testMethodConnectguidHasPostconditionThatTheCallWasDelegatedToTheServer()
+    {
+        $this->server->expects($this->exactly(1))
+            ->method('connectGuid')
+            ->with('user', 'pass');
+        $this->cleaner->connectGuid('user', 'pass');
+    }
+
+    public function testMethodReadHasPostconditionThatTheCallWasDelegatedToTheServer()
+    {
+        $this->server->expects($this->exactly(1))
+            ->method('read')
+            ->with('guid')
+            ->will($this->returnValue(array()));
+        $this->assertEquals(array(), $this->cleaner->read('guid'));
+    }
+
+    public function testMethodReadattributesHasPostconditionThatTheCallWasDelegatedToTheServer()
+    {
+        $this->server->expects($this->exactly(1))
+            ->method('readAttributes')
+            ->with('guid', array('a'))
+            ->will($this->returnValue(array()));
+        $this->assertEquals(
+            array(), $this->cleaner->readAttributes('guid', array('a'))
+        );
+    }
+
+    public function testMethodFindHasPostconditionThatTheCallWasDelegatedToTheServer()
+    {
+        $result = $this->getMock('Horde_Kolab_Server_Result');
+        $query = $this->getMock(
+            'Horde_Kolab_Server_Query_Element', array(), array(), '', false
+        );
+        $this->server->expects($this->exactly(1))
+            ->method('find')
+            ->with($query)
+            ->will($this->returnValue($result));
+        $this->assertType(
+            'Horde_Kolab_Server_Result',
+            $this->cleaner->find($query)
+        );
+    }
+
+    public function testMethodFindbelowHasPostconditionThatTheCallWasDelegatedToTheServer()
+    {
+        $result = $this->getMock('Horde_Kolab_Server_Result_Interface');
+        $query = $this->getMock(
+            'Horde_Kolab_Server_Query_Element', array(), array(), '', false
+        );
+        $this->server->expects($this->exactly(1))
+            ->method('findBelow')
+            ->with($query, 'none')
+            ->will($this->returnValue($result));
+        $this->assertType(
+            'Horde_Kolab_Server_Result_Interface',
+            $this->cleaner->findBelow($query, 'none')
+        );
+    }
+
+    public function testMethodSaveHasPostconditionThatTheCallWasDelegatedToTheServer()
+    {
+        $object = $this->getMock('Horde_Kolab_Server_Object_Interface');
+        $this->server->expects($this->exactly(1))
+            ->method('save')
+            ->with($object, array('a' => 'a'));
+        $this->cleaner->save($object, array('a' => 'a'));
+    }
+
+    public function testMethodAddHasPostconditionThatTheCallWasDelegatedToTheServer()
+    {
+        $object = $this->getMock('Horde_Kolab_Server_Object_Interface');
+        $this->server->expects($this->exactly(1))
+            ->method('add')
+            ->with($object, array('a' => 'a'));
+        $this->cleaner->add($object, array('a' => 'a'));
+    }
+
+    public function testMethodDeleteHasPostconditionThatTheCallWasDelegatedToTheServer()
+    {
+        $this->server->expects($this->exactly(1))
+            ->method('delete')
+            ->with('a');
+        $this->cleaner->delete('a');
+    }
+
+    public function testMethodRenameHasPostconditionThatTheCallWasDelegatedToTheServer()
+    {
+        $this->server->expects($this->exactly(1))
+            ->method('rename')
+            ->with('a', 'b');
+        $this->cleaner->rename('a', 'b');
+    }
+
+    public function testMethodGetschemaHasPostconditionThatTheCallWasDelegatedToTheServer()
+    {
+        $this->server->expects($this->exactly(1))
+            ->method('getSchema');
+        $this->cleaner->getSchema();
+    }
+
+    public function testMethodGetparentguidHasPostconditionThatTheCallWasDelegatedToTheServer()
+    {
+        $this->server->expects($this->exactly(1))
+            ->method('getParentGuid')
+            ->will($this->returnValue('parent'));
+        $this->assertEquals('parent', $this->cleaner->getParentGuid('child'));
+    }
+
+    public function testMethodAddHasPostconditionThatTheGuidOfTheAddedObjectIsRememberedAndDeletedOnDestruction()
+    {
+        $object = $this->getMock('Horde_Kolab_Server_Object_Interface');
+        $object->expects($this->exactly(1))
+            ->method('getGuid')
+            ->will($this->returnValue('a'));
+        $this->server->expects($this->exactly(1))
+            ->method('add')
+            ->with($object, array('a' => 'a'));
+        $this->server->expects($this->exactly(1))
+            ->method('delete')
+            ->with('a');
+        $this->cleaner->add($object, array('a' => 'a'));
+        unset($this->cleaner);
+    }
+
+    public function testMethodAddHasPostconditionThatTheGuidOfTheAddedObjectIsNotDeletedOnDestructionIfItWasDeletedBefore()
+    {
+        $object = $this->getMock('Horde_Kolab_Server_Object_Interface');
+        $object->expects($this->exactly(1))
+            ->method('getGuid')
+            ->will($this->returnValue('a'));
+        $this->server->expects($this->exactly(1))
+            ->method('add')
+            ->with($object, array('a' => 'a'));
+        $this->server->expects($this->exactly(1))
+            ->method('delete')
+            ->with('a');
+        $this->cleaner->add($object, array('a' => 'a'));
+        $this->cleaner->delete('a');
+        unset($this->cleaner);
+    }
+
+
+}
\ No newline at end of file
diff --git a/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Decorator/LogTest.php b/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Decorator/LogTest.php
new file mode 100644 (file)
index 0000000..b03e4e7
--- /dev/null
@@ -0,0 +1,220 @@
+<?php
+/**
+ * Test the log decorator for the server.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+
+/**
+ * Prepare the test setup.
+ */
+require_once dirname(__FILE__) . '/../../../Autoload.php';
+
+/**
+ * Test the log decorator for the server.
+ *
+ * Copyright 2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+class Horde_Kolab_Server_Class_Server_Decorator_LogTest extends PHPUnit_Framework_TestCase
+{
+    public function setUp()
+    {
+        parent::setUp();
+
+        $this->logger = $this->getMock('Horde_Log_Logger');
+        $this->server = $this->getMock('Horde_Kolab_Server_Interface');
+        $this->logged = new Horde_Kolab_Server_Decorator_Log(
+            $this->server, $this->logger
+        );
+    }
+
+    public function testMethodGetbaseguidHasPostconditionThatTheCallWasDelegatedToTheServer()
+    {
+        $this->server->expects($this->exactly(1))
+            ->method('getBaseGuid')
+            ->will($this->returnValue('base'));
+        $this->assertEquals('base', $this->logged->getBaseGuid());
+    }
+
+    public function testMethodGetuidHasPostconditionThatTheCallWasDelegatedToTheServer()
+    {
+        $this->server->expects($this->exactly(1))
+            ->method('getGuid')
+            ->will($this->returnValue('guid'));
+        $this->assertEquals('guid', $this->logged->getGuid());
+    }
+
+    public function testMethodConnectguidHasPostconditionThatTheCallWasDelegatedToTheServer()
+    {
+        $this->server->expects($this->exactly(1))
+            ->method('connectGuid')
+            ->with('user', 'pass');
+        $this->logged->connectGuid('user', 'pass');
+    }
+
+    public function testMethodReadHasPostconditionThatTheCallWasDelegatedToTheServer()
+    {
+        $this->server->expects($this->exactly(1))
+            ->method('read')
+            ->with('guid')
+            ->will($this->returnValue(array()));
+        $this->assertEquals(array(), $this->logged->read('guid'));
+    }
+
+    public function testMethodReadattributesHasPostconditionThatTheCallWasDelegatedToTheServer()
+    {
+        $this->server->expects($this->exactly(1))
+            ->method('readAttributes')
+            ->with('guid', array('a'))
+            ->will($this->returnValue(array()));
+        $this->assertEquals(
+            array(), $this->logged->readAttributes('guid', array('a'))
+        );
+    }
+
+    public function testMethodFindHasPostconditionThatTheCallWasDelegatedToTheServer()
+    {
+        $result = $this->getMock('Horde_Kolab_Server_Result');
+        $query = $this->getMock(
+            'Horde_Kolab_Server_Query_Element', array(), array(), '', false
+        );
+        $this->server->expects($this->exactly(1))
+            ->method('find')
+            ->with($query)
+            ->will($this->returnValue($result));
+        $this->assertType(
+            'Horde_Kolab_Server_Result',
+            $this->logged->find($query)
+        );
+    }
+
+    public function testMethodFindbelowHasPostconditionThatTheCallWasDelegatedToTheServer()
+    {
+        $result = $this->getMock('Horde_Kolab_Server_Result');
+        $query = $this->getMock(
+            'Horde_Kolab_Server_Query_Element', array(), array(), '', false
+        );
+        $this->server->expects($this->exactly(1))
+            ->method('findBelow')
+            ->with($query, 'none')
+            ->will($this->returnValue($result));
+        $this->assertType(
+            'Horde_Kolab_Server_Result',
+            $this->logged->findBelow($query, 'none')
+        );
+    }
+
+    public function testMethodSaveHasPostconditionThatTheCallWasDelegatedToTheServer()
+    {
+        $object = $this->getMock('Horde_Kolab_Server_Object_Interface');
+        $this->server->expects($this->exactly(1))
+            ->method('save')
+            ->with($object, array('a' => 'a'));
+        $this->logged->save($object, array('a' => 'a'));
+    }
+
+    public function testMethodAddHasPostconditionThatTheCallWasDelegatedToTheServer()
+    {
+        $object = $this->getMock('Horde_Kolab_Server_Object_Interface');
+        $this->server->expects($this->exactly(1))
+            ->method('add')
+            ->with($object, array('a' => 'a'));
+        $this->logged->add($object, array('a' => 'a'));
+    }
+
+    public function testMethodDeleteHasPostconditionThatTheCallWasDelegatedToTheServer()
+    {
+        $this->server->expects($this->exactly(1))
+            ->method('delete')
+            ->with('a');
+        $this->logged->delete('a');
+    }
+
+    public function testMethodRenameHasPostconditionThatTheCallWasDelegatedToTheServer()
+    {
+        $this->server->expects($this->exactly(1))
+            ->method('rename')
+            ->with('a', 'b');
+        $this->logged->rename('a', 'b');
+    }
+
+    public function testMethodGetschemaHasPostconditionThatTheCallWasDelegatedToTheServer()
+    {
+        $this->server->expects($this->exactly(1))
+            ->method('getSchema');
+        $this->logged->getSchema();
+    }
+
+    public function testMethodSaveHasPostconditionThatTheEventWasLogged()
+    {
+        $object = $this->getMock('Horde_Kolab_Server_Object_Interface');
+        $object->expects($this->once())
+            ->method('getGuid')
+            ->will($this->returnValue('a'));
+        $this->logger->expects($this->once())
+            ->method('__call')
+            ->with(
+                'info', array('The object "a" has been successfully saved!')
+            );
+        $this->logged->save($object, array('a' => 'a'));
+    }
+
+    public function testMethodAddHasPostconditionThatTheEventWasLogged()
+    {
+        $object = $this->getMock('Horde_Kolab_Server_Object_Interface');
+        $object->expects($this->once())
+            ->method('getGuid')
+            ->will($this->returnValue('a'));
+        $this->logger->expects($this->once())
+            ->method('__call')
+            ->with(
+                'info', array('The object "a" has been successfully added!')
+            );
+        $this->logged->add($object, array('a' => 'a'));
+    }
+
+    public function testMethodDeleteHasPostconditionThatTheEventWasLogged()
+    {
+        $this->logger->expects($this->once())
+            ->method('__call')
+            ->with(
+                'info', array('The object "a" has been successfully deleted!')
+            );
+        $this->logged->delete('a');
+    }
+
+    public function testMethodRenameHasPostconditionThatTheEventWasLogged()
+    {
+        $this->logger->expects($this->once())
+            ->method('__call')
+            ->with(
+                'info',
+                array('The object "a" has been successfully renamed to "b"!')
+            );
+        $this->logged->rename('a', 'b');
+    }
+
+    public function testMethodGetparentguidHasPostconditionThatTheCallWasDelegatedToTheServer()
+    {
+        $this->server->expects($this->exactly(1))
+            ->method('getParentGuid')
+            ->will($this->returnValue('parent'));
+        $this->assertEquals('parent', $this->logged->getParentGuid('child'));
+    }
+
+}
\ No newline at end of file
diff --git a/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/CleanerTest.php b/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/CleanerTest.php
deleted file mode 100644 (file)
index 4a7a234..0000000
+++ /dev/null
@@ -1,149 +0,0 @@
-<?php
-/**
- * Test the cleaner server factory.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-
-/**
- * Prepare the test setup.
- */
-require_once dirname(__FILE__) . '/../../../Autoload.php';
-
-/**
- * Test the cleaner server factory.
- *
- * Copyright 2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-class Horde_Kolab_Server_Class_Server_Factory_CleanerTest
-extends PHPUnit_Framework_TestCase
-{
-    public function setUp()
-    {
-        $this->factory = $this->getMock('Horde_Kolab_Server_Factory');
-    }
-
-    public function testMethodGetserverHasResultCleanerServerIfACleanedWasProvidedInTheConfiguration()
-    {
-        $this->factory->expects($this->once())
-            ->method('getServer')
-            ->will($this->returnValue($this->getMock('Horde_Kolab_Server')));
-        $factory = new Horde_Kolab_Server_Factory_Cleaner(
-            $this->factory, array('cleanup' => true)
-        );
-        $this->assertType('Horde_Kolab_Server_Cleaner', $factory->getServer());
-    }
-
-    public function testMethodConstructHasParametersFactory()
-    {
-        $factory = new Horde_Kolab_Server_Factory_Cleaner(
-            $this->factory
-        );
-    }
-
-    public function testMethodGetconnectionfactoryGetsDelegated()
-    {
-        $this->factory->expects($this->once())
-            ->method('getConnectionFactory');
-        $factory = new Horde_Kolab_Server_Factory_Cleaner(
-            $this->factory, array()
-        );
-        $factory->getConnectionFactory();
-    }
-
-    public function testMethodGetserverGetsDelegated()
-    {
-        $this->factory->expects($this->once())
-            ->method('getServer')
-            ->will($this->returnValue($this->getMock('Horde_Kolab_Server')));
-        $factory = new Horde_Kolab_Server_Factory_Cleaner(
-            $this->factory, array()
-        );
-        $factory->getServer();
-    }
-
-    public function testMethodGetconfigurationGetsDelegated()
-    {
-        $this->factory->expects($this->once())
-            ->method('getConfiguration');
-        $factory = new Horde_Kolab_Server_Factory_Cleaner(
-            $this->factory, array()
-        );
-        $factory->getConfiguration();
-    }
-
-    public function testMethodGetconnectionGetsDelegated()
-    {
-        $this->factory->expects($this->once())
-            ->method('getConnection');
-        $factory = new Horde_Kolab_Server_Factory_Cleaner(
-            $this->factory, array()
-        );
-        $factory->getConnection();
-    }
-
-    public function testMethodGetcompositeGetsDelegated()
-    {
-        $this->factory->expects($this->once())
-            ->method('getComposite');
-        $factory = new Horde_Kolab_Server_Factory_Cleaner(
-            $this->factory, array()
-        );
-        $factory->getComposite();
-    }
-
-    public function testMethodGetobjectsGetsDelegated()
-    {
-        $this->factory->expects($this->once())
-            ->method('getObjects');
-        $factory = new Horde_Kolab_Server_Factory_Cleaner(
-            $this->factory, array()
-        );
-        $factory->getObjects();
-    }
-
-    public function testMethodGetstructureGetsDelegated()
-    {
-        $this->factory->expects($this->once())
-            ->method('getStructure');
-        $factory = new Horde_Kolab_Server_Factory_Cleaner(
-            $this->factory, array()
-        );
-        $factory->getStructure();
-    }
-
-    public function testMethodGetsearchGetsDelegated()
-    {
-        $this->factory->expects($this->once())
-            ->method('getSearch');
-        $factory = new Horde_Kolab_Server_Factory_Cleaner(
-            $this->factory, array()
-        );
-        $factory->getSearch();
-    }
-
-    public function testMethodGetschemaGetsDelegated()
-    {
-        $this->factory->expects($this->once())
-            ->method('getSchema');
-        $factory = new Horde_Kolab_Server_Factory_Cleaner(
-            $this->factory, array()
-        );
-        $factory->getSchema();
-    }
-}
\ No newline at end of file
index 5939ce3..4eec53d 100644 (file)
@@ -39,7 +39,9 @@ extends Horde_Kolab_Server_LdapTestCase
         $factory = new Horde_Kolab_Server_Factory_Configuration(
             array('logger' => 'set', 'basedn' => '')
         );
-        $this->assertType('Horde_Kolab_Server_Logged', $factory->getServer());
+        $this->assertType(
+            'Horde_Kolab_Server_Decorator_Log', $factory->getServer()
+        );
     }
 
     public function testMethodGetserverHasResultMappedServerIfAMappedWasProvidedInTheConfiguration()
@@ -48,7 +50,9 @@ extends Horde_Kolab_Server_LdapTestCase
         $factory = new Horde_Kolab_Server_Factory_Configuration(
             array('map' => array(), 'basedn' => '')
         );
-        $this->assertType('Horde_Kolab_Server_Mapped', $factory->getServer());
+        $this->assertType(
+            'Horde_Kolab_Server_Decorator_Map', $factory->getServer()
+        );
     }
 
     public function testMethodGetserverHasResultCleanerServerIfACleanedWasProvidedInTheConfiguration()
@@ -57,7 +61,9 @@ extends Horde_Kolab_Server_LdapTestCase
         $factory = new Horde_Kolab_Server_Factory_Configuration(
             array('cleanup' => true, 'basedn' => '')
         );
-        $this->assertType('Horde_Kolab_Server_Cleaner', $factory->getServer());
+        $this->assertType(
+            'Horde_Kolab_Server_Decorator_Clean', $factory->getServer()
+        );
     }
 
     public function testMethodConstructHasParametersArrayParameters()
@@ -73,7 +79,7 @@ extends Horde_Kolab_Server_LdapTestCase
             array('basedn' => '')
         );
         $this->assertType(
-            'Horde_Kolab_Server_Factory_Conn',
+            'Horde_Kolab_Server_Factory_Connection_Interface',
             $factory->getConnectionFactory()
         );
     }
@@ -85,7 +91,7 @@ extends Horde_Kolab_Server_LdapTestCase
             array('basedn' => '')
         );
         $this->assertType(
-            'Horde_Kolab_Server',
+            'Horde_Kolab_Server_Interface',
             $factory->getServer()
         );
     }
@@ -108,7 +114,7 @@ extends Horde_Kolab_Server_LdapTestCase
             array('basedn' => '')
         );
         $this->assertType(
-            'Horde_Kolab_Server_Connection',
+            'Horde_Kolab_Server_Connection_Interface',
             $factory->getConnection()
         );
     }
@@ -120,7 +126,7 @@ extends Horde_Kolab_Server_LdapTestCase
             array('basedn' => '')
         );
         $this->assertType(
-            'Horde_Kolab_Server_Composite',
+            'Horde_Kolab_Server_Composite_Interface',
             $factory->getComposite()
         );
     }
@@ -131,7 +137,7 @@ extends Horde_Kolab_Server_LdapTestCase
             array('basedn' => '')
         );
         $this->assertType(
-            'Horde_Kolab_Server_Objects',
+            'Horde_Kolab_Server_Objects_Interface',
             $factory->getObjects()
         );
     }
@@ -164,7 +170,7 @@ extends Horde_Kolab_Server_LdapTestCase
             array('basedn' => '')
         );
         $this->assertType(
-            'Horde_Kolab_Server_Schema',
+            'Horde_Kolab_Server_Schema_Interface',
             $factory->getSchema()
         );
     }
diff --git a/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/Conn/ConfigurationTest.php b/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/Conn/ConfigurationTest.php
deleted file mode 100644 (file)
index 746c673..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-<?php
-/**
- * Test the configuration based connection factory.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-
-/**
- * Require our basic test case definition
- */
-require_once dirname(__FILE__) . '/../../../../LdapTestCase.php';
-
-/**
- * Test the configuration based connection factory.
- *
- * Copyright 2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-class Horde_Kolab_Server_Class_Server_Factory_Conn_ConfigurationTest
-extends Horde_Kolab_Server_LdapTestCase
-{
-    public function testMethodConstructHasParameterArrayConfiguration()
-    {
-        $factory = new Horde_Kolab_Server_Factory_Conn_Configuration(
-            array('basedn' => 'a')
-        );
-    }
-
-    public function testMethodConstructHasPostconditionThatTheConfigurationWasSaved()
-    {
-        $factory = new Horde_Kolab_Server_Factory_Conn_Configuration(
-            array('basedn' => 'a')
-        );
-        $this->assertEquals(array('basedn' => 'a'), $factory->getConfiguration());
-    }
-
-    public function testMethodConstructHasResultArrayTheConfiguration()
-    {
-        $factory = new Horde_Kolab_Server_Factory_Conn_Configuration(
-            array('basedn' => 'a')
-        );
-        $this->assertType('array', $factory->getConfiguration());
-    }
-
-    public function testMethodConstructHasPostconditionThatTheConnectionFactoryHasBeenSet()
-    {
-        $factory = new Horde_Kolab_Server_Factory_Conn_Configuration(
-            array('mock' => true)
-        );
-        $this->assertType('Horde_Kolab_Server_Connection_Mock', $factory->getConnection());
-    }
-
-    public function testMethodGetconnectionHasResultMockConnectionIfConfiguredThatWay()
-    {
-        $this->testMethodConstructHasPostconditionThatTheConnectionFactoryHasBeenSet();
-    }
-
-    public function testMethodGetconnectionHasResultLdapConnectionIfConfiguredThatWay()
-    {
-        $this->skipIfNoLdap();
-        $factory = new Horde_Kolab_Server_Factory_Conn_Configuration(
-            array('basedn' => 'a')
-        );
-        $this->assertType('Horde_Kolab_Server_Connection_Simpleldap', $factory->getConnection());
-    }
-}
\ No newline at end of file
diff --git a/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/Conn/InjectorTest.php b/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/Conn/InjectorTest.php
deleted file mode 100644 (file)
index 7ecff3f..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-<?php
-/**
- * Test the injector based connection factory.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-
-/**
- * Prepare the test setup.
- */
-require_once dirname(__FILE__) . '/../../../../Autoload.php';
-
-/**
- * Test the injector based connection factory.
- *
- * Copyright 2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-class Horde_Kolab_Server_Class_Server_Factory_Conn_InjectorTest
-extends PHPUnit_Framework_TestCase
-{
-    public function testMethodGetconnectionHasResultConnection()
-    {
-        $injector = new Horde_Injector(new Horde_Injector_TopLevel());
-        $injector->bindImplementation(
-            'Horde_Kolab_Server_Factory_Conn',
-            'Horde_Kolab_Server_Factory_Conn_Mock'
-        );
-        $injector->setInstance(
-            'Horde_Kolab_Server_Configuration',
-            array()
-        );
-        $factory = new Horde_Kolab_Server_Factory_Conn_Injector($injector);
-        $this->assertType(
-            'Horde_Kolab_Server_Connection',
-            $factory->getConnection()
-        );
-    }
-}
\ No newline at end of file
diff --git a/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/Conn/LdapTest.php b/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/Conn/LdapTest.php
deleted file mode 100644 (file)
index 880b816..0000000
+++ /dev/null
@@ -1,125 +0,0 @@
-<?php
-/**
- * Test the ldap connection factory.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-
-/**
- * Require our basic test case definition
- */
-require_once dirname(__FILE__) . '/../../../../LdapTestCase.php';
-
-/**
- * Test the ldap connection factory.
- *
- * Copyright 2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-class Horde_Kolab_Server_Class_Server_Factory_Conn_LdapTest
-extends Horde_Kolab_Server_LdapTestCase
-{
-    public function testMethodSetconfigurationHasPostconditionThatTheServerParameterWasRewritten()
-    {
-        $factory = new Horde_Kolab_Server_Factory_Conn_Ldap();
-        $factory->setConfiguration(
-            array(
-                'basedn' => 'test',
-                'server' => '1'
-            )
-        );
-        $this->assertEquals(
-            array(
-                'basedn' => 'test',
-                'host' => '1'
-            ),
-            $factory->getConfiguration()
-        );
-    }
-
-    public function testMethodSetconfigurationHasPostconditionThatThePhpdnParameterWasRewritten()
-    {
-        $factory = new Horde_Kolab_Server_Factory_Conn_Ldap();
-        $factory->setConfiguration(
-            array(
-                'basedn' => 'test',
-                'phpdn' => '1'
-            )
-        );
-        $this->assertEquals(
-            array(
-                'basedn' => 'test',
-                'binddn' => '1'
-            ),
-            $factory->getConfiguration()
-        );
-    }
-
-    public function testMethodSetconfigurationHasPostconditionThatThePhppwParameterWasRewritten()
-    {
-        $factory = new Horde_Kolab_Server_Factory_Conn_Ldap();
-        $factory->setConfiguration(
-            array(
-                'basedn' => 'test',
-                'phppw' => '1'
-            )
-        );
-        $this->assertEquals(
-            array(
-                'basedn' => 'test',
-                'bindpw' => '1'
-            ),
-            $factory->getConfiguration()
-        );
-    }
-
-    public function testMethodSetconfigurationThrowsExceptionIfTheBasednIsNotSet()
-    {
-        $factory = new Horde_Kolab_Server_Factory_Conn_Ldap();
-        try {
-            $factory->setConfiguration(array());
-            $this->fail('No exception!');
-        } catch (Horde_Kolab_Server_Exception $e) {
-            $this->assertEquals(
-                'The base DN is missing!',
-                $e->getMessage()
-            );
-        }
-    }
-
-    public function testMethodGetconnectionHasResultConnectionSimpleldap()
-    {
-        $this->skipIfNoLdap();
-        $factory = new Horde_Kolab_Server_Factory_Conn_Ldap();
-        $factory->setConfiguration(array('basedn' => 'test'));
-        $this->assertType(
-            'Horde_Kolab_Server_Connection_Simpleldap',
-            $factory->getConnection()
-        );
-    }
-
-    public function testMethodGetconnectionHasResultConnectionSplittedldapIfTheHostMasterIsSet()
-    {
-        $this->skipIfNoLdap();
-        $factory = new Horde_Kolab_Server_Factory_Conn_Ldap();
-        $factory->setConfiguration(array('basedn' => 'test', 'host_master' => 'dummy'));
-        $this->assertType(
-            'Horde_Kolab_Server_Connection_Splittedldap',
-            $factory->getConnection()
-        );
-    }
-}
\ No newline at end of file
diff --git a/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/Conn/MockTest.php b/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/Conn/MockTest.php
deleted file mode 100644 (file)
index 5e74120..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-<?php
-/**
- * Test the mock connection factory.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-
-/**
- * Prepare the test setup.
- */
-require_once dirname(__FILE__) . '/../../../../Autoload.php';
-
-/**
- * Test the mock connection factory.
- *
- * Copyright 2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-class Horde_Kolab_Server_Class_Server_Factory_Conn_MockTest
-extends PHPUnit_Framework_TestCase
-{
-    public function testMethodGetconfigurationHasResultArrayTheConnectionConfiguration()
-    {
-        $factory = new Horde_Kolab_Server_Factory_Conn_Mock();
-        $factory->setConfiguration(array('basedn' => 'test'));
-        $this->assertEquals(
-            array('basedn' => 'test'),
-            $factory->getConfiguration()
-        );
-    }
-
-    public function testMethodSetconfigurationHasPostconditionThatTheConfigurationWasSaved()
-    {
-        $factory = new Horde_Kolab_Server_Factory_Conn_Mock();
-        $factory->setConfiguration(array());
-        $this->assertEquals(
-            array(),
-            $factory->getConfiguration()
-        );
-    }
-
-    public function testMethodGetconfigurationThrowsExceptionIfNoConfigurationHasBeenSet()
-    {
-        $factory = new Horde_Kolab_Server_Factory_Conn_Mock();
-        try {
-            $factory->getConfiguration();
-            $this->fail('No exception!');
-        } catch (Horde_Kolab_Server_Exception $e) {
-            $this->assertEquals(
-                'The configuration has not been set!',
-                $e->getMessage()
-            );
-        }
-    }
-
-    public function testMethodGetconnectionHasResultConnectionmock()
-    {
-        $factory = new Horde_Kolab_Server_Factory_Conn_Mock();
-        $factory->setConfiguration(
-            array(
-                'basedn' => 'test',
-                'data' => array()
-            )
-        );
-        $this->assertType(
-            'Horde_Kolab_Server_Connection_Mock',
-            $factory->getConnection()
-        );
-    }
-}
\ No newline at end of file
diff --git a/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/Connection/ConfigurationTest.php b/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/Connection/ConfigurationTest.php
new file mode 100644 (file)
index 0000000..c3f5295
--- /dev/null
@@ -0,0 +1,80 @@
+<?php
+/**
+ * Test the configuration based connection factory.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+
+/**
+ * Require our basic test case definition
+ */
+require_once dirname(__FILE__) . '/../../../../LdapTestCase.php';
+
+/**
+ * Test the configuration based connection factory.
+ *
+ * Copyright 2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+class Horde_Kolab_Server_Class_Server_Factory_Connection_ConfigurationTest
+extends Horde_Kolab_Server_LdapTestCase
+{
+    public function testMethodConstructHasParameterArrayConfiguration()
+    {
+        $factory = new Horde_Kolab_Server_Factory_Connection_Configuration(
+            array('basedn' => 'a')
+        );
+    }
+
+    public function testMethodConstructHasPostconditionThatTheConfigurationWasSaved()
+    {
+        $factory = new Horde_Kolab_Server_Factory_Connection_Configuration(
+            array('basedn' => 'a')
+        );
+        $this->assertEquals(array('basedn' => 'a'), $factory->getConfiguration());
+    }
+
+    public function testMethodConstructHasResultArrayTheConfiguration()
+    {
+        $factory = new Horde_Kolab_Server_Factory_Connection_Configuration(
+            array('basedn' => 'a')
+        );
+        $this->assertType('array', $factory->getConfiguration());
+    }
+
+    public function testMethodConstructHasPostconditionThatTheConnectionFactoryHasBeenSet()
+    {
+        $factory = new Horde_Kolab_Server_Factory_Connection_Configuration(
+            array('mock' => true)
+        );
+        $this->assertType('Horde_Kolab_Server_Connection_Mock', $factory->getConnection());
+    }
+
+    public function testMethodGetconnectionHasResultMockConnectionIfConfiguredThatWay()
+    {
+        $this->testMethodConstructHasPostconditionThatTheConnectionFactoryHasBeenSet();
+    }
+
+    public function testMethodGetconnectionHasResultLdapConnectionIfConfiguredThatWay()
+    {
+        $this->skipIfNoLdap();
+        $factory = new Horde_Kolab_Server_Factory_Connection_Configuration(
+            array('basedn' => 'a')
+        );
+        $this->assertType('Horde_Kolab_Server_Connection_Simpleldap', $factory->getConnection());
+    }
+}
\ No newline at end of file
diff --git a/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/Connection/InjectorTest.php b/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/Connection/InjectorTest.php
new file mode 100644 (file)
index 0000000..f6882c3
--- /dev/null
@@ -0,0 +1,53 @@
+<?php
+/**
+ * Test the injector based connection factory.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+
+/**
+ * Prepare the test setup.
+ */
+require_once dirname(__FILE__) . '/../../../../Autoload.php';
+
+/**
+ * Test the injector based connection factory.
+ *
+ * Copyright 2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+class Horde_Kolab_Server_Class_Server_Factory_Connection_InjectorTest
+extends PHPUnit_Framework_TestCase
+{
+    public function testMethodGetconnectionHasResultConnection()
+    {
+        $injector = new Horde_Injector(new Horde_Injector_TopLevel());
+        $injector->bindImplementation(
+            'Horde_Kolab_Server_Factory_Connection_Interface',
+            'Horde_Kolab_Server_Factory_Connection_Mock'
+        );
+        $injector->setInstance(
+            'Horde_Kolab_Server_Configuration',
+            array()
+        );
+        $factory = new Horde_Kolab_Server_Factory_Connection_Injector($injector);
+        $this->assertType(
+            'Horde_Kolab_Server_Connection_Interface',
+            $factory->getConnection()
+        );
+    }
+}
\ No newline at end of file
diff --git a/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/Connection/LdapTest.php b/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/Connection/LdapTest.php
new file mode 100644 (file)
index 0000000..612f25c
--- /dev/null
@@ -0,0 +1,125 @@
+<?php
+/**
+ * Test the ldap connection factory.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+
+/**
+ * Require our basic test case definition
+ */
+require_once dirname(__FILE__) . '/../../../../LdapTestCase.php';
+
+/**
+ * Test the ldap connection factory.
+ *
+ * Copyright 2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+class Horde_Kolab_Server_Class_Server_Factory_Connection_LdapTest
+extends Horde_Kolab_Server_LdapTestCase
+{
+    public function testMethodSetconfigurationHasPostconditionThatTheServerParameterWasRewritten()
+    {
+        $factory = new Horde_Kolab_Server_Factory_Connection_Ldap();
+        $factory->setConfiguration(
+            array(
+                'basedn' => 'test',
+                'server' => '1'
+            )
+        );
+        $this->assertEquals(
+            array(
+                'basedn' => 'test',
+                'host' => '1'
+            ),
+            $factory->getConfiguration()
+        );
+    }
+
+    public function testMethodSetconfigurationHasPostconditionThatThePhpdnParameterWasRewritten()
+    {
+        $factory = new Horde_Kolab_Server_Factory_Connection_Ldap();
+        $factory->setConfiguration(
+            array(
+                'basedn' => 'test',
+                'phpdn' => '1'
+            )
+        );
+        $this->assertEquals(
+            array(
+                'basedn' => 'test',
+                'binddn' => '1'
+            ),
+            $factory->getConfiguration()
+        );
+    }
+
+    public function testMethodSetconfigurationHasPostconditionThatThePhppwParameterWasRewritten()
+    {
+        $factory = new Horde_Kolab_Server_Factory_Connection_Ldap();
+        $factory->setConfiguration(
+            array(
+                'basedn' => 'test',
+                'phppw' => '1'
+            )
+        );
+        $this->assertEquals(
+            array(
+                'basedn' => 'test',
+                'bindpw' => '1'
+            ),
+            $factory->getConfiguration()
+        );
+    }
+
+    public function testMethodSetconfigurationThrowsExceptionIfTheBasednIsNotSet()
+    {
+        $factory = new Horde_Kolab_Server_Factory_Connection_Ldap();
+        try {
+            $factory->setConfiguration(array());
+            $this->fail('No exception!');
+        } catch (Horde_Kolab_Server_Exception $e) {
+            $this->assertEquals(
+                'The base DN is missing!',
+                $e->getMessage()
+            );
+        }
+    }
+
+    public function testMethodGetconnectionHasResultConnectionSimpleldap()
+    {
+        $this->skipIfNoLdap();
+        $factory = new Horde_Kolab_Server_Factory_Connection_Ldap();
+        $factory->setConfiguration(array('basedn' => 'test'));
+        $this->assertType(
+            'Horde_Kolab_Server_Connection_Simpleldap',
+            $factory->getConnection()
+        );
+    }
+
+    public function testMethodGetconnectionHasResultConnectionSplittedldapIfTheHostMasterIsSet()
+    {
+        $this->skipIfNoLdap();
+        $factory = new Horde_Kolab_Server_Factory_Connection_Ldap();
+        $factory->setConfiguration(array('basedn' => 'test', 'host_master' => 'dummy'));
+        $this->assertType(
+            'Horde_Kolab_Server_Connection_Splittedldap',
+            $factory->getConnection()
+        );
+    }
+}
\ No newline at end of file
diff --git a/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/Connection/MockTest.php b/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/Connection/MockTest.php
new file mode 100644 (file)
index 0000000..8448170
--- /dev/null
@@ -0,0 +1,84 @@
+<?php
+/**
+ * Test the mock connection factory.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+
+/**
+ * Prepare the test setup.
+ */
+require_once dirname(__FILE__) . '/../../../../Autoload.php';
+
+/**
+ * Test the mock connection factory.
+ *
+ * Copyright 2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+class Horde_Kolab_Server_Class_Server_Factory_Connection_MockTest
+extends PHPUnit_Framework_TestCase
+{
+    public function testMethodGetconfigurationHasResultArrayTheConnectionConfiguration()
+    {
+        $factory = new Horde_Kolab_Server_Factory_Connection_Mock();
+        $factory->setConfiguration(array('basedn' => 'test'));
+        $this->assertEquals(
+            array('basedn' => 'test'),
+            $factory->getConfiguration()
+        );
+    }
+
+    public function testMethodSetconfigurationHasPostconditionThatTheConfigurationWasSaved()
+    {
+        $factory = new Horde_Kolab_Server_Factory_Connection_Mock();
+        $factory->setConfiguration(array());
+        $this->assertEquals(
+            array(),
+            $factory->getConfiguration()
+        );
+    }
+
+    public function testMethodGetconfigurationThrowsExceptionIfNoConfigurationHasBeenSet()
+    {
+        $factory = new Horde_Kolab_Server_Factory_Connection_Mock();
+        try {
+            $factory->getConfiguration();
+            $this->fail('No exception!');
+        } catch (Horde_Kolab_Server_Exception $e) {
+            $this->assertEquals(
+                'The configuration has not been set!',
+                $e->getMessage()
+            );
+        }
+    }
+
+    public function testMethodGetconnectionHasResultConnectionmock()
+    {
+        $factory = new Horde_Kolab_Server_Factory_Connection_Mock();
+        $factory->setConfiguration(
+            array(
+                'basedn' => 'test',
+                'data' => array()
+            )
+        );
+        $this->assertType(
+            'Horde_Kolab_Server_Connection_Mock',
+            $factory->getConnection()
+        );
+    }
+}
\ No newline at end of file
index 0fc37e6..8f0a652 100644 (file)
@@ -36,11 +36,21 @@ extends Horde_Kolab_Server_LdapTestCase
     public function setUp()
     {
         parent::setUp();
-        $this->factory   = $this->getMock('Horde_Kolab_Server_Factory_Conn');
-        $this->objects   = $this->getMock('Horde_Kolab_Server_Objects');
-        $this->structure = $this->getMock('Horde_Kolab_Server_Structure_Interface');
-        $this->search    = $this->getMock('Horde_Kolab_Server_Search_Interface');
-        $this->schema    = $this->getMock('Horde_Kolab_Server_Schema');
+        $this->factory   = $this->getMock(
+            'Horde_Kolab_Server_Factory_Connection_Interface'
+        );
+        $this->objects   = $this->getMock(
+            'Horde_Kolab_Server_Objects_Interface'
+        );
+        $this->structure = $this->getMock(
+            'Horde_Kolab_Server_Structure_Interface'
+        );
+        $this->search    = $this->getMock(
+            'Horde_Kolab_Server_Search_Interface'
+        );
+        $this->schema    = $this->getMock(
+            'Horde_Kolab_Server_Schema_Interface'
+        );
     }
 
     public function testMethodConstructHasParametersFactoryObjectsStructureSearchSchemaConfig()
@@ -58,14 +68,16 @@ extends Horde_Kolab_Server_LdapTestCase
             ->method('getConnection')
             ->will(
                 $this->returnValue(
-                    $this->getMock('Horde_Kolab_Server_Connection')
+                    $this->getMock(
+                        'Horde_Kolab_Server_Connection_Interface'
+                    )
                 )
             );
         $factory = new Horde_Kolab_Server_Factory_Constructor(
             $this->factory, $this->objects, $this->structure,
             $this->search, $this->schema, array('basedn' => 'test')
         );
-        $this->assertType('Horde_Kolab_Server', $factory->getServer());
+        $this->assertType('Horde_Kolab_Server_Interface', $factory->getServer());
     }
 
     public function testMethodGetconfigurationReturnsArrayConfiguration()
@@ -105,7 +117,9 @@ extends Horde_Kolab_Server_LdapTestCase
             ->method('getConnection')
             ->will(
                 $this->returnValue(
-                    $this->getMock('Horde_Kolab_Server_Connection')
+                    $this->getMock(
+                        'Horde_Kolab_Server_Connection_Interface'
+                    )
                 )
             );
         $factory = new Horde_Kolab_Server_Factory_Constructor(
@@ -113,7 +127,7 @@ extends Horde_Kolab_Server_LdapTestCase
             $this->search, $this->schema, array('basedn' => 'test')
         );
         $this->assertType(
-            'Horde_Kolab_Server_Composite',
+            'Horde_Kolab_Server_Composite_Interface',
             $factory->getComposite()
         );
     }
diff --git a/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/Decorator/CleanTest.php b/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/Decorator/CleanTest.php
new file mode 100644 (file)
index 0000000..f7bbadf
--- /dev/null
@@ -0,0 +1,166 @@
+<?php
+/**
+ * Test the cleaner server factory.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+
+/**
+ * Prepare the test setup.
+ */
+require_once dirname(__FILE__) . '/../../../../Autoload.php';
+
+/**
+ * Test the cleaner server factory.
+ *
+ * Copyright 2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+class Horde_Kolab_Server_Class_Server_Factory_Decorator_CleanTest
+extends PHPUnit_Framework_TestCase
+{
+    public function setUp()
+    {
+        $this->factory = $this->getMock(
+            'Horde_Kolab_Server_Factory_Interface'
+        );
+    }
+
+    public function testMethodGetserverHasResultCleanerServerIfACleanedWasProvidedInTheConfiguration()
+    {
+        $this->factory->expects($this->once())
+            ->method('getServer')
+            ->will(
+                $this->returnValue(
+                    $this->getMock(
+                        'Horde_Kolab_Server_Interface'
+                    )
+                )
+            );
+        $factory = new Horde_Kolab_Server_Factory_Decorator_Clean(
+            $this->factory, array('cleanup' => true)
+        );
+        $this->assertType(
+            'Horde_Kolab_Server_Decorator_Clean',
+            $factory->getServer()
+        );
+    }
+
+    public function testMethodConstructHasParametersFactory()
+    {
+        $factory = new Horde_Kolab_Server_Factory_Decorator_Clean(
+            $this->factory
+        );
+    }
+
+    public function testMethodGetconnectionfactoryGetsDelegated()
+    {
+        $this->factory->expects($this->once())
+            ->method('getConnectionFactory');
+        $factory = new Horde_Kolab_Server_Factory_Decorator_Clean(
+            $this->factory, array()
+        );
+        $factory->getConnectionFactory();
+    }
+
+    public function testMethodGetserverGetsDelegated()
+    {
+        $this->factory->expects($this->once())
+            ->method('getServer')
+            ->will(
+                $this->returnValue(
+                    $this->getMock(
+                        'Horde_Kolab_Server_Interface'
+                    )
+                )
+            );
+        $factory = new Horde_Kolab_Server_Factory_Decorator_Clean(
+            $this->factory, array()
+        );
+        $factory->getServer();
+    }
+
+    public function testMethodGetconfigurationGetsDelegated()
+    {
+        $this->factory->expects($this->once())
+            ->method('getConfiguration');
+        $factory = new Horde_Kolab_Server_Factory_Decorator_Clean(
+            $this->factory, array()
+        );
+        $factory->getConfiguration();
+    }
+
+    public function testMethodGetconnectionGetsDelegated()
+    {
+        $this->factory->expects($this->once())
+            ->method('getConnection');
+        $factory = new Horde_Kolab_Server_Factory_Decorator_Clean(
+            $this->factory, array()
+        );
+        $factory->getConnection();
+    }
+
+    public function testMethodGetcompositeGetsDelegated()
+    {
+        $this->factory->expects($this->once())
+            ->method('getComposite');
+        $factory = new Horde_Kolab_Server_Factory_Decorator_Clean(
+            $this->factory, array()
+        );
+        $factory->getComposite();
+    }
+
+    public function testMethodGetobjectsGetsDelegated()
+    {
+        $this->factory->expects($this->once())
+            ->method('getObjects');
+        $factory = new Horde_Kolab_Server_Factory_Decorator_Clean(
+            $this->factory, array()
+        );
+        $factory->getObjects();
+    }
+
+    public function testMethodGetstructureGetsDelegated()
+    {
+        $this->factory->expects($this->once())
+            ->method('getStructure');
+        $factory = new Horde_Kolab_Server_Factory_Decorator_Clean(
+            $this->factory, array()
+        );
+        $factory->getStructure();
+    }
+
+    public function testMethodGetsearchGetsDelegated()
+    {
+        $this->factory->expects($this->once())
+            ->method('getSearch');
+        $factory = new Horde_Kolab_Server_Factory_Decorator_Clean(
+            $this->factory, array()
+        );
+        $factory->getSearch();
+    }
+
+    public function testMethodGetschemaGetsDelegated()
+    {
+        $this->factory->expects($this->once())
+            ->method('getSchema');
+        $factory = new Horde_Kolab_Server_Factory_Decorator_Clean(
+            $this->factory, array()
+        );
+        $factory->getSchema();
+    }
+}
\ No newline at end of file
diff --git a/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/Decorator/LogTest.php b/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/Decorator/LogTest.php
new file mode 100644 (file)
index 0000000..bb2b0f1
--- /dev/null
@@ -0,0 +1,163 @@
+<?php
+/**
+ * Test the log decorator server factory.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+
+/**
+ * Prepare the test setup.
+ */
+require_once dirname(__FILE__) . '/../../../../Autoload.php';
+
+/**
+ * Test the log decorator server factory.
+ *
+ * Copyright 2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+class Horde_Kolab_Server_Class_Server_Factory_Decorator_LogTest
+extends PHPUnit_Framework_TestCase
+{
+    public function setUp()
+    {
+        $this->factory = $this->getMock(
+            'Horde_Kolab_Server_Factory_Interface'
+        );
+    }
+
+    public function testMethodGetserverHasResultLoggedServerIfALoggerWasProvidedInTheConfiguration()
+    {
+        $this->factory->expects($this->once())
+            ->method('getServer')
+            ->will(
+                $this->returnValue(
+                    $this->getMock(
+                        'Horde_Kolab_Server_Interface'
+                    )
+                )
+            );
+        $factory = new Horde_Kolab_Server_Factory_Decorator_Log(
+            $this->factory, 'logger'
+        );
+        $this->assertType('Horde_Kolab_Server_Decorator_Log', $factory->getServer());
+    }
+
+    public function testMethodConstructHasParametersFactoryAndMixedLoggerParameter()
+    {
+        $factory = new Horde_Kolab_Server_Factory_Decorator_Log(
+            $this->factory, 'logger'
+        );
+    }
+
+    public function testMethodGetconnectionfactoryGetsDelegated()
+    {
+        $this->factory->expects($this->once())
+            ->method('getConnectionFactory');
+        $factory = new Horde_Kolab_Server_Factory_Decorator_Log(
+            $this->factory, 'logger'
+        );
+        $factory->getConnectionFactory();
+    }
+
+    public function testMethodGetserverGetsDelegated()
+    {
+        $this->factory->expects($this->once())
+            ->method('getServer')
+            ->will(
+                $this->returnValue(
+                    $this->getMock(
+                        'Horde_Kolab_Server_Interface'
+                    )
+                )
+            );
+        $factory = new Horde_Kolab_Server_Factory_Decorator_Log(
+            $this->factory, 'logger'
+        );
+        $factory->getServer();
+    }
+
+    public function testMethodGetconfigurationGetsDelegated()
+    {
+        $this->factory->expects($this->once())
+            ->method('getConfiguration');
+        $factory = new Horde_Kolab_Server_Factory_Decorator_Log(
+            $this->factory, 'logger'
+        );
+        $factory->getConfiguration();
+    }
+
+    public function testMethodGetconnectionGetsDelegated()
+    {
+        $this->factory->expects($this->once())
+            ->method('getConnection');
+        $factory = new Horde_Kolab_Server_Factory_Decorator_Log(
+            $this->factory, 'logger'
+        );
+        $factory->getConnection();
+    }
+
+    public function testMethodGetcompositeGetsDelegated()
+    {
+        $this->factory->expects($this->once())
+            ->method('getComposite');
+        $factory = new Horde_Kolab_Server_Factory_Decorator_Log(
+            $this->factory, 'logger'
+        );
+        $factory->getComposite();
+    }
+
+    public function testMethodGetobjectsGetsDelegated()
+    {
+        $this->factory->expects($this->once())
+            ->method('getObjects');
+        $factory = new Horde_Kolab_Server_Factory_Decorator_Log(
+            $this->factory, 'logger'
+        );
+        $factory->getObjects();
+    }
+
+    public function testMethodGetstructureGetsDelegated()
+    {
+        $this->factory->expects($this->once())
+            ->method('getStructure');
+        $factory = new Horde_Kolab_Server_Factory_Decorator_Log(
+            $this->factory, 'logger'
+        );
+        $factory->getStructure();
+    }
+
+    public function testMethodGetsearchGetsDelegated()
+    {
+        $this->factory->expects($this->once())
+            ->method('getSearch');
+        $factory = new Horde_Kolab_Server_Factory_Decorator_Log(
+            $this->factory, 'logger'
+        );
+        $factory->getSearch();
+    }
+
+    public function testMethodGetschemaGetsDelegated()
+    {
+        $this->factory->expects($this->once())
+            ->method('getSchema');
+        $factory = new Horde_Kolab_Server_Factory_Decorator_Log(
+            $this->factory, 'logger'
+        );
+        $factory->getSchema();
+    }
+}
\ No newline at end of file
diff --git a/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/Decorator/MapTest.php b/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/Decorator/MapTest.php
new file mode 100644 (file)
index 0000000..9668883
--- /dev/null
@@ -0,0 +1,164 @@
+<?php
+/**
+ * Test the mapping server factory.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+
+/**
+ * Prepare the test setup.
+ */
+require_once dirname(__FILE__) . '/../../../../Autoload.php';
+
+/**
+ * Test the mapping server factory.
+ *
+ * Copyright 2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package  Kolab_Server
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Server
+ */
+class Horde_Kolab_Server_Class_Server_Factory_Decorator_MapTest
+extends PHPUnit_Framework_TestCase
+{
+    public function setUp()
+    {
+        $this->factory = $this->getMock(
+            'Horde_Kolab_Server_Factory_Interface'
+        );
+    }
+
+    public function testMethodGetserverHasResultMappedServer()
+    {
+        $this->factory->expects($this->once())
+            ->method('getServer')
+            ->will(
+                $this->returnValue(
+                    $this->getMock('Horde_Kolab_Server_Interface')
+                )
+            );
+        $factory = new Horde_Kolab_Server_Factory_Decorator_Map(
+            $this->factory, array()
+        );
+        $this->assertType(
+            'Horde_Kolab_Server_Decorator_Map',
+            $factory->getServer()
+        );
+    }
+
+    public function testMethodConstructHasParametersFactoryAndArrayMapping()
+    {
+        $factory = new Horde_Kolab_Server_Factory_Decorator_Map(
+            $this->factory, array()
+        );
+    }
+
+    public function testMethodGetconnectionfactoryGetsDelegated()
+    {
+        $this->factory->expects($this->once())
+            ->method('getConnectionFactory');
+        $factory = new Horde_Kolab_Server_Factory_Decorator_Map(
+            $this->factory, array()
+        );
+        $factory->getConnectionFactory();
+    }
+
+    public function testMethodGetserverGetsDelegated()
+    {
+        $this->factory->expects($this->once())
+            ->method('getServer')
+            ->will(
+                $this->returnValue(
+                    $this->getMock(
+                        'Horde_Kolab_Server_Interface'
+                    )
+                )
+            );
+        $factory = new Horde_Kolab_Server_Factory_Decorator_Map(
+            $this->factory, array()
+        );
+        $factory->getServer();
+    }
+
+    public function testMethodGetconfigurationGetsDelegated()
+    {
+        $this->factory->expects($this->once())
+            ->method('getConfiguration');
+        $factory = new Horde_Kolab_Server_Factory_Decorator_Map(
+            $this->factory, array()
+        );
+        $factory->getConfiguration();
+    }
+
+    public function testMethodGetconnectionGetsDelegated()
+    {
+        $this->factory->expects($this->once())
+            ->method('getConnection');
+        $factory = new Horde_Kolab_Server_Factory_Decorator_Map(
+            $this->factory, array()
+        );
+        $factory->getConnection();
+    }
+
+    public function testMethodGetcompositeGetsDelegated()
+    {
+        $this->factory->expects($this->once())
+            ->method('getComposite');
+        $factory = new Horde_Kolab_Server_Factory_Decorator_Map(
+            $this->factory, array()
+        );
+        $factory->getComposite();
+    }
+
+    public function testMethodGetobjectsGetsDelegated()
+    {
+        $this->factory->expects($this->once())
+            ->method('getObjects');
+        $factory = new Horde_Kolab_Server_Factory_Decorator_Map(
+            $this->factory, array()
+        );
+        $factory->getObjects();
+    }
+
+    public function testMethodGetstructureGetsDelegated()
+    {
+        $this->factory->expects($this->once())
+            ->method('getStructure');
+        $factory = new Horde_Kolab_Server_Factory_Decorator_Map(
+            $this->factory, array()
+        );
+        $factory->getStructure();
+    }
+
+    public function testMethodGetsearchGetsDelegated()
+    {
+        $this->factory->expects($this->once())
+            ->method('getSearch');
+        $factory = new Horde_Kolab_Server_Factory_Decorator_Map(
+            $this->factory, array()
+        );
+        $factory->getSearch();
+    }
+
+    public function testMethodGetschemaGetsDelegated()
+    {
+        $this->factory->expects($this->once())
+            ->method('getSchema');
+        $factory = new Horde_Kolab_Server_Factory_Decorator_Map(
+            $this->factory, array()
+        );
+        $factory->getSchema();
+    }
+}
\ No newline at end of file
index 024b50f..de20a2f 100644 (file)
@@ -37,7 +37,7 @@ extends Horde_Kolab_Server_LdapTestCase
     {
         $injector = new Horde_Injector(new Horde_Injector_TopLevel());
         Horde_Kolab_Server_Factory_Injector::setup(
-            'Horde_Kolab_Server_Factory_Conn_Mock',
+            'Horde_Kolab_Server_Factory_Connection_Mock',
             $configuration,
             $injector
         );
@@ -49,7 +49,7 @@ extends Horde_Kolab_Server_LdapTestCase
     public function testMethodGetconnectionfactoryHasResultConnectionfactory()
     {
         $this->assertType(
-            'Horde_Kolab_Server_Factory_Conn',
+            'Horde_Kolab_Server_Factory_Connection_Interface',
             $this->_getFactory(array())->getConnectionFactory()
         );
     }
@@ -58,7 +58,7 @@ extends Horde_Kolab_Server_LdapTestCase
     {
         $factory = $this->_getFactory(array());
         $this->assertType(
-            'Horde_Kolab_Server_Connection',
+            'Horde_Kolab_Server_Connection_Interface',
             $factory->getConnection()
         );
     }
@@ -101,7 +101,7 @@ extends Horde_Kolab_Server_LdapTestCase
     {
         $factory = $this->_getFactory(array());
         $this->assertType(
-            'Horde_Kolab_Server_Objects',
+            'Horde_Kolab_Server_Objects_Interface',
             $factory->getObjects()
         );
     }
@@ -143,7 +143,7 @@ extends Horde_Kolab_Server_LdapTestCase
     {
         $factory = $this->_getFactory(array());
         $this->assertType(
-            'Horde_Kolab_Server_Schema',
+            'Horde_Kolab_Server_Schema_Interface',
             $factory->getSchema()
         );
     }
@@ -153,7 +153,7 @@ extends Horde_Kolab_Server_LdapTestCase
         $this->skipIfNoLdap();
         $factory = $this->_getFactory(array('basedn' => 'test'));
         $this->assertType(
-            'Horde_Kolab_Server_Composite',
+            'Horde_Kolab_Server_Composite_Interface',
             $factory->getComposite()
         );
     }
index e0bb3eb..e5afa79 100644 (file)
@@ -35,8 +35,12 @@ extends Horde_Kolab_Server_LdapTestCase
 {
     public function setUp()
     {
-        $this->conn_factory = $this->getMock('Horde_Kolab_Server_Factory_Conn');
-        $this->connection = $this->getMock('Horde_Kolab_Server_Connection');
+        $this->conn_factory = $this->getMock(
+            'Horde_Kolab_Server_Factory_Connection_Interface'
+        );
+        $this->connection = $this->getMock(
+            'Horde_Kolab_Server_Connection_Interface'
+        );
     }
 
     public function testMethodConstructHasParametersConnectionfactoryAndArrayParameters()
@@ -74,7 +78,7 @@ extends Horde_Kolab_Server_LdapTestCase
             $this->conn_factory, array()
         );
         $this->assertType(
-            'Horde_Kolab_Server_Connection',
+            'Horde_Kolab_Server_Connection_Interface',
             $factory->getConnection()
         );
     }
@@ -176,7 +180,7 @@ extends Horde_Kolab_Server_LdapTestCase
             $this->conn_factory, array('basedn' => 'test')
         );
         $this->assertType(
-            'Horde_Kolab_Server_Composite',
+            'Horde_Kolab_Server_Composite_Interface',
             $factory->getComposite()
         );
     }
diff --git a/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/LoggedTest.php b/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/LoggedTest.php
deleted file mode 100644 (file)
index 9f299be..0000000
+++ /dev/null
@@ -1,149 +0,0 @@
-<?php
-/**
- * Test the log decorator server factory.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-
-/**
- * Prepare the test setup.
- */
-require_once dirname(__FILE__) . '/../../../Autoload.php';
-
-/**
- * Test the log decorator server factory.
- *
- * Copyright 2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-class Horde_Kolab_Server_Class_Server_Factory_LoggedTest
-extends PHPUnit_Framework_TestCase
-{
-    public function setUp()
-    {
-        $this->factory = $this->getMock('Horde_Kolab_Server_Factory');
-    }
-
-    public function testMethodGetserverHasResultLoggedServerIfALoggerWasProvidedInTheConfiguration()
-    {
-        $this->factory->expects($this->once())
-            ->method('getServer')
-            ->will($this->returnValue($this->getMock('Horde_Kolab_Server')));
-        $factory = new Horde_Kolab_Server_Factory_Logged(
-            $this->factory, 'logger'
-        );
-        $this->assertType('Horde_Kolab_Server_Logged', $factory->getServer());
-    }
-
-    public function testMethodConstructHasParametersFactoryAndMixedLoggerParameter()
-    {
-        $factory = new Horde_Kolab_Server_Factory_Logged(
-            $this->factory, 'logger'
-        );
-    }
-
-    public function testMethodGetconnectionfactoryGetsDelegated()
-    {
-        $this->factory->expects($this->once())
-            ->method('getConnectionFactory');
-        $factory = new Horde_Kolab_Server_Factory_Logged(
-            $this->factory, 'logger'
-        );
-        $factory->getConnectionFactory();
-    }
-
-    public function testMethodGetserverGetsDelegated()
-    {
-        $this->factory->expects($this->once())
-            ->method('getServer')
-            ->will($this->returnValue($this->getMock('Horde_Kolab_Server')));
-        $factory = new Horde_Kolab_Server_Factory_Logged(
-            $this->factory, 'logger'
-        );
-        $factory->getServer();
-    }
-
-    public function testMethodGetconfigurationGetsDelegated()
-    {
-        $this->factory->expects($this->once())
-            ->method('getConfiguration');
-        $factory = new Horde_Kolab_Server_Factory_Logged(
-            $this->factory, 'logger'
-        );
-        $factory->getConfiguration();
-    }
-
-    public function testMethodGetconnectionGetsDelegated()
-    {
-        $this->factory->expects($this->once())
-            ->method('getConnection');
-        $factory = new Horde_Kolab_Server_Factory_Logged(
-            $this->factory, 'logger'
-        );
-        $factory->getConnection();
-    }
-
-    public function testMethodGetcompositeGetsDelegated()
-    {
-        $this->factory->expects($this->once())
-            ->method('getComposite');
-        $factory = new Horde_Kolab_Server_Factory_Logged(
-            $this->factory, 'logger'
-        );
-        $factory->getComposite();
-    }
-
-    public function testMethodGetobjectsGetsDelegated()
-    {
-        $this->factory->expects($this->once())
-            ->method('getObjects');
-        $factory = new Horde_Kolab_Server_Factory_Logged(
-            $this->factory, 'logger'
-        );
-        $factory->getObjects();
-    }
-
-    public function testMethodGetstructureGetsDelegated()
-    {
-        $this->factory->expects($this->once())
-            ->method('getStructure');
-        $factory = new Horde_Kolab_Server_Factory_Logged(
-            $this->factory, 'logger'
-        );
-        $factory->getStructure();
-    }
-
-    public function testMethodGetsearchGetsDelegated()
-    {
-        $this->factory->expects($this->once())
-            ->method('getSearch');
-        $factory = new Horde_Kolab_Server_Factory_Logged(
-            $this->factory, 'logger'
-        );
-        $factory->getSearch();
-    }
-
-    public function testMethodGetschemaGetsDelegated()
-    {
-        $this->factory->expects($this->once())
-            ->method('getSchema');
-        $factory = new Horde_Kolab_Server_Factory_Logged(
-            $this->factory, 'logger'
-        );
-        $factory->getSchema();
-    }
-}
\ No newline at end of file
diff --git a/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/MappedTest.php b/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/MappedTest.php
deleted file mode 100644 (file)
index c2ea0b1..0000000
+++ /dev/null
@@ -1,149 +0,0 @@
-<?php
-/**
- * Test the mapping server factory.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-
-/**
- * Prepare the test setup.
- */
-require_once dirname(__FILE__) . '/../../../Autoload.php';
-
-/**
- * Test the mapping server factory.
- *
- * Copyright 2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-class Horde_Kolab_Server_Class_Server_Factory_MappedTest
-extends PHPUnit_Framework_TestCase
-{
-    public function setUp()
-    {
-        $this->factory = $this->getMock('Horde_Kolab_Server_Factory');
-    }
-
-    public function testMethodGetserverHasResultMappedServer()
-    {
-        $this->factory->expects($this->once())
-            ->method('getServer')
-            ->will($this->returnValue($this->getMock('Horde_Kolab_Server')));
-        $factory = new Horde_Kolab_Server_Factory_Mapped(
-            $this->factory, array()
-        );
-        $this->assertType('Horde_Kolab_Server_Mapped', $factory->getServer());
-    }
-
-    public function testMethodConstructHasParametersFactoryAndArrayMapping()
-    {
-        $factory = new Horde_Kolab_Server_Factory_Mapped(
-            $this->factory, array()
-        );
-    }
-
-    public function testMethodGetconnectionfactoryGetsDelegated()
-    {
-        $this->factory->expects($this->once())
-            ->method('getConnectionFactory');
-        $factory = new Horde_Kolab_Server_Factory_Mapped(
-            $this->factory, array()
-        );
-        $factory->getConnectionFactory();
-    }
-
-    public function testMethodGetserverGetsDelegated()
-    {
-        $this->factory->expects($this->once())
-            ->method('getServer')
-            ->will($this->returnValue($this->getMock('Horde_Kolab_Server')));
-        $factory = new Horde_Kolab_Server_Factory_Mapped(
-            $this->factory, array()
-        );
-        $factory->getServer();
-    }
-
-    public function testMethodGetconfigurationGetsDelegated()
-    {
-        $this->factory->expects($this->once())
-            ->method('getConfiguration');
-        $factory = new Horde_Kolab_Server_Factory_Mapped(
-            $this->factory, array()
-        );
-        $factory->getConfiguration();
-    }
-
-    public function testMethodGetconnectionGetsDelegated()
-    {
-        $this->factory->expects($this->once())
-            ->method('getConnection');
-        $factory = new Horde_Kolab_Server_Factory_Mapped(
-            $this->factory, array()
-        );
-        $factory->getConnection();
-    }
-
-    public function testMethodGetcompositeGetsDelegated()
-    {
-        $this->factory->expects($this->once())
-            ->method('getComposite');
-        $factory = new Horde_Kolab_Server_Factory_Mapped(
-            $this->factory, array()
-        );
-        $factory->getComposite();
-    }
-
-    public function testMethodGetobjectsGetsDelegated()
-    {
-        $this->factory->expects($this->once())
-            ->method('getObjects');
-        $factory = new Horde_Kolab_Server_Factory_Mapped(
-            $this->factory, array()
-        );
-        $factory->getObjects();
-    }
-
-    public function testMethodGetstructureGetsDelegated()
-    {
-        $this->factory->expects($this->once())
-            ->method('getStructure');
-        $factory = new Horde_Kolab_Server_Factory_Mapped(
-            $this->factory, array()
-        );
-        $factory->getStructure();
-    }
-
-    public function testMethodGetsearchGetsDelegated()
-    {
-        $this->factory->expects($this->once())
-            ->method('getSearch');
-        $factory = new Horde_Kolab_Server_Factory_Mapped(
-            $this->factory, array()
-        );
-        $factory->getSearch();
-    }
-
-    public function testMethodGetschemaGetsDelegated()
-    {
-        $this->factory->expects($this->once())
-            ->method('getSchema');
-        $factory = new Horde_Kolab_Server_Factory_Mapped(
-            $this->factory, array()
-        );
-        $factory->getSchema();
-    }
-}
\ No newline at end of file
index a0c47bc..fcbaf84 100644 (file)
@@ -35,21 +35,21 @@ class Horde_Kolab_Server_Class_Server_Ldap_ChangesTest extends PHPUnit_Framework
     public function testMethodConstructHasParameterServerobject()
     {
         $changes = new Horde_Kolab_Server_Ldap_Changes(
-            $this->getMock('Horde_Kolab_Server_Object'), array()
+            $this->getMock('Horde_Kolab_Server_Object_Interface'), array()
         );
     }
 
     public function testMethodConstructHasParameterArrayDataToBeStored()
     {
         $changes = new Horde_Kolab_Server_Ldap_Changes(
-            $this->getMock('Horde_Kolab_Server_Object'),
+            $this->getMock('Horde_Kolab_Server_Object_Interface'),
             array('store' => 'value')
         );
     }
 
     public function testMethodGetchangesetHasResultArrayEmptyIfOldAndNewDatasetsWereEmpty()
     {
-        $object = $this->getMock('Horde_Kolab_Server_Object');
+        $object = $this->getMock('Horde_Kolab_Server_Object_Interface');
         $object->expects($this->once())
             ->method('readInternal')
             ->will($this->returnValue(array()));
@@ -61,7 +61,7 @@ class Horde_Kolab_Server_Class_Server_Ldap_ChangesTest extends PHPUnit_Framework
 
     public function testMethodGetchangesetHasResultArrayEmptyIfOldAndNewDatasetsWereEqual()
     {
-        $object = $this->getMock('Horde_Kolab_Server_Object');
+        $object = $this->getMock('Horde_Kolab_Server_Object_Interface');
         $object->expects($this->once())
             ->method('readInternal')
             ->will($this->returnValue(array('a' => array('a'))));
@@ -73,7 +73,7 @@ class Horde_Kolab_Server_Class_Server_Ldap_ChangesTest extends PHPUnit_Framework
 
     public function testMethodGetchangesetHasResultArrayNewAttributesInNewDatasetAsAdded()
     {
-        $object = $this->getMock('Horde_Kolab_Server_Object');
+        $object = $this->getMock('Horde_Kolab_Server_Object_Interface');
         $object->expects($this->once())
             ->method('readInternal')
             ->will($this->returnValue(array()));
@@ -92,7 +92,7 @@ class Horde_Kolab_Server_Class_Server_Ldap_ChangesTest extends PHPUnit_Framework
 
     public function testMethodGetchangesetHasResultArrayMissingValuesInNewDatasetAsDeleted()
     {
-        $object = $this->getMock('Horde_Kolab_Server_Object');
+        $object = $this->getMock('Horde_Kolab_Server_Object_Interface');
         $object->expects($this->once())
             ->method('readInternal')
             ->will($this->returnValue(array('old' => 'a')));
@@ -111,7 +111,7 @@ class Horde_Kolab_Server_Class_Server_Ldap_ChangesTest extends PHPUnit_Framework
 
     public function testMethodGetchangesetHasResultArraySingleValuesWithDifferencesAsReplaced()
     {
-        $object = $this->getMock('Horde_Kolab_Server_Object');
+        $object = $this->getMock('Horde_Kolab_Server_Object_Interface');
         $object->expects($this->once())
             ->method('readInternal')
             ->will($this->returnValue(array('value' => 'a')));
@@ -130,7 +130,7 @@ class Horde_Kolab_Server_Class_Server_Ldap_ChangesTest extends PHPUnit_Framework
 
     public function testMethodGetchangesetHasResultArrayTheNewValuesAsAdded()
     {
-        $object = $this->getMock('Horde_Kolab_Server_Object');
+        $object = $this->getMock('Horde_Kolab_Server_Object_Interface');
         $object->expects($this->once())
             ->method('readInternal')
             ->will($this->returnValue(array('value' => array('a', 'b', 'c'))));
@@ -149,7 +149,7 @@ class Horde_Kolab_Server_Class_Server_Ldap_ChangesTest extends PHPUnit_Framework
 
     public function testMethodGetchangesetHasResultArrayTheRemovedValuesAsDeleted()
     {
-        $object = $this->getMock('Horde_Kolab_Server_Object');
+        $object = $this->getMock('Horde_Kolab_Server_Object_Interface');
         $object->expects($this->once())
             ->method('readInternal')
             ->will($this->returnValue(array('value' => array('a', 'b', 'c'))));
@@ -168,7 +168,7 @@ class Horde_Kolab_Server_Class_Server_Ldap_ChangesTest extends PHPUnit_Framework
 
     public function testMethodGetchangesetHasResultArrayTheNewValuesAsAddedAndTheRemovedValuesAsDeleted()
     {
-        $object = $this->getMock('Horde_Kolab_Server_Object');
+        $object = $this->getMock('Horde_Kolab_Server_Object_Interface');
         $object->expects($this->once())
             ->method('readInternal')
             ->will($this->returnValue(array('value' => array('a', 'b', 'c'))));
index 6316fe0..e6d7de9 100644 (file)
@@ -265,9 +265,7 @@ class Horde_Kolab_Server_Class_Server_LdapTest extends Horde_Kolab_Server_LdapTe
         $entry = $this->getMock(
             'Net_LDAP2_Entry', array(), array(), '', false
         );
-        $object = $this->getMock(
-            'Horde_Kolab_Server_Object', array(), array(), '', false
-        );
+        $object = $this->getMock('Horde_Kolab_Server_Object_Interface');
         $this->ldap_write->expects($this->exactly(1))
             ->method('getEntry')
             ->will($this->returnValue($entry));
@@ -285,9 +283,7 @@ class Horde_Kolab_Server_Class_Server_LdapTest extends Horde_Kolab_Server_LdapTe
         $entry = $this->getMock(
             'Net_LDAP2_Entry', array(), array(), '', false
         );
-        $object = $this->getMock(
-            'Horde_Kolab_Server_Object', array(), array(), '', false
-        );
+        $object = $this->getMock('Horde_Kolab_Server_Object_Interface');
         $this->ldap_write->expects($this->exactly(1))
             ->method('getEntry')
             ->will($this->returnValue($entry));
@@ -305,9 +301,7 @@ class Horde_Kolab_Server_Class_Server_LdapTest extends Horde_Kolab_Server_LdapTe
         $entry = $this->getMock(
             'Net_LDAP2_Entry', array(), array(), '', false
         );
-        $object = $this->getMock(
-            'Horde_Kolab_Server_Object', array(), array(), '', false
-        );
+        $object = $this->getMock('Horde_Kolab_Server_Object_Interface');
         $this->ldap_write->expects($this->exactly(1))
             ->method('getEntry')
             ->will($this->returnValue($entry));
@@ -322,9 +316,7 @@ class Horde_Kolab_Server_Class_Server_LdapTest extends Horde_Kolab_Server_LdapTe
 
     public function testMethodSaveThrowsExceptionIfSavingDataFailed()
     {
-        $object = $this->getMock(
-            'Horde_Kolab_Server_Object', array(), array(), '', false
-        );
+        $object = $this->getMock('Horde_Kolab_Server_Object_Interface');
         $this->ldap_write->expects($this->exactly(1))
             ->method('modify')
             ->will($this->returnValue(new PEAR_Error('Saving failed!')));
@@ -342,9 +334,7 @@ class Horde_Kolab_Server_Class_Server_LdapTest extends Horde_Kolab_Server_LdapTe
 
     public function testMethodAddHasParameterObjectTheObjectToAddToTheServer()
     {
-        $object = $this->getMock(
-            'Horde_Kolab_Server_Object', array(), array(), '', false
-        );
+        $object = $this->getMock('Horde_Kolab_Server_Object_Interface');
         $this->ldap_write->expects($this->exactly(1))
             ->method('add')
             ->with(new PHPUnit_Framework_Constraint_IsInstanceOf('Net_LDAP2_Entry'));
@@ -353,9 +343,7 @@ class Horde_Kolab_Server_Class_Server_LdapTest extends Horde_Kolab_Server_LdapTe
 
     public function testMethodAddHasParameterArrayData()
     {
-        $object = $this->getMock(
-            'Horde_Kolab_Server_Object', array(), array(), '', false
-        );
+        $object = $this->getMock('Horde_Kolab_Server_Object_Interface');
         $this->ldap_write->expects($this->exactly(1))
             ->method('add')
             ->with(new PHPUnit_Framework_Constraint_IsInstanceOf('Net_LDAP2_Entry'));
@@ -364,9 +352,7 @@ class Horde_Kolab_Server_Class_Server_LdapTest extends Horde_Kolab_Server_LdapTe
 
     public function testMethodAddHasPostconditionThatTheEntryWasModified()
     {
-        $object = $this->getMock(
-            'Horde_Kolab_Server_Object', array(), array(), '', false
-        );
+        $object = $this->getMock('Horde_Kolab_Server_Object_Interface');
         $this->ldap_write->expects($this->exactly(1))
             ->method('add')
             ->with(new PHPUnit_Framework_Constraint_IsInstanceOf('Net_LDAP2_Entry'));
@@ -375,9 +361,7 @@ class Horde_Kolab_Server_Class_Server_LdapTest extends Horde_Kolab_Server_LdapTe
 
     public function testMethodAddThrowsExceptionIfSavingDataFailed()
     {
-        $object = $this->getMock(
-            'Horde_Kolab_Server_Object', array(), array(), '', false
-        );
+        $object = $this->getMock('Horde_Kolab_Server_Object_Interface');
         $this->ldap_write->expects($this->exactly(1))
             ->method('add')
             ->will($this->returnValue(new PEAR_Error('Saving failed!')));
diff --git a/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/LoggedTest.php b/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/LoggedTest.php
deleted file mode 100644 (file)
index f094ee9..0000000
+++ /dev/null
@@ -1,228 +0,0 @@
-<?php
-/**
- * Test the log decorator for the server.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-
-/**
- * Prepare the test setup.
- */
-require_once dirname(__FILE__) . '/../../Autoload.php';
-
-/**
- * Test the log decorator for the server.
- *
- * Copyright 2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @category Kolab
- * @package  Kolab_Server
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Server
- */
-class Horde_Kolab_Server_Class_Server_LoggedTest extends PHPUnit_Framework_TestCase
-{
-    public function setUp()
-    {
-        parent::setUp();
-
-        $this->logger = $this->getMock('Horde_Log_Logger');
-        $this->server = $this->getMock('Horde_Kolab_Server');
-        $this->logged = new Horde_Kolab_Server_Logged(
-            $this->server, $this->logger
-        );
-    }
-
-    public function testMethodGetbaseguidHasPostconditionThatTheCallWasDelegatedToTheServer()
-    {
-        $this->server->expects($this->exactly(1))
-            ->method('getBaseGuid')
-            ->will($this->returnValue('base'));
-        $this->assertEquals('base', $this->logged->getBaseGuid());
-    }
-
-    public function testMethodGetuidHasPostconditionThatTheCallWasDelegatedToTheServer()
-    {
-        $this->server->expects($this->exactly(1))
-            ->method('getGuid')
-            ->will($this->returnValue('guid'));
-        $this->assertEquals('guid', $this->logged->getGuid());
-    }
-
-    public function testMethodConnectguidHasPostconditionThatTheCallWasDelegatedToTheServer()
-    {
-        $this->server->expects($this->exactly(1))
-            ->method('connectGuid')
-            ->with('user', 'pass');
-        $this->logged->connectGuid('user', 'pass');
-    }
-
-    public function testMethodReadHasPostconditionThatTheCallWasDelegatedToTheServer()
-    {
-        $this->server->expects($this->exactly(1))
-            ->method('read')
-            ->with('guid')
-            ->will($this->returnValue(array()));
-        $this->assertEquals(array(), $this->logged->read('guid'));
-    }
-
-    public function testMethodReadattributesHasPostconditionThatTheCallWasDelegatedToTheServer()
-    {
-        $this->server->expects($this->exactly(1))
-            ->method('readAttributes')
-            ->with('guid', array('a'))
-            ->will($this->returnValue(array()));
-        $this->assertEquals(
-            array(), $this->logged->readAttributes('guid', array('a'))
-        );
-    }
-
-    public function testMethodFindHasPostconditionThatTheCallWasDelegatedToTheServer()
-    {
-        $result = $this->getMock('Horde_Kolab_Server_Result');
-        $query = $this->getMock(
-            'Horde_Kolab_Server_Query_Element', array(), array(), '', false
-        );
-        $this->server->expects($this->exactly(1))
-            ->method('find')
-            ->with($query)
-            ->will($this->returnValue($result));
-        $this->assertType(
-            'Horde_Kolab_Server_Result',
-            $this->logged->find($query)
-        );
-    }
-
-    public function testMethodFindbelowHasPostconditionThatTheCallWasDelegatedToTheServer()
-    {
-        $result = $this->getMock('Horde_Kolab_Server_Result');
-        $query = $this->getMock(
-            'Horde_Kolab_Server_Query_Element', array(), array(), '', false
-        );
-        $this->server->expects($this->exactly(1))
-            ->method('findBelow')
-            ->with($query, 'none')
-            ->will($this->returnValue($result));
-        $this->assertType(
-            'Horde_Kolab_Server_Result',
-            $this->logged->findBelow($query, 'none')
-        );
-    }
-
-    public function testMethodSaveHasPostconditionThatTheCallWasDelegatedToTheServer()
-    {
-        $object = $this->getMock(
-            'Horde_Kolab_Server_Object', array(), array(), '', false
-        );
-        $this->server->expects($this->exactly(1))
-            ->method('save')
-            ->with($object, array('a' => 'a'));
-        $this->logged->save($object, array('a' => 'a'));
-    }
-
-    public function testMethodAddHasPostconditionThatTheCallWasDelegatedToTheServer()
-    {
-        $object = $this->getMock(
-            'Horde_Kolab_Server_Object', array(), array(), '', false
-        );
-        $this->server->expects($this->exactly(1))
-            ->method('add')
-            ->with($object, array('a' => 'a'));
-        $this->logged->add($object, array('a' => 'a'));
-    }
-
-    public function testMethodDeleteHasPostconditionThatTheCallWasDelegatedToTheServer()
-    {
-        $this->server->expects($this->exactly(1))
-            ->method('delete')
-            ->with('a');
-        $this->logged->delete('a');
-    }
-
-    public function testMethodRenameHasPostconditionThatTheCallWasDelegatedToTheServer()
-    {
-        $this->server->expects($this->exactly(1))
-            ->method('rename')
-            ->with('a', 'b');
-        $this->logged->rename('a', 'b');
-    }
-
-    public function testMethodGetschemaHasPostconditionThatTheCallWasDelegatedToTheServer()
-    {
-        $this->server->expects($this->exactly(1))
-            ->method('getSchema');
-        $this->logged->getSchema();
-    }
-
-    public function testMethodSaveHasPostconditionThatTheEventWasLogged()
-    {
-        $object = $this->getMock(
-            'Horde_Kolab_Server_Object', array(), array(), '', false
-        );
-        $object->expects($this->once())
-            ->method('getGuid')
-            ->will($this->returnValue('a'));
-        $this->logger->expects($this->once())
-            ->method('__call')
-            ->with(
-                'info', array('The object "a" has been successfully saved!')
-            );
-        $this->logged->save($object, array('a' => 'a'));
-    }
-
-    public function testMethodAddHasPostconditionThatTheEventWasLogged()
-    {
-        $object = $this->getMock(
-            'Horde_Kolab_Server_Object', array(), array(), '', false
-        );
-        $object->expects($this->once())
-            ->method('getGuid')
-            ->will($this->returnValue('a'));
-        $this->logger->expects($this->once())
-            ->method('__call')
-            ->with(
-                'info', array('The object "a" has been successfully added!')
-            );
-        $this->logged->add($object, array('a' => 'a'));
-    }
-
-    public function testMethodDeleteHasPostconditionThatTheEventWasLogged()
-    {
-        $this->logger->expects($this->once())
-            ->method('__call')
-            ->with(
-                'info', array('The object "a" has been successfully deleted!')
-            );
-        $this->logged->delete('a');
-    }
-
-    public function testMethodRenameHasPostconditionThatTheEventWasLogged()
-    {
-        $this->logger->expects($this->once())
-            ->method('__call')
-            ->with(
-                'info',
-                array('The object "a" has been successfully renamed to "b"!')
-            );
-        $this->logged->rename('a', 'b');
-    }
-
-    public function testMethodGetparentguidHasPostconditionThatTheCallWasDelegatedToTheServer()
-    {
-        $this->server->expects($this->exactly(1))
-            ->method('getParentGuid')
-            ->will($this->returnValue('parent'));
-        $this->assertEquals('parent', $this->logged->getParentGuid('child'));
-    }
-
-}
\ No newline at end of file
index 0b10da1..043060f 100644 (file)
@@ -36,7 +36,7 @@ extends Horde_Kolab_Server_TestCase
     public function setUp()
     {
         $this->object = $this->getMock(
-            'Horde_Kolab_Server_Object', array(), array(), '', false
+            'Horde_Kolab_Server_Object_Interface'
         );
         $this->composite = $this->getMockedComposite();
     }
@@ -54,13 +54,16 @@ extends Horde_Kolab_Server_TestCase
     public function testMethodGetobjectReturnsObjectAssociatedWithThisAttribute()
     {
         $attribute = new Attribute_Mock($this->object, $this->composite, '');
-        $this->assertType('Horde_Kolab_Server_Object', $attribute->getObject());
+        $this->assertType(
+            'Horde_Kolab_Server_Object_Interface',
+            $attribute->getObject()
+        );
     }
 
     public function testMethodGetnameReturnsStringTheNameOfTheAttribute()
     {
         $this->composite->structure->expects($this->exactly(1))
-            ->method('getInternalAttribute')
+            ->method('mapExternalToInternalAttribute')
             ->with('name')
             ->will($this->returnValue('name'));
         $attribute = new Attribute_Mock($this->object, $this->composite, 'name');
index 26932b5..32e2a8b 100644 (file)
@@ -74,7 +74,7 @@ class Horde_Kolab_Server_Class_Server_Object_BaseTest extends Horde_Kolab_Server
         $composite = $this->getMockedComposite();
         $composite->schema->expects($this->once())
             ->method('getExternalAttributes')
-            ->with($this->isInstanceOf('Horde_Kolab_Server_Object'))
+            ->with($this->isInstanceOf('Horde_Kolab_Server_Object_Interface'))
             ->will($this->returnValue(array('external')));
         $object = new Object_Mock($composite, 'guid');
         $this->assertEquals(array('external'), $object->getExternalAttributes());
@@ -85,7 +85,7 @@ class Horde_Kolab_Server_Class_Server_Object_BaseTest extends Horde_Kolab_Server
         $composite = $this->getMockedComposite();
         $composite->schema->expects($this->once())
             ->method('getInternalAttributes')
-            ->with($this->isInstanceOf('Horde_Kolab_Server_Object'))
+            ->with($this->isInstanceOf('Horde_Kolab_Server_Object_Interface'))
             ->will($this->returnValue(array('internal' => 'Internal')));
         $object = new Object_Mock($composite, 'guid');
         $this->assertEquals(array('internal' => 'Internal'), $object->getInternalAttributes());
@@ -103,7 +103,7 @@ class Horde_Kolab_Server_Class_Server_Object_BaseTest extends Horde_Kolab_Server
         $composite = $this->getMockedComposite();
         $composite->schema->expects($this->once())
             ->method('getInternalAttributes')
-            ->with($this->isInstanceOf('Horde_Kolab_Server_Object'))
+            ->with($this->isInstanceOf('Horde_Kolab_Server_Object_Interface'))
             ->will($this->returnValue(array('internal' => 'Internal')));
         $composite->server->expects($this->once())
             ->method('readAttributes')
@@ -118,7 +118,7 @@ class Horde_Kolab_Server_Class_Server_Object_BaseTest extends Horde_Kolab_Server
         $composite = $this->getMockedComposite();
         $composite->schema->expects($this->once())
             ->method('getInternalAttributes')
-            ->with($this->isInstanceOf('Horde_Kolab_Server_Object'))
+            ->with($this->isInstanceOf('Horde_Kolab_Server_Object_Interface'))
             ->will($this->returnValue(array('internal' => 'Internal')));
         $composite->server->expects($this->once())
             ->method('readAttributes')
@@ -133,7 +133,7 @@ class Horde_Kolab_Server_Class_Server_Object_BaseTest extends Horde_Kolab_Server
         $composite = $this->getMockedComposite();
         $composite->schema->expects($this->once())
             ->method('getInternalAttributes')
-            ->with($this->isInstanceOf('Horde_Kolab_Server_Object'))
+            ->with($this->isInstanceOf('Horde_Kolab_Server_Object_Interface'))
             ->will($this->returnValue(array('internal' => 'Internal')));
         $composite->server->expects($this->once())
             ->method('readAttributes')
@@ -150,7 +150,7 @@ class Horde_Kolab_Server_Class_Server_Object_BaseTest extends Horde_Kolab_Server
         $composite = $this->getMockedComposite();
         $composite->schema->expects($this->exactly(2))
             ->method('getInternalAttributes')
-            ->with($this->isInstanceOf('Horde_Kolab_Server_Object'))
+            ->with($this->isInstanceOf('Horde_Kolab_Server_Object_Interface'))
             ->will($this->returnValue(array('internal' => 'Internal')));
         $composite->server->expects($this->once())
             ->method('readAttributes')
@@ -167,7 +167,7 @@ class Horde_Kolab_Server_Class_Server_Object_BaseTest extends Horde_Kolab_Server
         $composite = $this->getMockedComposite();
         $composite->schema->expects($this->once())
             ->method('getInternalAttributes')
-            ->with($this->isInstanceOf('Horde_Kolab_Server_Object'))
+            ->with($this->isInstanceOf('Horde_Kolab_Server_Object_Interface'))
             ->will($this->returnValue(array('internal' => 'Internal')));
         $object = new Object_Mock($composite, 'guid');
         try {
@@ -183,7 +183,7 @@ class Horde_Kolab_Server_Class_Server_Object_BaseTest extends Horde_Kolab_Server
         $composite = $this->getMockedComposite();
         $composite->schema->expects($this->exactly(2))
             ->method('getInternalAttributes')
-            ->with($this->isInstanceOf('Horde_Kolab_Server_Object'))
+            ->with($this->isInstanceOf('Horde_Kolab_Server_Object_Interface'))
             ->will(
                 $this->returnValue(
                     array('internal' => 'Internal', 'test' => 'Test')
@@ -206,16 +206,16 @@ class Horde_Kolab_Server_Class_Server_Object_BaseTest extends Horde_Kolab_Server
     {
         $composite = $this->getMockedComposite();
         $composite->structure->expects($this->exactly(1))
-            ->method('getInternalAttribute')
+            ->method('mapExternalToInternalAttribute')
             ->with('Objectclass')
             ->will($this->returnValue('objectClass'));
         $composite->schema->expects($this->exactly(1))
             ->method('getExternalAttributes')
-            ->with($this->isInstanceOf('Horde_Kolab_Server_Object'))
+            ->with($this->isInstanceOf('Horde_Kolab_Server_Object_Interface'))
             ->will($this->returnValue(array('Objectclass')));
         $composite->schema->expects($this->exactly(2))
             ->method('getInternalAttributes')
-            ->with($this->isInstanceOf('Horde_Kolab_Server_Object'))
+            ->with($this->isInstanceOf('Horde_Kolab_Server_Object_Interface'))
             ->will($this->returnValue(array('objectClass' => 'Objectclass')));
         $composite->server->expects($this->once())
             ->method('readAttributes')
@@ -232,7 +232,7 @@ class Horde_Kolab_Server_Class_Server_Object_BaseTest extends Horde_Kolab_Server
         $composite = $this->getMockedComposite();
         $composite->schema->expects($this->once())
             ->method('getExternalAttributes')
-            ->with($this->isInstanceOf('Horde_Kolab_Server_Object'))
+            ->with($this->isInstanceOf('Horde_Kolab_Server_Object_Interface'))
             ->will($this->returnValue(array('external')));
         $object = new Object_Mock($composite, 'guid');
         try {
@@ -248,7 +248,7 @@ class Horde_Kolab_Server_Class_Server_Object_BaseTest extends Horde_Kolab_Server
         $composite = $this->getMockedComposite();
         $composite->schema->expects($this->once())
             ->method('getExternalAttributes')
-            ->with($this->isInstanceOf('Horde_Kolab_Server_Object'))
+            ->with($this->isInstanceOf('Horde_Kolab_Server_Object_Interface'))
             ->will($this->returnValue(array('Test')));
         $object = new Object_Mock($composite, 'guid');
         try {
@@ -274,7 +274,7 @@ class Horde_Kolab_Server_Class_Server_Object_BaseTest extends Horde_Kolab_Server
         $composite = $this->getMockedComposite();
         $composite->schema->expects($this->exactly(3))
             ->method('getInternalAttributes')
-            ->with($this->isInstanceOf('Horde_Kolab_Server_Object'))
+            ->with($this->isInstanceOf('Horde_Kolab_Server_Object_Interface'))
             ->will(
                 $this->returnValue(
                     array(
@@ -295,12 +295,12 @@ class Horde_Kolab_Server_Class_Server_Object_BaseTest extends Horde_Kolab_Server
     {
         $composite = $this->getMockedComposite();
         $composite->structure->expects($this->exactly(1))
-            ->method('getInternalAttribute')
+            ->method('mapExternalToInternalAttribute')
             ->with('Objectclass')
             ->will($this->returnValue('objectClass'));
         $composite->schema->expects($this->exactly(1))
             ->method('getInternalAttributes')
-            ->with($this->isInstanceOf('Horde_Kolab_Server_Object'))
+            ->with($this->isInstanceOf('Horde_Kolab_Server_Object_Interface'))
             ->will(
                 $this->returnValue(
                     array(
@@ -324,7 +324,7 @@ class Horde_Kolab_Server_Class_Server_Object_BaseTest extends Horde_Kolab_Server
             );
         $composite->server->expects($this->exactly(1))
             ->method('add')
-            ->with($this->isInstanceOf('Horde_Kolab_Server_Object'), array('objectClass' => array('top')));
+            ->with($this->isInstanceOf('Horde_Kolab_Server_Object_Interface'), array('objectClass' => array('top')));
         $object = new Object_Mock($composite);
         $object->save(array('Objectclass' => 'top'));
     }
index 9b5d05a..dd669a3 100644 (file)
@@ -40,7 +40,6 @@ class Horde_Kolab_Server_Class_Server_Query_LdapTest extends Horde_Kolab_Server_
         );
     }
 
-
     public function testMethodConstructHasParameterQueryelementTheQueryCriteria()
     {
         $equals = new Horde_Kolab_Server_Query_Element_Equals('equals', 'equals');
@@ -50,7 +49,7 @@ class Horde_Kolab_Server_Class_Server_Query_LdapTest extends Horde_Kolab_Server_
     public function testMethodConstructHasPostconditionThatTheQueryCriteriaWereSaved()
     {
         $this->structure->expects($this->once())
-            ->method('getInternalAttribute')
+            ->method('mapExternalToInternalAttribute')
             ->will($this->returnValue('equals'));
         $equals = new Horde_Kolab_Server_Query_Element_Equals('equals', 'equals');
         $query = new Horde_Kolab_Server_Query_Ldap($equals, $this->structure);
@@ -63,7 +62,7 @@ class Horde_Kolab_Server_Class_Server_Query_LdapTest extends Horde_Kolab_Server_
     public function testMethodTostringHasResultStringTheQuery()
     {
         $this->structure->expects($this->exactly(2))
-            ->method('getInternalAttribute')
+            ->method('mapExternalToInternalAttribute')
             ->will($this->returnValue('internal'));
         $equals = new Horde_Kolab_Server_Query_Element_Equals('equals', 'equals');
         $contains = new Horde_Kolab_Server_Query_Element_Equals('contains', 'contains');
@@ -78,7 +77,7 @@ class Horde_Kolab_Server_Class_Server_Query_LdapTest extends Horde_Kolab_Server_
     public function testMethodConvertequealsHasResultNetldapfilter()
     {
         $this->structure->expects($this->once())
-            ->method('getInternalAttribute')
+            ->method('mapExternalToInternalAttribute')
             ->will($this->returnValue('equals'));
         $equals = new Horde_Kolab_Server_Query_Element_Equals('equals', 'equals');
         $query = new Horde_Kolab_Server_Query_Ldap($equals, $this->structure);
@@ -91,7 +90,7 @@ class Horde_Kolab_Server_Class_Server_Query_LdapTest extends Horde_Kolab_Server_
     public function testMethodConvertbeginsHasResultNetldapfilter()
     {
         $this->structure->expects($this->once())
-            ->method('getInternalAttribute')
+            ->method('mapExternalToInternalAttribute')
             ->will($this->returnValue('begins'));
         $begins = new Horde_Kolab_Server_Query_Element_Begins('begins', 'begins');
         $query = new Horde_Kolab_Server_Query_Ldap($begins, $this->structure);
@@ -104,7 +103,7 @@ class Horde_Kolab_Server_Class_Server_Query_LdapTest extends Horde_Kolab_Server_
     public function testMethodConvertendsHasResultNetldapfilter()
     {
         $this->structure->expects($this->once())
-            ->method('getInternalAttribute')
+            ->method('mapExternalToInternalAttribute')
             ->will($this->returnValue('ends'));
         $ends = new Horde_Kolab_Server_Query_Element_Ends('ends', 'ends');
         $query = new Horde_Kolab_Server_Query_Ldap($ends, $this->structure);
@@ -117,7 +116,7 @@ class Horde_Kolab_Server_Class_Server_Query_LdapTest extends Horde_Kolab_Server_
     public function testMethodConvertcontainsHasResultNetldapfilter()
     {
         $this->structure->expects($this->once())
-            ->method('getInternalAttribute')
+            ->method('mapExternalToInternalAttribute')
             ->will($this->returnValue('contains'));
         $contains = new Horde_Kolab_Server_Query_Element_Contains('contains', 'contains');
         $query = new Horde_Kolab_Server_Query_Ldap($contains, $this->structure);
@@ -130,7 +129,7 @@ class Horde_Kolab_Server_Class_Server_Query_LdapTest extends Horde_Kolab_Server_
     public function testMethodConvertlessHasResultNetldapfilter()
     {
         $this->structure->expects($this->once())
-            ->method('getInternalAttribute')
+            ->method('mapExternalToInternalAttribute')
             ->will($this->returnValue('less'));
         $less = new Horde_Kolab_Server_Query_Element_Less('less', 'less');
         $query = new Horde_Kolab_Server_Query_Ldap($less, $this->structure);
@@ -143,7 +142,7 @@ class Horde_Kolab_Server_Class_Server_Query_LdapTest extends Horde_Kolab_Server_
     public function testMethodConvertgreaterHasResultNetldapfilter()
     {
         $this->structure->expects($this->once())
-            ->method('getInternalAttribute')
+            ->method('mapExternalToInternalAttribute')
             ->will($this->returnValue('greater'));
         $greater = new Horde_Kolab_Server_Query_Element_Greater('greater', 'greater');
         $query = new Horde_Kolab_Server_Query_Ldap($greater, $this->structure);
@@ -156,7 +155,7 @@ class Horde_Kolab_Server_Class_Server_Query_LdapTest extends Horde_Kolab_Server_
     public function testMethodConvertapproxHasResultNetldapfilter()
     {
         $this->structure->expects($this->once())
-            ->method('getInternalAttribute')
+            ->method('mapExternalToInternalAttribute')
             ->will($this->returnValue('approx'));
         $approx = new Horde_Kolab_Server_Query_Element_Approx('approx', 'approx');
         $query = new Horde_Kolab_Server_Query_Ldap($approx, $this->structure);
@@ -169,7 +168,7 @@ class Horde_Kolab_Server_Class_Server_Query_LdapTest extends Horde_Kolab_Server_
     public function testMethodConvertnotHasResultNetldapfilter()
     {
         $this->structure->expects($this->once())
-            ->method('getInternalAttribute')
+            ->method('mapExternalToInternalAttribute')
             ->will($this->returnValue('equals'));
         $equals = new Horde_Kolab_Server_Query_Element_Equals('equals', 'equals');
         $not = new Horde_Kolab_Server_Query_Element_Not($equals, $this->structure);
@@ -183,7 +182,7 @@ class Horde_Kolab_Server_Class_Server_Query_LdapTest extends Horde_Kolab_Server_
     public function testMethodConvertandHasResultNetldapfilter()
     {
         $this->structure->expects($this->exactly(2))
-            ->method('getInternalAttribute')
+            ->method('mapExternalToInternalAttribute')
             ->will($this->returnValue('internal'));
         $equals = new Horde_Kolab_Server_Query_Element_Equals('equals', 'equals');
         $contains = new Horde_Kolab_Server_Query_Element_Equals('contains', 'contains');
@@ -198,7 +197,7 @@ class Horde_Kolab_Server_Class_Server_Query_LdapTest extends Horde_Kolab_Server_
     public function testMethodConvertorHasResultNetldapfilter()
     {
         $this->structure->expects($this->exactly(2))
-            ->method('getInternalAttribute')
+            ->method('mapExternalToInternalAttribute')
             ->will($this->returnValue('internal'));
         $equals = new Horde_Kolab_Server_Query_Element_Equals('equals', 'equals');
         $contains = new Horde_Kolab_Server_Query_Element_Equals('contains', 'contains');
index fd268c6..0f605a3 100644 (file)
@@ -57,37 +57,41 @@ extends PHPUnit_Framework_TestCase
 
     public function testMethodSearchguidHasResultArrayTheGuidsOfTheSearchResult()
     {
-        $result = $this->getMock('Horde_Kolab_Server_Result');
+        $result = $this->getMock('Horde_Kolab_Server_Result_Interface');
         $result->expects($this->once())
             ->method('asArray')
             ->will($this->returnValue(array('a' => 'a')));
         $this->structure->expects($this->once())
             ->method('find')
             ->with(
-                $this->isInstanceOf('Horde_Kolab_Server_Query_Element'),
+                $this->isInstanceOf(
+                    'Horde_Kolab_Server_Query_Element_Interface'
+                ),
                 array('attributes' => 'Guid')
             )
             ->will($this->returnValue($result));
         $search = new Horde_Kolab_Server_Search_Operation_Guid($this->structure);
-        $criteria = $this->getMock('Horde_Kolab_Server_Query_Element');
+        $criteria = $this->getMock('Horde_Kolab_Server_Query_Element_Interface');
         $this->assertEquals(array('a'), $search->searchGuid($criteria));
     }
 
     public function testMethodSearchguidHasResultArrayEmptyIfTheSearchReturnedNoResults()
     {
-        $result = $this->getMock('Horde_Kolab_Server_Result');
+        $result = $this->getMock('Horde_Kolab_Server_Result_Interface');
         $result->expects($this->once())
             ->method('asArray')
             ->will($this->returnValue(array()));
         $this->structure->expects($this->once())
             ->method('find')
             ->with(
-                $this->isInstanceOf('Horde_Kolab_Server_Query_Element'),
+                $this->isInstanceOf(
+                    'Horde_Kolab_Server_Query_Element_Interface'
+                ),
                 array('attributes' => 'Guid')
             )
             ->will($this->returnValue($result));
         $search = new Horde_Kolab_Server_Search_Operation_Guid($this->structure);
-        $criteria = $this->getMock('Horde_Kolab_Server_Query_Element');
+        $criteria = $this->getMock('Horde_Kolab_Server_Query_Element_Interface');
         $this->assertEquals(array(), $search->searchGuid($criteria));
     }
 }
index 5930dcc..1864e9e 100644 (file)
@@ -34,13 +34,13 @@ class Horde_Kolab_Server_Class_Server_Structure_KolabTest extends PHPUnit_Framew
 {
     public function setUp()
     {
-        $server = $this->getMock('Horde_Kolab_Server');
-        $this->composite = new Horde_Kolab_Server_Composite(
+        $server = $this->getMock('Horde_Kolab_Server_Interface');
+        $this->composite = new Horde_Kolab_Server_Composite_Base(
             $server,
-            $this->getMock('Horde_Kolab_Server_Objects'),
+            $this->getMock('Horde_Kolab_Server_Objects_Interface'),
             new Horde_Kolab_Server_Structure_Kolab(),
             $this->getMock('Horde_Kolab_Server_Search_Interface'),
-            $this->getMock('Horde_Kolab_Server_Schema')
+            $this->getMock('Horde_Kolab_Server_Schema_Interface')
         );
     }
 
@@ -102,7 +102,7 @@ class Horde_Kolab_Server_Class_Server_Structure_KolabTest extends PHPUnit_Framew
             );
         $this->composite->search->expects($this->exactly(1))
             ->method('__call')
-            ->with('getGroups', array('guid'))
+            ->with('searchGroupsForMember', array('guid'))
             ->will(
                 $this->returnValue(
                     array(
@@ -135,7 +135,7 @@ class Horde_Kolab_Server_Class_Server_Structure_KolabTest extends PHPUnit_Framew
             ->will($this->returnValue('base'));
         $this->composite->search->expects($this->exactly(1))
             ->method('__call')
-            ->with('getGroups', array('guid'))
+            ->with('searchGroupsForMember', array('guid'))
             ->will(
                 $this->returnValue(
                     array(
@@ -169,7 +169,7 @@ class Horde_Kolab_Server_Class_Server_Structure_KolabTest extends PHPUnit_Framew
             ->will($this->returnValue('base'));
         $this->composite->search->expects($this->exactly(1))
             ->method('__call')
-            ->with('getGroups', array('guid'))
+            ->with('searchGroupsForMember', array('guid'))
             ->will(
                 $this->returnValue(
                     array(
@@ -203,7 +203,7 @@ class Horde_Kolab_Server_Class_Server_Structure_KolabTest extends PHPUnit_Framew
             ->will($this->returnValue('base'));
         $this->composite->search->expects($this->exactly(1))
             ->method('__call')
-            ->with('getGroups', array('guid'))
+            ->with('searchGroupsForMember', array('guid'))
             ->will(
                 $this->returnValue(
                     array(
@@ -234,7 +234,7 @@ class Horde_Kolab_Server_Class_Server_Structure_KolabTest extends PHPUnit_Framew
             );
         $this->composite->search->expects($this->exactly(1))
             ->method('__call')
-            ->with('getGroups', array('guid,cn=external'))
+            ->with('searchGroupsForMember', array('guid,cn=external'))
             ->will(
                 $this->returnValue(
                     array(
index ac4a990..8b3220d 100644 (file)
@@ -34,13 +34,13 @@ class Horde_Kolab_Server_Class_Server_Structure_LdapTest extends Horde_Kolab_Ser
 {
     public function setUp()
     {
-        $server = $this->getMock('Horde_Kolab_Server');
-        $this->composite = new Horde_Kolab_Server_Composite(
+        $server = $this->getMock('Horde_Kolab_Server_Interface');
+        $this->composite = new Horde_Kolab_Server_Composite_Base(
             $server,
-            $this->getMock('Horde_Kolab_Server_Objects'),
+            $this->getMock('Horde_Kolab_Server_Objects_Interface'),
             new Horde_Kolab_Server_Structure_Ldap(),
             $this->getMock('Horde_Kolab_Server_Search_Interface'),
-            $this->getMock('Horde_Kolab_Server_Schema')
+            $this->getMock('Horde_Kolab_Server_Schema_Interface')
         );
     }
 
@@ -170,7 +170,7 @@ class Horde_Kolab_Server_Class_Server_Structure_LdapTest extends Horde_Kolab_Ser
     {
         $structure = new Horde_Kolab_Server_Structure_Ldap();
         try {
-            $structure->getInternalAttribute('undefined');
+            $structure->mapExternalToInternalAttribute('undefined');
             $this->fail('No exception!');
         } catch (Horde_Kolab_Server_Exception $e) {
             $this->assertEquals(
index a4a7bcd..6de7c27 100644 (file)
@@ -35,28 +35,18 @@ class Horde_Kolab_Server_TestCase extends PHPUnit_Framework_TestCase
     protected function getComposite()
     {
         return $this->getMock(
-            'Horde_Kolab_Server_Composite', array(), array(), '', false
+            'Horde_Kolab_Server_Composite_Interface'
         );
     }
 
     protected function getMockedComposite()
     {
-        return new Horde_Kolab_Server_Composite(
-            $this->getMock(
-                'Horde_Kolab_Server', array(), array(), '', false
-            ),
-            $this->getMock(
-                'Horde_Kolab_Server_Objects', array(), array(), '', false
-            ),
-            $this->getMock(
-                'Horde_Kolab_Server_Structure_Interface', array(), array(), '', false
-            ),
-            $this->getMock(
-                'Horde_Kolab_Server_Search_Interface', array(), array(), '', false
-            ),
-            $this->getMock(
-                'Horde_Kolab_Server_Schema', array(), array(), '', false
-            )
+        return new Horde_Kolab_Server_Composite_Base(
+            $this->getMock('Horde_Kolab_Server_Interface'),
+            $this->getMock('Horde_Kolab_Server_Objects_Interface'),
+            $this->getMock('Horde_Kolab_Server_Structure_Interface'),
+            $this->getMock('Horde_Kolab_Server_Search_Interface'),
+            $this->getMock('Horde_Kolab_Server_Schema_Interface')
         );
     }
 }
\ No newline at end of file