jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r653905 - in /jackrabbit/trunk/jackrabbit-core/src: main/java/org/apache/jackrabbit/core/ main/java/org/apache/jackrabbit/core/lock/ main/java/org/apache/jackrabbit/core/query/lucene/ main/java/org/apache/jackrabbit/core/security/authorizat...
Date Tue, 06 May 2008 20:21:51 GMT
Author: jukka
Date: Tue May  6 13:21:49 2008
New Revision: 653905

URL: http://svn.apache.org/viewvc?rev=653905&view=rev
Log:
JCR-1564: JSR 283 namespace handling
    - Made SessionImpl implement NamespaceResolver
    - Removed SessionImpl.getNamePathResolver() and
      SessionImpl.getNamespaceResolver() in favor of
      using SessionImpl directly as a namespace, name
      or path resolver

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/PropertyImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SecurityItemModifier.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SessionImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/WorkspaceImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/LockManagerImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/QueryImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/combined/CombinedProvider.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/SessionImporter.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/user/AuthorizableImplTest.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java?rev=653905&r1=653904&r2=653905&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java
Tue May  6 13:21:49 2008
@@ -4418,11 +4418,11 @@
             Value[] values = prop.getValues();
             InternalValue[] ivalues = new InternalValue[values.length];
             for (int i = 0; i < values.length; i++) {
-                ivalues[i] = InternalValue.create(values[i], session.getNamePathResolver(),
rep.getDataStore());
+                ivalues[i] = InternalValue.create(values[i], session, rep.getDataStore());
             }
             internalSetProperty(prop.getQName(), ivalues);
         } else {
-            InternalValue value = InternalValue.create(prop.getValue(), session.getNamePathResolver(),
rep.getDataStore());
+            InternalValue value = InternalValue.create(prop.getValue(), session, rep.getDataStore());
             internalSetProperty(prop.getQName(), value);
         }
     }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/PropertyImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/PropertyImpl.java?rev=653905&r1=653904&r2=653905&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/PropertyImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/PropertyImpl.java
Tue May  6 13:21:49 2008
@@ -353,10 +353,10 @@
         if (reqType != PropertyType.NAME) {
             // type conversion required
             Value targetValue = ValueHelper.convert(
-                    InternalValue.create(name).toJCRValue(session.getNamePathResolver()),
+                    InternalValue.create(name).toJCRValue(session),
                     reqType,
                     ValueFactoryImpl.getInstance());
-            internalValue = InternalValue.create(targetValue, session.getNamePathResolver(),
rep.getDataStore());
+            internalValue = InternalValue.create(targetValue, session, rep.getDataStore());
         } else {
             // no type conversion required
             internalValue = InternalValue.create(name);
@@ -405,10 +405,10 @@
                     if (reqType != PropertyType.NAME) {
                         // type conversion required
                         Value targetValue = ValueHelper.convert(
-                                InternalValue.create(name).toJCRValue(session.getNamePathResolver()),
+                                InternalValue.create(name).toJCRValue(session),
                                 reqType,
                                 ValueFactoryImpl.getInstance());
-                        internalValue = InternalValue.create(targetValue, session.getNamePathResolver(),
rep.getDataStore());
+                        internalValue = InternalValue.create(targetValue, session, rep.getDataStore());
                     } else {
                         // no type conversion required
                         internalValue = InternalValue.create(name);
@@ -622,10 +622,10 @@
             Value targetVal = ValueHelper.convert(
                     value, reqType,
                     ValueFactoryImpl.getInstance());
-            internalValue = InternalValue.create(targetVal, session.getNamePathResolver(),
rep.getDataStore());
+            internalValue = InternalValue.create(targetVal, session, rep.getDataStore());
         } else {
             // no type conversion required
-            internalValue = InternalValue.create(value, session.getNamePathResolver(), rep.getDataStore());
+            internalValue = InternalValue.create(value, session, rep.getDataStore());
         }
         internalSetValue(new InternalValue[]{internalValue}, reqType);
     }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SecurityItemModifier.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SecurityItemModifier.java?rev=653905&r1=653904&r2=653905&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SecurityItemModifier.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SecurityItemModifier.java
Tue May  6 13:21:49 2008
@@ -92,7 +92,7 @@
         synchronized (parentImpl) {
             // validation: make sure Node is not locked or checked-in.
             parentImpl.checkSetProperty();
-            InternalValue intVs = InternalValue.create(value, parentImpl.session.getNamePathResolver());
+            InternalValue intVs = InternalValue.create(value, parentImpl.session);
             return parentImpl.internalSetProperty(name, intVs);
         }
     }
@@ -103,7 +103,7 @@
             parentImpl.checkSetProperty();
             InternalValue[] intVs = new InternalValue[values.length];
             for (int i = 0; i < values.length; i++) {
-                intVs[i] = InternalValue.create(values[i], parentImpl.session.getNamePathResolver());
+                intVs[i] = InternalValue.create(values[i], parentImpl.session);
             }
             return parentImpl.internalSetProperty(name, intVs);
         }

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=653905&r1=653904&r2=653905&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
Tue May  6 13:21:49 2008
@@ -108,7 +108,7 @@
  * A <code>SessionImpl</code> ...
  */
 public class SessionImpl extends AbstractSession
-        implements JackrabbitSession, NamePathResolver, Dumpable {
+        implements JackrabbitSession, NamespaceResolver, NamePathResolver, Dumpable {
 
     private static Logger log = LoggerFactory.getLogger(SessionImpl.class);
 
@@ -288,7 +288,7 @@
 
         nsMappings = new LocalNamespaceMappings(rep.getNamespaceRegistry());
         namePathResolver = new DefaultNamePathResolver(nsMappings, true);
-        ntMgr = new NodeTypeManagerImpl(rep.getNodeTypeRegistry(), rep.getNamespaceRegistry(),
getNamespaceResolver(), getNamePathResolver(), rep.getDataStore());
+        ntMgr = new NodeTypeManagerImpl(rep.getNodeTypeRegistry(), rep.getNamespaceRegistry(),
this, this, rep.getDataStore());
         String wspName = wspConfig.getName();
         wsp = createWorkspaceInstance(wspConfig,
                 rep.getWorkspaceStateManager(wspName), rep, this);
@@ -366,7 +366,7 @@
                 this,
                 getSubject(),
                 hierarchyManager,
-                getNamePathResolver(),
+                this,
                 wspName);
         return rep.getSecurityManager().getAccessManager(this, ctx);
     }
@@ -450,24 +450,6 @@
     }
 
     /**
-     * Returns the <code>NamespaceResolver</code> of this session.
-     *
-     * @return the <code>NamespaceResolver</code> of this session
-     */
-    public NamespaceResolver getNamespaceResolver() {
-        return nsMappings;
-    }
-
-    /**
-     * Returns the <code>NamePathResolver</code> of this session.
-     *
-     * @return the <code>NamePathResolver</code> of this session
-     */
-    public NamePathResolver getNamePathResolver() {
-        return namePathResolver;
-    }
-
-    /**
      * Returns the <code>SessionItemStateManager</code> associated with this
session.
      *
      * @return the <code>SessionItemStateManager</code> associated with this
session
@@ -682,6 +664,16 @@
         return gc;
     }
 
+    //---------------------------------------------------< NamespaceResolver >
+
+    public String getPrefix(String uri) throws NamespaceException {
+        return nsMappings.getPrefix(uri);
+    }
+
+    public String getURI(String prefix) throws NamespaceException {
+        return nsMappings.getURI(prefix);
+    }
+
     //--------------------------------------------------------< NameResolver >
 
     public String getJCRName(Name name) throws NamespaceException {
@@ -929,7 +921,7 @@
         parent.checkLock();
 
         SessionImporter importer = new SessionImporter(parent, this, uuidBehavior);
-        return new ImportHandler(importer, getNamespaceResolver(), rep.getNamespaceRegistry());
+        return new ImportHandler(importer, this, rep.getNamespaceRegistry());
     }
 
     /**

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/WorkspaceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/WorkspaceImpl.java?rev=653905&r1=653904&r2=653905&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/WorkspaceImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/WorkspaceImpl.java
Tue May  6 13:21:49 2008
@@ -751,8 +751,7 @@
 
         Importer importer = new WorkspaceImporter(parentPath, this,
                 rep.getNodeTypeRegistry(), uuidBehavior);
-        return new ImportHandler(importer, session.getNamespaceResolver(),
-                rep.getNamespaceRegistry());
+        return new ImportHandler(importer, session, rep.getNamespaceRegistry());
     }
 
     /**

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/LockManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/LockManagerImpl.java?rev=653905&r1=653904&r2=653905&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/LockManagerImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/LockManagerImpl.java
Tue May  6 13:21:49 2008
@@ -20,7 +20,6 @@
 import org.apache.commons.collections.map.LinkedMap;
 import org.apache.commons.io.IOUtils;
 import org.apache.jackrabbit.spi.commons.conversion.MalformedPathException;
-import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
 import org.apache.jackrabbit.core.ItemId;
 import org.apache.jackrabbit.core.NodeId;
 import org.apache.jackrabbit.core.NodeImpl;
@@ -101,11 +100,6 @@
     private boolean savingDisabled;
 
     /**
-     * Name and Path resolver
-     */
-    private final NamePathResolver resolver;
-
-    /**
      * Lock event channel.
      */
     private LockEventChannel eventChannel;
@@ -121,7 +115,6 @@
             throws RepositoryException {
 
         this.session = session;
-        this.resolver = session.getNamePathResolver();
         this.locksFile = new FileSystemResource(fs, FileSystem.SEPARATOR + LOCKS_FILE);
 
         session.getWorkspace().getObservationManager().
@@ -813,7 +806,7 @@
 
             try {
                 he = new HierarchyEvent(event.getChildId(),
-                        resolver.getQPath(event.getPath()).getNormalizedPath(),
+                        session.getQPath(event.getPath()).getNormalizedPath(),
                         event.getType());
             } catch (MalformedPathException e) {
                 log.info("Unable to get event's path: " + e.getMessage());

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/QueryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/QueryImpl.java?rev=653905&r1=653904&r2=653905&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/QueryImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/QueryImpl.java
Tue May  6 13:21:49 2008
@@ -88,8 +88,7 @@
         super(session, itemMgr, index, propReg);
         // parse query according to language
         // build query tree using the passed factory
-        this.root = QueryParser.parse(statement, language,
-                session.getNamePathResolver(), factory);
+        this.root = QueryParser.parse(statement, language, session, factory);
     }
 
     /**

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/combined/CombinedProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/combined/CombinedProvider.java?rev=653905&r1=653904&r2=653905&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/combined/CombinedProvider.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/combined/CombinedProvider.java
Tue May  6 13:21:49 2008
@@ -157,8 +157,7 @@
         if (editingSession instanceof SessionImpl) {
             try {
                 return new CombinedEditor((SessionImpl) editingSession,
-                        session.getNamePathResolver(),
-                        session.getQPath(acRoot.getPath()));
+                        session, session.getQPath(acRoot.getPath()));
             } catch (RepositoryException e) {
                 // should never get here
                 log.error("Internal error:", e.getMessage());

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/SessionImporter.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/SessionImporter.java?rev=653905&r1=653904&r2=653905&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/SessionImporter.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/SessionImporter.java
Tue May  6 13:21:49 2008
@@ -247,7 +247,7 @@
         Iterator iter = propInfos.iterator();
         while (iter.hasNext()) {
             PropInfo pi = (PropInfo) iter.next();
-            pi.apply(node, session.getNamePathResolver(), refTracker);
+            pi.apply(node, session, refTracker);
         }
 
         parents.push(node);

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/user/AuthorizableImplTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/user/AuthorizableImplTest.java?rev=653905&r1=653904&r2=653905&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/user/AuthorizableImplTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/user/AuthorizableImplTest.java
Tue May  6 13:21:49 2008
@@ -50,7 +50,7 @@
         super.setUp();
 
         if (superuser instanceof SessionImpl) {
-            NameResolver resolver = ((SessionImpl) superuser).getNamePathResolver();
+            NameResolver resolver = (SessionImpl) superuser;
             protectedUserProps.add(resolver.getJCRName(UserConstants.P_USERID));
             protectedUserProps.add(resolver.getJCRName(UserConstants.P_PASSWORD));
             protectedUserProps.add(resolver.getJCRName(UserConstants.P_GROUPS));



Mime
View raw message