fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [6864] Class to get repository info from Java (Jsdai)


From: Petur Thorsteinsson
Subject: [Fmsystem-commits] [6864] Class to get repository info from Java (Jsdai).
Date: Thu, 27 Jan 2011 08:37:48 +0000

Revision: 6864
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=6864
Author:   peturbjorn
Date:     2011-01-27 08:37:47 +0000 (Thu, 27 Jan 2011)
Log Message:
-----------
Class to get repository info from Java (Jsdai).
Class is not really needed at present

Added Paths:
-----------
    branches/dev-bim2/property/inc/class.sobim_repository.inc.php

Added: branches/dev-bim2/property/inc/class.sobim_repository.inc.php
===================================================================
--- branches/dev-bim2/property/inc/class.sobim_repository.inc.php               
                (rev 0)
+++ branches/dev-bim2/property/inc/class.sobim_repository.inc.php       
2011-01-27 08:37:47 UTC (rev 6864)
@@ -0,0 +1,45 @@
+<?php
+/*
+ * Requires the following to work:
+ * Curl library
+ * HTTP_Request (Pear)
+ */
+
+phpgw::import_class('property.restrequest');
+
+interface sobimrest {
+       public function getRepositoryCountJson();
+}
+
+class sobimrest_impl implements sobimrest{
+       private $baseUrl = "http://localhost:8080/RestTests/rest/repositories";;
+       
+       public function __construct() {
+               if(!$this->iscurlinstalled()) {
+                       throw new Exception("Curl library is required for this 
to work!");
+               }
+       }
+       private function iscurlinstalled() {
+               return  (in_array  ('curl', get_loaded_extensions()));
+       }
+       public function getRepositoryCountJson() {
+               
+               $url = $this->baseUrl."/count";
+               $method = "GET";
+               $rest = new RestRequest($url, $method);
+               //$rest->setAcceptType("application/xml");
+               $rest->execute();
+               $output = $rest->getResponseBody();
+               echo $output;
+       }
+       
+       public function getRepositoryNames() {
+               $url = $this->baseUrl."/names";
+               $method = "GET";
+               $rest = new RestRequest($url, $method);
+               //$rest->setAcceptType("application/xml");
+               $rest->execute();
+               $output = $rest->getResponseBody();
+               echo $output;
+       }
+}
\ No newline at end of file




reply via email to

[Prev in Thread] Current Thread [Next in Thread]