jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r655573 - in /jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi: WorkspaceManager.java name/NamespaceCache.java name/NamespaceRegistryImpl.java
Date Mon, 12 May 2008 17:32:25 GMT
Author: jukka
Date: Mon May 12 10:32:25 2008
New Revision: 655573

URL: http://svn.apache.org/viewvc?rev=655573&view=rev
Log:
JCR-1564: JSR 283 namespace handling
    - Removed caching and listening of namespace registry in jcr2spi
      as AbstractSession already caches namespaces and JSR 283 removes
      the need to notify sessions about global namespace remappings

Removed:
    jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/name/NamespaceCache.java
Modified:
    jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceManager.java
    jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/name/NamespaceRegistryImpl.java

Modified: jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceManager.java?rev=655573&r1=655572&r2=655573&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceManager.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceManager.java
Mon May 12 10:32:25 2008
@@ -25,7 +25,6 @@
 import org.apache.jackrabbit.jcr2spi.nodetype.NodeTypeCache;
 import org.apache.jackrabbit.jcr2spi.name.NamespaceStorage;
 import org.apache.jackrabbit.jcr2spi.name.NamespaceRegistryImpl;
-import org.apache.jackrabbit.jcr2spi.name.NamespaceCache;
 import org.apache.jackrabbit.jcr2spi.state.ItemState;
 import org.apache.jackrabbit.jcr2spi.state.ChangeLog;
 import org.apache.jackrabbit.jcr2spi.state.UpdatableItemStateManager;
@@ -173,7 +172,7 @@
         this.pathFactory = service.getPathFactory();
 
         idFactory = service.getIdFactory();
-        nsRegistry = createNamespaceRegistry(NamespaceCache.getInstance(service));
+        nsRegistry = new NamespaceRegistryImpl(this);
         ntRegistry = createNodeTypeRegistry(nsRegistry);
         changeFeed = createChangeFeed(pollTimeout, enableObservation);
         definitionProvider = createDefinitionProvider(getEffectiveNodeTypeProvider());
@@ -434,15 +433,6 @@
 
     /**
      *
-     * @param nsCache the namespace cache.
-     * @return
-     */
-    private NamespaceRegistryImpl createNamespaceRegistry(NamespaceCache nsCache) throws
RepositoryException {
-        return new NamespaceRegistryImpl(this, nsCache);
-    }
-
-    /**
-     *
      * @param nsRegistry
      * @return
      */

Modified: jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/name/NamespaceRegistryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/name/NamespaceRegistryImpl.java?rev=655573&r1=655572&r2=655573&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/name/NamespaceRegistryImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/name/NamespaceRegistryImpl.java
Mon May 12 10:32:25 2008
@@ -16,8 +16,8 @@
  */
 package org.apache.jackrabbit.jcr2spi.name;
 
-import org.apache.jackrabbit.spi.commons.namespace.AbstractNamespaceResolver;
-import org.apache.jackrabbit.spi.commons.namespace.NamespaceListener;
+import java.util.Collection;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -30,56 +30,51 @@
  * <code>NamespaceRegistryImpl</code> implements the JCR client facing
  * NamespaceRegistry.
  */
-public class NamespaceRegistryImpl extends AbstractNamespaceResolver
-    implements NamespaceRegistry {
+public class NamespaceRegistryImpl implements NamespaceRegistry {
 
     private static Logger log = LoggerFactory.getLogger(NamespaceRegistryImpl.class);
 
     private final NamespaceStorage storage;
-    private final NamespaceCache nsCache;
 
     /**
      * Create a new <code>NamespaceRegistryImpl</code>.
      *
      * @param storage
-     * @param nsCache
      */
-    public NamespaceRegistryImpl(NamespaceStorage storage,
-                                 NamespaceCache nsCache) {
-        // listener support in AbstractNamespaceResolver is not needed
-        // because we delegate listeners to NamespaceCache
-        super(false);
+    public NamespaceRegistryImpl(NamespaceStorage storage) {
         this.storage = storage;
-        this.nsCache = nsCache;
     }
 
     //--------------------------------------------------< NamespaceRegistry >---
+
     /**
      * @see NamespaceRegistry#registerNamespace(String, String)
      */
     public void registerNamespace(String prefix, String uri) throws NamespaceException, UnsupportedRepositoryOperationException,
RepositoryException {
-        nsCache.registerNamespace(storage, prefix, uri);
+        storage.registerNamespace(prefix, uri);
     }
 
     /**
      * @see NamespaceRegistry#unregisterNamespace(String)
      */
     public void unregisterNamespace(String prefix) throws NamespaceException, UnsupportedRepositoryOperationException,
RepositoryException {
-        nsCache.unregisterNamespace(storage, prefix);
+        storage.unregisterNamespace(prefix);
     }
 
     /**
      * @see javax.jcr.NamespaceRegistry#getPrefixes()
      */
     public String[] getPrefixes() throws RepositoryException {
-        return nsCache.getPrefixes(storage);
+        Collection prefixes = storage.getRegisteredNamespaces().keySet();
+        return (String[]) prefixes.toArray(new String[prefixes.size()]);
     }
 
     /**
      * @see javax.jcr.NamespaceRegistry#getURIs()
      */
     public String[] getURIs() throws RepositoryException {
-        return nsCache.getURIs(storage);
+        Collection uris = storage.getRegisteredNamespaces().values();
+        return (String[]) uris.toArray(new String[uris.size()]);
     }
 
     /**
@@ -89,7 +84,7 @@
     public String getURI(String prefix) throws NamespaceException {
         // try to load the uri
         try {
-            return nsCache.getURI(storage, prefix);
+            return storage.getURI(prefix);
         } catch (RepositoryException ex) {
             log.debug("Internal error while loading registered namespaces.");
             throw new NamespaceException(prefix + ": is not a registered namespace prefix.");
@@ -103,28 +98,11 @@
     public String getPrefix(String uri) throws NamespaceException {
         // try to load the prefix
         try {
-            return nsCache.getPrefix(storage, uri);
+            return storage.getPrefix(uri);
         } catch (RepositoryException ex) {
             log.debug("Internal error while loading registered namespaces.");
             throw new NamespaceException(uri + ": is not a registered namespace uri.");
         }
     }
 
-    //-----------------------< AbstractNamespaceResolver >----------------------
-
-    /**
-     * Unregister on <code>NamespaceCache</code>.
-     * @param listener the namespace listener.
-     */
-    public void removeListener(NamespaceListener listener) {
-        nsCache.removeListener(listener);
-    }
-
-    /**
-     * Register on <code>NamespaceCache</code>.
-     * @param listener the namespace listener.
-     */
-    public void addListener(NamespaceListener listener) {
-        nsCache.addListener(listener);
-    }
 }



Mime
View raw message