source: trunk/library/Zend/Ldap/Node/Schema.php @ 5146

Revision 5146, 3.5 KB checked in by wmerlotto, 12 years ago (diff)

Ticket #2305 - Enviando alteracoes, desenvolvidas internamente na Prognus. Library: adicionando arquivos.

Line 
1<?php
2/**
3 * Zend Framework
4 *
5 * LICENSE
6 *
7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
14 *
15 * @category   Zend
16 * @package    Zend_Ldap
17 * @subpackage Schema
18 * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license    http://framework.zend.com/license/new-bsd     New BSD License
20 * @version    $Id: Schema.php 20096 2010-01-06 02:05:09Z bkarwin $
21 */
22
23/**
24 * @see Zend_Ldap_Node_Abstract
25 */
26require_once 'Zend/Ldap/Node/Abstract.php';
27
28/**
29 * Zend_Ldap_Node_Schema provides a simple data-container for the Schema node.
30 *
31 * @category   Zend
32 * @package    Zend_Ldap
33 * @subpackage Schema
34 * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
35 * @license    http://framework.zend.com/license/new-bsd     New BSD License
36 */
37class Zend_Ldap_Node_Schema extends Zend_Ldap_Node_Abstract
38{
39    const OBJECTCLASS_TYPE_UNKNOWN    = 0;
40    const OBJECTCLASS_TYPE_STRUCTURAL = 1;
41    const OBJECTCLASS_TYPE_ABSTRACT   = 3;
42    const OBJECTCLASS_TYPE_AUXILIARY  = 4;
43
44    /**
45     * Factory method to create the Schema node.
46     *
47     * @param  Zend_Ldap $ldap
48     * @return Zend_Ldap_Node_Schema
49     * @throws Zend_Ldap_Exception
50     */
51    public static function create(Zend_Ldap $ldap)
52    {
53        $dn = $ldap->getRootDse()->getSchemaDn();
54        $data = $ldap->getEntry($dn, array('*', '+'), true);
55        switch ($ldap->getRootDse()->getServerType()) {
56            case Zend_Ldap_Node_RootDse::SERVER_TYPE_ACTIVEDIRECTORY:
57                /**
58                 * @see Zend_Ldap_Node_Schema_ActiveDirectory
59                 */
60                require_once 'Zend/Ldap/Node/Schema/ActiveDirectory.php';
61                return new Zend_Ldap_Node_Schema_ActiveDirectory($dn, $data, $ldap);
62            case Zend_Ldap_Node_RootDse::SERVER_TYPE_OPENLDAP:
63                /**
64                 * @see Zend_Ldap_Node_RootDse_ActiveDirectory
65                 */
66                require_once 'Zend/Ldap/Node/Schema/OpenLdap.php';
67                return new Zend_Ldap_Node_Schema_OpenLdap($dn, $data, $ldap);
68            case Zend_Ldap_Node_RootDse::SERVER_TYPE_EDIRECTORY:
69            default:
70                return new self($dn, $data, $ldap);
71        }
72    }
73
74    /**
75     * Constructor.
76     *
77     * Constructor is protected to enforce the use of factory methods.
78     *
79     * @param  Zend_Ldap_Dn $dn
80     * @param  array        $data
81     * @param  Zend_Ldap    $ldap
82     */
83    protected function __construct(Zend_Ldap_Dn $dn, array $data, Zend_Ldap $ldap)
84    {
85        parent::__construct($dn, $data, true);
86        $this->_parseSchema($dn, $ldap);
87    }
88
89    /**
90     * Parses the schema
91     *
92     * @param  Zend_Ldap_Dn $dn
93     * @param  Zend_Ldap    $ldap
94     * @return Zend_Ldap_Node_Schema Provides a fluid interface
95     */
96    protected function _parseSchema(Zend_Ldap_Dn $dn, Zend_Ldap $ldap)
97    {
98        return $this;
99    }
100
101    /**
102     * Gets the attribute Types
103     *
104     * @return array
105     */
106    public function getAttributeTypes()
107    {
108        return array();
109    }
110
111    /**
112     * Gets the object classes
113     *
114     * @return array
115     */
116    public function getObjectClasses()
117    {
118        return array();
119    }
120}
Note: See TracBrowser for help on using the repository browser.