Skip to content

Commit

Permalink
PHPCR:
Browse files Browse the repository at this point in the history
* created subpackages in PHPCR according to spec package hierarchy, moved and adapted files as needed
* now all Exceptions defined in JSR-283 are in the package
* added some new interfaces and classes

TYPO3CR:
* created subpackages like in the PHPCR package, moved and adapted files as needed
  • Loading branch information
kdambekalns committed May 30, 2008
1 parent 5aab652 commit 7d12334
Show file tree
Hide file tree
Showing 30 changed files with 756 additions and 28 deletions.
2 changes: 1 addition & 1 deletion Classes/F3_PHPCR_AccessDeniedException.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* @version $Id$
* @license http://opensource.org/licenses/gpl-license.php GNU Public License, version 2
*/
class F3_PHPCR_AccessDeniedException extends F3_PHPCR_AccessControlException {
class F3_PHPCR_AccessDeniedException extends F3_PHPCR_Security_AccessControlException {
}

?>
5 changes: 5 additions & 0 deletions Classes/F3_PHPCR_CredentialsInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
*/

/**
* Interface for all credentials that may be passed to the
* Repository.login(Credentials credentials, String workspaceName) method.
* Serves as a marker interface that all repositories must implement when
* providing a credentials class. See SimpleCredentials for one example of
* such a class.
*
* @package PHPCR
* @version $Id$
Expand Down
2 changes: 1 addition & 1 deletion Classes/F3_PHPCR_ItemInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*/

/**
* A Node interface
* The Item is the base interface of Node and Property.
*
* @package PHPCR
* @version $Id$
Expand Down
7 changes: 6 additions & 1 deletion Classes/F3_PHPCR_NamespaceRegistryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@
*/

/**
* A NamespaceRegistry interface
* Each repository has a single, persistent namespace registry represented by
* the NamespaceRegistry object, accessed via Workspace.getNamespaceRegistry().
* The namespace registry contains the default prefixes of the registered
* namespaces. The namespace registry may contain namespaces that are not used
* in repository content, and there may be repository content with namespaces
* that are not included n the registry.
*
* @package PHPCR
* @version $Id$
Expand Down
4 changes: 2 additions & 2 deletions Classes/F3_PHPCR_NodeInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
*/

/**
* A Node interface
* The Node interface represents a node in the hierarchy that makes up the repository.
*
* @package PHPCR
* @version $Id$
* @license http://opensource.org/licenses/gpl-license.php GNU Public License, version 2
*/
interface F3_PHPCR_NodeInterface {
interface F3_PHPCR_NodeInterface extends F3_PHPCR_ItemInterface {

}

Expand Down
7 changes: 5 additions & 2 deletions Classes/F3_PHPCR_PropertyInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,16 @@
*/

/**
* A Property interface
* A Property object represents the smallest granularity of content storage.
* It has a single parent node and no children. A property consists of a name
* and a value, or in the case of multi-value properties, a set of values all
* of the same type. See Value.
*
* @package PHPCR
* @version $Id$
* @license http://opensource.org/licenses/gpl-license.php GNU Public License, version 2
*/
interface F3_PHPCR_PropertyInterface {
interface F3_PHPCR_PropertyInterface extends F3_PHPCR_ItemInterface {

}

Expand Down
94 changes: 94 additions & 0 deletions Classes/F3_PHPCR_RepositoryFactory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
<?php
declare(ENCODING = 'utf-8');

/* *
* This script is part of the TYPO3 project - inspiring people to share! *
* *
* TYPO3 is free software; you can redistribute it and/or modify it under *
* the terms of the GNU General Public License version 2 as published by *
* the Free Software Foundation. *
* *
* This script is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- *
* TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General *
* Public License for more details. *
* */

/**
* @package PHPCR
* @version $Id$
*/

/**
* RepositoryFactory is a factory class for Repository implementations.
*
* A concrete implementation of this class must have a zero-argument constructor.
* Repository factories may be installed in an instance of the Java platform as extensions,
* that is, jar files placed into any of the usual extension directories. Factories may
* also be made available by adding them to the applet or application class path or by
* some other platform-specific means. Repository factories are looked up via the current
* thread's context class loader.
*
* A repository factory should identify itself with a factory-configuration file named
* javax.jcr.RepositoryFactory in the resource directory META-INF/services. The file
* should contain a list of fully-qualified concrete repository-factory class names, one
* per line. A line is terminated by any one of a line feed ('\n'), a carriage return
* ('\r'), or a carriage return followed immediately by a line feed. Space and tab
* characters surrounding each name, as well as blank lines, are ignored. The comment
* character is '#' ('#'); on each line all characters following the first comment
* character are ignored. The file must be encoded in UTF-8.
*
* If a particular concrete repository factory class is named in more than one configuration
* file, or is named in the same configuration file more than once, then the duplicates will
* be ignored. The configuration file naming a particular factory need not be in the same jar
* file or other distribution unit as the factory itself. The factory must be accessible from
* the same class loader that was initially queried to locate the configuration file; this is
* not necessarily the class loader that loaded the file.
*
* Examples how to obtain repository instances
*
* Use repository factory based on parameters:
* $parameters = array('address' => 'vendor://localhost:9999/myrepo');
* $repo = F3_PHPCR_RepositoryFactory::getRepository($parameters);
*
* Get a default repository available in this environment:
* $repo = F3_PHPCR_RepositoryFactory::getRepository();
*
* Manually instantiate a specific repository factory and connect to the repository:
* $parameters = array('address' => 'vendor://localhost:9999/myrepo');
* $factory = new F3_TYPO3CR_RepositoryFactory();
* $repo = $factory->connect($parameters);
*
* @package PHPCR
* @version $Id$
* @license http://opensource.org/licenses/gpl-license.php GNU Public License, version 2
*/
abstract class F3_PHPCR_RepositoryFactory {

/**
* Attempts to establish a connection to a repository described by the given
* parameters. The implementation should return null if it does not understand
* the given parameters. The implementation may also return null if a default
* repository instance is requested (indicated by null parameters) and this
* factory is not able to identify a default repository.
*
* @param array $parameters
* @return F3_PHPCR_RepositoryInterface
* @throws F3_PHPCR_RepositoryException If an implementation is the right factory but has trouble connecting to the repository.
*/
abstract public function connect(array $parameters);

/**
* Attempts to establish a connection to a repository using the given parameters.
* If no parameters are given, the first found default repository is returned.
*
* @param array|NULL $parameters string key/value pairs as repository arguments or null if none are provided and a client wishes to connect to a default repository.
* @return F3_PHPCR_RepositoryInterface
* @throws F3_PHPCR_RepositoryException if getRepository fails or if no suitable (default) repository is found.
*/
static public function getRepository($parameters = NULL) {

}
}

?>
3 changes: 2 additions & 1 deletion Classes/F3_PHPCR_RepositoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
*/

/**
* A Repository interface
* The entry point into the content repository. The Repository object is
* usually acquired through the RepositoryFactory.
*
* @package PHPCR
* @version $Id$
Expand Down
12 changes: 8 additions & 4 deletions Classes/F3_PHPCR_WorkspaceInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,15 @@
*/

/**
* A Workspace interface
* The Workspace object represents a "view" of an actual repository workspace
* entity as seen through the authorization settings of its associated Session.
* Each Workspace object is associated one-to-one with a Session object. The
* Workspace object can be acquired by calling Session.getWorkspace() on the
* associated Session object.
*
* @package PHPCR
* @version $Id$
* @license http://opensource.org/licenses/gpl-license.php GNU Public License, version 2
* @package PHPCR
* @version $Id$
* @license http://opensource.org/licenses/gpl-license.php GNU Public License, version 2
*/
interface F3_PHPCR_WorkspaceInterface {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

/**
* @package PHPCR
* @subpackage Lock
* @version $Id$
*/

Expand All @@ -24,10 +25,11 @@
* change would conflict with a lock.
*
* @package PHPCR
* @subpackage Lock
* @version $Id$
* @license http://opensource.org/licenses/gpl-license.php GNU Public License, version 2
*/
class F3_PHPCR_LockException extends F3_PHPCR_RepositoryException {
class F3_PHPCR_Lock_LockException extends F3_PHPCR_RepositoryException {
}

?>
116 changes: 116 additions & 0 deletions Classes/Lock/F3_PHPCR_Lock_LockInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
<?php
declare(ENCODING = 'utf-8');

/* *
* This script is part of the TYPO3 project - inspiring people to share! *
* *
* TYPO3 is free software; you can redistribute it and/or modify it under *
* the terms of the GNU General Public License version 2 as published by *
* the Free Software Foundation. *
* *
* This script is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- *
* TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General *
* Public License for more details. *
* */

/**
* @package PHPCR
* @subpackage Lock
* @version $Id$
*/

/**
* Represents a lock placed on an item.
*
* @package PHPCR
* @subpackage Lock
* @version $Id$
* @license http://opensource.org/licenses/gpl-license.php GNU Public License, version 2
*/
interface F3_PHPCR_Lock_LockInterface {

/**
* Returns the value of the jcr:lockOwner property. This is the user ID
* bound to the Session that holds the lock or another implementation-
* dependent string identifying the user. The lock owner's identity is
* only provided for informational purposes. It does not govern who can
* perform an unlock or make changes to the locked nodes; that depends
* entirely upon who the token holder is.
*
* @return string a user ID
*/
public function getLockOwner();

/**
* Returns true if this is a deep lock; false otherwise.
*
* @return boolean
*/
public function isDeep();

/**
* Returns the lock holding node. Note that N.getLock().getNode() (where N
* is a locked node) will only return N if N is the lock holder. If N is in
* the subtree of the lock holder, H, then this call will return H.
*
* @return F3_PHPCR_NodeInterface a Node
*/
public function getNode();

/**
* May return the lock token for this lock. If this lock is open-scoped and
* the current session holds the lock token for this lock, then this method
* will return that lock token. Otherwise this method will return null.
*
* @return string
*/
public function getLockToken();

/**
* Returns true if this Lock object represents a lock that is currently in
* effect. If this lock has been unlocked either explicitly or due to an
* implementation-specific limitation (like a timeout) then it returns false.
* Note that this method is intended for those cases where one is holding a
* Lock Java object and wants to find out whether the lock (the JCR-level
* entity that is attached to the lockable node) that this object originally
* represented still exists. For example, a timeout or explicit unlock will
* remove a lock from a node but the Lock Java object corresponding to that
* lock may still exist, and in that case its isLive method will return false.
*
* @return boolean
* @throws RepositoryException if an error occurs
*/
public function isLive();

/**
* Returns true if this is a session-scoped lock and the scope is bound to the
* current session. Returns false if this is an open-scoped lock or is session-
* scoped but the scope is bound to another session.
*
* @return boolean
*/
public function isSessionScoped();

/**
* Returns true if the current session is the owner of this lock, either because
* it is session-scoped and bound to this session or open-scoped and this session
* currently holds the token for this lock. Returns false otherwise.
*
* @return boolean
*/
public function isLockOwningSession();

/**
* If this lock's time-to-live is governed by a timer, this method resets that
* timer so that the lock does not timeout and expire. If this lock's time-to-live
* is not governed by a timer, then this method has no effect.
*
* @throws F3_PHPCR_Lock_LockException if this Session does not hold the correct lock token for this lock.
* @throws F3_PHPCR_RepositoryException if another error occurs.
*/
public function refresh();

}

?>
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

/**
* @package PHPCR
* @subpackage NodeType
* @version $Id$
*/

Expand All @@ -25,10 +26,11 @@
* item to a node that would violate that node's node type.
*
* @package PHPCR
* @subpackage NodeType
* @version $Id$
* @license http://opensource.org/licenses/gpl-license.php GNU Public License, version 2
*/
class F3_PHPCR_ConstraintViolationException extends F3_PHPCR_RepositoryException {
class F3_PHPCR_NodeType_ConstraintViolationException extends F3_PHPCR_RepositoryException {
}

?>
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

/**
* @package PHPCR
* @subpackage NodeType
* @version $Id$
*/

Expand All @@ -24,10 +25,11 @@
* type definition template.
*
* @package PHPCR
* @subpackage NodeType
* @version $Id$
* @license http://opensource.org/licenses/gpl-license.php GNU Public License, version 2
*/
class F3_PHPCR_InvalidNodeTypeDefinitionException extends F3_PHPCR_RepositoryException {
class F3_PHPCR_NodeType_InvalidNodeTypeDefinitionException extends F3_PHPCR_RepositoryException {
}

?>
Loading

0 comments on commit 7d12334

Please sign in to comment.