public function run()
 {
     self::init();
     require_once __DIR__ . '/../anyem.client.impl/AnyemClientImpl.php';
     $anyemClient = new AnyemClientImpl(self::$_clientConnection, self::$_identifier);
     $responseWrapper = $anyemClient->read();
     $resourceImpl = $responseWrapper->getResource();
     if (!is_null($resourceImpl)) {
         $value = $responseWrapper->getResource()->getData();
     } else {
         $value = 0;
     }
     $this->value = $value;
 }
Example #2
0
 public static function main($args)
 {
     $clientConnection = ClientConnectionImpl::newClient();
     $identifier = new ResourceIdentifierImpl("anyem.com", "anyemNameSpace", "a");
     $anyemClient = new AnyemClientImpl($clientConnection, $identifier);
     for ($i = 0; $i < $args[0]; $i++) {
         usleep(1000);
         try {
             $responseWrapper = $anyemClient->read();
         } catch (Exception $e) {
             print $e->getMessage() . "\n";
             continue;
         }
         print sprintf("variable [a] contains: %s\n", $responseWrapper->getResource()->getData());
     }
 }