jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From resc...@apache.org
Subject svn commit: r1360164 - in /jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr: RepositoryImpl.java SessionDelegate.java WorkspaceImpl.java nodetype/NodeTypeManagerImpl.java
Date Wed, 11 Jul 2012 12:59:46 GMT
Author: reschke
Date: Wed Jul 11 12:59:46 2012
New Revision: 1360164

URL: http://svn.apache.org/viewvc?rev=1360164&view=rev
Log:
OAK-66: attach NodeTypeManagerDelegate to Repository instance

Modified:
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/RepositoryImpl.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionDelegate.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/WorkspaceImpl.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/nodetype/NodeTypeManagerImpl.java

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/RepositoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/RepositoryImpl.java?rev=1360164&r1=1360163&r2=1360164&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/RepositoryImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/RepositoryImpl.java
Wed Jul 11 12:59:46 2012
@@ -29,6 +29,7 @@ import org.apache.jackrabbit.commons.Sim
 import org.apache.jackrabbit.oak.api.ContentRepository;
 import org.apache.jackrabbit.oak.api.ContentSession;
 import org.apache.jackrabbit.oak.core.ContentRepositoryImpl;
+import org.apache.jackrabbit.oak.jcr.nodetype.NodeTypeManagerDelegate;
 import org.apache.jackrabbit.oak.jcr.util.LazyValue;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -45,6 +46,7 @@ public class RepositoryImpl implements R
 
     private final Descriptors descriptors = new Descriptors(new SimpleValueFactory());
     private final ContentRepository contentRepository;
+    private final NodeTypeManagerDelegate nodeTypeManagerDelegate;
 
     private final LazyValue<Timer> observationTimer = new LazyValue<Timer>()
{
         @Override
@@ -55,13 +57,20 @@ public class RepositoryImpl implements R
 
     public RepositoryImpl(ContentRepository contentRepository) {
         this.contentRepository = contentRepository;
+        try {
+            nodeTypeManagerDelegate = new NodeTypeManagerDelegate();
+        }
+        catch (RepositoryException ex) {
+            throw new RuntimeException(ex);
+        }
     }
 
     /**
      * Utility constructor that creates a new in-memory repository for use
      * mostly in test cases.
+     * @throws RepositoryException 
      */
-    public RepositoryImpl() {
+    public RepositoryImpl() throws RepositoryException {
         this(new ContentRepositoryImpl());
     }
 
@@ -131,11 +140,10 @@ public class RepositoryImpl implements R
         // TODO: needs complete refactoring
         try {
             ContentSession contentSession = contentRepository.login(credentials, workspaceName);
-            return new SessionDelegate(this, observationTimer, contentSession).getSession();
+            return new SessionDelegate(this, nodeTypeManagerDelegate, observationTimer, contentSession).getSession();
         } catch (LoginException e) {
             throw new javax.jcr.LoginException(e.getMessage());
         }
-
     }
 
     /**

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionDelegate.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionDelegate.java?rev=1360164&r1=1360163&r2=1360164&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionDelegate.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionDelegate.java
Wed Jul 11 12:59:46 2012
@@ -51,6 +51,7 @@ import org.apache.jackrabbit.oak.api.Roo
 import org.apache.jackrabbit.oak.api.Tree;
 import org.apache.jackrabbit.oak.commons.PathUtils;
 import org.apache.jackrabbit.oak.core.DefaultConflictHandler;
+import org.apache.jackrabbit.oak.jcr.nodetype.NodeTypeManagerDelegate;
 import org.apache.jackrabbit.oak.jcr.observation.ObservationManagerImpl;
 import org.apache.jackrabbit.oak.jcr.util.LazyValue;
 import org.apache.jackrabbit.oak.jcr.value.ValueFactoryImpl;
@@ -66,6 +67,7 @@ public class SessionDelegate {
 
     private final NamePathMapper namePathMapper = new NamePathMapperImpl(new SessionNameMapper());
     private final Repository repository;
+    private final NodeTypeManagerDelegate nodeTypeManagerDelegate;
     private final LazyValue<Timer> observationTimer;
     private final ContentSession contentSession;
     private final ValueFactoryImpl valueFactory;
@@ -77,12 +79,13 @@ public class SessionDelegate {
     private ObservationManagerImpl observationManager;
     private boolean isAlive = true;
 
-    SessionDelegate(Repository repository, LazyValue<Timer> observationTimer, ContentSession
contentSession)
+    SessionDelegate(Repository repository, NodeTypeManagerDelegate nodeTypeManagerDelegate,
LazyValue<Timer> observationTimer, ContentSession contentSession)
             throws RepositoryException {
         assert repository != null;
         assert contentSession != null;
 
         this.repository = repository;
+        this.nodeTypeManagerDelegate = nodeTypeManagerDelegate;
         this.observationTimer = observationTimer;
         this.contentSession = contentSession;
         this.valueFactory = new ValueFactoryImpl(contentSession.getCoreValueFactory(), namePathMapper);
@@ -111,6 +114,11 @@ public class SessionDelegate {
         return repository;
     }
 
+    @Nonnull
+    public NodeTypeManagerDelegate getNodeTypeManagerDelegate() {
+        return nodeTypeManagerDelegate;
+    }
+
     public void logout() {
         if (!isAlive) {
             // ignore

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/WorkspaceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/WorkspaceImpl.java?rev=1360164&r1=1360163&r2=1360164&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/WorkspaceImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/WorkspaceImpl.java
Wed Jul 11 12:59:46 2012
@@ -34,6 +34,7 @@ import org.apache.jackrabbit.api.Jackrab
 import org.apache.jackrabbit.api.security.authorization.PrivilegeManager;
 import org.apache.jackrabbit.oak.commons.PathUtils;
 import org.apache.jackrabbit.oak.jcr.lock.LockManagerImpl;
+import org.apache.jackrabbit.oak.jcr.nodetype.NodeTypeManagerDelegate;
 import org.apache.jackrabbit.oak.jcr.nodetype.NodeTypeManagerImpl;
 import org.apache.jackrabbit.oak.jcr.query.QueryManagerImpl;
 import org.apache.jackrabbit.oak.jcr.security.privilege.PrivilegeManagerImpl;
@@ -62,7 +63,7 @@ public class WorkspaceImpl implements Ja
     public WorkspaceImpl(SessionDelegate sessionDelegate)
             throws RepositoryException {
         this.sessionDelegate = sessionDelegate;
-        this.nodeTypeManager = new NodeTypeManagerImpl(sessionDelegate);
+        this.nodeTypeManager = new NodeTypeManagerImpl(sessionDelegate, sessionDelegate.getNodeTypeManagerDelegate());
         this.queryManager = new QueryManagerImpl(sessionDelegate);
         this.lockManager = new LockManagerImpl(sessionDelegate.getSession());
     }

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/nodetype/NodeTypeManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/nodetype/NodeTypeManagerImpl.java?rev=1360164&r1=1360163&r2=1360164&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/nodetype/NodeTypeManagerImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/nodetype/NodeTypeManagerImpl.java
Wed Jul 11 12:59:46 2012
@@ -46,10 +46,10 @@ public class NodeTypeManagerImpl impleme
     private final NodeTypeManagerDelegate ntmd;
     private final Map<String, NodeType> typemap = new HashMap<String, NodeType>();
 
-    public NodeTypeManagerImpl(SessionDelegate sd) throws RepositoryException {
+    public NodeTypeManagerImpl(SessionDelegate sd, NodeTypeManagerDelegate ntmd) throws RepositoryException
{
         this.vf = sd.getValueFactory();
         this.mapper = sd.getNamePathMapper();
-        this.ntmd = new NodeTypeManagerDelegate();
+        this.ntmd = ntmd;
     }
 
     private void init() {



Mime
View raw message