Skip to content

Commit

Permalink
First implementation of Version\Version
Browse files Browse the repository at this point in the history
  • Loading branch information
chregu authored and nicam committed Jan 4, 2011
1 parent 64f4e4b commit b79d15f
Show file tree
Hide file tree
Showing 3 changed files with 128 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/Jackalope/Transport/Davex/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,13 @@ public function checkinItem($path)
{
try {
$request = $this->getRequest(Request::CHECKIN, $path);
return $request->execute();
$curl = $request->execute(true);
if ($curl->getHeader("Location")) {
return $this->cleanUriFromWebserverRoot(urldecode($curl->getHeader("Location")));
} else {
// not sure
throw new \PHPCR\RepositoryException();
}
} catch (\Jackalope\Transport\Davex\HTTPErrorException $e) {
if ($e->getCode() == 405) {
throw new \PHPCR\UnsupportedRepositoryOperationException();
Expand Down
119 changes: 119 additions & 0 deletions src/Jackalope/Version/Version.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
<?php

declare(ENCODING = 'utf-8');

namespace Jackalope\Version;

use Jackalope\NotImplementedException;
use Jackalope\Node;

class Version extends Node implements \PHPCR\Version\VersionInterface {

/**
* Returns the VersionHistory that contains this Version
*
* @return \PHPCR\Version\VersionHistoryInterface the VersionHistory that contains this Version
* @throws \PHPCR\RepositoryException if an error occurs
* @api
*/
public function getContainingHistory() {
throw new NotImplementedException();
}

/**
* Returns the date this version was created. This corresponds to the
* value of the jcr:created property in the nt:version node that represents
* this version.
*
* @return \DateTime a \DateTime object
* @throws \PHPCR\RepositoryException - if an error occurs
* @api
*/
public function getCreated()
{
throw new NotImplementedException();
}

/**
* Assuming that this Version object was acquired through a Workspace W and
* is within the VersionHistory H, this method returns the successor of this
* version along the same line of descent as is returned by
* H.getAllLinearVersions() where H was also acquired through W.
*
* Note that under simple versioning the behavior of this method is equivalent
* to getting the unique successor (if any) of this version.
*
* @return \PHPCR\VersionInterface a Version or NULL if no linear successor exists.
* @throws \PHPCR\RepositoryException if an error occurs.
* @see VersionHistory::getAllLinearVersions()
* @api
*/
public function getLinearSuccessor()
{
throw new NotImplementedException();
}


/**
* Returns the successor versions of this version. This corresponds to
* returning all the nt:version nodes referenced by the jcr:successors
* multi-value property in the nt:version node that represents this version.
*
* @return array of \PHPCR\Version\VersionInterface
* @throws \PHPCR\RepositoryException if an error occurs
* @api
*/
public function getSuccessors()
{
throw new NotImplementedException();
}


/**
* Assuming that this Version object was acquired through a Workspace W and
* is within the VersionHistory H, this method returns the predecessor of
* this version along the same line of descent as is returned by
* H.getAllLinearVersions() where H was also acquired through W.
*
* Note that under simple versioning the behavior of this method is equivalent
* to getting the unique predecessor (if any) of this version.
*
* @return \PHPCR\Version\VersionInterface a Version or NULL if no linear predecessor exists.
* @throws \PHPCR\RepositoryException if an error occurs.
* @see VersionHistory::getAllLinearVersions()
* @api
*/
public function getLinearPredecessor()
{
throw new NotImplementedException();
}


/**
* In both simple and full versioning repositories, this method returns the
* predecessor versions of this version. This corresponds to returning all
* the nt:version nodes whose jcr:successors property includes a reference
* to the nt:version node that represents this version.
*
* @return array of \PHPCR\Version\VersionInterface
* @throws \PHPCR\RepositoryException if an error occurs
* @api
*/
public function getPredecessors()
{
throw new NotImplementedException();
}


/**
* Returns the frozen node of this version.
*
* @return \PHPCR\NodeInterface a Node object
* @throws \PHPCR\RepositoryException if an error occurs
* @api
*/
public function getFrozenNode()
{
throw new NotImplementedException();
}
}
3 changes: 2 additions & 1 deletion src/Jackalope/Version/VersionManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ public function __construct(ObjectManager $objectmanager)
// TODO @return \PHPCR\Version\VersionInterface the created version.
public function checkin($absPath)
{
return $this->objectmanager->getTransport()->checkinItem($absPath);
$path = $this->objectmanager->getTransport()->checkinItem($absPath);
return $this->objectmanager->getNodeByPath($path, "Version\Version");
}

/**
Expand Down

0 comments on commit b79d15f

Please sign in to comment.