jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r983900 - in /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core: ./ query/ query/lucene/ session/
Date Tue, 10 Aug 2010 09:28:09 GMT
Author: jukka
Date: Tue Aug 10 09:28:07 2010
New Revision: 983900

URL: http://svn.apache.org/viewvc?rev=983900&view=rev
Log:
JCR-890: concurrent read-only access to a session

Simplify things by making SessionContext implement NamePathResolver

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/AddMixinOperation.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemValidator.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RemoveMixinOperation.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/QueryImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/QueryManagerImpl.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/query/lucene/QueryResultImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/session/AddNodeOperation.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/session/SessionContext.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/session/SessionItemOperation.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/AddMixinOperation.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/AddMixinOperation.java?rev=983900&r1=983899&r2=983900&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/AddMixinOperation.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/AddMixinOperation.java
Tue Aug 10 09:28:07 2010
@@ -59,8 +59,6 @@ class AddMixinOperation implements Sessi
     }
 
     public Object perform(SessionContext context) throws RepositoryException {
-        SessionImpl session = context.getSessionImpl();
-
         int permissions = Permission.NODE_TYPE_MNGMT;
         // special handling of mix:(simple)versionable. since adding the
         // mixin alters the version storage jcr:versionManagement privilege
@@ -69,16 +67,17 @@ class AddMixinOperation implements Sessi
                 || MIX_SIMPLE_VERSIONABLE.equals(mixinName)) {
             permissions |= Permission.VERSION_MNGMT;
         }
-        session.getValidator().checkModify(
+        context.getSessionImpl().getValidator().checkModify(
                 node,
                 CHECK_LOCK | CHECK_CHECKED_OUT | CHECK_CONSTRAINTS | CHECK_HOLD,
                 permissions);
 
-        NodeTypeManagerImpl ntMgr = session.getNodeTypeManager();
+        NodeTypeManagerImpl ntMgr =
+            context.getSessionImpl().getNodeTypeManager();
         NodeTypeImpl mixin = ntMgr.getNodeType(mixinName);
         if (!mixin.isMixin()) {
             throw new RepositoryException(
-                    session.getJCRName(mixinName) + " is not a mixin node type");
+                    context.getJCRName(mixinName) + " is not a mixin node type");
         }
 
         Name primaryTypeName = node.getNodeState().getNodeTypeName();

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemImpl.java?rev=983900&r1=983899&r2=983900&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemImpl.java
Tue Aug 10 09:28:07 2010
@@ -222,7 +222,7 @@ public abstract class ItemImpl implement
      * @throws RepositoryException if the given name is invalid
      */
     protected Name getQName(String name) throws RepositoryException {
-        return session.getQName(name);
+        return sessionContext.getQName(name);
     }
 
     /**
@@ -379,7 +379,7 @@ public abstract class ItemImpl implement
         return perform(new SessionOperation<String>() {
             public String perform(SessionContext context)
                     throws RepositoryException {
-                return context.getSessionImpl().getJCRPath(getPrimaryPath());
+                return context.getJCRPath(getPrimaryPath());
             }
         });
     }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemValidator.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemValidator.java?rev=983900&r1=983899&r2=983900&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemValidator.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemValidator.java
Tue Aug 10 09:28:07 2010
@@ -42,7 +42,6 @@ import org.apache.jackrabbit.spi.Path;
 import org.apache.jackrabbit.spi.QPropertyDefinition;
 import org.apache.jackrabbit.spi.QItemDefinition;
 import org.apache.jackrabbit.spi.QNodeDefinition;
-import org.apache.jackrabbit.spi.commons.conversion.PathResolver;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -113,11 +112,6 @@ public class ItemValidator {
     protected final NodeTypeRegistry ntReg;
 
     /**
-     * Path resolver for outputting user-friendly error messages.
-     */
-    protected final PathResolver resolver;
-
-    /**
      * Creates a new <code>ItemValidator</code> instance.
      *
      * @param sessionContext component context of this session
@@ -125,7 +119,6 @@ public class ItemValidator {
     public ItemValidator(SessionContext sessionContext) throws RepositoryException {
         this.sessionContext = sessionContext;
         this.ntReg = sessionContext.getRepositoryContext().getNodeTypeRegistry();
-        this.resolver = sessionContext.getSessionImpl();
     }
 
     /**
@@ -490,7 +483,7 @@ public class ItemValidator {
      */
     public String safeGetJCRPath(Path path) {
         try {
-            return resolver.getJCRPath(path);
+            return sessionContext.getJCRPath(path);
         } catch (NamespaceException e) {
             log.error("failed to convert {} to a JCR path", path);
             // return string representation of internal path as a fallback

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=983900&r1=983899&r2=983900&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 Aug 10 09:28:07 2010
@@ -1173,7 +1173,7 @@ public class NodeImpl extends ItemImpl i
                     return (PropertyImpl) context.getItemManager().getItem(
                             new PropertyId(getNodeId(), name));
                 } catch (AccessDeniedException ade) {
-                    String n = context.getSessionImpl().getJCRName(name);
+                    String n = context.getJCRName(name);
                     throw new ItemNotFoundException(
                             "Property " + n + " not found");
                 }
@@ -1667,7 +1667,7 @@ public class NodeImpl extends ItemImpl i
                     name = context.getHierarchyManager().getName(
                             getNodeId(), parentId);
                 }
-                return context.getSessionImpl().getJCRName(name);
+                return context.getJCRName(name);
             }
         });
     }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RemoveMixinOperation.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RemoveMixinOperation.java?rev=983900&r1=983899&r2=983900&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RemoveMixinOperation.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RemoveMixinOperation.java
Tue Aug 10 09:28:07 2010
@@ -85,7 +85,7 @@ class RemoveMixinOperation implements Se
         NodeState state = node.getNodeState();
         if (!state.getMixinTypeNames().contains(mixinName)) {
             throw new NoSuchNodeTypeException(
-                    "Mixin " + session.getJCRName(mixinName)
+                    "Mixin " + context.getJCRName(mixinName)
                     + " not included in " + node);
         }
 
@@ -177,7 +177,7 @@ class RemoveMixinOperation implements Se
         } catch (ItemStateException e) {
             throw new RepositoryException(
                     "Failed to determine effect of removing mixin "
-                    + session.getJCRName(mixinName), e);
+                    + context.getJCRName(mixinName), e);
         }
 
         // modify the state of this node
@@ -278,7 +278,7 @@ class RemoveMixinOperation implements Se
         } catch (ItemStateException e) {
             throw new RepositoryException(
                     "Failed to clean up child items defined by removed mixin "
-                    + session.getJCRName(mixinName), e);
+                    + context.getJCRName(mixinName), e);
         } finally {
             if (!success) {
                 // TODO JCR-1914: revert any changes made so far

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/QueryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/QueryImpl.java?rev=983900&r1=983899&r2=983900&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/QueryImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/QueryImpl.java
Tue Aug 10 09:28:07 2010
@@ -179,20 +179,19 @@ public class QueryImpl extends AbstractQ
             RepositoryException {
 
         checkInitialized();
-        NamePathResolver resolver = sessionContext.getSessionImpl();
         try {
-            Path p = resolver.getQPath(absPath).getNormalizedPath();
+            Path p = sessionContext.getQPath(absPath).getNormalizedPath();
             if (!p.isAbsolute()) {
                 throw new RepositoryException(absPath + " is not an absolute path");
             }
 
-            String relPath = resolver.getJCRPath(p).substring(1);
+            String relPath = sessionContext.getJCRPath(p).substring(1);
             Node queryNode =
                 sessionContext.getSessionImpl().getRootNode().addNode(
-                        relPath, resolver.getJCRName(NT_QUERY));
+                        relPath, sessionContext.getJCRName(NT_QUERY));
             // set properties
-            queryNode.setProperty(resolver.getJCRName(JCR_LANGUAGE), language);
-            queryNode.setProperty(resolver.getJCRName(JCR_STATEMENT), statement);
+            queryNode.setProperty(sessionContext.getJCRName(JCR_LANGUAGE), language);
+            queryNode.setProperty(sessionContext.getJCRName(JCR_STATEMENT), statement);
             node = queryNode;
             return node;
         } catch (NameException e) {
@@ -204,11 +203,10 @@ public class QueryImpl extends AbstractQ
      * {@inheritDoc}
      */
     public String[] getBindVariableNames() throws RepositoryException {
-        NameResolver resolver = sessionContext.getSessionImpl();
         Name[] names = query.getBindVariableNames();
         String[] strNames = new String[names.length];
         for (int i = 0; i < names.length; i++) {
-            strNames[i] = resolver.getJCRName(names[i]);
+            strNames[i] = sessionContext.getJCRName(names[i]);
         }
         return strNames;
     }
@@ -227,7 +225,7 @@ public class QueryImpl extends AbstractQ
             throws IllegalArgumentException, RepositoryException {
         checkInitialized();
         try {
-            query.bindValue(sessionContext.getSessionImpl().getQName(varName), value);
+            query.bindValue(sessionContext.getQName(varName), value);
         } catch (NameException e) {
             throw new RepositoryException(e.getMessage());
         }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/QueryManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/QueryManagerImpl.java?rev=983900&r1=983899&r2=983900&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/QueryManagerImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/QueryManagerImpl.java
Tue Aug 10 09:28:07 2010
@@ -75,8 +75,7 @@ public class QueryManagerImpl implements
             throws RepositoryException {
         this.sessionContext = sessionContext;
         this.searchMgr = searchMgr;
-        this.qomFactory = new QueryObjectModelFactoryImpl(
-                sessionContext.getSessionImpl()) {
+        this.qomFactory = new QueryObjectModelFactoryImpl(sessionContext) {
             protected QueryObjectModel createQuery(QueryObjectModelTree qomTree)
                     throws InvalidQueryException, RepositoryException {
                 return searchMgr.createQueryObjectModel(
@@ -106,15 +105,14 @@ public class QueryManagerImpl implements
         return perform(new SessionOperation<Query>() {
             public Query perform(SessionContext context)
                     throws RepositoryException {
-                NamePathResolver resolver = context.getSessionImpl();
-                if (!node.isNodeType(resolver.getJCRName(NT_QUERY))) {
+                if (!node.isNodeType(context.getJCRName(NT_QUERY))) {
                     throw new InvalidQueryException(
                             "Node is not of type nt:query: " + node);
                 }
                 String statement =
-                    node.getProperty(resolver.getJCRName(JCR_STATEMENT)).getString();
+                    node.getProperty(context.getJCRName(JCR_STATEMENT)).getString();
                 String language =
-                    node.getProperty(resolver.getJCRName(JCR_LANGUAGE)).getString();
+                    node.getProperty(context.getJCRName(JCR_LANGUAGE)).getString();
 
                 QueryFactory qf = new QueryFactoryImpl(node, language);
                 return qf.createQuery(statement, language);

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=983900&r1=983899&r2=983900&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 Aug 10 09:28:07 2010
@@ -20,6 +20,7 @@ import java.util.LinkedHashMap;
 import java.util.Map;
 
 import javax.jcr.RepositoryException;
+import javax.jcr.Workspace;
 import javax.jcr.nodetype.PropertyDefinition;
 import javax.jcr.query.InvalidQueryException;
 import javax.jcr.query.QueryResult;
@@ -89,7 +90,7 @@ public class QueryImpl extends AbstractQ
         // parse query according to language
         // build query tree using the passed factory
         this.root = QueryParser.parse(
-                statement, language, sessionContext.getSessionImpl(), factory);
+                statement, language, sessionContext, factory);
     }
 
     /**
@@ -144,13 +145,14 @@ public class QueryImpl extends AbstractQ
      */
     protected ColumnImpl[] getColumns() throws RepositoryException {
         SessionImpl session = sessionContext.getSessionImpl();
-        QueryObjectModelFactory qomFactory = session.getWorkspace().getQueryManager().getQOMFactory();
+        QueryObjectModelFactory qomFactory =
+            session.getWorkspace().getQueryManager().getQOMFactory();
         // get columns
         Map<Name, ColumnImpl> columns = new LinkedHashMap<Name, ColumnImpl>();
         for (Name name : root.getSelectProperties()) {
-            String pn = session.getJCRName(name);
+            String pn = sessionContext.getJCRName(name);
             ColumnImpl col = (ColumnImpl) qomFactory.column(
-                    session.getJCRName(DEFAULT_SELECTOR_NAME), pn, pn);
+                    sessionContext.getJCRName(DEFAULT_SELECTOR_NAME), pn, pn);
             columns.put(name, col);
         }
         if (columns.size() == 0) {
@@ -212,11 +214,11 @@ public class QueryImpl extends AbstractQ
      * @throws RepositoryException if an error occurs while creating the column.
      */
     protected ColumnImpl columnForName(Name propertyName) throws RepositoryException {
-        SessionImpl session = sessionContext.getSessionImpl();
+        Workspace workspace = sessionContext.getSessionImpl().getWorkspace();
         QueryObjectModelFactory qomFactory =
-            session.getWorkspace().getQueryManager().getQOMFactory();
-        String name = session.getJCRName(propertyName);
+            workspace.getQueryManager().getQOMFactory();
+        String name = sessionContext.getJCRName(propertyName);
         return (ColumnImpl) qomFactory.column(
-                session.getJCRName(DEFAULT_SELECTOR_NAME), name, name);
+                sessionContext.getJCRName(DEFAULT_SELECTOR_NAME), name, name);
     }
 }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/QueryResultImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/QueryResultImpl.java?rev=983900&r1=983899&r2=983900&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/QueryResultImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/QueryResultImpl.java
Tue Aug 10 09:28:07 2010
@@ -164,10 +164,9 @@ public abstract class QueryResultImpl im
      * {@inheritDoc}
      */
     public String[] getSelectorNames() throws RepositoryException {
-        NameResolver resolver = sessionContext.getSessionImpl();
         String[] names = new String[selectorNames.length];
         for (int i = 0; i < selectorNames.length; i++) {
-            names[i] = resolver.getJCRName(selectorNames[i]);
+            names[i] = sessionContext.getJCRName(selectorNames[i]);
         }
         return names;
     }
@@ -202,7 +201,7 @@ public abstract class QueryResultImpl im
                 getScoreNodes(), columns,
                 selectorNames, sessionContext.getItemManager(),
                 index.getContext().getHierarchyManager(),
-                sessionContext.getSessionImpl(), 
+                sessionContext, 
                 sessionContext.getSessionImpl().getValueFactory(),
                 excerptProvider, spellSuggestion);
     }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/session/AddNodeOperation.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/session/AddNodeOperation.java?rev=983900&r1=983899&r2=983900&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/session/AddNodeOperation.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/session/AddNodeOperation.java
Tue Aug 10 09:28:07 2010
@@ -25,7 +25,6 @@ import javax.jcr.nodetype.ConstraintViol
 
 import org.apache.jackrabbit.core.ItemManager;
 import org.apache.jackrabbit.core.NodeImpl;
-import org.apache.jackrabbit.core.SessionImpl;
 import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.Path;
@@ -55,14 +54,13 @@ public class AddNodeOperation implements
     }
 
     public Node perform(SessionContext context) throws RepositoryException {
-        SessionImpl session = context.getSessionImpl();
         ItemManager itemMgr = context.getItemManager();
 
         // Get the canonical path of the new node
         Path path;
         try {
             path = PathFactoryImpl.getInstance().create(
-                    node.getPrimaryPath(), session.getQPath(relPath), true);
+                    node.getPrimaryPath(), context.getQPath(relPath), true);
         } catch (NameException e) {
             throw new RepositoryException(
                     "Failed to resolve path " + relPath
@@ -86,7 +84,7 @@ public class AddNodeOperation implements
             if (itemMgr.propertyExists(parentPath)) {
                 throw new ConstraintViolationException(
                         "Unable to add a child node to property "
-                        + session.getJCRPath(parentPath));
+                        + context.getJCRPath(parentPath));
             }
             throw e;
         } catch (AccessDeniedException ade) {
@@ -98,7 +96,7 @@ public class AddNodeOperation implements
         // Resolve node type name (if any)
         Name typeName = null;
         if (nodeTypeName != null) {
-            typeName = session.getQName(nodeTypeName);
+            typeName = context.getQName(nodeTypeName);
         }
 
         // Check that the given UUID (if any) does not already exist

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/session/SessionContext.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/session/SessionContext.java?rev=983900&r1=983899&r2=983900&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/session/SessionContext.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/session/SessionContext.java
Tue Aug 10 09:28:07 2010
@@ -16,6 +16,8 @@
  */
 package org.apache.jackrabbit.core.session;
 
+import javax.jcr.NamespaceException;
+
 import org.apache.jackrabbit.core.HierarchyManager;
 import org.apache.jackrabbit.core.ItemManager;
 import org.apache.jackrabbit.core.ItemValidator;
@@ -26,8 +28,13 @@ import org.apache.jackrabbit.core.id.Nod
 import org.apache.jackrabbit.core.observation.ObservationManagerImpl;
 import org.apache.jackrabbit.core.security.AccessManager;
 import org.apache.jackrabbit.core.state.SessionItemStateManager;
+import org.apache.jackrabbit.spi.Name;
+import org.apache.jackrabbit.spi.Path;
+import org.apache.jackrabbit.spi.commons.conversion.IllegalNameException;
+import org.apache.jackrabbit.spi.commons.conversion.MalformedPathException;
+import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
 
-public class SessionContext {
+public class SessionContext implements NamePathResolver {
 
     private final RepositoryContext repositoryContext;
 
@@ -156,4 +163,33 @@ public class SessionContext {
         this.observationManager = observationManager;
     }
 
+    //--------------------------------------------------------< NameResolver >
+
+    public Name getQName(String name)
+            throws IllegalNameException, NamespaceException {
+        return session.getQName(name);
+    }
+
+    public String getJCRName(Name name) throws NamespaceException {
+        return session.getJCRName(name);
+    }
+
+    //--------------------------------------------------------< PathResolver >
+
+    public Path getQPath(String path)
+            throws MalformedPathException, IllegalNameException,
+            NamespaceException {
+        return session.getQPath(path);
+    }
+
+    public Path getQPath(String path, boolean normalizeIdentifier)
+            throws MalformedPathException, IllegalNameException,
+            NamespaceException {
+        return session.getQPath(path, normalizeIdentifier);
+    }
+
+    public String getJCRPath(Path path) throws NamespaceException {
+        return session.getJCRPath(path);
+    }
+
 }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/session/SessionItemOperation.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/session/SessionItemOperation.java?rev=983900&r1=983899&r2=983900&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/session/SessionItemOperation.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/session/SessionItemOperation.java
Tue Aug 10 09:28:07 2010
@@ -42,7 +42,7 @@ public abstract class SessionItemOperati
     public T perform(SessionContext context) throws RepositoryException {
         try {
             Path normalized =
-                context.getSessionImpl().getQPath(path).getNormalizedPath();
+                context.getQPath(path).getNormalizedPath();
             if (normalized.isAbsolute()) {
                 return perform(context.getItemManager(), normalized);
             } else {



Mime
View raw message