1 | <?php |
---|
2 | /*********************************************** |
---|
3 | * File : ibackend.php |
---|
4 | * Project : Z-Push |
---|
5 | * Descr : All Z-Push backends must implement this interface. |
---|
6 | * It describes all generic methods expected to be |
---|
7 | * implemented by a backend. |
---|
8 | * The next abstraction layer is the default Backend |
---|
9 | * implementation which already implements some generics. |
---|
10 | * |
---|
11 | * Created : 02.01.2012 |
---|
12 | * |
---|
13 | * Copyright 2007 - 2012 Zarafa Deutschland GmbH |
---|
14 | * |
---|
15 | * This program is free software: you can redistribute it and/or modify |
---|
16 | * it under the terms of the GNU Affero General Public License, version 3, |
---|
17 | * as published by the Free Software Foundation with the following additional |
---|
18 | * term according to sec. 7: |
---|
19 | * |
---|
20 | * According to sec. 7 of the GNU Affero General Public License, version 3, |
---|
21 | * the terms of the AGPL are supplemented with the following terms: |
---|
22 | * |
---|
23 | * "Zarafa" is a registered trademark of Zarafa B.V. |
---|
24 | * "Z-Push" is a registered trademark of Zarafa Deutschland GmbH |
---|
25 | * The licensing of the Program under the AGPL does not imply a trademark license. |
---|
26 | * Therefore any rights, title and interest in our trademarks remain entirely with us. |
---|
27 | * |
---|
28 | * However, if you propagate an unmodified version of the Program you are |
---|
29 | * allowed to use the term "Z-Push" to indicate that you distribute the Program. |
---|
30 | * Furthermore you may use our trademarks where it is necessary to indicate |
---|
31 | * the intended purpose of a product or service provided you use it in accordance |
---|
32 | * with honest practices in industrial or commercial matters. |
---|
33 | * If you want to propagate modified versions of the Program under the name "Z-Push", |
---|
34 | * you may only do so if you have a written permission by Zarafa Deutschland GmbH |
---|
35 | * (to acquire a permission please contact Zarafa at trademark@zarafa.com). |
---|
36 | * |
---|
37 | * This program is distributed in the hope that it will be useful, |
---|
38 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
39 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
40 | * GNU Affero General Public License for more details. |
---|
41 | * |
---|
42 | * You should have received a copy of the GNU Affero General Public License |
---|
43 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
---|
44 | * |
---|
45 | * Consult LICENSE file for details |
---|
46 | ************************************************/ |
---|
47 | |
---|
48 | interface IBackend { |
---|
49 | /** |
---|
50 | * Returns a IStateMachine implementation used to save states |
---|
51 | * |
---|
52 | * @access public |
---|
53 | * @return boolean/object if false is returned, the default Statemachine is |
---|
54 | * used else the implementation of IStateMachine |
---|
55 | */ |
---|
56 | public function GetStateMachine(); |
---|
57 | |
---|
58 | /** |
---|
59 | * Returns a ISearchProvider implementation used for searches |
---|
60 | * |
---|
61 | * @access public |
---|
62 | * @return object Implementation of ISearchProvider |
---|
63 | */ |
---|
64 | public function GetSearchProvider(); |
---|
65 | |
---|
66 | /** |
---|
67 | * Indicates which AS version is supported by the backend. |
---|
68 | * Depending on this value the supported AS version announced to the |
---|
69 | * mobile device is set. |
---|
70 | * |
---|
71 | * @access public |
---|
72 | * @return string AS version constant |
---|
73 | */ |
---|
74 | public function GetSupportedASVersion(); |
---|
75 | |
---|
76 | /** |
---|
77 | * Authenticates the user |
---|
78 | * |
---|
79 | * @param string $username |
---|
80 | * @param string $domain |
---|
81 | * @param string $password |
---|
82 | * |
---|
83 | * @access public |
---|
84 | * @return boolean |
---|
85 | * @throws FatalException e.g. some required libraries are unavailable |
---|
86 | */ |
---|
87 | public function Logon($username, $domain, $password); |
---|
88 | |
---|
89 | /** |
---|
90 | * Setup the backend to work on a specific store or checks ACLs there. |
---|
91 | * If only the $store is submitted, all Import/Export/Fetch/Etc operations should be |
---|
92 | * performed on this store (switch operations store). |
---|
93 | * If the ACL check is enabled, this operation should just indicate the ACL status on |
---|
94 | * the submitted store, without changing the store for operations. |
---|
95 | * For the ACL status, the currently logged on user MUST have access rights on |
---|
96 | * - the entire store - admin access if no folderid is sent, or |
---|
97 | * - on a specific folderid in the store (secretary/full access rights) |
---|
98 | * |
---|
99 | * The ACLcheck MUST fail if a folder of the authenticated user is checked! |
---|
100 | * |
---|
101 | * @param string $store target store, could contain a "domain\user" value |
---|
102 | * @param boolean $checkACLonly if set to true, Setup() should just check ACLs |
---|
103 | * @param string $folderid if set, only ACLs on this folderid are relevant |
---|
104 | * |
---|
105 | * @access public |
---|
106 | * @return boolean |
---|
107 | */ |
---|
108 | public function Setup($store, $checkACLonly = false, $folderid = false); |
---|
109 | |
---|
110 | /** |
---|
111 | * Logs off |
---|
112 | * non critical operations closing the session should be done here |
---|
113 | * |
---|
114 | * @access public |
---|
115 | * @return boolean |
---|
116 | */ |
---|
117 | public function Logoff(); |
---|
118 | |
---|
119 | /** |
---|
120 | * Returns an array of SyncFolder types with the entire folder hierarchy |
---|
121 | * on the server (the array itself is flat, but refers to parents via the 'parent' property |
---|
122 | * |
---|
123 | * provides AS 1.0 compatibility |
---|
124 | * |
---|
125 | * @access public |
---|
126 | * @return array SYNC_FOLDER |
---|
127 | */ |
---|
128 | public function GetHierarchy(); |
---|
129 | |
---|
130 | /** |
---|
131 | * Returns the importer to process changes from the mobile |
---|
132 | * If no $folderid is given, hierarchy data will be imported |
---|
133 | * With a $folderid a content data will be imported |
---|
134 | * |
---|
135 | * @param string $folderid (opt) |
---|
136 | * |
---|
137 | * @access public |
---|
138 | * @return object implements IImportChanges |
---|
139 | * @throws StatusException |
---|
140 | */ |
---|
141 | public function GetImporter($folderid = false); |
---|
142 | |
---|
143 | /** |
---|
144 | * Returns the exporter to send changes to the mobile |
---|
145 | * If no $folderid is given, hierarchy data should be exported |
---|
146 | * With a $folderid a content data is expected |
---|
147 | * |
---|
148 | * @param string $folderid (opt) |
---|
149 | * |
---|
150 | * @access public |
---|
151 | * @return object implements IExportChanges |
---|
152 | * @throws StatusException |
---|
153 | */ |
---|
154 | public function GetExporter($folderid = false); |
---|
155 | |
---|
156 | /** |
---|
157 | * Sends an e-mail |
---|
158 | * This messages needs to be saved into the 'sent items' folder |
---|
159 | * |
---|
160 | * Basically two things can be done |
---|
161 | * 1) Send the message to an SMTP server as-is |
---|
162 | * 2) Parse the message, and send it some other way |
---|
163 | * |
---|
164 | * @param SyncSendMail $sm SyncSendMail object |
---|
165 | * |
---|
166 | * @access public |
---|
167 | * @return boolean |
---|
168 | * @throws StatusException |
---|
169 | */ |
---|
170 | public function SendMail($sm); |
---|
171 | |
---|
172 | /** |
---|
173 | * Returns all available data of a single message |
---|
174 | * |
---|
175 | * @param string $folderid |
---|
176 | * @param string $id |
---|
177 | * @param ContentParameters $contentparameters flag |
---|
178 | * |
---|
179 | * @access public |
---|
180 | * @return object(SyncObject) |
---|
181 | * @throws StatusException |
---|
182 | */ |
---|
183 | public function Fetch($folderid, $id, $contentparameters); |
---|
184 | |
---|
185 | /** |
---|
186 | * Returns the waste basket |
---|
187 | * |
---|
188 | * The waste basked is used when deleting items; if this function returns a valid folder ID, |
---|
189 | * then all deletes are handled as moves and are sent to the backend as a move. |
---|
190 | * If it returns FALSE, then deletes are handled as real deletes |
---|
191 | * |
---|
192 | * @access public |
---|
193 | * @return string |
---|
194 | */ |
---|
195 | public function GetWasteBasket(); |
---|
196 | |
---|
197 | /** |
---|
198 | * Returns the content of the named attachment as stream. The passed attachment identifier is |
---|
199 | * the exact string that is returned in the 'AttName' property of an SyncAttachment. |
---|
200 | * Any information necessary to locate the attachment must be encoded in that 'attname' property. |
---|
201 | * Data is written directly - 'print $data;' |
---|
202 | * |
---|
203 | * @param string $attname |
---|
204 | * |
---|
205 | * @access public |
---|
206 | * @return SyncItemOperationsAttachment |
---|
207 | * @throws StatusException |
---|
208 | */ |
---|
209 | public function GetAttachmentData($attname); |
---|
210 | |
---|
211 | /** |
---|
212 | * Deletes all contents of the specified folder. |
---|
213 | * This is generally used to empty the trash (wastebasked), but could also be used on any |
---|
214 | * other folder. |
---|
215 | * |
---|
216 | * @param string $folderid |
---|
217 | * @param boolean $includeSubfolders (opt) also delete sub folders, default true |
---|
218 | * |
---|
219 | * @access public |
---|
220 | * @return boolean |
---|
221 | * @throws StatusException |
---|
222 | */ |
---|
223 | public function EmptyFolder($folderid, $includeSubfolders = true); |
---|
224 | |
---|
225 | /** |
---|
226 | * Processes a response to a meeting request. |
---|
227 | * CalendarID is a reference and has to be set if a new calendar item is created |
---|
228 | * |
---|
229 | * @param string $requestid id of the object containing the request |
---|
230 | * @param string $folderid id of the parent folder of $requestid |
---|
231 | * @param string $response |
---|
232 | * |
---|
233 | * @access public |
---|
234 | * @return string id of the created/updated calendar obj |
---|
235 | * @throws StatusException |
---|
236 | */ |
---|
237 | public function MeetingResponse($requestid, $folderid, $response); |
---|
238 | |
---|
239 | /** |
---|
240 | * Indicates if the backend has a ChangesSink. |
---|
241 | * A sink is an active notification mechanism which does not need polling. |
---|
242 | * |
---|
243 | * @access public |
---|
244 | * @return boolean |
---|
245 | */ |
---|
246 | public function HasChangesSink(); |
---|
247 | |
---|
248 | /** |
---|
249 | * The folder should be considered by the sink. |
---|
250 | * Folders which were not initialized should not result in a notification |
---|
251 | * of IBacken->ChangesSink(). |
---|
252 | * |
---|
253 | * @param string $folderid |
---|
254 | * |
---|
255 | * @access public |
---|
256 | * @return boolean false if there is any problem with that folder |
---|
257 | */ |
---|
258 | public function ChangesSinkInitialize($folderid); |
---|
259 | |
---|
260 | /** |
---|
261 | * The actual ChangesSink. |
---|
262 | * For max. the $timeout value this method should block and if no changes |
---|
263 | * are available return an empty array. |
---|
264 | * If changes are available a list of folderids is expected. |
---|
265 | * |
---|
266 | * @param int $timeout max. amount of seconds to block |
---|
267 | * |
---|
268 | * @access public |
---|
269 | * @return array |
---|
270 | */ |
---|
271 | public function ChangesSink($timeout = 30); |
---|
272 | |
---|
273 | /** |
---|
274 | * Applies settings to and gets informations from the device |
---|
275 | * |
---|
276 | * @param SyncObject $settings (SyncOOF or SyncUserInformation possible) |
---|
277 | * |
---|
278 | * @access public |
---|
279 | * @return SyncObject $settings |
---|
280 | */ |
---|
281 | public function Settings($settings); |
---|
282 | } |
---|
283 | |
---|
284 | ?> |
---|