Example #1
0
 /**
  * Verifies the path to be absolute and well-formed
  *
  * @param string $path the path to verify 
  * @return  bool    Always true :)
  * @throws PHPCR_RepositoryException    If the path is not absolute or well-formed
  */
 public function verifyAbsolutePath($path)
 {
     if (!jackalope_Helper::isAbsolutePath($path)) {
         throw new PHPCR_RepositoryException('Path is not absolute: ' . $path);
     }
     if (!jackalope_Helper::isValidPath($path)) {
         throw new PHPCR_RepositoryException('Path is not well-formed (TODO: match against spec): ' . $path);
     }
     return true;
 }
Example #2
0
 /**
  * Returns true if a property exists at absPath and this Session has read
  * access to it; otherwise returns false.
  *
  * @param string $absPath An absolute path.
  * @return boolean a boolean
  * @throws PHPCR_RepositoryException if absPath is not a well-formed absolute path.
  * @api
  */
 public function propertyExists($absPath)
 {
     // TODO: what about $absPath == '/' here? if not then ::itemExists is faulty
     if (!jackalope_Helper::isAbsolutePath($absPath) || !jackalope_Helper::isValidPath($absPath)) {
         throw new PHPCR_RepositoryException("Path is invalid: {$absPath}");
     }
     try {
         //OPTIMIZE: avoid throwing and catching errors would improve performance if many node exists calls are made
         //would need to communicate to the lower layer that we do not want exceptions
         $this->getProperty($absPath);
     } catch (Exception $e) {
         return false;
     }
     return true;
 }