diff options
| author | root <root@kabir-PC> | 2016-03-23 11:31:51 +0100 |
|---|---|---|
| committer | root <root@kabir-PC> | 2016-03-23 11:31:51 +0100 |
| commit | a26989103d70fb0dd3ff6834de107cae246778c3 (patch) | |
| tree | 0f243c83b790ffb57f19261fc2a509131f6776ce /server/core | |
| parent | 1342db60283cb61a1c3810993575d35b9fb33ac0 (diff) | |
| parent | 6e78d76f887d1149ea85bfb06db7ee7ad7435f5a (diff) | |
Merge branch 'develop' of https://github.com/manzerbredes/istic-openstack into develop
Diffstat (limited to 'server/core')
| -rwxr-xr-x | server/core/App.php | 40 | ||||
| -rwxr-xr-x[-rw-r--r--] | server/core/Compute.php | 639 | ||||
| -rwxr-xr-x | server/core/ErrorManagement.php | 14 | ||||
| -rwxr-xr-x | server/core/Identity.php | 715 | ||||
| -rwxr-xr-x[-rw-r--r--] | server/core/Image.php | 834 | ||||
| -rwxr-xr-x | server/core/LibOverride/genTokenOptions.php | 36 |
6 files changed, 1490 insertions, 788 deletions
diff --git a/server/core/App.php b/server/core/App.php index edb75f6..d35ccc0 100755 --- a/server/core/App.php +++ b/server/core/App.php @@ -3,10 +3,10 @@ include_once("core/Plugin_Api.php"); include_once("core/LibOverride/genTokenOptions.php");
include_once("core/ErrorManagement.php");
-use OpenStack\Common\Error\BadResponseError;
-use OpenStack\Common\Error\BaseError;
-use OpenStack\Common\Error\NotImplementedError;
-use OpenStack\Common\Error\UserInputError;
+use OpenCloud\Common\Error\BadResponseError;
+use OpenCloud\Common\Error\BaseError;
+use OpenCloud\Common\Error\NotImplementedError;
+use OpenCloud\Common\Error\UserInputError;
class App{
@@ -56,10 +56,10 @@ class App{ return $this->openstack->networkingV2($opt);
break;
case "Compute":
- if($this->tokenPost == NULL) $this->tokenClass->genComputeToken();
- $opt = $this->tokenClass->getOptions($service);
- return $this->openstack->computeV2($opt);
- break;
+ if($this->tokenPost == NULL) $this->tokenClass->genComputeToken();
+ $opt = $this->tokenClass->getOptions($service);
+ return $this->openstack->computeV2($opt);
+ break;
}
}
@@ -81,7 +81,29 @@ class App{ $this->errorClass->BaseErrorHandler($e);
}catch(NotImplementedError $e){
$this->errorClass->NotImplementedHandler($e);
- }
+ }
+
+ }
+
+ public function deauthenticate(){
+
+ try{
+
+ $this->tokenClass->revokeComputeToken();
+ $this->tokenClass->revokeImageToken();
+ $this->tokenClass->revokeNetworkToken();
+ $this->tokenClass->revokeIdentityToken();
+
+ $this->setOutput("deauthenticate", "Ok");
+ }catch(BadResponseError $e){
+ $this->errorClass->BadResponseHandler($e);
+ }catch(UserInputError $e){
+ $this->errorClass->UserInputHandler($e);
+ }catch(BaseError $e){
+ $this->errorClass->BaseErrorHandler($e);
+ }catch(NotImplementedError $e){
+ $this->errorClass->NotImplementedHandler($e);
+ }
}
diff --git a/server/core/Compute.php b/server/core/Compute.php index a5b8375..9b01d49 100644..100755 --- a/server/core/Compute.php +++ b/server/core/Compute.php @@ -1,7 +1,6 @@ <?php //namespace istic-openstack\Server\core; -// TODO introduce error-handling based on errors specific to the compute module -use OpenStack\Common\Error; +use OpenCloud\Common\Error; class compute { @@ -12,11 +11,11 @@ class compute protected $libClass; - public function __construct($app) - { - $this->app = $app; - $this->libClass = $app->getLibClass("Compute"); - } + public function __construct($app) + { + $this->app = $app; + $this->libClass = $app->getLibClass("Compute"); + } /** * Execute an action * @@ -35,21 +34,51 @@ class compute */ public function listServers() { - $serverList = $this->libClass->listServers(true); - $servers = Array(); - foreach($serverList as $server){ - $servers[$server->id] = Array(); - $server->flavor->retrieve(); - $server->image->retrieve(); - $servers[$server->id]["id"] = $server->id; - $servers[$server->id]["name"] = $server->name; - $servers[$server->id]["imageId"] = $server->image->id; - $servers[$server->id]["flavorId"] = $server->flavor->id; - $servers[$server->id]["status"] = $server->status; - $servers[$server->id]["ram"] = $server->flavor->ram; - $servers[$server->id]["disk"] = $server->flavor->disk; - } - $this->app->setOutput("Servers", $servers); + try{ + $serverList = $this->libClass->listServers(true); + $servers = Array(); + foreach($serverList as $server){ + $servers[$server->id] = Array(); + $server->flavor->retrieve(); + $server->image->retrieve(); + $server->retrieve(); + $servers[$server->id]["id"] = $server->id; + $servers[$server->id]["name"] = $server->name; + $servers[$server->id]["image"] = $server->image; + $servers[$server->id]["ram"] = $server->flavor->ram; + $servers[$server->id]["disk"] = $server->flavor->disk; + $servers[$server->id]["flavor"] = $server->flavor; + $servers[$server->id]["status"] = $server->status; + $servers[$server->id]["created"] = $server->created; + $servers[$server->id]["updated"] = $server->updated; + $servers[$server->id]["ipv4"] = $server->ipv4; + $servers[$server->id]["ipv6"] = $server->ipv6; + $servers[$server->id]["progress"] = $server->progress; + $servers[$server->id]["hostId"] = $server->hostId; + $servers[$server->id]["tenantId"] = $server->tenantId; + $servers[$server->id]["userId"] = $server->userId; + $servers[$server->id]["taskState"] = $server->taskState; + $servers[$server->id]["addresses"] = $server->addresses; + $servers[$server->id]["links"] = $server->links; + $servers[$server->id]["metadata"] = $server->metadata; + } + $this->app->setOutput("Servers", $servers); + } + catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + } + catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + } + catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + } + catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + } + catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } return; } /** @@ -58,14 +87,36 @@ class compute */ public function listFlavors() { - $flavorList = $this->libClass->listFlavors(); - $flavors = Array(); - foreach($flavorList as $flavor){ - $flavors[$flavor->id] = Array(); - $flavors[$flavor->id]["id"] = $flavor->id; - $flavors[$flavor->id]["name"] = $flavor->name; + try{ + $flavorList = $this->libClass->listFlavors(); + $flavors = Array(); + foreach($flavorList as $flavor){ + $flavors[$flavor->id] = Array(); + $flavor->retrieve(); + $flavors[$flavor->id]["id"] = $flavor->id; + $flavors[$flavor->id]["name"] = $flavor->name; + $flavors[$flavor->id]["ram"] = $flavor->ram; + $flavors[$flavor->id]["disk"] = $flavor->disk; + $flavors[$flavor->id]["vcpus"] = $flavor->vcpus; + $flavors[$flavor->id]["links"] = $flavor->links; } $this->app->setOutput("Flavors", $flavors); + } + catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + } + catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + } + catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + } + catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + } + catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } return; } /** @@ -74,37 +125,74 @@ class compute */ public function listImages() { - $imageList = $this->libClass->listImages(); - $images = Array(); - foreach($imageList as $image){ - $images[$image->id] = Array(); - $images[$image->id]["id"] = $image->id; - $images[$image->id]["name"] = $image->name; + try{ + $imageList = $this->libClass->listImages(); + $images = Array(); + foreach($imageList as $image){ + $images[$image->id] = Array(); + $image->retrieve(); + $images[$image->id]["id"] = $image->id; + $images[$image->id]["name"] = $image->name; + $images[$image->id]["status"] = $image->status; + $images[$image->id]["created"] = $image->created; + $images[$image->id]["updated"] = $image->updated; + $images[$image->id]["minDisk"] = $image->minDisk; + $images[$image->id]["minRam"] = $image->minRam; + $images[$image->id]["progress"] = $image->progress; + $images[$image->id]["links"] = $image->links; + $images[$image->id]["metadata"] = $image->metadata; } $this->app->setOutput("Images", $images); + } + catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + } + catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + } + catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + } + catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + } + catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } return; } - /** - * Create server. - * @return array - * - public function createServer() - { - - $server = $this->libClass->createServer(); - } - */ - /** + /** * Get server details. * @return array */ public function getServer() { - $serverId = $this->app->getPostParam("serverId"); - $opt = array('id' => $serverId); - $server = $this->libClass->getServer($opt); - $server->retrieve(); - $this->app->setOutput("MyServer", $server); + try{ + $serverId = $this->app->getPostParam("serverId"); + if(!isset($serverId)){ + $this->app->setOutput("Error", "Server ID is missing, son!"); + return; + } + $opt = array('id' => $serverId); + $server = $this->libClass->getServer($opt); + $server->retrieve(); + $this->app->setOutput("MyServer", $server); + } + catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + } + catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + } + catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + } + catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + } + catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } return; } /** @@ -113,11 +201,32 @@ class compute */ public function getFlavor() { - $flavorId = $this->app->getPostParam("flavorId"); - $opt = array('id' => $flavorId); - $flavor = $this->libClass->getFlavor($opt); - $flavor->retrieve(); - $this->app->setOutput("MyFlavor", $flavor); + try{ + $flavorId = $this->app->getPostParam("flavorId"); + if(!isset($serverId)){ + $this->app->setOutput("Error", "Flavor ID is missing, son!"); + return; + } + $opt = array('id' => $flavorId); + $flavor = $this->libClass->getFlavor($opt); + $flavor->retrieve(); + $this->app->setOutput("MyFlavor", $flavor); + } + catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + } + catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + } + catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + } + catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + } + catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } return; } /** @@ -126,76 +235,400 @@ class compute */ public function getImage() { - $imageId = $this->app->getPostParam("imageId"); - $opt = array('id' => $imageId); - $image = $this->libClass->getImage($opt); - $image->retrieve(); - $this->app->setOutput("MyImage", $image); + try{ + $imageId = $this->app->getPostParam("imageId"); + if(!isset($serverId)){ + $this->app->setOutput("Error", "Image ID is missing, son!"); + return; + } + $opt = array('id' => $imageId); + $image = $this->libClass->getImage($opt); + $image->retrieve(); + $this->app->setOutput("MyImage", $image); + } + catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + } + catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + } + catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + } + catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + } + catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } return; } - /* working on tests - - public function update() + /** + * Create server. + * @return array + */ + public function createServer() { - $image = $this->app->getServer(array $options = []); - + try{ + $name = $this->app->getPostParam("name"); + $imageId = $this->app->getPostParam("imageId"); + $flavorId = $this->app->getPostParam("flavorId"); + if(!isset($name) || !isset($imageId) || !isset($flavorId)){ + $this->app->setOutput("Error", "No, we don't let you create a server without a name OR image ID OR flavor ID."); + return; + } + $opt = array('name' => $name, 'imageId' => $imageId, 'flavorId' => $flavorId); + $server = $this->libClass->createServer($opt); + } + catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + } + catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + } + catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + } + catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + } + catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + return; } - public function delete() + + /** + * update a server + * @return void + */ + public function updateServer() { - //TODO + try{ + $serverId = $this->app->getPostParam("serverId"); + $newName = $this->app->getPostParam("newName"); + $newIpv4 = $this->app->getPostParam("newIpv4"); + $newIpv6 = $this->app->getPostParam("newIpv6"); + if(!isset($serverId)|| !(isset($newName) || isset($newIpv4) || isset($newIpv6)) ){ + $this->app->setOutput("Error", "You'll have to provide server ID and the new attribute(IP(v4/v6)/Name) you desire to update!"); + return; + } + $opt = array('id' => $serverId); + $server = $this->libClass->getServer($opt); + if (isset($newName)){ + if(isset($newIpv4)){ + if(isset($newIpv6)){ + $attr = array('name' => $newName, 'accessIPv4' => $newIPv4, 'accessIPv6' => $newIpv6); + } + else $attr = array('name' => $newName, 'accessIPv4' => $newIPv4); + } + else $attr = array('name' => $newName); + } + $server->update($attr); + $this->app->setOutput("Success", $serverId." has been updated successfully."); + } + catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + } + catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + } + catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + } + catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + } + catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + return; } - public function changePassword($newPassword) + /** + * Delete a server + * @return void + */ + public function deleteServer() { - //TODO + try{ + $serverId = $this->app->getPostParam("serverId"); + if(!isset($serverId)){ + $this->app->setOutput("Error", "Server ID is missing, son!"); + return; + } + $opt = array('id' => $serverId); + $server = $this->libClass->getServer($opt); + $server->delete(); + $this->app->setOutput("Success", $serverId." has been deleted successfully."); + } + catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + } + catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + } + catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + } + catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + } + catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + return; } - public function reboot($type = Enum::REBOOT_SOFT) + /** + * Change the password of a server + * @return void + */ + public function changePassword() { - //TODO + try{ + $serverId = $this->app->getPostParam("serverId"); + $password = $this->app->getPostParam("newPassword"); + if(!isset($serverId) || !isset($password)){ + $this->app->setOutput("Error", "Server ID or new password missing."); + return; + } + $opt = array('id' => $serverId); + $server = $this->libClass->getServer($opt); + $server->changePassword($password); + $this->app->setOutput("Success", "Password for ".$serverId." has been updated successfully."); + } + catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + } + catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + } + catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + } + catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + } + catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + return; } - public function rebuild(array $options) + /** + * Reboot a server + * @return void + */ + public function reboot() { - //TODO + try{ + $serverId = $this->app->getPostParam("serverId"); + if(!isset($serverId)){ + $this->app->setOutput("Error", "Server ID is missing, son!"); + return; + } + $opt = array('id' => $serverId); + $server = $this->libClass->getServer($opt); + $server->reboot(); + $this->app->setOutput("Success", $serverId." has been deleted successfully."); + } + catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + } + catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + } + catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + } + catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + } + catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + return; } - public function resize($flavorId) + /** + * Rebuild a server + * @return void + */ + public function rebuild() { - //TODO + $serverId = $this->app->getPostParam("serverId"); + $imageId = $this->app->getPostParam("imageId"); + $newName = $this->app->getPostParam("newName"); + $adminPass = $this->app->getPostParam("adminPass"); + if(!isset($serverId)|| !isset($imageId) || isset($newName) || isset($adminPass)) { + $this->app->setOutput("Error", "You'll have to provide server ID and the new image, name and admin password!"); + return; + try{ + $serverId = $this->app->getPostParam("serverId"); + $imageId = $this->app->getPostParam("imageId"); + $newName = $this->app->getPostParam("newName"); + $adminPass = $this->app->getPostParam("adminPass"); + if(!isset($serverId)|| !isset($imageId) || isset($newName) || isset($adminPass)){ + $this->app->setOutput("Error", "You'll have to provide server ID and the new image, name and admin password!"); + return; + } + $opt = array('id' => $serverId); + $server = $this->libClass->getServer($opt); + $attr = array('imageId' => $imageId, 'name' => $newName, 'adminPass' => $adminPass); + $server->rebuild($attr); + $this->app->setOutput("Success", $serverId." has been rebuilt successfully with the new image."); + } + catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + } + catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + } + catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + } + catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + } + catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + return; } - public function confirmResize() + /** + * Resize a server + * A call to this method has to be followed by either confirmResize or revertResize + * @return void + */ + public function resize() { - //TODO + try{ + $serverId = $this->app->getPostParam("serverId"); + $newFlavorId = $this->app->getPostParam("newFlavorId"); + if(!isset($serverId)|| !isset($flavorId)){ + $this->app->setOutput("Error", "You'll have to provide server ID and the new flavor ID!"); + return; + } + $opt = array('id' => $serverId); + $server = $this->libClass->getServer($opt); + $server->resize($newFlavorId); + } + catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + } + catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + } + catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + } + catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + } + catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + return; } - public function revertResize() + /** + * Confirm resize operation on a server + * @return void + */ + public function confirmResize() { - //TODO + try{ + $serverId = $this->app->getPostParam("serverId"); + if(!isset($serverId)){ + $this->app->setOutput("Error", "Server ID is missing!"); + return; + } + $opt = array('id' => $serverId); + $server = $this->libClass->getServer($opt); + $server->confirmResize(); + $this->app->setOutput("Success", $serverId." has been resized successfully as the new flavor."); + } + catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + } + catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + } + catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + } + catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + } + catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + return; } - public function createImage(array $options) + /** + * Revert resize operation on a server + * @return void + */ + public function revertResize() { - //TODO + try{ + $serverId = $this->app->getPostParam("serverId"); + if(!isset($serverId)){ + $this->app->setOutput("Error", "Server ID is missing!"); + return; + } + $opt = array('id' => $serverId); + $server = $this->libClass->getServer($opt); + $server->revertResize(); + $this->app->setOutput("Success", $serverId." : resize operation has been reverted to the old flavor."); + } + catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + } + catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + } + catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + } + catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + } + catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + return; } + /** + * List private and public addresses of a server + * @return void + */ + public function listAddresses(array $options = []) { - //TODO - } - public function getMetadata() - { - //TODO - } - public function resetMetadata(array $metadata) - { - //TODO - } - public function mergeMetadata(array $metadata) - { - //TODO - } - public function getMetadataItem($key) - { - //TODO - } - public function deleteMetadataItem($key) - { - //TODO + try{ + $serverId = $this->app->getPostParam("serverId"); + if(!isset($serverId)){ + $this->app->setOutput("Error", "Server ID is missing!"); + return; + } + $opt = array('id' => $serverId); + $server = $this->libClass->getServer($opt); + $addresses = $server->listAddresses(); + $this->app->setOutput("Addresses", $addresses); + } + catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + } + catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + } + catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + } + catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + } + catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + return; } -*/ } diff --git a/server/core/ErrorManagement.php b/server/core/ErrorManagement.php index 6bff61f..3257dd3 100755 --- a/server/core/ErrorManagement.php +++ b/server/core/ErrorManagement.php @@ -1,9 +1,9 @@ <?php
-use OpenStack\Common\Error\BadResponseError;
-use OpenStack\Common\Error\BaseError;
-use OpenStack\Common\Error\NotImplementedError;
-use OpenStack\Common\Error\UserInputError;
+use OpenCloud\Common\Error\BadResponseError;
+use OpenCloud\Common\Error\BaseError;
+use OpenCloud\Common\Error\NotImplementedError;
+use OpenCloud\Common\Error\UserInputError;
Class errorManagement{
@@ -32,8 +32,12 @@ Class errorManagement{ public function UserInputHandler($error){
}
+
+ public function OtherException($error){
+ $this->app->setOutput("Error", $error->getMessage());
+ }
}
-?>
\ No newline at end of file +?>
diff --git a/server/core/Identity.php b/server/core/Identity.php index 2638985..464522a 100755 --- a/server/core/Identity.php +++ b/server/core/Identity.php @@ -9,7 +9,7 @@ * * @todo Complete the functions and finish the descriptions */ -use OpenStack\Common\Error; +use OpenCloud\Common\Error; /** * Identity Class of the back-end application @@ -87,13 +87,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -111,13 +113,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -144,13 +148,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -187,13 +193,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -220,14 +228,17 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } + }- /** @@ -266,13 +277,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -291,13 +304,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -325,13 +340,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -374,13 +391,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -407,13 +426,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -442,13 +463,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -480,13 +503,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -519,13 +544,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -557,13 +584,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -592,13 +621,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -630,13 +661,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -669,13 +702,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -714,13 +749,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -754,13 +791,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -786,13 +825,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -810,13 +851,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -849,13 +892,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); }*/ } @@ -881,13 +926,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -914,13 +961,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); }*/ } @@ -947,13 +996,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); }*/ } @@ -981,13 +1032,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); }*/ } @@ -1022,13 +1075,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -1056,13 +1111,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -1090,13 +1147,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -1125,13 +1184,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -1160,13 +1221,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -1195,13 +1258,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -1228,13 +1293,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); }*/ } @@ -1261,13 +1328,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); }*/ } @@ -1294,13 +1363,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); }*/ } @@ -1328,13 +1399,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); }*/ } @@ -1361,13 +1434,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); }*/ } @@ -1398,13 +1473,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -1422,13 +1499,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -1455,13 +1534,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -1495,13 +1576,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -1528,13 +1611,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -1563,13 +1648,17 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -1602,13 +1691,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -1643,13 +1734,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -1682,13 +1775,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -1718,13 +1813,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -1757,13 +1854,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -1798,13 +1897,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -1837,13 +1938,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -1871,13 +1974,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -1895,13 +2000,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -1919,13 +2026,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -1954,13 +2063,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -1978,13 +2089,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -2009,13 +2122,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -2043,13 +2158,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -2081,13 +2198,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -2123,13 +2242,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -2159,13 +2280,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -2201,13 +2324,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -2249,13 +2374,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -2285,13 +2412,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -2317,13 +2446,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -2362,13 +2493,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -2386,13 +2519,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -2419,13 +2554,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -2458,13 +2595,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -2491,13 +2630,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -2525,13 +2666,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } @@ -2559,13 +2702,15 @@ class identity implements Core{ //TODO parse answer }catch(BadResponseError $e){ - $this->app->getErrorInstance->BadResponseHandler($e); + $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } } } diff --git a/server/core/Image.php b/server/core/Image.php index 4025595..71e19ce 100644..100755 --- a/server/core/Image.php +++ b/server/core/Image.php @@ -9,10 +9,12 @@ * * @todo Complete the functions with errors detection and finish the descriptions */ -use OpenStack\Common\Error\BadResponseError; -use OpenStack\Common\Error\BaseError; -use OpenStack\Common\Error\NotImplementedError; -use OpenStack\Common\Error\UserInputError; +use OpenCloud\Common\Error\BadResponseError; +use OpenCloud\Common\Error\BaseError; +use OpenCloud\Common\Error\NotImplementedError; +use OpenCloud\Common\Error\UserInputError; + +include("CoreInterface.php"); /** * Image Class of the back-end application @@ -33,26 +35,14 @@ class image implements Core{ * * @param App $app the main app object * - * @throws [Type] [<description>] - * * @return Image */ public function __construct($app){ if(!isset($app)){ - $this->app->setOutput("Error", "Incorrect parameter"); + $this->app->setOutput("Error", "Incorrect parameter app"); } - try{ - $this->app = $app; - $this->libClass = $app->getLibClass("Image"); - }catch(BadResponseError $e){ - $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); - }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); - }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); - } + $this->app = $app; + $this->libClass = $app->getLibClass("Image"); } @@ -64,45 +54,46 @@ class image implements Core{ * @return void */ public function action($action){ - - $this->{$action.""}(); - + $this->{$action.""}(); } /** - * Details about an image + * Create a new image * - * @param array $opt - * options for the image creation + * @param array $opt Options for the image creation (name is required, others are optionals) * - **/ - private function createImage(array $opt){ + * @return Image + */ + private function createImage(){ + $opt = $this->app->getPostParam("opt"); if(!isset($opt)){ - $this->app->setOutput("Error", "Incorrect parameter"); + $this->app->setOutput("Error", "Incorrect parameter opt"); } - try{ - // VOIR SI MAUVAIS TYPE $options = Array(); - if(isset($opt['name'])){ // if the image name already exists -> error + + // Check the image name + if(isset($opt['name'])){ $imagesList = listImage(); - if(isset($images)){ + if(isset($imagesList)){ foreach($imagesList as $image){ - if(strcmp($image->name, $opt['name']) == 0){ - + if(strcmp($image->name, $opt['name']) == 0){ // if the image name already exists -> error + $this->app->setOutput("Error", "Image name already exists"); } } } } else{ - $this->app->setOutput("Error", "Image name already exists"); + $this->app->setOutput("Error", "Missing parameter 'name' for the new image"); } + + // Check optionals arguments if(isset($opt['id'])){ // UUID : nnnnnnnn-nnnn-nnnn-nnnn-nnnnnnnnnnnn if($this->libClass->getImage($opt['id']) != null){ // if the id already exists -> error - + $this->app->setOutput("Error", "Image id already exists"); } $options['id'] = $opt['id']; } @@ -135,478 +126,561 @@ class image implements Core{ }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } - return $image; + $this->app->setOutput("Images", $image); + } /** * List the images of the server * - * @return the list with all images on the server + * @return List of Image */ private function listImage(){ try{ + $result = array(); $l = $this->libClass->listImages(); - if(!isset($l)){ // if the list is empty there is no images - $this->app->setOutput("Error", "No image"); + foreach($l as $tmp){ + $result[] = $tmp; } }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); + $this->app->getErrorInstance()->UserInputHandler($e); }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); + $this->app->getErrorInstance()->BaseErrorHandler($e); }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); } - return $l; + + $this->app->setOutput("Images", $result); } /** * Details about an image * - * @param string $id - * identifier of the image - * - **/ - private function detailsImage($id){ + * @param String $id Identifier of the image + * + * @return Image + */ + private function detailsImage(){ + $id = $this->app->getPostParam("id"); + if(!isset($id)){ - // Renvoyer erreur + $this->app->setOutput("Error", "Incorrect id parameter"); } - try{ - $service = $this->libClass; - $image = $service->getImage($id); - if($image == null){ // if the image don't exists -> error - $this->app->setOutput("Error", "Image doesn't exist"); - } - - return $image; - }catch(BadResponseError $e){ - $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); - }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); - }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); - } + else{ + try{ + $service = $this->libClass; + $image = $service->getImage($id); + if($image == null){ // if the image don't exists -> error + $this->app->setOutput("Error", "Image doesn't exist"); + } + else{ + echo 'toto'; + $this->app->setOutput("Images", $image); + } + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } } /** - * Details about an image + * Update informations about an image * - * @param string $id - * id of the image - * - * @param array $opt - * options for the image creation - **/ - private function updateImage($id, array $opt){ + * @param String $id id of the image + * @param array $opt Options for the image creation + * + * @return Image + */ + + private function updateImage(){ + $id = $this->app->getPostParam("id"); + $opt = $this->app->getPostParam("opt"); + if(!isset($id)){ $this->app->setOutput("Error", "Incorrect id parameter"); } - if(!isset($opt)){ + else if(!isset($opt)){ $this->app->setOutput("Error", "Incorrect opt parameter"); } + else{ + try{ + //vérifier existence image + $service = $this->libClass; + $image = $service->getImage($id); + if($image == null){ // if the image don't exists -> error + $this->app->setOutput("Error", "Image doesn't exist"); + } - try{ - //vérifier existence image - $service = $this->libClass; - $image = $service->getImage($id); - if($image == null){ // if the image don't exists -> error - $this->app->setOutput("Error", "Image doesn't exist"); - } - - $options = Array(); + $options = Array(); - // Voir vérification des types - if(isset($opt['name'])){ //string - $options['name'] = $opt['name']; - } - if(isset($opt['minDisk'])){ //int - $options['minDisk'] = $opt['minDisk']; - } - if(isset($opt['minRam'])){ // int - $options['minRam'] = $opt['minRam']; - } - if(isset($opt['protected'])){ // boolean - $options['protected'] = $opt['protected']; - } - if(isset($opt['visibility'])){ // public, private - $options['visibility'] = $opt['visibility']; - } - if(isset($opt['tags'])){ // list - $options['tags'] = $opt['tags']; - } - $image->update($options); - }catch(BadResponseError $e){ - $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); - }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); - }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); - } - return $image; + // Voir vérification des types + if(isset($opt['name'])){ //string + $options['name'] = $opt['name']; + } + if(isset($opt['minDisk'])){ //int + $options['minDisk'] = $opt['minDisk']; + } + if(isset($opt['minRam'])){ // int + $options['minRam'] = $opt['minRam']; + } + if(isset($opt['protected'])){ // boolean + $options['protected'] = $opt['protected']; + } + if(isset($opt['visibility'])){ // public, private + $options['visibility'] = $opt['visibility']; + } + if(isset($opt['tags'])){ // list + $options['tags'] = $opt['tags']; + } + $image->update($options); + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + $this->app->setOutput("Images", $image); + } } /** * Delete an image * - * @param string $id - * identifier of the image - **/ - private function deleteImage($id){ + * @param String $id Identifier of the image + * + * @return void + */ + private function deleteImage(){ // si protected = true, demander de le mettre a false // vérifier existence image + $id = $this->app->getPostParam("id"); if(!isset($id)){ $this->app->setOutput("Error", "Image doesn't exist"); } - - try{ - $service = $this->libClass; - $image = $this->libClass->getImage($id); - if($image == null){ // if the image don't exists -> error - $this->app->setOutput("Error", "Image doesn't exist"); - } - $image->delete(); - }catch(BadResponseError $e){ - $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); - }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); - }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); - } - + else{ + try{ + $service = $this->libClass; + $image = $this->libClass->getImage($id); + if($image == null){ // if the image doesn't exists -> error + $this->app->setOutput("Error", "Image doesn't exist"); + } + $image->delete(); + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } } /** * Resactive an image * - * @param string $id - * identifier of the image - **/ - private function reactivateImage($id){ + * @param String $id Identifier of the image + * + * @return void + */ + private function reactivateImage(){ + $id = $this->app->getPostParam("id"); + if(!isset($id)){ $this->app->setOutput("Error", "Incorrect parameter"); } - try{ - // vérifier existence image - $service = $this->libClass; - $image = $service->getImage($id); - if($image == null){ // if the image don't exists -> error - $this->app->setOutput("Error", "Image doesn't exist"); - } - $image->reactivate(); - }catch(BadResponseError $e){ - $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); - }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); - }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); - } + else + { + try{ + $service = $this->libClass; + $image = $service->getImage($id); + if($image == null){ // if the image don't exists -> error + $this->app->setOutput("Error", "Image doesn't exist"); + } + $image->reactivate(); + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } } /** * Desactive an image * - * @param string $id - * identifier of the image - **/ - private function desactivateImage($id){ + * @param String $id Identifier of the image + * + * @return void + */ + private function desactivateImage(){ + $id = $this->app->getPostParam("id"); + if(!isset($id)){ $this->app->setOutput("Error", "Incorrect parameter"); } - try{ - // vérifier existence image - $service = $this->libClass; - $image = $service->getImage($id); - if($image == null){ // if the image don't exists -> error - $this->app->setOutput("Error", "Image doesn't exist"); - } - $image->deactivate(); - }catch(BadResponseError $e){ - $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); - }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); - }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); - } + else + { + try{ + // vérifier existence image + $service = $this->libClass; + $image = $service->getImage($id); + if($image == null){ // if the image don't exists -> error + $this->app->setOutput("Error", "Image doesn't exist"); + } + $image->deactivate(); + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } } /** * Upload an image * - * @param string $id - * identifier of the image - * - * @param string $file_name - * path of the image - **/ - private function uploadImage($id, $file_name){ + * @param String $id Identifier of the image + * @param String $file_name Path of the image + * + * @return void + */ + private function uploadImage(){ + $id = $this->app->getPostParam("id"); + $file_name = $this->app->getPostParam("file_name"); + + if(!isset($id)){ $this->app->setOutput("Error", "Incorrect id parameter"); } - if(!isset($file_name)){ - $this->app->setOutput("Error", "Incorrect file_name parameter"); + else if(!isset($file_name)){ + $this->app->setOutput("Error", "Incorrect file name parameter"); } - try{ - // vérifier existence image - $service = $this->libClass; - $image = $service->getImage($id); - if($image == null){ // if the image don't exists -> error - $this->app->setOutput("Error", "Image doesn't exist"); - } - $stream = \GuzzleHttp\Psr7\stream_for(fopen($file_name, 'r')); - $image->uploadData($stream); - }catch(BadResponseError $e){ - $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); - }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); - }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); + else{ + try{ + // vérifier existence image + $service = $this->libClass; + $image = $service->getImage($id); + if($image == null){ // if the image don't exists -> error + $this->app->setOutput("Error", "Image doesn't exist"); + } + $stream = \GuzzleHttp\Psr7\stream_for(fopen($file_name, 'r')); + $image->uploadData($stream); + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } } /** * Download an image * - * @param string $id - * identifier of the image - **/ - private function downloadImage($id){ + * @param String $id Identifier of the image + * + * @return Stream + */ + private function downloadImage(){ + $id = $this->app->getPostParam("id"); + if(!isset($id)){ - $this->app->setOutput("Error", "Incorrect parameter"); + $this->app->setOutput("Error", "Incorrect id parameter"); } - try{ - // vérifier existence image - $service = $this->libClass; - $image = $service->getImage($id); - if($image == null){ // if the image don't exists -> error - $this->app->setOutput("Error", "Image doesn't exist"); - } - $stream = $image->downloadData(); - }catch(BadResponseError $e){ - $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); - }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); - }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); - } - return $stream; + else{ + try{ + // vérifier existence image + $service = $this->libClass; + $image = $service->getImage($id); + if($image == null){ // if the image don't exists -> error + $this->app->setOutput("Error", "Image doesn't exist"); + } + $stream = $image->downloadData(); + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + $this->app->setOutput("Images", $stream); + } } /** * Add a member to image * - * @param string $image_id - * identifier of the image - * - * @param string $member_id - * identifier of the member - **/ - private function addMemberImage($image_id, $member_id){ + * @param String $image_id Identifier of the image + * @param String $member_id Identifier of the member + * + * @return Member + */ + private function addMemberImage(){ + $image_id = $this->app->getPostParam("image_id"); + $member_id = $this->app->getPostParam("member_id"); + if(!isset($image_id)){ - $this->app->setOutput("Error", "Incorrect parameter image_id"); + $this->app->setOutput("Error", "Incorrect image id parameter"); } - if(!isset($member_id)){ - $this->app->setOutput("Error", "Incorrect parameter member_id"); + else if(!isset($member_id)){ + $this->app->setOutput("Error", "Incorrect member id parameter"); } - try{ - $service = $this->libClass; + else{ + try{ + $service = $this->libClass; - $image = $service->getImage($id); - if($image == null){ // if the image don't exists -> error - $this->app->setOutput("Error", "Image doesn't exist"); - } - $member_id = $image->addMember($member_id); - }catch(BadResponseError $e){ - $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); - }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); - }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); - } + $image = $service->getImage($id); + if($image == null){ // if the image don't exists -> error + $this->app->setOutput("Error", "Image doesn't exist"); + } + $member_id = $image->addMember($member_id); + $this->app->setOutput("Images", $member_id); + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } } /** * List members of an image * - * @param string $image_id - * identifier of the image - **/ - private function listMemberImage($image_id, $member_id){ + * @param String $image_id identifier of the image + * + * @return List of Member + */ + private function listMemberImage(){ + $image_id = $this->app->getPostParam("image_id"); + $member_id = $this->app->getPostParam("member_id"); + if(!isset($image_id)){ - $this->app->setOutput("Error", "Incorrect parameter image_id"); + $this->app->setOutput("Error", "Incorrect image id parameter"); } - if(!isset($member_id)){ - $this->app->setOutput("Error", "Incorrect parameter member_id"); + else if(!isset($member_id)){ + $this->app->setOutput("Error", "Incorrect member id parameter"); + } + else{ + try{ + // vérifier existence image + $service = $this->libClass; + $image = $service->getImage($image_id); + if($image == null){ // if the image don't exists -> error + $this->app->setOutput("Error", "Image doesn't exist"); + } + $members = $image->listMembers(); + if($members == null){ // if the image don't exists -> error + $this->app->setOutput("Error", "No member"); + } + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + $this->app->setOutput("Images", $members); } - try{ - // vérifier existence image - $service = $this->libClass; - $image = $service->getImage($image_id); - if($image == null){ // if the image don't exists -> error - $this->app->setOutput("Error", "Image doesn't exist"); - } - $members = $image->listMembers(); - if($member == null){ // if the image don't exists -> error - $this->app->setOutput("Error", "No member"); - } - }catch(BadResponseError $e){ - $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); - }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); - }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); - } - return $members; } /** * Show details of a member of an image * - * @param string $image_id - * identifier of the image + * @param String $image_id Identifier of the image + * @param String $member_id Identifier of the member * - * @param string $member_id - * identifier of the member - **/ - private function detailMemberImage($image_id, $member_id){ + * @return Member + */ + private function detailMemberImage(){ + $image_id = $this->app->getPostParam("image_id"); + $member_id = $this->app->getPostParam("member_id"); + if(!isset($image_id)){ - $this->app->setOutput("Error", "Incorrect parameter image_id"); + $this->app->setOutput("Error", "Incorrect image id parameter"); } - if(!isset($member_id)){ - $this->app->setOutput("Error", "Incorrect parameter member_id"); + else if(!isset($member_id)){ + $this->app->setOutput("Error", "Incorrect member id parameter"); } - try{ - // vérifier existence image - // on doit être le proprio de l'image - // vérifier membre existe - $service = $this->libClass; - - $image = $service->getImage($id); - if($image == null){ // if the image don't exists -> error - $this->app->setOutput("Error", "Image doesn't exist"); - } + else{ + try{ + $service = $this->libClass; - $member = $image->getMember($member_id); - if($member == null){ // if the member don't exists -> error - $this->app->setOutput("Error", "Member doesn't exist"); - } - }catch(BadResponseError $e){ - $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); - }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); - }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); - } - return $member; + $image = $service->getImage($id); + if($image == null){ // if the image don't exists -> error + $this->app->setOutput("Error", "Image doesn't exist"); + } + + $member = $image->getMember($member_id); + if($member == null){ // if the member don't exists -> error + $this->app->setOutput("Error", "Member doesn't exist"); + } + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + $this->app->setOutput("Images", $member); + } } /** * Remove a member of an image * - * @param string $image_id - * identifier of the image - * - * @param string $member_id - * identifier of the member - **/ - private function removeMemberImage($image_id, $member_id){ + * @param String $image_id Identifier of the image + * @param String $member_id Identifier of the member + * + * @return void + */ + private function removeMemberImage(){ + $image_id = $this->app->getPostParam("image_id"); + $member_id = $this->app->getPostParam("member_id"); + if(!isset($image_id)){ - $this->app->setOutput("Error", "Incorrect parameter image_id"); + $this->app->setOutput("Error", "Incorrect image id parameter"); } - if(!isset($member_id)){ - $this->app->setOutput("Error", "Incorrect parameter member_id"); + else if(!isset($member_id)){ + $this->app->setOutput("Error", "Incorrect member id parameter"); } - try{ - $service = $this->libClass; - - $image = $service->getImage($id); - if($image == null){ // if the image don't exists -> error - $this->app->setOutput("Error", "Image doesn't exist"); - } - $member = $image->getMember($member_id); - if($member == null){ // if the image don't exists -> error - $this->app->setOutput("Error", "Member doesn't exist"); - } - $member->delete(); - }catch(BadResponseError $e){ - $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); - }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); - }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); - } + else{ + try{ + $service = $this->libClass; + + $image = $service->getImage($id); + if($image == null){ // if the image don't exists -> error + $this->app->setOutput("Error", "Image doesn't exist"); + } + $member = $image->getMember($member_id); + if($member == null){ // if the image don't exists -> error + $this->app->setOutput("Error", "Member doesn't exist"); + } + $member->delete(); + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } } /** * Update a member of an image * - * @param string $image_id - * identifier of the image + * @param String $image_id Identifier of the image + * @param String $member_id Identifier of the member + * @param String $status New status for the member * - * @param string $member_id - * identifier of the member - * - * @param string $status - * new status for the member + * @return void **/ - private function updateMemberImage($image_id, $member_id, $status){ + private function updateMemberImage(){ + $image_id = $this->app->getPostParam("image_id"); + $member_id = $this->app->getPostParam("member_id"); + $status = $this->app->getPostParam("status"); + if(!isset($image_id)){ - $this->app->setOutput("Error", "Incorrect parameter image_id"); + $this->app->setOutput("Error", "Incorrect image id parameter"); } - if(!isset($member_id)){ - $this->app->setOutput("Error", "Incorrect parameter member_id"); + else if(!isset($member_id)){ + $this->app->setOutput("Error", "Incorrect member id parameter"); } - try{ - $service = $this->libClass; + else{ + try{ + $service = $this->libClass; - $image = $service->getImage($id); - if($image == null){ // if the image don't exists -> error - $this->app->setOutput("Error", "Image doesn't exist"); - } - $member = $image->getMember($member_id); - if($member == null){ // if the member don't exists -> error - $this->app->setOutput("Error", "Member doesn't exist"); - } - $member->updateStatus($status); - }catch(BadResponseError $e){ - $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ - $this->app->getErrorInstance->UserInputHandler($e); - }catch(BaseError $e){ - $this->app->getErrorInstance->BaseErrorHandler($e); - }catch(NotImplementedError $e){ - $this->app->getErrorInstance->NotImplementedHandler($e); - } + $image = $service->getImage($id); + if($image == null){ // if the image don't exists -> error + $this->app->setOutput("Error", "Image doesn't exist"); + } + $member = $image->getMember($member_id); + if($member == null){ // if the member don't exists -> error + $this->app->setOutput("Error", "Member doesn't exist"); + } + $member->updateStatus($status); + }catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } } } diff --git a/server/core/LibOverride/genTokenOptions.php b/server/core/LibOverride/genTokenOptions.php index 50826ed..bdae8a6 100755 --- a/server/core/LibOverride/genTokenOptions.php +++ b/server/core/LibOverride/genTokenOptions.php @@ -1,12 +1,12 @@ <?php use GuzzleHttp\Client; -use OpenStack\Common\Transport\HandlerStack; -use OpenStack\Common\Transport\Middleware; +use OpenCloud\Common\Transport\HandlerStack; +use OpenCloud\Common\Transport\Middleware; use OpenStack\Identity\v3\Service; use OpenStack\Identity\v3\Api; -use OpenStack\Common\Auth\Token; -use OpenStack\Common\Transport\Utils; +use OpenCloud\Common\Auth\Token; +use OpenCloud\Common\Transport\Utils; use OpenStack\Identity\v3\Models; class genTokenOptions @@ -75,6 +75,12 @@ class genTokenOptions $this->optionsGlobal['Identity'] = $options; } + public function revokeIdentityToken(){ + $token = $this->unserializeToken($this->backup['Identity']['token']); + $this->optionsGlobal['Common']['identityService']->revokeToken($token->id); + + } + public function loadIdentityBackup($opt){ $options = $this->optionsGlobal['Common']; $options['catalogName'] = 'false'; @@ -123,6 +129,12 @@ class genTokenOptions $this->optionsGlobal['Image'] = $options; } + public function revokeImageToken(){ + $token = $this->unserializeToken($this->backup['Image']['token']); + $this->optionsGlobal['Common']['identityService']->revokeToken($token->id); + + } + public function loadImageBackup($opt){ $options = $this->optionsGlobal['Common']; $options['catalogName'] = 'glance'; @@ -157,7 +169,7 @@ class genTokenOptions $stack = HandlerStack::create(); - $stack->push(Middleware::authHandler($options['authHandler'], $token)); + $stack->push(Middleware::authHandler($options['authHandler'], $token)); $this->addDebugMiddleware($options, $stack); @@ -170,6 +182,12 @@ class genTokenOptions $this->optionsGlobal['Network'] = $options; } + public function revokeNetworkToken(){ + $token = $this->unserializeToken($this->backup['Network']['token']); + $this->optionsGlobal['Common']['identityService']->revokeToken($token->id); + + } + public function loadNetworkBackup($opt){ $options = $this->optionsGlobal['Common']; $options['catalogName'] = 'neutron'; @@ -217,6 +235,12 @@ class genTokenOptions $this->optionsGlobal['Compute'] = $options; } + public function revokeComputeToken(){ + $token = $this->unserializeToken($this->backup['Compute']['token']); + $this->optionsGlobal['Common']['identityService']->revokeToken($token->id); + + } + public function loadComputeBackup($opt){ $options = $this->optionsGlobal['Common']; @@ -245,7 +269,7 @@ class genTokenOptions private function saveBackup($name, $data){ $token = $this->serializeToken($data["token"]); $path = "core/LibOverride/projectTokenData/".$token['saved']["project"]["name"]; - error_log(print_r($path, true), 0); + //error_log(print_r($path, true), 0); file_put_contents("core/LibOverride/projectTokenData/".$token['saved']["project"]["name"], serialize($token['saved'])); $this->backup["roles"] = $token["roles"]; $this->backup["project"] = $token['saved']["project"]["name"]; |
