Remove unnecessary interface definition.
authorGunnar Wrobel <p@rdus.de>
Tue, 16 Mar 2010 08:21:47 +0000 (09:21 +0100)
committerGunnar Wrobel <wrobel@temple.(none)>
Tue, 16 Mar 2010 10:18:29 +0000 (11:18 +0100)
25 files changed:
framework/Kolab_Server/lib/Horde/Kolab/Server/Composite.php [new file with mode: 0644]
framework/Kolab_Server/lib/Horde/Kolab/Server/Composite/Base.php [deleted file]
framework/Kolab_Server/lib/Horde/Kolab/Server/Composite/Interface.php [deleted file]
framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Base.php
framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Injector.php
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/Objects/Base.php
framework/Kolab_Server/lib/Horde/Kolab/Server/Objects/Interface.php
framework/Kolab_Server/lib/Horde/Kolab/Server/Schema/Base.php
framework/Kolab_Server/lib/Horde/Kolab/Server/Schema/Decorator/Cache.php
framework/Kolab_Server/lib/Horde/Kolab/Server/Schema/Interface.php
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/Structure/Base.php
framework/Kolab_Server/lib/Horde/Kolab/Server/Structure/Interface.php
framework/Kolab_Server/package.xml
framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/ConfigurationTest.php
framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/ConstructorTest.php
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/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/Composite.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Composite.php
new file mode 100644 (file)
index 0000000..5b286e2
--- /dev/null
@@ -0,0 +1,129 @@
+<?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-2010 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_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 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)
+    {
+        /** 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
deleted file mode 100644 (file)
index 5043287..0000000
+++ /dev/null
@@ -1,130 +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-2010 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 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)
-    {
-        /** 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
deleted file mode 100644 (file)
index d7e1bba..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-<?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-2010 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);
-}
index 74969e4..2d3c685 100644 (file)
@@ -129,7 +129,7 @@ implements Horde_Kolab_Server_Factory_Interface
      */
     public function getComposite()
     {
-        $composite = new Horde_Kolab_Server_Composite_Base(
+        $composite = new Horde_Kolab_Server_Composite(
             $this->getServer(),
             $this->getObjects(),
             $this->getStructure(),
index e8ce9fd..55a6bff 100644 (file)
@@ -114,7 +114,6 @@ implements Horde_Kolab_Server_Factory_Interface
         $this->_setupStructure();
         $this->_setupConnection();
         $this->_setupServer();
-        $this->_setupComposite();
     }
 
     /**
@@ -204,19 +203,6 @@ implements Horde_Kolab_Server_Factory_Interface
     }
 
     /**
-     * Setup the machinery to create a Horde_Kolab_Server_Composite server.
-     *
-     * @return NULL
-     */
-    private function _setupComposite()
-    {
-        $this->_injector->bindImplementation(
-            'Horde_Kolab_Server_Composite_Interface',
-            'Horde_Kolab_Server_Composite_Base'
-        );
-    }
-
-    /**
      * Return the conn server connection that should be used.
      *
      * @return Horde_Kolab_Server The Horde_Kolab_Server connection.
@@ -338,7 +324,7 @@ implements Horde_Kolab_Server_Factory_Interface
     public function getComposite()
     {
         return $this->_injector->getInstance(
-            'Horde_Kolab_Server_Composite_Interface'
+            'Horde_Kolab_Server_Composite'
         );
     }
 }
\ No newline at end of file
index fbd3f14..ec6fc69 100644 (file)
@@ -37,7 +37,7 @@ extends Horde_Kolab_Server_Object_Attribute_Decorator
      */
     public function __construct(
         Horde_Kolab_Server_Object_Interface $object,
-        Horde_Kolab_Server_Composite_Interface $composite
+        Horde_Kolab_Server_Composite $composite
     ) {
         $this->_attribute = new Horde_Kolab_Server_Object_Attribute_Required(
             new Horde_Kolab_Server_Object_Attribute_Locked(
index 6b7c385..75bcebe 100644 (file)
@@ -51,7 +51,7 @@ implements Horde_Kolab_Server_Object_Interface
      * @param string                       $guid      GUID of the object.
      */
     public function __construct(
-        Horde_Kolab_Server_Composite_Interface $composite,
+        Horde_Kolab_Server_Composite $composite,
         $guid = null
     ) {
         $this->_composite = $composite;
index 4d8dd89..277b8c0 100644 (file)
@@ -42,7 +42,7 @@ class Horde_Kolab_Server_Object_Factory
      */
     static public function factory(
         $type, $uid,
-        Horde_Kolab_Server_Composite_Interface $storage,
+        Horde_Kolab_Server_Composite $storage,
         $data = null
     ) {
         if (class_exists($type)) {
index ef57eab..3eb882e 100644 (file)
@@ -45,7 +45,7 @@ implements Horde_Kolab_Server_Objects_Interface
      * @return NULL
      */
     public function setComposite(
-        Horde_Kolab_Server_Composite_Interface $composite
+        Horde_Kolab_Server_Composite $composite
     ) {
         $this->_composite = $composite;
     }
index 0d6e2a3..6176f24 100644 (file)
@@ -34,7 +34,7 @@ interface Horde_Kolab_Server_Objects_Interface
      *                                                server handler.
      */
     public function setComposite(
-        Horde_Kolab_Server_Composite_Interface $composite
+        Horde_Kolab_Server_Composite $composite
     );
 
     /**
index 7c5ee8d..3a83700 100644 (file)
@@ -44,7 +44,7 @@ implements Horde_Kolab_Server_Schema_Interface
      * @return NULL
      */
     public function setComposite(
-        Horde_Kolab_Server_Composite_Interface $composite
+        Horde_Kolab_Server_Composite $composite
     ) {
         $this->_composite = $composite;
     }
index 33e4b55..bf5782c 100644 (file)
@@ -54,7 +54,7 @@ implements Horde_Kolab_Server_Schema_Interface
      * @return NULL
      */
     public function setComposite(
-        Horde_Kolab_Server_Composite_Interface $composite
+        Horde_Kolab_Server_Composite $composite
     ) {
         $this->composite = $composite;
     }
index c66c2f8..4a3526e 100644 (file)
@@ -34,7 +34,7 @@ interface Horde_Kolab_Server_Schema_Interface
      *                                                server handler.
      */
     public function setComposite(
-        Horde_Kolab_Server_Composite_Interface $composite
+        Horde_Kolab_Server_Composite $composite
     );
 
     /**
index f969c68..a329788 100644 (file)
@@ -53,7 +53,7 @@ implements Horde_Kolab_Server_Search_Interface
      * @return NULL
      */
     public function setComposite(
-        Horde_Kolab_Server_Composite_Interface $composite
+        Horde_Kolab_Server_Composite $composite
     ) {
         $this->_composite = $composite;
         $this->_searches = $this->_getSearchOperations();
index de98651..5bcd26d 100644 (file)
@@ -34,7 +34,7 @@ interface Horde_Kolab_Server_Search_Interface
      *                                                server handler.
      */
     public function setComposite(
-        Horde_Kolab_Server_Composite_Interface $composite
+        Horde_Kolab_Server_Composite $composite
     );
 
     /**
index d894080..e4cf30f 100644 (file)
@@ -89,7 +89,7 @@ implements Horde_Kolab_Server_Structure_Interface
      * @return NULL
      */
     public function setComposite(
-        Horde_Kolab_Server_Composite_Interface $composite
+        Horde_Kolab_Server_Composite $composite
     ) {
         $this->_composite = $composite;
     }
index d82f167..ec674c7 100644 (file)
@@ -69,7 +69,7 @@ interface Horde_Kolab_Server_Structure_Interface
      * @return NULL
      */
     public function setComposite(
-        Horde_Kolab_Server_Composite_Interface $composite
+        Horde_Kolab_Server_Composite $composite
     );
 
     /**
index 0b87c8d..ca01edc 100644 (file)
     <dir name="Horde">
      <dir name="Kolab">
       <dir name="Server">
-       <dir name="Composite">
-        <file name="Base.php" role="php" />
-        <file name="Interface.php" role="php" />
-       </dir> <!-- /lib/Horde/Kolab/Server/Composite -->
+       <file name="Composite.php" role="php" />
        <dir name="Connection">
         <dir name="Mock">
          <file name="Ldap.php" role="php" />
    <install as="Horde/Kolab/Server/Exception.php" name="lib/Horde/Kolab/Server/Exception.php" />
    <install as="Horde/Kolab/Server/Interface.php" name="lib/Horde/Kolab/Server/Interface.php" />
    <install as="Horde/Kolab/Server/Ldap.php" name="lib/Horde/Kolab/Server/Ldap.php" />
-   <install as="Horde/Kolab/Server/Composite/Base.php" name="lib/Horde/Kolab/Server/Composite/Base.php" />
-   <install as="Horde/Kolab/Server/Composite/Interface.php" name="lib/Horde/Kolab/Server/Composite/Interface.php" />
+   <install as="Horde/Kolab/Server/Composite.php" name="lib/Horde/Kolab/Server/Composite.php" />
    <install as="Horde/Kolab/Server/Connection/File.php" name="lib/Horde/Kolab/Server/Connection/File.php" />
    <install as="Horde/Kolab/Server/Connection/Interface.php" name="lib/Horde/Kolab/Server/Connection/Interface.php" />
    <install as="Horde/Kolab/Server/Connection/Mock.php" name="lib/Horde/Kolab/Server/Connection/Mock.php" />
index e4c3bdf..6779271 100644 (file)
@@ -126,7 +126,7 @@ extends Horde_Kolab_Server_LdapTestCase
             array('basedn' => '')
         );
         $this->assertType(
-            'Horde_Kolab_Server_Composite_Interface',
+            'Horde_Kolab_Server_Composite',
             $factory->getComposite()
         );
     }
index 10d4b5b..092b834 100644 (file)
@@ -127,7 +127,7 @@ extends Horde_Kolab_Server_LdapTestCase
             $this->search, $this->schema, array('basedn' => 'test')
         );
         $this->assertType(
-            'Horde_Kolab_Server_Composite_Interface',
+            'Horde_Kolab_Server_Composite',
             $factory->getComposite()
         );
     }
index b32bb92..41cb69e 100644 (file)
@@ -153,7 +153,7 @@ extends Horde_Kolab_Server_LdapTestCase
         $this->skipIfNoLdap();
         $factory = $this->_getFactory(array('basedn' => 'test'));
         $this->assertType(
-            'Horde_Kolab_Server_Composite_Interface',
+            'Horde_Kolab_Server_Composite',
             $factory->getComposite()
         );
     }
index e9880bd..5b4bf0a 100644 (file)
@@ -180,7 +180,7 @@ extends Horde_Kolab_Server_LdapTestCase
             $this->conn_factory, array('basedn' => 'test')
         );
         $this->assertType(
-            'Horde_Kolab_Server_Composite_Interface',
+            'Horde_Kolab_Server_Composite',
             $factory->getComposite()
         );
     }
index 83cb888..8ce7ad2 100644 (file)
@@ -35,7 +35,7 @@ class Horde_Kolab_Server_Class_Server_Structure_KolabTest extends PHPUnit_Framew
     public function setUp()
     {
         $server = $this->getMock('Horde_Kolab_Server_Interface');
-        $this->composite = new Horde_Kolab_Server_Composite_Base(
+        $this->composite = new Horde_Kolab_Server_Composite(
             $server,
             $this->getMock('Horde_Kolab_Server_Objects_Interface'),
             new Horde_Kolab_Server_Structure_Kolab(),
index bde26fd..5778ea4 100644 (file)
@@ -35,7 +35,7 @@ class Horde_Kolab_Server_Class_Server_Structure_LdapTest extends Horde_Kolab_Ser
     public function setUp()
     {
         $server = $this->getMock('Horde_Kolab_Server_Interface');
-        $this->composite = new Horde_Kolab_Server_Composite_Base(
+        $this->composite = new Horde_Kolab_Server_Composite(
             $server,
             $this->getMock('Horde_Kolab_Server_Objects_Interface'),
             new Horde_Kolab_Server_Structure_Ldap(),
index 0ab0c49..d0da676 100644 (file)
@@ -42,13 +42,13 @@ class Horde_Kolab_Server_TestCase extends PHPUnit_Framework_TestCase
     protected function getComposite()
     {
         return $this->getMock(
-            'Horde_Kolab_Server_Composite_Interface'
+            'Horde_Kolab_Server_Composite', array(), array(), '', false, false
         );
     }
 
     protected function getMockedComposite()
     {
-        return new Horde_Kolab_Server_Composite_Base(
+        return new Horde_Kolab_Server_Composite(
             $this->getMock('Horde_Kolab_Server_Interface'),
             $this->getMock('Horde_Kolab_Server_Objects_Interface'),
             $this->getMock('Horde_Kolab_Server_Structure_Interface'),