jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1489747 - /jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionContext.java
Date Wed, 05 Jun 2013 08:56:44 GMT
Author: mduerig
Date: Wed Jun  5 08:56:43 2013
New Revision: 1489747

URL: http://svn.apache.org/r1489747
Log:
OAK-775 Implement backward compatible observation
guard cast

Modified:
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionContext.java

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionContext.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionContext.java?rev=1489747&r1=1489746&r2=1489747&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionContext.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionContext.java
Wed Jun  5 08:56:43 2013
@@ -28,6 +28,7 @@ import javax.jcr.PathNotFoundException;
 import javax.jcr.Repository;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
+import javax.jcr.UnsupportedRepositoryOperationException;
 import javax.jcr.ValueFactory;
 import javax.jcr.Workspace;
 import javax.jcr.lock.LockManager;
@@ -242,10 +243,15 @@ public abstract class SessionContext imp
 
 
     @Nonnull
-    public ObservationManager getObservationManager() {
+    public ObservationManager getObservationManager() throws UnsupportedRepositoryOperationException
{
         if (observationManager == null) {
             ContentRepository contentRepository = repository.getContentRepository();
+            if (!(contentRepository instanceof ContentRepositoryImpl)) {
+                throw new UnsupportedRepositoryOperationException("Observation not supported");
+            }
+
             observationManager = new ObservationManagerImpl(
+                // FIXME avoid casting to implementation
                 ((ContentRepositoryImpl) contentRepository),
                 ReadOnlyNodeTypeManager.getInstance(delegate.getRoot(), namePathMapper),
                 namePathMapper, repository.getObservationExecutor());



Mime
View raw message