]> source.dussan.org Git - nextcloud-server.git/commitdiff
move new interfaces into lib/public and OCP
authorThomas Müller <thomas.mueller@tmit.eu>
Sat, 31 Aug 2013 19:34:29 +0000 (21:34 +0200)
committerThomas Müller <thomas.mueller@tmit.eu>
Sat, 31 Aug 2013 19:34:29 +0000 (21:34 +0200)
14 files changed:
lib/appframework/dependencyinjection/dicontainer.php
lib/appframework/http/request.php
lib/appframework/utility/simplecontainer.php
lib/contactsmanager.php
lib/public/appframework/iappcontainer.php
lib/public/contacts/imanager.php [new file with mode: 0644]
lib/public/core/contacts/imanager.php [deleted file]
lib/public/core/icontainer.php [deleted file]
lib/public/core/irequest.php [deleted file]
lib/public/core/iservercontainer.php [deleted file]
lib/public/icontainer.php [new file with mode: 0644]
lib/public/irequest.php [new file with mode: 0644]
lib/public/iservercontainer.php [new file with mode: 0644]
lib/server.php

index 43f6eee29b03a477e65d487c8a1db7d910801db9..2ef885d7b2ca7f628807ae5fc7ceaf199d4cdac9 100644 (file)
@@ -132,7 +132,7 @@ class DIContainer extends SimpleContainer implements IAppContainer{
        }
 
        /**
-        * @return \OCP\Core\IServerContainer
+        * @return \OCP\IServerContainer
         */
        function getServer()
        {
index ab72a8db697fb6d658e3d1ee464f0c7cc6875f0e..4f1775182a1e89da5b23d5656a7644d1dbdc3357 100644 (file)
@@ -22,7 +22,7 @@
 
 namespace OC\AppFramework\Http;
 
-use OCP\Core\IRequest;
+use OCP\IRequest;
 
 /**
  * Class for accessing variables in the request.
index 04b6cd727b8f6a4876242fa904df0e6f7a2cfd7c..a51ace83a3759fb73b3f75b8455301ba5075f549 100644 (file)
@@ -10,7 +10,7 @@ require_once __DIR__ . '/../../../3rdparty/Pimple/Pimple.php';
  *
  * SimpleContainer is a simple implementation of IContainer on basis of \Pimple
  */
-class SimpleContainer extends \Pimple implements \OCP\Core\IContainer {
+class SimpleContainer extends \Pimple implements \OCP\IContainer {
 
        /**
         * @param string $name name of the service to query for
index 59c413ec03b3da4c573ec26204cf80d0ad6b7a40..fc6745b450506b063afe027cb8f3578d2e53093d 100644 (file)
@@ -22,7 +22,7 @@
 
 namespace OC {
 
-       class ContactsManager implements \OCP\Core\Contacts\IManager {
+       class ContactsManager implements \OCP\Contacts\IManager {
 
                /**
                 * This function is used to search and find contacts within the users address books.
index db909241e5dcce73167e785840b8eed1a6d5158e..c8f6229dd9ee23184f7f710e9d2c827bb6fc84f8 100644 (file)
@@ -23,7 +23,7 @@
 namespace OCP\AppFramework;
 
 use OCP\AppFramework\IApi;
-use OCP\Core\IContainer;
+use OCP\IContainer;
 
 /**
  * Class IAppContainer
@@ -39,7 +39,7 @@ interface IAppContainer extends IContainer{
        function getCoreApi();
 
        /**
-        * @return \OCP\Core\IServerContainer
+        * @return \OCP\IServerContainer
         */
        function getServer();
 }
diff --git a/lib/public/contacts/imanager.php b/lib/public/contacts/imanager.php
new file mode 100644 (file)
index 0000000..3bfbca7
--- /dev/null
@@ -0,0 +1,150 @@
+<?php
+/**
+ * ownCloud
+ *
+ * @author Thomas Müller
+ * @copyright 2013 Thomas Müller thomas.mueller@tmit.eu
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public
+ * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/**
+ * Public interface of ownCloud for apps to use.
+ * Contacts Class
+ *
+ */
+
+// use OCP namespace for all classes that are considered public.
+// This means that they should be used by apps instead of the internal ownCloud classes
+namespace OCP\Contacts {
+
+       /**
+        * This class provides access to the contacts app. Use this class exclusively if you want to access contacts.
+        *
+        * Contacts in general will be expressed as an array of key-value-pairs.
+        * The keys will match the property names defined in https://tools.ietf.org/html/rfc2426#section-1
+        *
+        * Proposed workflow for working with contacts:
+        *  - search for the contacts
+        *  - manipulate the results array
+        *  - createOrUpdate will save the given contacts overwriting the existing data
+        *
+        * For updating it is mandatory to keep the id.
+        * Without an id a new contact will be created.
+        *
+        */
+       interface IManager {
+
+               /**
+                * This function is used to search and find contacts within the users address books.
+                * In case $pattern is empty all contacts will be returned.
+                *
+                * Example:
+                *  Following function shows how to search for contacts for the name and the email address.
+                *
+                *              public static function getMatchingRecipient($term) {
+                *                      $cm = \OC::$server->getContactsManager();
+                *                      // The API is not active -> nothing to do
+                *                      if (!$cm->isEnabled()) {
+                *                              return array();
+                *                      }
+                *
+                *                      $result = $cm->search($term, array('FN', 'EMAIL'));
+                *                      $receivers = array();
+                *                      foreach ($result as $r) {
+                *                              $id = $r['id'];
+                *                              $fn = $r['FN'];
+                *                              $email = $r['EMAIL'];
+                *                              if (!is_array($email)) {
+                *                                      $email = array($email);
+                *                              }
+                *
+                *                              // loop through all email addresses of this contact
+                *                              foreach ($email as $e) {
+                *                              $displayName = $fn . " <$e>";
+                *                              $receivers[] = array(
+                *                                      'id'    => $id,
+                *                                      'label' => $displayName,
+                *                                      'value' => $displayName);
+                *                              }
+                *                      }
+                *
+                *                      return $receivers;
+                *              }
+                *
+                *
+                * @param string $pattern which should match within the $searchProperties
+                * @param array $searchProperties defines the properties within the query pattern should match
+                * @param array $options - for future use. One should always have options!
+                * @return array of contacts which are arrays of key-value-pairs
+                */
+               function search($pattern, $searchProperties = array(), $options = array());
+
+               /**
+                * This function can be used to delete the contact identified by the given id
+                *
+                * @param object $id the unique identifier to a contact
+                * @param $address_book_key
+                * @return bool successful or not
+                */
+               function delete($id, $address_book_key);
+
+               /**
+                * This function is used to create a new contact if 'id' is not given or not present.
+                * Otherwise the contact will be updated by replacing the entire data set.
+                *
+                * @param array $properties this array if key-value-pairs defines a contact
+                * @param $address_book_key string to identify the address book in which the contact shall be created or updated
+                * @return array representing the contact just created or updated
+                */
+               function createOrUpdate($properties, $address_book_key);
+
+               /**
+                * Check if contacts are available (e.g. contacts app enabled)
+                *
+                * @return bool true if enabled, false if not
+                */
+               function isEnabled();
+
+               /**
+                * @param \OCP\IAddressBook $address_book
+                */
+               function registerAddressBook(\OCP\IAddressBook $address_book);
+
+               /**
+                * @param \OCP\IAddressBook $address_book
+                */
+               function unregisterAddressBook(\OCP\IAddressBook $address_book);
+
+               /**
+                * In order to improve lazy loading a closure can be registered which will be called in case
+                * address books are actually requested
+                *
+                * @param string $key
+                * @param \Closure $callable
+                */
+               function register($key, \Closure $callable);
+
+               /**
+                * @return array
+                */
+               function getAddressBooks();
+
+               /**
+                * removes all registered address book instances
+                */
+               function clear();
+       }
+}
diff --git a/lib/public/core/contacts/imanager.php b/lib/public/core/contacts/imanager.php
deleted file mode 100644 (file)
index e8bb7bf..0000000
+++ /dev/null
@@ -1,150 +0,0 @@
-<?php
-/**
- * ownCloud
- *
- * @author Thomas Müller
- * @copyright 2013 Thomas Müller thomas.mueller@tmit.eu
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
- *
- * You should have received a copy of the GNU Affero General Public
- * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-/**
- * Public interface of ownCloud for apps to use.
- * Contacts Class
- *
- */
-
-// use OCP namespace for all classes that are considered public.
-// This means that they should be used by apps instead of the internal ownCloud classes
-namespace OCP\Core\Contacts {
-
-       /**
-        * This class provides access to the contacts app. Use this class exclusively if you want to access contacts.
-        *
-        * Contacts in general will be expressed as an array of key-value-pairs.
-        * The keys will match the property names defined in https://tools.ietf.org/html/rfc2426#section-1
-        *
-        * Proposed workflow for working with contacts:
-        *  - search for the contacts
-        *  - manipulate the results array
-        *  - createOrUpdate will save the given contacts overwriting the existing data
-        *
-        * For updating it is mandatory to keep the id.
-        * Without an id a new contact will be created.
-        *
-        */
-       interface IManager {
-
-               /**
-                * This function is used to search and find contacts within the users address books.
-                * In case $pattern is empty all contacts will be returned.
-                *
-                * Example:
-                *  Following function shows how to search for contacts for the name and the email address.
-                *
-                *              public static function getMatchingRecipient($term) {
-                *                      $cm = \OC::$server->getContactsManager();
-                *                      // The API is not active -> nothing to do
-                *                      if (!$cm->isEnabled()) {
-                *                              return array();
-                *                      }
-                *
-                *                      $result = $cm->search($term, array('FN', 'EMAIL'));
-                *                      $receivers = array();
-                *                      foreach ($result as $r) {
-                *                              $id = $r['id'];
-                *                              $fn = $r['FN'];
-                *                              $email = $r['EMAIL'];
-                *                              if (!is_array($email)) {
-                *                                      $email = array($email);
-                *                              }
-                *
-                *                              // loop through all email addresses of this contact
-                *                              foreach ($email as $e) {
-                *                              $displayName = $fn . " <$e>";
-                *                              $receivers[] = array(
-                *                                      'id'    => $id,
-                *                                      'label' => $displayName,
-                *                                      'value' => $displayName);
-                *                              }
-                *                      }
-                *
-                *                      return $receivers;
-                *              }
-                *
-                *
-                * @param string $pattern which should match within the $searchProperties
-                * @param array $searchProperties defines the properties within the query pattern should match
-                * @param array $options - for future use. One should always have options!
-                * @return array of contacts which are arrays of key-value-pairs
-                */
-               function search($pattern, $searchProperties = array(), $options = array());
-
-               /**
-                * This function can be used to delete the contact identified by the given id
-                *
-                * @param object $id the unique identifier to a contact
-                * @param $address_book_key
-                * @return bool successful or not
-                */
-               function delete($id, $address_book_key);
-
-               /**
-                * This function is used to create a new contact if 'id' is not given or not present.
-                * Otherwise the contact will be updated by replacing the entire data set.
-                *
-                * @param array $properties this array if key-value-pairs defines a contact
-                * @param $address_book_key string to identify the address book in which the contact shall be created or updated
-                * @return array representing the contact just created or updated
-                */
-               function createOrUpdate($properties, $address_book_key);
-
-               /**
-                * Check if contacts are available (e.g. contacts app enabled)
-                *
-                * @return bool true if enabled, false if not
-                */
-               function isEnabled();
-
-               /**
-                * @param \OCP\IAddressBook $address_book
-                */
-               function registerAddressBook(\OCP\IAddressBook $address_book);
-
-               /**
-                * @param \OCP\IAddressBook $address_book
-                */
-               function unregisterAddressBook(\OCP\IAddressBook $address_book);
-
-               /**
-                * In order to improve lazy loading a closure can be registered which will be called in case
-                * address books are actually requested
-                *
-                * @param string $key
-                * @param \Closure $callable
-                */
-               function register($key, \Closure $callable);
-
-               /**
-                * @return array
-                */
-               function getAddressBooks();
-
-               /**
-                * removes all registered address book instances
-                */
-               function clear();
-       }
-}
diff --git a/lib/public/core/icontainer.php b/lib/public/core/icontainer.php
deleted file mode 100644 (file)
index 88ebc6c..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-<?php
-/**
- * ownCloud
- *
- * @author Thomas Müller
- * @copyright 2013 Thomas Müller deepdiver@owncloud.com
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
- *
- * You should have received a copy of the GNU Affero General Public
- * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-namespace OCP\Core;
-
-/**
- * Class IContainer
- *
- * IContainer is the basic interface to be used for any internal dependency injection mechanism
- *
- * @package OCP\Core
- */
-interface IContainer {
-
-       /**
-        * Look up a service for a given name in the container.
-        *
-        * @param string $name
-        * @return mixed
-        */
-       function query($name);
-
-       /**
-        * A value is stored in the container with it's corresponding name
-        *
-        * @param string $name
-        * @param mixed $value
-        * @return void
-        */
-       function registerParameter($name, $value);
-
-       /**
-        * A service is registered in the container where a closure is passed in which will actually
-        * create the service on demand.
-        * In case the parameter $shared is set to true (the default usage) the once created service will remain in
-        * memory and be reused on subsequent calls.
-        * In case the parameter is false the service will be recreated on every call.
-        *
-        * @param string $name
-        * @param callable $closure
-        * @param bool $shared
-        * @return void
-        */
-       function registerService($name, \Closure $closure, $shared = true);
-}
diff --git a/lib/public/core/irequest.php b/lib/public/core/irequest.php
deleted file mode 100644 (file)
index be60978..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-<?php
-/**
- * ownCloud
- *
- * @author Thomas Müller
- * @copyright 2013 Thomas Müller deepdiver@owncloud.com
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
- *
- * You should have received a copy of the GNU Affero General Public
- * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-namespace OCP\Core;
-
-
-interface IRequest {
-
-       function getHeader($name);
-
-       /**
-        * Lets you access post and get parameters by the index
-        * In case of json requests the encoded json body is accessed
-        *
-        * @param string $key the key which you want to access in the URL Parameter
-        *                     placeholder, $_POST or $_GET array.
-        *                     The priority how they're returned is the following:
-        *                     1. URL parameters
-        *                     2. POST parameters
-        *                     3. GET parameters
-        * @param mixed $default If the key is not found, this value will be returned
-        * @return mixed the content of the array
-        */
-       public function getParam($key, $default = null);
-
-
-       /**
-        * Returns all params that were received, be it from the request
-        *
-        * (as GET or POST) or through the URL by the route
-        * @return array the array with all parameters
-        */
-       public function getParams();
-
-       /**
-        * Returns the method of the request
-        *
-        * @return string the method of the request (POST, GET, etc)
-        */
-       public function getMethod();
-
-       /**
-        * Shortcut for accessing an uploaded file through the $_FILES array
-        *
-        * @param string $key the key that will be taken from the $_FILES array
-        * @return array the file in the $_FILES element
-        */
-       public function getUploadedFile($key);
-
-
-       /**
-        * Shortcut for getting env variables
-        *
-        * @param string $key the key that will be taken from the $_ENV array
-        * @return array the value in the $_ENV element
-        */
-       public function getEnv($key);
-
-
-       /**
-        * Shortcut for getting session variables
-        *
-        * @param string $key the key that will be taken from the $_SESSION array
-        * @return array the value in the $_SESSION element
-        */
-       function getSession($key);
-
-
-       /**
-        * Shortcut for getting cookie variables
-        *
-        * @param string $key the key that will be taken from the $_COOKIE array
-        * @return array the value in the $_COOKIE element
-        */
-       function getCookie($key);
-
-
-       /**
-        * Returns the request body content.
-        *
-        * @param Boolean $asResource If true, a resource will be returned
-        * @return string|resource The request body content or a resource to read the body stream.
-        * @throws \LogicException
-        */
-       function getContent($asResource = false);
-}
diff --git a/lib/public/core/iservercontainer.php b/lib/public/core/iservercontainer.php
deleted file mode 100644 (file)
index 0517cc5..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-<?php
-/**
- * ownCloud
- *
- * @author Thomas Müller
- * @copyright 2013 Thomas Müller deepdiver@owncloud.com
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
- *
- * You should have received a copy of the GNU Affero General Public
- * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-namespace OCP\Core;
-
-
-/**
- * Class IServerContainer
- * @package OCP\Core
- *
- * This container holds all ownCloud services
- */
-interface IServerContainer {
-
-       /**
-        * The contacts manager will act as a broker between consumers for contacts information and
-        * providers which actual deliver the contact information.
-        *
-        * @return \OCP\Core\Contacts\IManager
-        */
-       function getContactsManager();
-
-       /**
-        * The current request object holding all information about the request currently being processed
-        * is returned from this method.
-        * In case the current execution was not initiated by a web request null is returned
-        *
-        * @return \OCP\Core\IRequest|null
-        */
-       function getRequest();
-
-}
diff --git a/lib/public/icontainer.php b/lib/public/icontainer.php
new file mode 100644 (file)
index 0000000..d43c1c9
--- /dev/null
@@ -0,0 +1,64 @@
+<?php
+/**
+ * ownCloud
+ *
+ * @author Thomas Müller
+ * @copyright 2013 Thomas Müller deepdiver@owncloud.com
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public
+ * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace OCP;
+
+/**
+ * Class IContainer
+ *
+ * IContainer is the basic interface to be used for any internal dependency injection mechanism
+ *
+ * @package OCP
+ */
+interface IContainer {
+
+       /**
+        * Look up a service for a given name in the container.
+        *
+        * @param string $name
+        * @return mixed
+        */
+       function query($name);
+
+       /**
+        * A value is stored in the container with it's corresponding name
+        *
+        * @param string $name
+        * @param mixed $value
+        * @return void
+        */
+       function registerParameter($name, $value);
+
+       /**
+        * A service is registered in the container where a closure is passed in which will actually
+        * create the service on demand.
+        * In case the parameter $shared is set to true (the default usage) the once created service will remain in
+        * memory and be reused on subsequent calls.
+        * In case the parameter is false the service will be recreated on every call.
+        *
+        * @param string $name
+        * @param callable $closure
+        * @param bool $shared
+        * @return void
+        */
+       function registerService($name, \Closure $closure, $shared = true);
+}
diff --git a/lib/public/irequest.php b/lib/public/irequest.php
new file mode 100644 (file)
index 0000000..cd39855
--- /dev/null
@@ -0,0 +1,105 @@
+<?php
+/**
+ * ownCloud
+ *
+ * @author Thomas Müller
+ * @copyright 2013 Thomas Müller deepdiver@owncloud.com
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public
+ * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace OCP;
+
+
+interface IRequest {
+
+       function getHeader($name);
+
+       /**
+        * Lets you access post and get parameters by the index
+        * In case of json requests the encoded json body is accessed
+        *
+        * @param string $key the key which you want to access in the URL Parameter
+        *                     placeholder, $_POST or $_GET array.
+        *                     The priority how they're returned is the following:
+        *                     1. URL parameters
+        *                     2. POST parameters
+        *                     3. GET parameters
+        * @param mixed $default If the key is not found, this value will be returned
+        * @return mixed the content of the array
+        */
+       public function getParam($key, $default = null);
+
+
+       /**
+        * Returns all params that were received, be it from the request
+        *
+        * (as GET or POST) or through the URL by the route
+        * @return array the array with all parameters
+        */
+       public function getParams();
+
+       /**
+        * Returns the method of the request
+        *
+        * @return string the method of the request (POST, GET, etc)
+        */
+       public function getMethod();
+
+       /**
+        * Shortcut for accessing an uploaded file through the $_FILES array
+        *
+        * @param string $key the key that will be taken from the $_FILES array
+        * @return array the file in the $_FILES element
+        */
+       public function getUploadedFile($key);
+
+
+       /**
+        * Shortcut for getting env variables
+        *
+        * @param string $key the key that will be taken from the $_ENV array
+        * @return array the value in the $_ENV element
+        */
+       public function getEnv($key);
+
+
+       /**
+        * Shortcut for getting session variables
+        *
+        * @param string $key the key that will be taken from the $_SESSION array
+        * @return array the value in the $_SESSION element
+        */
+       function getSession($key);
+
+
+       /**
+        * Shortcut for getting cookie variables
+        *
+        * @param string $key the key that will be taken from the $_COOKIE array
+        * @return array the value in the $_COOKIE element
+        */
+       function getCookie($key);
+
+
+       /**
+        * Returns the request body content.
+        *
+        * @param Boolean $asResource If true, a resource will be returned
+        * @return string|resource The request body content or a resource to read the body stream.
+        * @throws \LogicException
+        */
+       function getContent($asResource = false);
+}
diff --git a/lib/public/iservercontainer.php b/lib/public/iservercontainer.php
new file mode 100644 (file)
index 0000000..5f5b967
--- /dev/null
@@ -0,0 +1,51 @@
+<?php
+/**
+ * ownCloud
+ *
+ * @author Thomas Müller
+ * @copyright 2013 Thomas Müller deepdiver@owncloud.com
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public
+ * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace OCP;
+
+
+/**
+ * Class IServerContainer
+ * @package OCP
+ *
+ * This container holds all ownCloud services
+ */
+interface IServerContainer {
+
+       /**
+        * The contacts manager will act as a broker between consumers for contacts information and
+        * providers which actual deliver the contact information.
+        *
+        * @return \OCP\Contacts\IManager
+        */
+       function getContactsManager();
+
+       /**
+        * The current request object holding all information about the request currently being processed
+        * is returned from this method.
+        * In case the current execution was not initiated by a web request null is returned
+        *
+        * @return \OCP\IRequest|null
+        */
+       function getRequest();
+
+}
index 72c82efe16bc2b350eb5f64e866640a278306c9c..ad955bf5c655062cf39a23d378c5f79b459ab013 100644 (file)
@@ -3,7 +3,7 @@
 namespace OC;
 
 use OC\AppFramework\Utility\SimpleContainer;
-use OCP\Core\IServerContainer;
+use OCP\IServerContainer;
 
 /**
  * Class Server
@@ -20,9 +20,21 @@ class Server extends SimpleContainer implements IServerContainer {
        }
 
        /**
-        * @return \OCP\Core\Contacts\IManager
+        * @return \OCP\Contacts\IManager
         */
        function getContactsManager() {
                return $this->query('ContactsManager');
        }
+
+       /**
+        * The current request object holding all information about the request currently being processed
+        * is returned from this method.
+        * In case the current execution was not initiated by a web request null is returned
+        *
+        * @return \OCP\IRequest|null
+        */
+       function getRequest()
+       {
+               return $this->query('Request');
+       }
 }