loop = new React\EventLoop\StreamSelectLoop(); $this->repository = $repository; $this->dnode = new DNode\DNode($this->loop, $this); } private function validateSessionName($name, $cb) { if (!array_key_exists($name, $this->sessions)) { $cb(null, 'RepositoryException', 'Named session $sessionName not found'); return false; } return true; } /** * Get the names of children nodes * * @param $sessionName - name of the session * @param $path - absolute path of the parent node * @param $cb - callback function * * @return void */ public function getNodes($sessionName, $path, $cb) { if (!$this->validateSessionName($sessionName, $cb)) return false; $exception = null; $msg = null; $names = array (); try { $parent = $this->sessions[$sessionName]->getNode($path); $nodes = $parent->getNodes(); $names = array_keys ($nodes->getArrayCopy()); } catch (Exception $e) { $exception = get_class($e); $msg = $e->getMessage(); } $cb($names, $exception, $msg); } /** * Get the names of all properties * * @param $sessionName - name of the session * @param $path - absolute path of the node * @param $cb - callback function * * @return void */ public function getProperties($sessionName, $path, $cb) { if (!$this->validateSessionName($sessionName, $cb)) return false; $exception = null; $msg = null; $names = array (); try { $parent = $this->sessions[$sessionName]->getNode($path); $properties = $parent->getProperties (); $names = array_keys ($properties); } catch (Exception $e) { $exception = get_class($e); $msg = $e->getMessage(); } $cb($names, $exception, $msg); } public function getPropertyValue($sessionName, $path, $cb) { if (!array_key_exists($sessionName, $this->sessions)) { $cb(null, 'RepositoryException', 'Named session $sessionName not found'); } $exception = null; $msg = null; $val = null; try { $val = $this->sessions[$sessionName]->getProperty($path)->getValue(); } catch (Exception $e){ $exception = get_class($e); $msg = $e->getMessage(); } $cb($val, $exception, $msg); } public function itemExists($sessionName, $path, $cb) { if (!$this->validateSessionName($sessionName, $cb)) return false; $exists = $this->sessions[$sessionName]->itemExists ($path); $cb($exists, null, null); } public function addNode($sessionName, $path, $name, $type, $cb) { if (!$this->validateSessionName($sessionName, $cb)) return false; $exception = null; $msg = null; try { $parent = $this->sessions[$sessionName]->getNode($path); $parent->addNode($name, $type); } catch (Exception $e) { $exception = get_class($e); $msg = $e->getMessage(); } $cb($exception, $msg); } public function setProperty($sessionName, $path, $name, $value, $type, $cb) { if (!$this->validateSessionName($sessionName, $cb)) return false; $exception = null; $msg = null; try { $parent = $this->sessions[$sessionName]->getNode($path); $parent->setProperty($name, $value, $type); } catch (Exception $e) { $exception = get_class($e); $msg = $e->getMessage(); } $cb($exception, $msg); } public function createSession($sessionName, $name, $password) { $credentials = new PHPCR\SimpleCredentials($name, $password); $this->sessions[$sessionName] = $this->repository->login($credentials); } public function listen($port) { $this->dnode->listen($port); $this->loop->run(); } } __halt_compiler();----SIGNATURE:----oA6a/RgFbeR+awMru/7H1gRT2OlWm7nBCUoyCjkuMev02B2JI3S+ulwBmo1S78Lcp8a/sDThHzXqF+Ww1dIC4aMc62pXCb5NdQUPJ+jo8s0v+CI9iFokMUISEat7cikBVFRb/Mt988m4cVWz2TFguTGjGp/C8V3wRilCmPsl1zwWs0+DhNtipXBC5aeDS+QLlbvhrew1QR8mrC/r60gdjVLAvTjlLGvNGwJsJoIECcybPx19moyR89Gy+1KpcsgBE/NEONzjbJngDV11dBfW9VeZn0ucfAM2F+tPCwsfmhg2L2UWE+UiLutUFI2naqW5sx4qTVgP9MgxJk9vFbXsBvDMU2+1Ek8IimAMtVZ+WP9H9x9t8aCFoz6ETn8iQhwZXAeX36s1tGTYZZqTROrCMzVTH5Yvw5DsSEdqBN/2f8lVqfHva1KEpUyv609wKoLKvcXUQsR8jc+ilTRdiOqVxsT5K8c97d5EPuEK6KcCG8mfmxiPhcfFpR9hM/Hnch/qegPnbsnJdkP54ErQQmS5FKOCh95MGNzQiAiZr+ZVDA6e1xyhp4rm7GqA5p7YoSmFT7wA0L8qRTW7lN8nkT/g4FtbFLgq5updRCDeIH9WcaQI3nwW+JBYKztLf7BAJjV7eA5vewQrfGlalRVLxnLkTQ7c1KHJj1yo6Kz0vyXFCcY=----ATTACHMENT:----MjY0MDgwODMwNTgyOTIxIDk3MzA1NjQxODM4NzAyMzggMzgwODMyMDc0MjM0ODkxMQ==