jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r793072 - in /jackrabbit/trunk/jackrabbit-core/src: main/java/org/apache/jackrabbit/core/id/ main/java/org/apache/jackrabbit/core/version/ main/java/org/apache/jackrabbit/core/virtual/ main/java/org/apache/jackrabbit/core/xml/ test/java/org...
Date Fri, 10 Jul 2009 18:40:07 GMT
Author: jukka
Date: Fri Jul 10 18:40:06 2009
New Revision: 793072

URL: http://svn.apache.org/viewvc?rev=793072&view=rev
Log:
JCR-1232: Merge UUID to NodeId

Removed the public NodeId(UUID) constructor.

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/id/NodeId.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/AbstractVersionManager.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionHistoryImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/NodeStateEx.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/virtual/AbstractVISProvider.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/CachingHierarchyManagerTest.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/AccessManagerTest.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/state/AbstractISMLockingTest.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/state/ChangeLogTest.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/version/VersionIteratorImplTest.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/id/NodeId.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/id/NodeId.java?rev=793072&r1=793071&r2=793072&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/id/NodeId.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/id/NodeId.java
Fri Jul 10 18:40:06 2009
@@ -30,18 +30,16 @@
     private static final long serialVersionUID = 7348217305215708805L;
 
     /**
-     * Creates a node identifier instance for the identified node.
-     *
-     * @param uuid node UUID
+     * Creates a new randomly generated node identifier.
      */
-    public NodeId(UUID uuid) {
-        super(uuid.getMostSignificantBits(), uuid.getLeastSignificantBits());
-    }
-
     public NodeId() {
         this(UUID.randomUUID());
     }
 
+    private NodeId(UUID uuid) {
+        super(uuid.getMostSignificantBits(), uuid.getLeastSignificantBits());
+    }
+
     /**
      * Creates a node identifier from the given UUID string.
      *

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/AbstractVersionManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/AbstractVersionManager.java?rev=793072&r1=793071&r2=793072&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/AbstractVersionManager.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/AbstractVersionManager.java
Fri Jul 10 18:40:06 2009
@@ -417,7 +417,7 @@
         WriteOperation operation = startWriteOperation();
         try {
             // create deep path
-            NodeId activityId = new NodeId(UUID.randomUUID());
+            NodeId activityId = new NodeId();
             NodeStateEx parent = getParentNode(activitiesRoot, activityId.toString(), NameConstants.REP_ACTIVITIES);
             Name name = getName(activityId.toString());
 

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionHistoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionHistoryImpl.java?rev=793072&r1=793071&r2=793072&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionHistoryImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionHistoryImpl.java
Fri Jul 10 18:40:06 2009
@@ -522,7 +522,7 @@
             predecessors = new InternalValue[]{InternalValue.create(last)};
         }
 
-        NodeId versionId = new NodeId(UUID.randomUUID());
+        NodeId versionId = new NodeId();
         NodeStateEx vNode = node.addNode(name, NameConstants.NT_VERSION, versionId, true);
 
         // check for jcr:activity
@@ -572,7 +572,7 @@
             NodeState nodeState, NodeId copiedFrom) throws RepositoryException {
 
         // create history node
-        NodeId historyId = new NodeId(UUID.randomUUID());
+        NodeId historyId = new NodeId();
         NodeStateEx pNode = parent.addNode(name, NameConstants.NT_VERSIONHISTORY, historyId,
true);
 
         // set the versionable uuid
@@ -588,7 +588,7 @@
         }
         
         // create root version
-        NodeId versionId = new NodeId(UUID.randomUUID());
+        NodeId versionId = new NodeId();
         NodeStateEx vNode = pNode.addNode(NameConstants.JCR_ROOTVERSION, NameConstants.NT_VERSION,
versionId, true);
 
         // initialize 'created' and 'predecessors'

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/NodeStateEx.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/NodeStateEx.java?rev=793072&r1=793071&r2=793072&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/NodeStateEx.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/NodeStateEx.java
Fri Jul 10 18:40:06 2009
@@ -461,7 +461,7 @@
         NodeId parentId = nodeState.getNodeId();
         // create a new node state
         if (id == null) {
-            id = new NodeId(UUID.randomUUID());
+            id = new NodeId();
         }
         NodeState state = stateMgr.createNew(id, nodeTypeName, parentId);
 

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/virtual/AbstractVISProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/virtual/AbstractVISProvider.java?rev=793072&r1=793071&r2=793072&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/virtual/AbstractVISProvider.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/virtual/AbstractVISProvider.java
Fri Jul 10 18:40:06 2009
@@ -288,7 +288,7 @@
         // create a new node state
         VirtualNodeState state;
         if (id == null) {
-            id = new NodeId(UUID.randomUUID());
+            id = new NodeId();
         }
         state = new VirtualNodeState(this, parent.getNodeId(), id, nodeTypeName, new Name[0]);
         state.setDefinitionId(def);

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=793072&r1=793071&r2=793072&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
Fri Jul 10 18:40:06 2009
@@ -289,7 +289,7 @@
                 Value[] newVals = new Value[values.length];
                 for (int i = 0; i < values.length; i++) {
                     Value val = values[i];
-                    NodeId original = new NodeId(UUID.fromString(val.getString()));
+                    NodeId original = new NodeId(val.getString());
                     NodeId adjusted = refTracker.getMappedId(original);
                     if (adjusted != null) {
                         newVals[i] = session.getValueFactory().createValue(
@@ -303,7 +303,7 @@
                 prop.setValue(newVals);
             } else {
                 Value val = prop.getValue();
-                NodeId original = new NodeId(UUID.fromString(val.getString()));
+                NodeId original = new NodeId(val.getString());
                 NodeId adjusted = refTracker.getMappedId(original);
                 if (adjusted != null) {
                     prop.setValue(session.getNodeById(adjusted).getUUID());

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/CachingHierarchyManagerTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/CachingHierarchyManagerTest.java?rev=793072&r1=793071&r2=793072&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/CachingHierarchyManagerTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/CachingHierarchyManagerTest.java
Fri Jul 10 18:40:06 2009
@@ -342,7 +342,7 @@
          * Create a new instance of this class.
          */
         public StaticItemStateManager() {
-            rootNodeId = new NodeId(nextUUID());
+            rootNodeId = nextNodeId();
         }
 
         /**
@@ -387,7 +387,7 @@
          * @return new node
          */
         public NodeState addNode(NodeState parent, String name) {
-            NodeId id = new NodeId(nextUUID());
+            NodeId id = nextNodeId();
             NodeState child = new NodeState(id, NameConstants.NT_UNSTRUCTURED,
                     parent.getNodeId(), NodeState.STATUS_EXISTING, false);
             if (listener != null) {
@@ -519,13 +519,13 @@
         }
 
         /**
-         * Return the next available UUID. Simply increments the last UUID
+         * Return the next available node id. Simply increments the last UUID
          * returned by <code>1</code>.
          *
          * @return next UUID
          */
-        private UUID nextUUID() {
-            return new UUID(0, lsbGenerator++);
+        private NodeId nextNodeId() {
+            return new NodeId(0, lsbGenerator++);
         }
 
         //----------------------------------------------------- ItemStateManager

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/AccessManagerTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/AccessManagerTest.java?rev=793072&r1=793071&r2=793072&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/AccessManagerTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/AccessManagerTest.java
Fri Jul 10 18:40:06 2009
@@ -115,7 +115,7 @@
 
     public void testCheckPermissionWithUnknowId() throws RepositoryException, NotExecutableException
{
         Session s = getHelper().getReadOnlySession();
-        NodeId id = new NodeId(UUID.randomUUID());
+        NodeId id = new NodeId();
         try {
             AccessManager acMgr = getAccessManager(s);
             acMgr.checkPermission(id, AccessManager.READ);

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/state/AbstractISMLockingTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/state/AbstractISMLockingTest.java?rev=793072&r1=793071&r2=793072&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/state/AbstractISMLockingTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/state/AbstractISMLockingTest.java
Fri Jul 10 18:40:06 2009
@@ -58,7 +58,7 @@
     protected void setUp() throws Exception {
         super.setUp();
         locking = createISMLocking();
-        NodeId id = new NodeId(UUID.randomUUID());
+        NodeId id = new NodeId();
         state = new NodeState(id, NameConstants.NT_BASE, null, ItemState.STATUS_EXISTING,
true);
         refs = new NodeReferences(new NodeReferencesId(state.getNodeId()));
         logs = new ArrayList();

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/state/ChangeLogTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/state/ChangeLogTest.java?rev=793072&r1=793071&r2=793072&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/state/ChangeLogTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/state/ChangeLogTest.java
Fri Jul 10 18:40:06 2009
@@ -43,8 +43,7 @@
      * entry in either the added nor the removed states
      */
     public void testAddDelete() throws Exception {
-        PropertyId id = new PropertyId(
-                new NodeId(UUID.randomUUID()), factory.create("", "a"));
+        PropertyId id = new PropertyId(new NodeId(), factory.create("", "a"));
         ItemState state = new PropertyState(id, ItemState.STATUS_NEW, false);
 
         ChangeLog log = new ChangeLog();
@@ -63,8 +62,7 @@
      * in the added states.
      */
     public void testAddModify() throws Exception {
-        PropertyId id = new PropertyId(
-                new NodeId(UUID.randomUUID()), factory.create("", "a"));
+        PropertyId id = new PropertyId(new NodeId(), factory.create("", "a"));
         ItemState state = new PropertyState(id, ItemState.STATUS_NEW, false);
 
         ChangeLog log = new ChangeLog();
@@ -85,8 +83,7 @@
     public void testPreserveOrder() throws Exception {
         ItemState[] states = new ItemState[10];
         for (int i = 0; i < states.length; i++) {
-            PropertyId id = new PropertyId(
-                    new NodeId(UUID.randomUUID()), factory.create("", "a" + i));
+            PropertyId id = new PropertyId(new NodeId(), factory.create("", "a" + i));
             states[i] = new PropertyState(id, ItemState.STATUS_NEW, false);
         }
 

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/version/VersionIteratorImplTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/version/VersionIteratorImplTest.java?rev=793072&r1=793071&r2=793072&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/version/VersionIteratorImplTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/version/VersionIteratorImplTest.java
Fri Jul 10 18:40:06 2009
@@ -63,9 +63,9 @@
 
     public void testVersionIterator() throws Exception {
 
-        InternalVersion version = new DummyInternalVersion(new InternalVersion[] {}, new
NodeId(UUID.randomUUID()));
+        InternalVersion version = new DummyInternalVersion(new InternalVersion[] {}, new
NodeId());
         for (int i = 1; i < VERSION_COUNT; i++) {
-            version = new DummyInternalVersion(new InternalVersion[] {version}, new NodeId(UUID.randomUUID()));
+            version = new DummyInternalVersion(new InternalVersion[] {version}, new NodeId());
         }
 
         try {



Mime
View raw message