[dna-commits] DNA SVN: r1059 - in trunk: dna-graph/src/main/java/org/jboss/dna/graph/connector/inmemory and 4 other directories.

dna-commits at lists.jboss.org dna-commits at lists.jboss.org
Mon Jun 22 12:50:22 EDT 2009


Author: rhauch
Date: 2009-06-22 12:50:22 -0400 (Mon, 22 Jun 2009)
New Revision: 1059

Modified:
   trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/UuidAlreadyExistsException.java
   trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/inmemory/InMemoryRepository.java
   trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/AbstractJcrNode.java
   trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrNode.java
   trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrRootNode.java
   trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrWorkspace.java
   trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/AbstractJcrNodeTest.java
   trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrRepositoryTest.java
   trunk/extensions/dna-connector-jbosscache/src/main/java/org/jboss/dna/connector/jbosscache/JBossCacheRequestProcessor.java
   trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/basic/BasicRequestProcessor.java
Log:
DNA-370 JcrWorkspace.clone Is Not Implemented

Corrected compilation warnings and errors.  The errors were due primarily to JDK 6 methods being used.

Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/UuidAlreadyExistsException.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/UuidAlreadyExistsException.java	2009-06-21 00:45:14 UTC (rev 1058)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/UuidAlreadyExistsException.java	2009-06-22 16:50:22 UTC (rev 1059)
@@ -1,3 +1,26 @@
+/*
+ * JBoss DNA (http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.  Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of 
+ * individual contributors. 
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
 package org.jboss.dna.graph.connector;
 
 import java.util.UUID;

Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/inmemory/InMemoryRepository.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/inmemory/InMemoryRepository.java	2009-06-21 00:45:14 UTC (rev 1058)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/inmemory/InMemoryRepository.java	2009-06-22 16:50:22 UTC (rev 1059)
@@ -466,6 +466,7 @@
             UUID uuidForCopy = reuseUuids ? original.getUuid() : UUID.randomUUID();
             InMemoryNode copy = newWorkspace.createNode(context, newParent, childName, uuidForCopy);
             if (!reuseUuids) {
+                assert oldToNewUuids != null;
                 oldToNewUuids.put(original.getUuid(), copy.getUuid());
             }
 
@@ -480,6 +481,7 @@
             }
 
             if (!reuseUuids) {
+                assert oldToNewUuids != null;
                 // Now, adjust any references in the new subgraph to objects in the original subgraph
                 // (because they were internal references, and need to be internal to the new subgraph)
                 PropertyFactory propertyFactory = context.getPropertyFactory();

Modified: trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/AbstractJcrNode.java
===================================================================
--- trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/AbstractJcrNode.java	2009-06-21 00:45:14 UTC (rev 1058)
+++ trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/AbstractJcrNode.java	2009-06-22 16:50:22 UTC (rev 1059)
@@ -717,7 +717,8 @@
                 JcrNodeDefinition match = this.cache.nodeTypes().findChildNodeDefinition(mixinCandidateType.getInternalName(),
                                                                                          Collections.<Name>emptyList(),
                                                                                          nodeName,
-                                                                                         childNode.getPrimaryNodeType().getInternalName(),
+                                                                                         childNode.getPrimaryNodeType()
+                                                                                                  .getInternalName(),
                                                                                          snsCount,
                                                                                          false);
 
@@ -1356,9 +1357,13 @@
     }
 
     /**
-     * {@inheritDoc}
+     * Obtain the corresponding node path from the supplied workspace name.
      * 
-     * @see javax.jcr.Node#getCorrespondingNodePath(java.lang.String)
+     * @param workspaceName
+     * @return the path of the corresponding node in the supplied workspace
+     * @throws NoSuchWorkspaceException if the workspace does not exist
+     * @throws ItemNotFoundException if there is no corresponding node in the supplied workspace
+     * @throws RepositoryException if there is another problem
      */
     final Path correspondingNodePathFrom( String workspaceName )
         throws NoSuchWorkspaceException, ItemNotFoundException, RepositoryException {

Modified: trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrNode.java
===================================================================
--- trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrNode.java	2009-06-21 00:45:14 UTC (rev 1058)
+++ trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrNode.java	2009-06-22 16:50:22 UTC (rev 1059)
@@ -72,6 +72,7 @@
      * 
      * @see javax.jcr.Item#getParent()
      */
+    @Override
     public AbstractJcrNode getParent() throws ItemNotFoundException, RepositoryException {
         return cache.findJcrNode(nodeInfo().getParent());
     }

Modified: trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrRootNode.java
===================================================================
--- trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrRootNode.java	2009-06-21 00:45:14 UTC (rev 1058)
+++ trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrRootNode.java	2009-06-22 16:50:22 UTC (rev 1059)
@@ -88,6 +88,7 @@
      * @throws ItemNotFoundException always
      * @see javax.jcr.Item#getParent()
      */
+    @Override
     public AbstractJcrNode getParent() throws ItemNotFoundException {
         throw new ItemNotFoundException(JcrI18n.rootNodeHasNoParent.text());
     }

Modified: trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrWorkspace.java
===================================================================
--- trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrWorkspace.java	2009-06-21 00:45:14 UTC (rev 1058)
+++ trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrWorkspace.java	2009-06-22 16:50:22 UTC (rev 1059)
@@ -355,10 +355,10 @@
 
             Set<UUID> sourceUuids = new HashSet<UUID>();
             LinkedList<SubgraphNode> nodesToVisit = new LinkedList<SubgraphNode>();
-            nodesToVisit.push(sourceTree.getRoot());
+            nodesToVisit.addFirst(sourceTree.getRoot());
 
             while (!nodesToVisit.isEmpty()) {
-                SubgraphNode node = nodesToVisit.pop();
+                SubgraphNode node = nodesToVisit.removeFirst();
 
                 UUID uuid = uuidFactory.create(node.getProperty(DnaLexicon.UUID).getFirstValue().toString());
                 if (uuid != null) {

Modified: trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/AbstractJcrNodeTest.java
===================================================================
--- trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/AbstractJcrNodeTest.java	2009-06-21 00:45:14 UTC (rev 1058)
+++ trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/AbstractJcrNodeTest.java	2009-06-22 16:50:22 UTC (rev 1059)
@@ -87,6 +87,7 @@
             return cache.getPathFor(nodeInfo()).getLastSegment().getString(namespaces());
         }
 
+        @Override
         public AbstractJcrNode getParent() throws RepositoryException {
             return cache.findJcrNode(nodeInfo().getParent());
         }

Modified: trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrRepositoryTest.java
===================================================================
--- trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrRepositoryTest.java	2009-06-21 00:45:14 UTC (rev 1058)
+++ trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrRepositoryTest.java	2009-06-22 16:50:22 UTC (rev 1059)
@@ -184,7 +184,6 @@
         repository.login();
     }
 
-    @SuppressWarnings("cast")
     @Test
     public void shouldAllowLoginWithNoCredentialsInPrivilegedBlock() throws Exception {
         LoginContext login = new LoginContext("dna-jcr", new UserPasswordCallbackHandler("superuser", "superuser".toCharArray()));

Modified: trunk/extensions/dna-connector-jbosscache/src/main/java/org/jboss/dna/connector/jbosscache/JBossCacheRequestProcessor.java
===================================================================
--- trunk/extensions/dna-connector-jbosscache/src/main/java/org/jboss/dna/connector/jbosscache/JBossCacheRequestProcessor.java	2009-06-21 00:45:14 UTC (rev 1058)
+++ trunk/extensions/dna-connector-jbosscache/src/main/java/org/jboss/dna/connector/jbosscache/JBossCacheRequestProcessor.java	2009-06-22 16:50:22 UTC (rev 1059)
@@ -250,7 +250,7 @@
             nodesToVisit.add(node);
 
             while (!nodesToVisit.isEmpty()) {
-                Node<Name, Object> nodeToCheck = nodesToVisit.pop();
+                Node<Name, Object> nodeToCheck = nodesToVisit.removeFirst();
                 UUID uuid = uuidFactory.create(nodeToCheck.get(DnaLexicon.UUID));
                 if (uuid != null) uuidsFromSource.add(uuid);
 
@@ -688,8 +688,7 @@
      * @param desiredName the desired name of the node in the new location
      * @param beforeNodeName the node before which the new node should be placed
      * @param recursive if this is a deep copy
-     * @param reuseOriginalUuids indicates whether the original UUIDs should be used for the copies or new UUIDs should be used
-     * @param uuidForCopyOfOriginal pre-determined UUID for copy of node; ignored if reuseOriginalUuids is true
+     * @param uuidConflictBehavior indicates whether the original UUIDs should be used for the copies or new UUIDs should be used
      * @param count the count of nodes affected by the operation
      * @param context the execution context that provides the path factory to be used to create the new path name
      * @return the path segment that identifies the new node under its new parent
@@ -707,7 +706,8 @@
         assert original != null;
         assert newParent != null;
         // Get or create the new node ...
-        Path.Segment name = desiredName != null ? context.getValueFactories().getPathFactory().createSegment(desiredName) : (Path.Segment)original.getFqn().getLastElement();
+        Path.Segment name = desiredName != null ? context.getValueFactories().getPathFactory().createSegment(desiredName) : (Path.Segment)original.getFqn()
+                                                                                                                                                  .getLastElement();
 
         // Update the children to account for same-name siblings.
         // This not only updates the FQN of the child nodes, but it also sets the property that stores the
@@ -923,8 +923,9 @@
                     // don't copy ...
                 } else {
                     // Append an updated segment ...
-                    Path.Segment newSegment = context.getValueFactories().getPathFactory().createSegment(childName.getName(),
-                                                                                                         childName.getIndex() - 1);
+                    Path.Segment newSegment = context.getValueFactories()
+                                                     .getPathFactory()
+                                                     .createSegment(childName.getName(), childName.getIndex() - 1);
                     newChildNames[index] = newSegment;
                     // Replace the child with the correct FQN ...
                     changeNodeName(cache, parent, childName, newSegment, context);

Modified: trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/basic/BasicRequestProcessor.java
===================================================================
--- trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/basic/BasicRequestProcessor.java	2009-06-21 00:45:14 UTC (rev 1058)
+++ trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/basic/BasicRequestProcessor.java	2009-06-22 16:50:22 UTC (rev 1059)
@@ -2094,7 +2094,7 @@
     /**
      * Attempt to resolve the reference.
      * 
-     * @param workspaceId the ID of the workspace in which the reference occurs; may not be null
+     * @param workspace the workspace in which the reference occurs; may not be null
      * @param reference the reference
      * @return the UUID of the node to which the reference points, or null if the reference could not be resolved
      */
@@ -2135,7 +2135,7 @@
      * This method will also find the path when the location contains just the UUID.
      * </p>
      * 
-     * @param workspaceId the ID of the workspace; may not be null
+     * @param workspace the workspace; may not be null
      * @param original the original location; may not be null
      * @return the actual location, which includes the verified location and additional information needed by this method that may
      *         be usable after this method is called




More information about the dna-commits mailing list