jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r655577 - in /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core: LocalNamespaceMappings.java SessionImpl.java
Date Mon, 12 May 2008 17:50:40 GMT
Author: jukka
Date: Mon May 12 10:50:40 2008
New Revision: 655577

URL: http://svn.apache.org/viewvc?rev=655577&view=rev
Log:
JCR-1564: JSR 283 namespace handling
    - Use AbstractSession for namespace handling in core
    - LocalNamespaceMappings is no longer needed

Removed:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/LocalNamespaceMappings.java
Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SessionImpl.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SessionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SessionImpl.java?rev=655577&r1=655576&r2=655577&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SessionImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SessionImpl.java
Mon May 12 10:50:40 2008
@@ -194,14 +194,9 @@
     protected final WorkspaceImpl wsp;
 
     /**
-     * the transient prefix/namespace mappings with session scope
-     */
-    protected final LocalNamespaceMappings nsMappings;
-
-    /**
      * Name and Path resolver
      */
-    protected final NamePathResolver namePathResolver;
+    protected NamePathResolver namePathResolver;
 
     /**
      * The version manager for this session
@@ -286,8 +281,7 @@
         }
         userId = uid;
 
-        nsMappings = new LocalNamespaceMappings(rep.getNamespaceRegistry());
-        namePathResolver = new DefaultNamePathResolver(nsMappings, true);
+        namePathResolver = new DefaultNamePathResolver(this, true);
         ntMgr = new NodeTypeManagerImpl(rep.getNodeTypeRegistry(), rep.getNamespaceRegistry(),
this, this, rep.getDataStore());
         String wspName = wspConfig.getName();
         wsp = createWorkspaceInstance(wspConfig,
@@ -667,11 +661,23 @@
     //---------------------------------------------------< NamespaceResolver >
 
     public String getPrefix(String uri) throws NamespaceException {
-        return nsMappings.getPrefix(uri);
+        try {
+            return getNamespacePrefix(uri);
+        } catch (NamespaceException e) {
+            throw e;
+        } catch (RepositoryException e) {
+            throw new NamespaceException("Namespace not found: " + uri, e);
+        }
     }
 
     public String getURI(String prefix) throws NamespaceException {
-        return nsMappings.getURI(prefix);
+        try {
+            return getNamespaceURI(prefix);
+        } catch (NamespaceException e) {
+            throw e;
+        } catch (RepositoryException e) {
+            throw new NamespaceException("Namespace not found: " + prefix, e);
+        }
     }
 
     //--------------------------------------------------------< NameResolver >
@@ -1011,8 +1017,6 @@
         // notify listeners that session is about to be closed
         notifyLoggingOut();
 
-        // dispose name resolver
-        nsMappings.dispose();
         // dispose session item state manager
         itemStateMgr.dispose();
         // dispose item manager
@@ -1087,32 +1091,11 @@
      */
     public void setNamespacePrefix(String prefix, String uri)
             throws NamespaceException, RepositoryException {
-        nsMappings.setNamespacePrefix(prefix, uri);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public String[] getNamespacePrefixes()
-            throws NamespaceException, RepositoryException {
-        return nsMappings.getPrefixes();
+        super.setNamespacePrefix(prefix, uri);
+        // Clear name and path caches
+        namePathResolver = new DefaultNamePathResolver(this, true);
     }
 
-    /**
-     * {@inheritDoc}
-     */
-    public String getNamespaceURI(String prefix)
-            throws NamespaceException, RepositoryException {
-        return nsMappings.getURI(prefix);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public String getNamespacePrefix(String uri)
-            throws NamespaceException, RepositoryException {
-        return nsMappings.getPrefix(uri);
-    }
 
     //------------------------------------------------------< locking support >
     /**



Mime
View raw message