Overview

Packages

  • Kolab
    • Server

Classes

  • Horde_Kolab_Server_Composite
  • Horde_Kolab_Server_Connection_File
  • Horde_Kolab_Server_Connection_Mock
  • Horde_Kolab_Server_Connection_Mock_Ldap
  • Horde_Kolab_Server_Connection_Mock_Search
  • Horde_Kolab_Server_Connection_Simpleldap
  • Horde_Kolab_Server_Connection_Splittedldap
  • Horde_Kolab_Server_Decorator_Clean
  • Horde_Kolab_Server_Decorator_Count
  • Horde_Kolab_Server_Decorator_Log
  • Horde_Kolab_Server_Decorator_Map
  • Horde_Kolab_Server_Exception
  • Horde_Kolab_Server_Exception_Bindfailed
  • Horde_Kolab_Server_Exception_Novalue
  • Horde_Kolab_Server_Factory
  • Horde_Kolab_Server_Ldap
  • Horde_Kolab_Server_Ldap_Changes
  • Horde_Kolab_Server_Ldap_Filtered
  • Horde_Kolab_Server_Ldap_Standard
  • Horde_Kolab_Server_List_Base
  • Horde_Kolab_Server_Object_Attribute_Base
  • Horde_Kolab_Server_Object_Attribute_Createtimestamp
  • Horde_Kolab_Server_Object_Attribute_Createtimestampdate
  • Horde_Kolab_Server_Object_Attribute_Decorator
  • Horde_Kolab_Server_Object_Attribute_Default
  • Horde_Kolab_Server_Object_Attribute_Empty
  • Horde_Kolab_Server_Object_Attribute_External
  • Horde_Kolab_Server_Object_Attribute_Field
  • Horde_Kolab_Server_Object_Attribute_Firstnamelastname
  • Horde_Kolab_Server_Object_Attribute_Guid
  • Horde_Kolab_Server_Object_Attribute_Id
  • Horde_Kolab_Server_Object_Attribute_Internal
  • Horde_Kolab_Server_Object_Attribute_Locked
  • Horde_Kolab_Server_Object_Attribute_Modifytimestamp
  • Horde_Kolab_Server_Object_Attribute_Modifytimestampdate
  • Horde_Kolab_Server_Object_Attribute_Objectclass
  • Horde_Kolab_Server_Object_Attribute_Openldapaci
  • Horde_Kolab_Server_Object_Attribute_Required
  • Horde_Kolab_Server_Object_Attribute_Single
  • Horde_Kolab_Server_Object_Attribute_Value
  • Horde_Kolab_Server_Object_Attribute_Writelock
  • Horde_Kolab_Server_Object_Base
  • Horde_Kolab_Server_Object_Factory
  • Horde_Kolab_Server_Object_Groupofnames
  • Horde_Kolab_Server_Object_Hash
  • Horde_Kolab_Server_Object_Inetorgperson
  • Horde_Kolab_Server_Object_Kolab
  • Horde_Kolab_Server_Object_Kolab_Address
  • Horde_Kolab_Server_Object_Kolab_Administrator
  • Horde_Kolab_Server_Object_Kolab_Adminrole
  • Horde_Kolab_Server_Object_Kolab_Distlist
  • Horde_Kolab_Server_Object_Kolab_Domainmaintainer
  • Horde_Kolab_Server_Object_Kolab_Maintainer
  • Horde_Kolab_Server_Object_Kolab_User
  • Horde_Kolab_Server_Object_Kolabgermanbankarrangement
  • Horde_Kolab_Server_Object_Kolabgroupofnames
  • Horde_Kolab_Server_Object_Kolabinetorgperson
  • Horde_Kolab_Server_Object_Kolabpop3account
  • Horde_Kolab_Server_Object_Kolabsharedfolder
  • Horde_Kolab_Server_Object_Mcached
  • Horde_Kolab_Server_Object_Organizationalperson
  • Horde_Kolab_Server_Object_Person
  • Horde_Kolab_Server_Object_Top
  • Horde_Kolab_Server_Objects_Base
  • Horde_Kolab_Server_Query_Element_And
  • Horde_Kolab_Server_Query_Element_Approx
  • Horde_Kolab_Server_Query_Element_Begins
  • Horde_Kolab_Server_Query_Element_Contains
  • Horde_Kolab_Server_Query_Element_Ends
  • Horde_Kolab_Server_Query_Element_Equals
  • Horde_Kolab_Server_Query_Element_Greater
  • Horde_Kolab_Server_Query_Element_Group
  • Horde_Kolab_Server_Query_Element_Less
  • Horde_Kolab_Server_Query_Element_Mapped
  • Horde_Kolab_Server_Query_Element_Not
  • Horde_Kolab_Server_Query_Element_Or
  • Horde_Kolab_Server_Query_Element_Single
  • Horde_Kolab_Server_Query_Ldap
  • Horde_Kolab_Server_Result_Ldap
  • Horde_Kolab_Server_Schema_Base
  • Horde_Kolab_Server_Schema_Decorator_Cache
  • Horde_Kolab_Server_Search_Base
  • Horde_Kolab_Server_Search_Operation_Addressesforuidormail
  • Horde_Kolab_Server_Search_Operation_Attributes
  • Horde_Kolab_Server_Search_Operation_Base
  • Horde_Kolab_Server_Search_Operation_Children
  • Horde_Kolab_Server_Search_Operation_Constraint_Single
  • Horde_Kolab_Server_Search_Operation_Constraint_Strict
  • Horde_Kolab_Server_Search_Operation_Groupsformember
  • Horde_Kolab_Server_Search_Operation_Guid
  • Horde_Kolab_Server_Search_Operation_Guidforalias
  • Horde_Kolab_Server_Search_Operation_Guidforcn
  • Horde_Kolab_Server_Search_Operation_Guidforkolabusers
  • Horde_Kolab_Server_Search_Operation_Guidformail
  • Horde_Kolab_Server_Search_Operation_Guidformailoralias
  • Horde_Kolab_Server_Search_Operation_Guidforuid
  • Horde_Kolab_Server_Search_Operation_Guidforuidormail
  • Horde_Kolab_Server_Search_Operation_Guidforuidormailoralias
  • Horde_Kolab_Server_Search_Operation_Mailforuidormail
  • Horde_Kolab_Server_Search_Operation_Restrictgroups
  • Horde_Kolab_Server_Search_Operation_Restrictkolab
  • Horde_Kolab_Server_Structure_Attribute_Double
  • Horde_Kolab_Server_Structure_Attribute_Value
  • Horde_Kolab_Server_Structure_Base
  • Horde_Kolab_Server_Structure_Kolab
  • Horde_Kolab_Server_Structure_Ldap

Interfaces

  • Horde_Kolab_Server_Connection_Interface
  • Horde_Kolab_Server_Interface
  • Horde_Kolab_Server_List_Interface
  • Horde_Kolab_Server_Object_Attribute_Interface
  • Horde_Kolab_Server_Object_Interface
  • Horde_Kolab_Server_Object_Searches
  • Horde_Kolab_Server_Objects_Interface
  • Horde_Kolab_Server_Query_Element_Interface
  • Horde_Kolab_Server_Query_Interface
  • Horde_Kolab_Server_Result_Interface
  • Horde_Kolab_Server_Schema_Interface
  • Horde_Kolab_Server_Search_Interface
  • Horde_Kolab_Server_Search_Operation_Interface
  • Horde_Kolab_Server_Structure_Attribute_Interface
  • Horde_Kolab_Server_Structure_Interface
  • Overview
  • Package
  • Class
  • Tree
  1: <?php
  2: /**
  3:  * Low level caching for the Kolab object.
  4:  *
  5:  * PHP version 5
  6:  *
  7:  * @category Kolab
  8:  * @package  Kolab_Server
  9:  * @author   Gunnar Wrobel <wrobel@pardus.de>
 10:  * @license  http://www.horde.org/licenses/lgpl21 LGPL 2.1
 11:  * @link     http://pear.horde.org/index.php?package=Kolab_Server
 12:  */
 13: 
 14: /**
 15:  * Low level caching for the Kolab object.
 16:  *
 17:  * Copyright 2008-2012 Horde LLC (http://www.horde.org/)
 18:  *
 19:  * See the enclosed file COPYING for license information (LGPL). If you
 20:  * did not receive this file, see http://www.horde.org/licenses/lgpl21.
 21:  *
 22:  * @category Kolab
 23:  * @package  Kolab_Server
 24:  * @author   Gunnar Wrobel <wrobel@pardus.de>
 25:  * @license  http://www.horde.org/licenses/lgpl21 LGPL 2.1
 26:  * @link     http://pear.horde.org/index.php?package=Kolab_Server
 27:  */
 28: class Horde_Kolab_Server_Object_Mcached
 29: implements Horde_Kolab_Server_Object_Interface
 30: {
 31:     /**
 32:      * Link to the decorated object.
 33:      *
 34:      * @var Horde_Kolab_Server_Object
 35:      */
 36:     private $_object;
 37: 
 38:     /**
 39:      * The external attributes supported by this class.
 40:      *
 41:      * @var array
 42:      */
 43:     protected $_attributes_ext;
 44: 
 45:     /**
 46:      * The internal attributes required for this class.
 47:      *
 48:      * @var array
 49:      */
 50:     protected $_attributes_int;
 51: 
 52:     /**
 53:      * Does the object exist?
 54:      *
 55:      * @return boolean True if the object exists, false otherwise.
 56:      */
 57:     private $_exists;
 58: 
 59:     /**
 60:      * The cached internal result
 61:      *
 62:      * @var array
 63:      */
 64:     private $_cache_int = array();
 65: 
 66:     /**
 67:      * The cached external attribute values
 68:      *
 69:      * @var array
 70:      */
 71:     private $_cache_ext = array();
 72: 
 73:     /**
 74:      * A cache for the list of actions this object supports.
 75:      *
 76:      * @var array
 77:      */
 78:     protected $_actions;
 79: 
 80:     /**
 81:      * Initialize the Kolab Object. Provide either the GUID
 82:      *
 83:      * @param Horde_Kolab_Server_Composite $composite The link to the Kolab server.
 84:      * @param string                       $guid      GUID of the object.
 85:      */
 86:     public function __construct(
 87:         Horde_Kolab_Server_Object $object
 88:     ) {
 89:         $this->_object = $object;
 90:     }
 91: 
 92:     /**
 93:      * Get the GUID of this object
 94:      *
 95:      * @return string the GUID of this object
 96:      */
 97:     public function getGuid()
 98:     {
 99:         return $this->_object->getGuid();
100:     }
101: 
102:     /**
103:      * Get the external attributes supported by this object.
104:      *
105:      * @return array The external attributes supported by this object. This is a
106:      * list of abbreviated attribute class names.
107:      */
108:     public function getExternalAttributes()
109:     {
110:         if (empty($this->_attributes_ext)) {
111:             $this->_attributes_ext = $this->_object->getExternalAttributes();
112:         }
113:         return $this->_attributes_ext;
114:     }
115: 
116:     /**
117:      * Get the internal attributes supported by this object.
118:      *
119:      * @return array The internal attributes supported by this object. This is
120:      * an association of internal attribute names an the correspodning attribute
121:      * class names.
122:      */
123:     public function getInternalAttributes()
124:     {
125:         if (empty($this->_attributes_int)) {
126:             $this->_attributes_int = $this->_object->getInternalAttributes();
127:         }
128:         return $this->_attributes_int;
129:     }
130: 
131:     /**
132:      * Set the internal data of this object.
133:      *
134:      * @param array $data A data array for the object.
135:      *
136:      * @return NULL
137:      */
138:     public function setInternalData(array $data)
139:     {
140:         $this->_cache_int = $data;
141:     }
142: 
143:     /**
144:      * Does the object exist?
145:      *
146:      * @return NULL
147:      */
148:     public function exists()
149:     {
150:         if ($this->_exists === null) {
151:             $this->_exists = $this->_object->exists();
152:         }
153:         return $this->_exists;
154:     }
155: 
156:     /**
157:      * Read the object data.
158:      *
159:      * @return array The read data.
160:      */
161:     public function readInternal()
162:     {
163:         $this->_cache_int = array_merge(
164:             $this->_cache_int,
165:             $this->_object->readInternal()
166:         );
167:     }
168: 
169:     /**
170:      * Get the specified internal attributes.
171:      *
172:      * @param array $attributes The internal attribute.
173:      *
174:      * @return array The value(s) of these attribute
175:      */
176:     public function getInternal(array $attributes)
177:     {
178:         if (!isset($this->_cache_int[$attr])) {
179:             if (!in_array($attr, array_keys($this->getInternalAttributes()))) {
180:                 throw new Horde_Kolab_Server_Exception(sprintf("Attribute \"%s\" not supported!",
181:                                                                $attr));
182:             }
183:             $this->_object->readInternal();
184:             if (!isset($this->_cache_int[$attr])) {
185:                 throw new Horde_Kolab_Server_Exception(sprintf("Failed to read attribute \"%s\"!",
186:                                                                $attr));
187:             }
188:         }
189:         return $this->_cache_int[$attr];
190:     }
191: 
192:     /**
193:      * Get the specified attribute of this object.
194:      *
195:      * @param string $attr The attribute to read.
196:      *
197:      * @return mixed The value of this attribute.
198:      */
199:     public function getExternal($attr)
200:     {
201:         if (!isset($this->_cache_ext[$attr])) {
202:             $this->_cache_ext[$attr] = $this->_object->getExternal($attr);
203:         }
204:         return $this->_cache_ext[$attr];
205:     }
206: 
207:     /**
208:      * Get the specified attribute of this object and ensure that only a single
209:      * value is being returned.
210:      *
211:      * @param string $attr The attribute to read.
212:      *
213:      * @return mixed The value of this attribute.
214:      */
215:     public function getSingle($attr)
216:     {
217:         return $this->_object->getSingle($attr);
218:     }
219: 
220:     /**
221:      * Convert the object attributes to a hash.
222:      *
223:      * @param array   $attrs  The attributes to return.
224:      * @param boolean $single Should only a single attribute be returned?
225:      *
226:      * @return array|PEAR_Error The hash representing this object.
227:      */
228:     public function toHash(array $attrs = array(), $single = true)
229:     {
230:         return $this->_object->toHash($attrs, $single);
231:     }
232: 
233:     /**
234:      * Saves object information. This may either create a new entry or modify an
235:      * existing entry.
236:      *
237:      * Please note that fields with multiple allowed values require the callee
238:      * to provide the full set of values for the field. Any old values that are
239:      * not resubmitted will be considered to be deleted.
240:      *
241:      * @param array $info The information about the object.
242:      *
243:      * @return NULL
244:      *
245:      * @throws Horde_Kolab_Server_Exception If saving the data failed.
246:      */
247:     public function save(array $info)
248:     {
249:         $this->_object->save($info);
250: 
251:         /** Mark the object as existing */
252:         $this->_exists = true;
253: 
254:         /**
255:          * Throw away the cache data to ensure it gets refetched in case we need
256:          * to access it again
257:          */
258:         $this->_cache_ext = array();
259:         $this->_cache_int = array();
260:     }
261: 
262:     /**
263:      * Delete this object.
264:      *
265:      * @return NULL
266:      *
267:      * @throws Horde_Kolab_Server_Exception If deleting the object failed.
268:      */
269:     public function delete()
270:     {
271:         $this->_object->delete();
272: 
273:         /** Mark the object as missing */
274:         $this->_exists = false;
275: 
276:         /**
277:          * Throw away the cache data to ensure it gets refetched in case we need
278:          * to access it again
279:          */
280:         $this->_cache_ext = array();
281:         $this->_cache_int = array();
282:     }
283: 
284:     /**
285:      * Generates an ID for the given information.
286:      *
287:      * @param array &$info The data of the object.
288:      *
289:      * @return string The ID.
290:      */
291:     public function generateId(array &$info)
292:     {
293:         $this->_object->generateId($info);
294:     }
295: 
296:     /**
297:      * Distill the server side object information to save.
298:      *
299:      * @param array &$info The information about the object.
300:      *
301:      * @return NULL.
302:      *
303:      * @throws Horde_Kolab_Server_Exception If the given information contains errors.
304:      */
305:     public function prepareObjectInformation(array &$info)
306:     {
307:         $this->_object->prepareObjectInformation($info);
308:     }
309: 
310:     /**
311:      * Returns the set of actions supported by this object type.
312:      *
313:      * @return array An array of supported actions.
314:      */
315:     public function getActions()
316:     {
317:         if (!isset($this->_actions)) {
318:             $this->_actions = $this->_object->getActions();
319:         }
320:         return $this->_actions;
321:     }
322: }
323: 
API documentation generated by ApiGen