/**
* {@inheritDoc}
*/
public function getNodePathForIdentifier($uuid, $workspace = null)
{
if (null !== $workspace && $workspace != $this->workspace) {
$client = new Client($this->factory, $this->server);
$client->login($this->credentials, $workspace);
return $client->getNodePathForIdentifier($uuid);
}
$request = $this->getRequest(Request::REPORT, $this->workspaceUri);
$request->setBody($this->buildLocateRequest($uuid));
$dom = $request->executeDom();
/* answer looks like
<D:multistatus xmlns:D="DAV:">
<D:response>
<D:href>http://localhost:8080/server/tests/jcr%3aroot/tests_level1_access_base/idExample/</D:href>
</D:response>
</D:multistatus>
*/
$set = $dom->getElementsByTagNameNS(self::NS_DAV, 'href');
if ($set->length != 1) {
throw new RepositoryException('Unexpected answer from server: ' . $dom->saveXML());
}
$fullPath = $set->item(0)->textContent;
if (strncmp($this->workspaceUriRoot, $fullPath, strlen($this->workspaceUri))) {
throw new RepositoryException("Server answered a path that is not in the current workspace: uuid={$uuid}, path={$fullPath}, workspace=" . $this->workspaceUriRoot);
}
return $this->stripServerRootFromUri(substr(urldecode($fullPath), 0, -1));
}