jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1396841 - in /jackrabbit/oak/trunk: oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/token/ oak-core/src/main/java/org/apache/jackrabbit/oak/securit...
Date Wed, 10 Oct 2012 22:42:07 GMT
Author: mduerig
Date: Wed Oct 10 22:42:06 2012
New Revision: 1396841

URL: http://svn.apache.org/viewvc?rev=1396841&view=rev
Log:
OAK-350: Unify PropertyState and CoreValue
- Remove un-needed instances of CoreValueFactory

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ReadOnlyNodeTypeManager.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ReadWriteNodeTypeManager.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/token/TokenProviderImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeRegistry.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/MembershipProviderImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserProviderImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/util/NodeUtil.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/AbstractCoreTest.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/WorkspaceImpl.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ReadOnlyNodeTypeManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ReadOnlyNodeTypeManager.java?rev=1396841&r1=1396840&r2=1396841&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ReadOnlyNodeTypeManager.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ReadOnlyNodeTypeManager.java
Wed Oct 10 22:42:06 2012
@@ -34,11 +34,9 @@ import javax.jcr.nodetype.PropertyDefini
 
 import com.google.common.collect.Lists;
 import org.apache.jackrabbit.commons.iterator.NodeTypeIteratorAdapter;
-import org.apache.jackrabbit.oak.api.CoreValueFactory;
 import org.apache.jackrabbit.oak.api.Tree;
 import org.apache.jackrabbit.oak.namepath.NameMapper;
 import org.apache.jackrabbit.oak.namepath.NamePathMapperImpl;
-import org.apache.jackrabbit.oak.plugins.memory.MemoryValueFactory;
 import org.apache.jackrabbit.oak.util.NodeUtil;
 
 /**
@@ -84,19 +82,6 @@ public abstract class ReadOnlyNodeTypeMa
     }
 
     /**
-     * Returns a {@link CoreValueFactory} to be used by this node type manager.
-     * This implementation returns a {@link MemoryValueFactory#INSTANCE}. A
-     * subclass may override this method and provide a different
-     * implementation.
-     *
-     * @return {@link CoreValueFactory} instance.
-     */
-    @Nonnull
-    protected CoreValueFactory getCoreValueFactory() {
-        return MemoryValueFactory.INSTANCE;
-    }
-
-    /**
      * Returns a {@link NameMapper} to be used by this node type manager. This
      * implementation returns the {@link NamePathMapperImpl#DEFAULT} instance. A
      * subclass may override this method and provide a different
@@ -124,7 +109,7 @@ public abstract class ReadOnlyNodeTypeMa
             Tree type = types.getChild(getOakName(name));
             if (type != null) {
                 return new NodeTypeImpl(this, getValueFactory(),
-                        new NodeUtil(type, getCoreValueFactory(), getNameMapper()));
+                        new NodeUtil(type, getNameMapper()));
             }
         }
         throw new NoSuchNodeTypeException(name);
@@ -137,7 +122,7 @@ public abstract class ReadOnlyNodeTypeMa
         if (types != null) {
             for (Tree type : types.getChildren()) {
                 list.add(new NodeTypeImpl(this, getValueFactory(),
-                        new NodeUtil(type, getCoreValueFactory(), getNameMapper())));
+                        new NodeUtil(type, getNameMapper())));
 
             }
         }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ReadWriteNodeTypeManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ReadWriteNodeTypeManager.java?rev=1396841&r1=1396840&r2=1396841&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ReadWriteNodeTypeManager.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ReadWriteNodeTypeManager.java
Wed Oct 10 22:42:06 2012
@@ -231,7 +231,7 @@ public abstract class ReadWriteNodeTypeM
         }
         type = types.addChild(oakName);
 
-        NodeUtil node = new NodeUtil(type, getCoreValueFactory(), getNameMapper());
+        NodeUtil node = new NodeUtil(type, getNameMapper());
         node.setName(JCR_PRIMARYTYPE, NT_NODETYPE);
         node.setName(JCR_NODETYPENAME, jcrName);
         node.setNames(JCR_SUPERTYPES, ntd.getDeclaredSupertypeNames());

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/token/TokenProviderImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/token/TokenProviderImpl.java?rev=1396841&r1=1396840&r2=1396841&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/token/TokenProviderImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/token/TokenProviderImpl.java
Wed Oct 10 22:42:06 2012
@@ -127,11 +127,10 @@ public class TokenProviderImpl implement
         SimpleCredentials sc = extractSimpleCredentials(credentials);
         if (sc != null) {
             String userId = sc.getUserID();
-            CoreValueFactory valueFactory = root.getValueFactory();
             try {
                 Tree userTree = userProvider.getAuthorizable(userId, AuthorizableType.USER);
                 if (userTree != null) {
-                    NodeUtil userNode = new NodeUtil(userTree, valueFactory);
+                    NodeUtil userNode = new NodeUtil(userTree);
                     NodeUtil tokenParent = userNode.getChild(TOKENS_NODE_NAME);
                     if (tokenParent == null) {
                         tokenParent = userNode.addChild(TOKENS_NODE_NAME, TOKENS_NT_NAME);
@@ -189,7 +188,7 @@ public class TokenProviderImpl implement
         if (tokenTree == null || userId == null) {
             return null;
         } else {
-            return new TokenInfoImpl(new NodeUtil(tokenTree, root.getValueFactory()), token,
userId);
+            return new TokenInfoImpl(new NodeUtil(tokenTree), token, userId);
         }
     }
 
@@ -213,7 +212,7 @@ public class TokenProviderImpl implement
     public boolean resetTokenExpiration(TokenInfo tokenInfo, long loginTime) {
         Tree tokenTree = getTokenTree(tokenInfo);
         if (tokenTree != null) {
-            NodeUtil tokenNode = new NodeUtil(tokenTree, root.getValueFactory());
+            NodeUtil tokenNode = new NodeUtil(tokenTree);
             long expTime = tokenNode.getLong(TOKEN_ATTRIBUTE_EXPIRY, 0);
             if (expTime - loginTime <= tokenExpiration/2) {
                 long expirationTime = loginTime + tokenExpiration;

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeRegistry.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeRegistry.java?rev=1396841&r1=1396840&r2=1396841&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeRegistry.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeRegistry.java
Wed Oct 10 22:42:06 2012
@@ -129,7 +129,7 @@ public class PrivilegeRegistry implement
                 throw new RepositoryException("Repository doesn't contain node " + PRIVILEGES_PATH);
             }
 
-            NodeUtil privilegesNode = new NodeUtil(privilegesTree, latestRoot.getValueFactory());
+            NodeUtil privilegesNode = new NodeUtil(privilegesTree);
             writeDefinition(privilegesNode, toRegister);
 
             // delegate validation to the commit validation (see above)

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/MembershipProviderImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/MembershipProviderImpl.java?rev=1396841&r1=1396840&r2=1396841&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/MembershipProviderImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/MembershipProviderImpl.java
Wed Oct 10 22:42:06 2012
@@ -203,7 +203,7 @@ public class MembershipProviderImpl exte
     @Override
     public boolean addMember(Tree groupTree, Tree newMemberTree) {
         if (useMemberNode(groupTree)) {
-            NodeUtil groupNode = new NodeUtil(groupTree, valueFactory);
+            NodeUtil groupNode = new NodeUtil(groupTree);
             NodeUtil membersNode = groupNode.getOrAddChild(REP_MEMBERS, NT_REP_MEMBERS);
             // TODO: add implementation
             throw new UnsupportedOperationException("not implemented: addMember with member-node
hierarchy");

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserProviderImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserProviderImpl.java?rev=1396841&r1=1396840&r2=1396841&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserProviderImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserProviderImpl.java
Wed Oct 10 22:42:06 2012
@@ -263,7 +263,7 @@ class UserProviderImpl extends Authoriza
     public String getPasswordHash(Tree userTree) {
         checkNotNull(userTree);
 
-        NodeUtil n = new NodeUtil(userTree, valueFactory);
+        NodeUtil n = new NodeUtil(userTree);
         return n.getString(UserConstants.REP_PASSWORD, null);
     }
 
@@ -348,7 +348,7 @@ class UserProviderImpl extends Authoriza
         if (values == null) {
             authorizableTree.removeProperty(propertyName);
         } else {
-            NodeUtil node = new NodeUtil(authorizableTree, valueFactory);
+            NodeUtil node = new NodeUtil(authorizableTree);
             node.setValues(propertyName, values, propertyType);
         }
     }
@@ -388,12 +388,12 @@ class UserProviderImpl extends Authoriza
         NodeUtil folder;
         Tree authTree = root.getTree(authRoot);
         if (authTree == null) {
-            folder = new NodeUtil(root.getTree("/"), valueFactory);
+            folder = new NodeUtil(root.getTree("/"));
             for (String name : Text.explode(authRoot, '/', false)) {
                 folder = folder.getOrAddChild(name, NT_REP_AUTHORIZABLE_FOLDER);
             }
         }  else {
-            folder = new NodeUtil(authTree, valueFactory);
+            folder = new NodeUtil(authTree);
         }
 
         // verification of hierarchy and node types is delegated to UserValidator upon commit

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/util/NodeUtil.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/util/NodeUtil.java?rev=1396841&r1=1396840&r2=1396841&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/util/NodeUtil.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/util/NodeUtil.java
Wed Oct 10 22:42:06 2012
@@ -30,13 +30,11 @@ import javax.jcr.ValueFactory;
 import com.google.common.collect.Iterables;
 import com.google.common.collect.Lists;
 import org.apache.jackrabbit.JcrConstants;
-import org.apache.jackrabbit.oak.api.CoreValueFactory;
 import org.apache.jackrabbit.oak.api.PropertyState;
 import org.apache.jackrabbit.oak.api.Tree;
 import org.apache.jackrabbit.oak.api.Type;
 import org.apache.jackrabbit.oak.namepath.NameMapper;
 import org.apache.jackrabbit.oak.namepath.NamePathMapper;
-import org.apache.jackrabbit.oak.plugins.memory.MemoryValueFactory;
 import org.apache.jackrabbit.oak.plugins.memory.PropertyStates;
 import org.apache.jackrabbit.util.ISO8601;
 import org.slf4j.Logger;
@@ -57,24 +55,17 @@ public class NodeUtil {
 
     private static final Logger log = LoggerFactory.getLogger(NodeUtil.class);
 
-    private final CoreValueFactory factory;
-
     private final NameMapper mapper;
 
     private final Tree tree;
 
-    public NodeUtil(Tree tree, CoreValueFactory factory, NameMapper mapper) {
-        this.factory = factory;
+    public NodeUtil(Tree tree, NameMapper mapper) {
         this.mapper = mapper;
         this.tree = tree;
     }
 
-    public NodeUtil(Tree tree, CoreValueFactory factory) {
-        this(tree, factory, NamePathMapper.DEFAULT);
-    }
-
     public NodeUtil(Tree tree) {
-        this(tree, MemoryValueFactory.INSTANCE);
+        this(tree, NamePathMapper.DEFAULT);
     }
 
     @Nonnull
@@ -88,7 +79,7 @@ public class NodeUtil {
     }
 
     public NodeUtil getParent() {
-        return new NodeUtil(tree.getParent(), factory, mapper);
+        return new NodeUtil(tree.getParent(), mapper);
     }
 
     public boolean hasChild(String name) {
@@ -98,13 +89,13 @@ public class NodeUtil {
     @CheckForNull
     public NodeUtil getChild(String name) {
         Tree child = tree.getChild(name);
-        return (child == null) ? null : new NodeUtil(child, factory, mapper);
+        return (child == null) ? null : new NodeUtil(child, mapper);
     }
 
     @Nonnull
     public NodeUtil addChild(String name, String primaryNodeTypeName) {
         Tree child = tree.addChild(name);
-        NodeUtil childUtil = new NodeUtil(child, factory, mapper);
+        NodeUtil childUtil = new NodeUtil(child, mapper);
         childUtil.setName(JcrConstants.JCR_PRIMARYTYPE, primaryNodeTypeName);
         return childUtil;
     }
@@ -214,7 +205,7 @@ public class NodeUtil {
         List<NodeUtil> nodes = Lists.newArrayList();
         for (Tree child : tree.getChildren()) {
             if (child.getName().startsWith(namePrefix)) {
-                nodes.add(new NodeUtil(child, factory, mapper));
+                nodes.add(new NodeUtil(child, mapper));
             }
         }
         return nodes;

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/AbstractCoreTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/AbstractCoreTest.java?rev=1396841&r1=1396840&r2=1396841&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/AbstractCoreTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/AbstractCoreTest.java
Wed Oct 10 22:42:06 2012
@@ -20,7 +20,6 @@ import javax.security.auth.Subject;
 
 import org.apache.jackrabbit.mk.api.MicroKernel;
 import org.apache.jackrabbit.mk.core.MicroKernelImpl;
-import org.apache.jackrabbit.oak.api.CoreValueFactory;
 import org.apache.jackrabbit.oak.kernel.KernelNodeStore;
 import org.apache.jackrabbit.oak.security.authorization.AccessControlProviderImpl;
 import org.apache.jackrabbit.oak.spi.query.CompositeQueryIndexProvider;
@@ -41,7 +40,6 @@ public abstract class AbstractCoreTest {
 
     // TODO: use regular oak-repo setup
     protected KernelNodeStore store;
-    protected CoreValueFactory valueFactory;
 
     protected NodeState state;
 
@@ -49,7 +47,6 @@ public abstract class AbstractCoreTest {
     public void setUp() {
         MicroKernel microKernel = new MicroKernelImpl();
         store = new KernelNodeStore(microKernel);
-        valueFactory = store.getValueFactory();
         state = createInitialState(microKernel);
     }
 

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=1396841&r1=1396840&r2=1396841&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 Oct 10 22:42:06 2012
@@ -34,13 +34,11 @@ import javax.jcr.version.VersionManager;
 
 import org.apache.jackrabbit.api.JackrabbitWorkspace;
 import org.apache.jackrabbit.api.security.authorization.PrivilegeManager;
-import org.apache.jackrabbit.oak.api.CoreValueFactory;
 import org.apache.jackrabbit.oak.api.Root;
 import org.apache.jackrabbit.oak.api.Tree;
 import org.apache.jackrabbit.oak.commons.PathUtils;
 import org.apache.jackrabbit.oak.jcr.lock.LockManagerImpl;
 import org.apache.jackrabbit.oak.jcr.query.QueryManagerImpl;
-import org.apache.jackrabbit.oak.jcr.security.privilege.PrivilegeManagerImpl;
 import org.apache.jackrabbit.oak.jcr.version.VersionManagerImpl;
 import org.apache.jackrabbit.oak.namepath.NameMapper;
 import org.apache.jackrabbit.oak.plugins.name.ReadWriteNamespaceRegistry;
@@ -188,12 +186,6 @@ public class WorkspaceImpl implements Ja
                 return sessionDelegate.getContentSession().getLatestRoot();
             }
 
-            @Nonnull
-            @Override
-            protected CoreValueFactory getCoreValueFactory() {
-                return sessionDelegate.getContentSession().getCoreValueFactory();
-            }
-
             @Override
             protected ValueFactory getValueFactory() {
                 return sessionDelegate.getValueFactory();



Mime
View raw message