jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r479646 - in /jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi: NodeImpl.java WorkspaceImpl.java
Date Mon, 27 Nov 2006 14:59:25 GMT
Author: angela
Date: Mon Nov 27 06:59:24 2006
New Revision: 479646

URL: http://svn.apache.org/viewvc?view=rev&rev=479646
Log:
work in progress

- simplify: don't check for supported-option (locking, versioning) on the client.

Modified:
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceImpl.java

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java?view=diff&rev=479646&r1=479645&r2=479646
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java
(original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java
Mon Nov 27 06:59:24 2006
@@ -871,7 +871,6 @@
      * @see Node#merge(String, boolean)
      */
     public NodeIterator merge(String srcWorkspace, boolean bestEffort) throws NoSuchWorkspaceException,
AccessDeniedException, VersionException, LockException, InvalidItemStateException, RepositoryException
{
-        checkSupportedOption(Repository.OPTION_VERSIONING_SUPPORTED);
         checkIsWritable();
         checkSessionHasPendingChanges();
 
@@ -973,9 +972,6 @@
      */
     public boolean isCheckedOut() throws RepositoryException {
         checkStatus();
-        if (!isSupportedOption(Repository.OPTION_VERSIONING_SUPPORTED)) {
-            return true;
-        }
         // shortcut: if state is new, its ancestor must be checkout
         if (isNew()) {
             return true;
@@ -987,7 +983,6 @@
      * @see Node#restore(String, boolean)
      */
     public void restore(String versionName, boolean removeExisting) throws VersionException,
ItemExistsException, UnsupportedRepositoryOperationException, LockException, InvalidItemStateException,
RepositoryException {
-        checkSupportedOption(Repository.OPTION_VERSIONING_SUPPORTED);
         checkSessionHasPendingChanges();
         // check for version-enabled and lock are performed with subsequent calls.
         Version v = getVersionHistory().getVersion(versionName);
@@ -998,9 +993,7 @@
      * @see Node#restore(Version, boolean)
      */
     public void restore(Version version, boolean removeExisting) throws VersionException,
ItemExistsException, UnsupportedRepositoryOperationException, LockException, RepositoryException
{
-        checkSupportedOption(Repository.OPTION_VERSIONING_SUPPORTED);
         checkSessionHasPendingChanges();
-
         restore(this, null, version, removeExisting);
     }
 
@@ -1008,7 +1001,6 @@
      * @see Node#restore(Version, String, boolean)
      */
     public void restore(Version version, String relPath, boolean removeExisting) throws PathNotFoundException,
ItemExistsException, VersionException, ConstraintViolationException, UnsupportedRepositoryOperationException,
LockException, InvalidItemStateException, RepositoryException {
-        checkSupportedOption(Repository.OPTION_VERSIONING_SUPPORTED);
         checkSessionHasPendingChanges();
 
         // additional checks are performed with subsequest calls.
@@ -1046,7 +1038,6 @@
      * @see Node#restoreByLabel(String, boolean)
      */
     public void restoreByLabel(String versionLabel, boolean removeExisting) throws VersionException,
ItemExistsException, UnsupportedRepositoryOperationException, LockException, InvalidItemStateException,
RepositoryException {
-        checkSupportedOption(Repository.OPTION_VERSIONING_SUPPORTED);
         checkSessionHasPendingChanges();
 
         // check for version-enabled and lock are performed with subsequent calls.
@@ -1142,9 +1133,7 @@
      */
     public Lock getLock() throws UnsupportedRepositoryOperationException, LockException,
AccessDeniedException, RepositoryException {
         // lock can be inherited from a parent > do not check for node being lockable.
-        checkSupportedOption(Repository.OPTION_LOCKING_SUPPORTED);
         checkStatus();
-
         return session.getLockManager().getLock(getNodeState());
     }
 
@@ -1163,9 +1152,7 @@
      */
     public boolean holdsLock() throws RepositoryException {
         // lock can be inherited from a parent > do not check for node being lockable.
-        checkSupportedOption(Repository.OPTION_LOCKING_SUPPORTED);
         checkStatus();
-
         if (isNew() || !isNodeType(QName.MIX_LOCKABLE)) {
             // a node that is new or not lockable never holds a lock
             return false;
@@ -1180,9 +1167,7 @@
      */
     public boolean isLocked() throws RepositoryException {
         // lock can be inherited from a parent > do not check for node being lockable.
-        checkSupportedOption(Repository.OPTION_LOCKING_SUPPORTED);
         checkStatus();
-
         return session.getLockManager().isLocked(getNodeState());
     }
 
@@ -1261,7 +1246,6 @@
      * @throws RepositoryException if another error occurs.
      */
     private void checkIsLockable() throws UnsupportedRepositoryOperationException, RepositoryException
{
-        checkSupportedOption(Repository.OPTION_LOCKING_SUPPORTED);
         checkStatus();
         if (!isNodeType(QName.MIX_LOCKABLE)) {
             String msg = "Unable to perform locking operation on non-lockable node: " + getPath();
@@ -1277,9 +1261,8 @@
      * @throws RepositoryException if some other error occurs.
      */
     void checkIsLocked() throws LockException, RepositoryException {
-        if (!isSupportedOption(Repository.OPTION_LOCKING_SUPPORTED) || isNew()) {
-            // if locking is not support at all or if this node is new, no
-            // checks must be performed.
+        if (isNew()) {
+            // if this node is new, no checks must be performed.
             return;
         }
         // perform check
@@ -1293,7 +1276,6 @@
      * @throws RepositoryException
      */
     private void checkIsVersionable() throws UnsupportedRepositoryOperationException, RepositoryException
{
-        checkSupportedOption(Repository.OPTION_VERSIONING_SUPPORTED);
         checkStatus();
         if (!isNodeType(QName.MIX_VERSIONABLE)) {
             String msg = "Unable to perform versioning operation on non versionable node:
" + getPath();

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceImpl.java?view=diff&rev=479646&r1=479645&r2=479646
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceImpl.java
(original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceImpl.java
Mon Nov 27 06:59:24 2006
@@ -31,10 +31,8 @@
 import org.apache.jackrabbit.jcr2spi.security.AccessManager;
 import org.apache.jackrabbit.jcr2spi.lock.LockManager;
 import org.apache.jackrabbit.jcr2spi.lock.LockManagerImpl;
-import org.apache.jackrabbit.jcr2spi.lock.DefaultLockManager;
 import org.apache.jackrabbit.jcr2spi.version.VersionManager;
 import org.apache.jackrabbit.jcr2spi.version.VersionManagerImpl;
-import org.apache.jackrabbit.jcr2spi.version.DefaultVersionManager;
 import org.apache.jackrabbit.jcr2spi.version.VersionImpl;
 import org.apache.jackrabbit.jcr2spi.name.NamespaceRegistryImpl;
 import org.apache.jackrabbit.jcr2spi.observation.ObservationManagerImpl;
@@ -242,7 +240,6 @@
      * @see javax.jcr.Workspace#restore(Version[], boolean)
      */
     public void restore(Version[] versions, boolean removeExisting) throws ItemExistsException,
UnsupportedRepositoryOperationException, VersionException, LockException, InvalidItemStateException,
RepositoryException {
-        session.checkSupportedOption(Repository.OPTION_VERSIONING_SUPPORTED);
         session.checkHasPendingChanges();
 
         NodeState[] versionStates = new NodeState[versions.length];
@@ -471,13 +468,9 @@
      * @return a new <code>LockManager</code> instance.
      */
     protected LockManager createLockManager(WorkspaceManager wspManager, ItemManager itemManager)
{
-        if (session.isSupportedOption(Repository.OPTION_LOCKING_SUPPORTED)) {
-            LockManager lMgr = new LockManagerImpl(wspManager, itemManager);
-            session.addListener((LockManagerImpl) lMgr);
-            return lMgr;
-        } else {
-            return new DefaultLockManager();
-        }
+        LockManager lMgr = new LockManagerImpl(wspManager, itemManager);
+        session.addListener((LockManagerImpl) lMgr);
+        return lMgr;
     }
 
     /**
@@ -487,11 +480,7 @@
      * @return a new <code>VersionManager</code> instance.
      */
     protected VersionManager createVersionManager(WorkspaceManager wspManager) {
-        if (session.isSupportedOption(Repository.OPTION_VERSIONING_SUPPORTED)) {
-            return new VersionManagerImpl(wspManager);
-        } else {
-            return new DefaultVersionManager();
-        }
+        return new VersionManagerImpl(wspManager);
     }
 
     /**



Mime
View raw message