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:----o/yz542SG/rfrx4cJwzjA4TQp/ljAB4lgY5b0C6XV/trnPvpJt0Lj3Gg5KOoWJHrJC/QQl4h8hNmb/m/DuTha5tHmyLqmeWd0ALw6QOGV+T5R71sKjn8QN37gqjxRlC/FIzpcZedqV04IW1u3WgqL+RKRyaAvVrKPAwE7pFWSU+ORnI7Eobbh0O3flC/Vjs521bh2J6iYYYGCDI9qeIBLUjSEJIMzXYnMcAH8KLldYAOCiV2P1jEVzhD3nkEsfbyh/IcVI3dZimh5+2K+33x+SVMTWgR6x156UWu3OZrYMq/og4HnydWO0U0VjtMHhGkV/MztFCCV1mnbx114snINg13eKcb2WYY5RtDCwSvUxUWe2O5/CwkNh82ra+UeqxUmW/Vb5os5nAesYi3cqyKqkm4ihSbZCo64YaJ9w10CoZG0PqIyvxaMSQGEPtAlqMmGx7tijxHJ2IqNWyzxY4HPGoizS7g3OZomwrqzgKpywoPu1rrf/cn5uPerph18PKZ+sm29o2YaYQGjgnCcmKdm0DmfIwq8ajFFKvooWrf8UHcWdezJeyOSWMKGcvA3Fv/6EAGi4mx7+KAY+Zjp8kQ2KoAe9T3aumcPP6YEiuA2TV+C7aVOl8yXTPLphDOfXeUIP44aDTWcIeHld3z0pZN2chc060dZh4/9ZEIcRagVRk=----ATTACHMENT:----NDE3NDc2MjU3NTM4NzQ5MiA1MzI0MjU0OTk4MTk4NTEgMjIxMjg3ODI0Njg0NTU5Mw==