--- /dev/null
+<?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);
+ }
+}
+++ /dev/null
-<?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);
- }
-}
+++ /dev/null
-<?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);
-}
*/
public function getComposite()
{
- $composite = new Horde_Kolab_Server_Composite_Base(
+ $composite = new Horde_Kolab_Server_Composite(
$this->getServer(),
$this->getObjects(),
$this->getStructure(),
$this->_setupStructure();
$this->_setupConnection();
$this->_setupServer();
- $this->_setupComposite();
}
/**
}
/**
- * 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.
public function getComposite()
{
return $this->_injector->getInstance(
- 'Horde_Kolab_Server_Composite_Interface'
+ 'Horde_Kolab_Server_Composite'
);
}
}
\ No newline at end of file
*/
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(
* @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;
*/
static public function factory(
$type, $uid,
- Horde_Kolab_Server_Composite_Interface $storage,
+ Horde_Kolab_Server_Composite $storage,
$data = null
) {
if (class_exists($type)) {
* @return NULL
*/
public function setComposite(
- Horde_Kolab_Server_Composite_Interface $composite
+ Horde_Kolab_Server_Composite $composite
) {
$this->_composite = $composite;
}
* server handler.
*/
public function setComposite(
- Horde_Kolab_Server_Composite_Interface $composite
+ Horde_Kolab_Server_Composite $composite
);
/**
* @return NULL
*/
public function setComposite(
- Horde_Kolab_Server_Composite_Interface $composite
+ Horde_Kolab_Server_Composite $composite
) {
$this->_composite = $composite;
}
* @return NULL
*/
public function setComposite(
- Horde_Kolab_Server_Composite_Interface $composite
+ Horde_Kolab_Server_Composite $composite
) {
$this->composite = $composite;
}
* server handler.
*/
public function setComposite(
- Horde_Kolab_Server_Composite_Interface $composite
+ Horde_Kolab_Server_Composite $composite
);
/**
* @return NULL
*/
public function setComposite(
- Horde_Kolab_Server_Composite_Interface $composite
+ Horde_Kolab_Server_Composite $composite
) {
$this->_composite = $composite;
$this->_searches = $this->_getSearchOperations();
* server handler.
*/
public function setComposite(
- Horde_Kolab_Server_Composite_Interface $composite
+ Horde_Kolab_Server_Composite $composite
);
/**
* @return NULL
*/
public function setComposite(
- Horde_Kolab_Server_Composite_Interface $composite
+ Horde_Kolab_Server_Composite $composite
) {
$this->_composite = $composite;
}
* @return NULL
*/
public function setComposite(
- Horde_Kolab_Server_Composite_Interface $composite
+ Horde_Kolab_Server_Composite $composite
);
/**
<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" />
array('basedn' => '')
);
$this->assertType(
- 'Horde_Kolab_Server_Composite_Interface',
+ 'Horde_Kolab_Server_Composite',
$factory->getComposite()
);
}
$this->search, $this->schema, array('basedn' => 'test')
);
$this->assertType(
- 'Horde_Kolab_Server_Composite_Interface',
+ 'Horde_Kolab_Server_Composite',
$factory->getComposite()
);
}
$this->skipIfNoLdap();
$factory = $this->_getFactory(array('basedn' => 'test'));
$this->assertType(
- 'Horde_Kolab_Server_Composite_Interface',
+ 'Horde_Kolab_Server_Composite',
$factory->getComposite()
);
}
$this->conn_factory, array('basedn' => 'test')
);
$this->assertType(
- 'Horde_Kolab_Server_Composite_Interface',
+ 'Horde_Kolab_Server_Composite',
$factory->getComposite()
);
}
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(),
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(),
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'),