Author: rhauch
Date: 2009-11-25 15:18:20 -0500 (Wed, 25 Nov 2009)
New Revision: 1351
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/Graph.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/GraphI18n.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/Location.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/LocationWithPath.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/LocationWithPathAndProperties.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/LocationWithPathAndProperty.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/LocationWithPathAndUuid.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/LocationWithProperties.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/LocationWithProperty.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/LocationWithUuid.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/federation/ProjectedNode.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/observe/NetChangeObserver.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/process/MergeJoinComponent.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/BatchRequestBuilder.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/CloneBranchRequest.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/CopyBranchRequest.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/CreateNodeRequest.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/DeleteBranchRequest.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/DeleteChildrenRequest.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/LockBranchRequest.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/MoveBranchRequest.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/ReadAllChildrenRequest.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/ReadAllPropertiesRequest.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/ReadBlockOfChildrenRequest.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/ReadBranchRequest.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/ReadNextBlockOfChildrenRequest.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/ReadNodeRequest.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/ReadPropertyRequest.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/RemovePropertyRequest.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/RenameNodeRequest.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/SetPropertyRequest.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/UnlockBranchRequest.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/UpdatePropertiesRequest.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/UpdateValuesRequest.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/VerifyNodeExistsRequest.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/processor/RequestProcessor.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/session/GraphSession.java
trunk/dna-graph/src/main/resources/org/jboss/dna/graph/GraphI18n.properties
trunk/dna-graph/src/test/java/org/jboss/dna/graph/LocationTest.java
trunk/dna-graph/src/test/java/org/jboss/dna/graph/connector/test/AbstractConnectorTest.java
trunk/dna-graph/src/test/java/org/jboss/dna/graph/connector/test/ReadableConnectorTest.java
trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/AbstractJcrNode.java
Log:
DNA-551 graph.Location's equals(Object) and hashCode() Methods Are Not Consistent
Applied the second version of the patch ('DNA-551-patch2.txt'), after all unit and
integration tests passed. Basically, the Location.equals(...) and Location.isSame(...)
method behaviors were switched, and the various uses corrected. Now, the
Location.equals(...) and Location.hashCode() methods behave in the traditional way, and
can be used as keys in Maps (even when you might have partial Location objects and the Map
might contain actual Location objects, or vice versa). For more detail, see DNA-551.
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/Graph.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/Graph.java 2009-11-25 18:15:33 UTC
(rev 1350)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/Graph.java 2009-11-25 20:18:20 UTC
(rev 1351)
@@ -6323,7 +6323,7 @@
public boolean equals( Object obj ) {
if (obj instanceof Node) {
Node that = (Node)obj;
- return this.getLocation().equals(that.getLocation());
+ return this.getLocation().isSame(that.getLocation());
}
return false;
}
@@ -6591,7 +6591,7 @@
public boolean equals( Object obj ) {
if (obj instanceof Node) {
Node that = (Node)obj;
- return this.location.equals(that.getLocation());
+ return this.location.isSame(that.getLocation());
}
return false;
}
@@ -6799,7 +6799,7 @@
public boolean equals( Object obj ) {
if (obj instanceof Node) {
Node that = (Node)obj;
- return this.location.equals(that.getLocation());
+ return this.location.isSame(that.getLocation());
}
return false;
}
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/GraphI18n.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/GraphI18n.java 2009-11-25 18:15:33
UTC (rev 1350)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/GraphI18n.java 2009-11-25 20:18:20
UTC (rev 1351)
@@ -73,7 +73,7 @@
public static I18n unableToCreateReferenceToNodeWithoutUuid;
public static I18n unableToCopyToLocationWithoutAPath;
public static I18n unableToCopyToTheRoot;
- public static I18n actualLocationIsNotSameAsInputLocation;
+ public static I18n actualLocationNotEqualToInputLocation;
public static I18n actualLocationIsNotChildOfInputLocation;
public static I18n actualLocationIsNotAtCorrectChildSegment;
public static I18n actualLocationDoesNotHaveCorrectChildName;
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/Location.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/Location.java 2009-11-25 18:15:33
UTC (rev 1350)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/Location.java 2009-11-25 20:18:20
UTC (rev 1351)
@@ -41,7 +41,8 @@
import org.jboss.dna.graph.property.Property;
/**
- * The location of a node, as specified by either its path, UUID, and/or identification
properties.
+ * The location of a node, as specified by either its path, UUID, and/or identification
properties. Hash codes are not implemented
+ * in this base class to allow immutable subclasses to calculate and cache the hash code
during object construction.
*/
@Immutable
public abstract class Location implements Iterable<Property>,
Comparable<Location> {
@@ -97,7 +98,6 @@
*/
public static Location create( Path path ) {
CheckArg.isNotNull(path, "path");
-
return new LocationWithPath(path);
}
@@ -125,11 +125,8 @@
*/
public static Location create( Path path,
UUID uuid ) {
- if (path == null) {
- CheckArg.isNotNull(uuid, "uuid");
- return new LocationWithUuid(uuid);
- }
- if (uuid == null) return new LocationWithPath(path);
+ if (path == null) return create(uuid);
+ if (uuid == null) return create(path);
return new LocationWithPathAndUuid(path, uuid);
}
@@ -145,6 +142,11 @@
Property idProperty ) {
CheckArg.isNotNull(path, "path");
CheckArg.isNotNull(idProperty, "idProperty");
+ if (DnaLexicon.UUID.equals(idProperty.getName()) &&
idProperty.isSingle()) {
+ Object uuid = idProperty.getFirstValue();
+ assert uuid instanceof UUID;
+ return new LocationWithPathAndUuid(path, (UUID)uuid);
+ }
return new LocationWithPathAndProperty(path, idProperty);
}
@@ -190,14 +192,8 @@
for (Property property : idProperties) {
if (names.add(property.getName())) idPropertiesList.add(property);
}
- switch (idPropertiesList.size()) {
- case 0:
- return new LocationWithPath(path);
- case 1:
- return new LocationWithPathAndProperty(path, idPropertiesList.get(0));
- default:
- return new LocationWithPathAndProperties(path, idPropertiesList);
- }
+ if (idPropertiesList.isEmpty()) return new LocationWithPath(path);
+ return new LocationWithPathAndProperties(path, idPropertiesList);
}
/**
@@ -209,6 +205,11 @@
*/
public static Location create( Property idProperty ) {
CheckArg.isNotNull(idProperty, "idProperty");
+ if (DnaLexicon.UUID.equals(idProperty.getName()) &&
idProperty.isSingle()) {
+ Object uuid = idProperty.getFirstValue();
+ assert uuid instanceof UUID;
+ return new LocationWithUuid((UUID)uuid);
+ }
return new LocationWithProperty(idProperty);
}
@@ -224,7 +225,7 @@
Property... remainingIdProperties ) {
CheckArg.isNotNull(firstIdProperty, "firstIdProperty");
CheckArg.isNotNull(remainingIdProperties, "remainingIdProperties");
- if (remainingIdProperties.length == 0) return new
LocationWithProperty(firstIdProperty);
+ if (remainingIdProperties.length == 0) return create(firstIdProperty);
List<Property> idProperties = new ArrayList<Property>(1 +
remainingIdProperties.length);
Set<Name> names = new HashSet<Name>();
names.add(firstIdProperty.getName());
@@ -249,16 +250,7 @@
for (Property property : idProperties) {
if (names.add(property.getName())) idPropertiesList.add(property);
}
- switch (idPropertiesList.size()) {
- case 0:
- CheckArg.isNotEmpty(idPropertiesList, "idProperties");
- assert false;
- return null; // never get here
- case 1:
- return new LocationWithProperty(idPropertiesList.get(0));
- default:
- return new LocationWithProperties(idPropertiesList);
- }
+ return create(idPropertiesList);
}
/**
@@ -337,79 +329,16 @@
return null;
}
- /**
- * Compare this location to the supplied location, and determine whether the two
locations represent the same logical
- * location. One location is considered the same as another location when one
location is a superset of the other. For
- * example, consider the following locations:
- * <ul>
- * <li>location A is defined with a "<code>/x/y</code>"
path</li>
- * <li>location B is defined with an identification property {id=3}</li>
- * <li>location C is defined with a
"<code>/x/y/z</code>"</li>
- * <li>location D is defined with a "<code>/x/y/z</code>"
path and an identification property {id=3}</li>
- * </ul>
- * Locations C and D would be considered the same, and B and D would also be
considered the same. None of the other
- * combinations would be considered the same.
- * <p>
- * Note that passing a null location as a parameter will always return false.
- * </p>
- *
- * @param other the other location to compare
- * @return true if the two locations represent the same location, or false otherwise
- */
- public boolean isSame( Location other ) {
- return isSame(other, true);
- }
-
- /**
- * Compare this location to the supplied location, and determine whether the two
locations represent the same logical
- * location. One location is considered the same as another location when one
location is a superset of the other. For
- * example, consider the following locations:
- * <ul>
- * <li>location A is defined with a "<code>/x/y</code>"
path</li>
- * <li>location B is defined with an identification property {id=3}</li>
- * <li>location C is defined with a
"<code>/x/y/z</code>"</li>
- * <li>location D is defined with a "<code>/x/y/z</code>"
path and an identification property {id=3}</li>
- * </ul>
- * Locations C and D would be considered the same, and B and D would also be
considered the same. None of the other
- * combinations would be considered the same.
- * <p>
- * Note that passing a null location as a parameter will always return false.
- * </p>
- *
- * @param other the other location to compare
- * @param requireSameNameSiblingIndexes true if the paths must have equivalent {@link
Path.Segment#getIndex()
- * same-name-sibling indexes}, or false if the same-name-siblings may be
different
- * @return true if the two locations represent the same location, or false otherwise
- */
- public boolean isSame( Location other,
- boolean requireSameNameSiblingIndexes ) {
- if (other != null) {
- if (this.hasPath() && other.hasPath()) {
- // Paths on both, so the paths MUST match
- if (requireSameNameSiblingIndexes) {
- if (!this.getPath().equals(other.getPath())) return false;
- } else {
- Path thisPath = this.getPath();
- Path thatPath = other.getPath();
- if (thisPath.isRoot()) return thatPath.isRoot();
- if (thatPath.isRoot()) return thisPath.isRoot();
- // The parents must match ...
- if (!thisPath.hasSameAncestor(thatPath)) return false;
- // And the names of the last segments must match ...
- if
(!thisPath.getLastSegment().getName().equals(thatPath.getLastSegment().getName())) return
false;
- }
-
- // And the identification properties must match only if they exist on
both
- if (this.hasIdProperties() && other.hasIdProperties()) {
- return this.getIdProperties().containsAll(other.getIdProperties());
- }
- return true;
- }
- // Path only in one, so the identification properties MUST match
- if (!other.hasIdProperties()) return false;
- return this.getIdProperties().containsAll(other.getIdProperties());
+ public boolean isSame( Location that ) {
+ if (that == null) return false;
+ if (this.hasPath()) {
+ if (!this.getPath().equals(that.getPath())) return false;
+ } else if (that.hasPath()) return false;
+ if (this.hasIdProperties()) {
+ if (that.hasIdProperties()) return
this.getIdProperties().containsAll(that.getIdProperties());
+ return false;
}
- return false;
+ return (!that.hasIdProperties());
}
/**
@@ -438,20 +367,69 @@
*/
@Override
public boolean equals( Object obj ) {
+ return equals(obj, true);
+ }
+
+ /**
+ * Compare this location to the supplied location, and determine whether the two
locations represent the same logical
+ * location. One location is considered the same as another location when one
location is a superset of the other. For
+ * example, consider the following locations:
+ * <ul>
+ * <li>location A is defined with a "<code>/x/y</code>"
path</li>
+ * <li>location B is defined with an identification property {id=3}</li>
+ * <li>location C is defined with a
"<code>/x/y/z</code>"</li>
+ * <li>location D is defined with a "<code>/x/y/z</code>"
path and an identification property {id=3}</li>
+ * </ul>
+ * Locations C and D would be considered the same, and B and D would also be
considered the same. None of the other
+ * combinations would be considered the same.
+ * <p>
+ * Note that passing a null location as a parameter will always return false.
+ * </p>
+ *
+ * @param obj the other location to compare
+ * @param requireSameNameSiblingIndexes true if the paths must have equivalent {@link
Path.Segment#getIndex()
+ * same-name-sibling indexes}, or false if the same-name-siblings may be
different
+ * @return true if the two locations represent the same location, or false otherwise
+ */
+ public boolean equals( Object obj,
+ boolean requireSameNameSiblingIndexes ) {
+ // if (obj instanceof Location) {
+ // Location that = (Location)obj;
+ // if (this.hasPath()) {
+ // if (!this.getPath().equals(that.getPath())) return false;
+ // } else {
+ // if (that.hasPath()) return false;
+ // }
+ // if (this.hasIdProperties()) {
+ // if (!this.getIdProperties().equals(that.getIdProperties())) return
+ // false;
+ // } else {
+ // if (that.hasIdProperties()) return false;
+ // }
+ // return true;
+ // }
+ // return false;
if (obj instanceof Location) {
Location that = (Location)obj;
- if (this.hasPath()) {
- if (!this.getPath().equals(that.getPath())) return false;
+
+ // if both have same path they are equal
+ if (requireSameNameSiblingIndexes) {
+ if (this.hasPath() && that.hasPath()) return
(this.getPath().equals(that.getPath()));
} else {
- if (that.hasPath()) return false;
+ Path thisPath = this.getPath();
+ Path thatPath = that.getPath();
+ if (thisPath.isRoot()) return thatPath.isRoot();
+ if (thatPath.isRoot()) return thisPath.isRoot();
+ // The parents must match ...
+ if (!thisPath.hasSameAncestor(thatPath)) return false;
+ // And the names of the last segments must match ...
+ if
(!thisPath.getLastSegment().getName().equals(thatPath.getLastSegment().getName())) return
false;
}
- if (this.hasIdProperties()) {
- if (!this.getIdProperties().equals(that.getIdProperties())) return
false;
- } else {
- if (that.hasIdProperties()) return false;
- }
- return true;
+
+ // one or both is/are missing path so check properties instead
+ if (this.hasIdProperties()) return
(this.getIdProperties().equals(that.getIdProperties()));
}
+
return false;
}
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/LocationWithPath.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/LocationWithPath.java 2009-11-25
18:15:33 UTC (rev 1350)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/LocationWithPath.java 2009-11-25
20:18:20 UTC (rev 1351)
@@ -39,7 +39,7 @@
* @see Location
*/
@Immutable
-final class LocationWithPath extends Location {
+class LocationWithPath extends Location {
private final Path path;
private final int hashCode;
@@ -79,7 +79,7 @@
* @see Location#getIdProperties()
*/
@Override
- public final List<Property> getIdProperties() {
+ public List<Property> getIdProperties() {
return null;
}
@@ -89,7 +89,7 @@
* @see Location#hasIdProperties()
*/
@Override
- public final boolean hasIdProperties() {
+ public boolean hasIdProperties() {
return false;
}
@@ -99,7 +99,7 @@
* @see Location#getUuid()
*/
@Override
- public final UUID getUuid() {
+ public UUID getUuid() {
return null;
}
@@ -137,7 +137,7 @@
@Override
public Location with( Property newIdProperty ) {
if (newIdProperty == null || newIdProperty.isEmpty()) return this;
- return Location.create(path, newIdProperty);
+ return create(path, newIdProperty);
}
/**
@@ -148,7 +148,7 @@
@Override
public Location with( Path newPath ) {
if (newPath == null || path.equals(newPath)) return this;
- return Location.create(newPath);
+ return create(newPath);
}
/**
@@ -159,6 +159,6 @@
@Override
public Location with( UUID uuid ) {
if (uuid == null) return this;
- return Location.create(path, uuid);
+ return create(path, uuid);
}
}
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/LocationWithPathAndProperties.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/LocationWithPathAndProperties.java 2009-11-25
18:15:33 UTC (rev 1350)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/LocationWithPathAndProperties.java 2009-11-25
20:18:20 UTC (rev 1351)
@@ -27,8 +27,9 @@
import java.util.Collections;
import java.util.List;
import java.util.UUID;
+
import net.jcip.annotations.Immutable;
-import org.jboss.dna.common.util.HashCode;
+
import org.jboss.dna.graph.property.Path;
import org.jboss.dna.graph.property.Property;
import org.jboss.dna.graph.property.basic.BasicSingleValueProperty;
@@ -40,13 +41,10 @@
* @see Location
*/
@Immutable
-final class LocationWithPathAndProperties extends Location {
+class LocationWithPathAndProperties extends LocationWithPath {
- private final Path path;
private final List<Property> idProperties;
- private final int hashCode;
-
/**
* Create a new location with a given path and set of identification properties.
*
@@ -55,30 +53,15 @@
*/
LocationWithPathAndProperties( Path path,
List<Property> idProperties ) {
- assert path != null;
+ super(path);
assert idProperties != null;
assert !idProperties.isEmpty();
- this.path = path;
this.idProperties = Collections.unmodifiableList(idProperties);
- // Paths are immutable, Properties are immutable, the idProperties list
- // is wrapped in an unmodifiableList by the Location factory methods...
- // ... so we can cache the hash code.
- hashCode = HashCode.compute(path, idProperties);
}
/**
* {@inheritDoc}
*
- * @see Location#getPath()
- */
- @Override
- public final Path getPath() {
- return path;
- }
-
- /**
- * {@inheritDoc}
- *
* @see Location#getIdProperties()
*/
@Override
@@ -87,23 +70,28 @@
}
/**
- * {@inheritDoc}
+ * Get the first UUID that is in one of the {@link #getIdProperties() identification
properties}.
*
- * @see Location#hasIdProperties()
+ * @return the UUID for this location, or null if there is no such identification
property
*/
@Override
- public final boolean hasIdProperties() {
- return idProperties.size() > 0;
+ public UUID getUuid() {
+ Property property = getIdProperty(DnaLexicon.UUID);
+ if (property != null && !property.isEmpty()) {
+ Object value = property.getFirstValue();
+ if (value instanceof UUID) return (UUID)value;
+ }
+ return null;
}
/**
* {@inheritDoc}
*
- * @see Location#hashCode()
+ * @see Location#hasIdProperties()
*/
@Override
- public int hashCode() {
- return hashCode;
+ public boolean hasIdProperties() {
+ return idProperties.size() > 0;
}
/**
@@ -124,9 +112,9 @@
}
newIdProperties.add(newIdProperty);
newIdProperties = Collections.unmodifiableList(newIdProperties);
- return new LocationWithPathAndProperties(path, newIdProperties);
+ return create(getPath(), newIdProperties);
}
- return new LocationWithPathAndProperty(path, newIdProperty);
+ return create(getPath(), newIdProperty);
}
/**
@@ -137,7 +125,7 @@
@Override
public Location with( Path newPath ) {
if (newPath == null || newPath.equals(this.getPath())) return this;
- return new LocationWithPathAndProperties(newPath, idProperties);
+ return create(newPath, idProperties);
}
/**
@@ -157,6 +145,6 @@
List<Property> newIdProperties = new
ArrayList<Property>(idProperties.size() + 1);
newIdProperties.addAll(idProperties);
newIdProperties.add(newProperty);
- return new LocationWithPathAndProperties(path, newIdProperties);
+ return create(getPath(), newIdProperties);
}
}
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/LocationWithPathAndProperty.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/LocationWithPathAndProperty.java 2009-11-25
18:15:33 UTC (rev 1350)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/LocationWithPathAndProperty.java 2009-11-25
20:18:20 UTC (rev 1351)
@@ -24,11 +24,9 @@
package org.jboss.dna.graph;
import java.util.Collections;
-import java.util.List;
import java.util.UUID;
import net.jcip.annotations.Immutable;
import org.jboss.dna.common.util.CheckArg;
-import org.jboss.dna.common.util.HashCode;
import org.jboss.dna.graph.property.Name;
import org.jboss.dna.graph.property.Path;
import org.jboss.dna.graph.property.Property;
@@ -41,13 +39,8 @@
* @see Location
*/
@Immutable
-final class LocationWithPathAndProperty extends Location {
+class LocationWithPathAndProperty extends LocationWithPathAndProperties {
- private final Path path;
- private final List<Property> idProperties;
-
- private final int hashCode;
-
/**
* Create a new location with a given path and identification property.
*
@@ -56,67 +49,20 @@
*/
LocationWithPathAndProperty( Path path,
Property idProperty ) {
- assert path != null;
+ super(path, Collections.singletonList(idProperty));
assert idProperty != null;
assert !idProperty.isEmpty();
- this.path = path;
- this.idProperties = Collections.singletonList(idProperty);
-
- // Paths are immutable, Properties are immutable, the idProperties list
- // is wrapped in an unmodifiableList by the Location factory methods...
- // ... so we can cache the hash code.
- hashCode = HashCode.compute(this.path, idProperties);
}
/**
* {@inheritDoc}
*
- * @see Location#getPath()
- */
- @Override
- public final Path getPath() {
- return path;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.jboss.dna.graph.Location#hasPath()
- */
- @Override
- public final boolean hasPath() {
- return true;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see Location#getIdProperties()
- */
- @Override
- public final List<Property> getIdProperties() {
- return idProperties;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see Location#hasIdProperties()
- */
- @Override
- public final boolean hasIdProperties() {
- return true;
- }
-
- /**
- * {@inheritDoc}
- *
* @see Location#getIdProperty(Name)
*/
@Override
public final Property getIdProperty( Name name ) {
CheckArg.isNotNull(name, "name");
- Property property = idProperties.get(0); // this is fast
+ Property property = getIdProperties().get(0); // this is fast
return property.getName().equals(name) ? property : null;
}
@@ -127,7 +73,7 @@
*/
@Override
public UUID getUuid() {
- Property property = idProperties.get(0); // this is fast
+ Property property = getIdProperties().get(0); // this is fast
if (DnaLexicon.UUID.equals(property.getName())) {
Object value = property.getFirstValue();
if (value instanceof UUID) return (UUID)value;
@@ -138,14 +84,14 @@
/**
* {@inheritDoc}
- *
- * @see Location#hashCode()
+ *
+ * @see org.jboss.dna.graph.LocationWithPathAndProperties#hasIdProperties()
*/
@Override
- public int hashCode() {
- return hashCode;
+ public final boolean hasIdProperties() {
+ return true;
}
-
+
/**
* {@inheritDoc}
*
@@ -154,11 +100,11 @@
@Override
public Location with( Property newIdProperty ) {
if (newIdProperty == null || newIdProperty.isEmpty()) return this;
- Property idProperty = idProperties.get(0); // fast
+ Property idProperty = getIdProperties().get(0); // fast
if (newIdProperty.getName().equals(idProperty.getName())) {
- return new LocationWithPathAndProperty(path, newIdProperty);
+ return Location.create(getPath(), newIdProperty);
}
- return Location.create(path, idProperty, newIdProperty);
+ return Location.create(getPath(), idProperty, newIdProperty);
}
/**
@@ -168,10 +114,10 @@
*/
@Override
public Location with( Path newPath ) {
- if (newPath == null) return Location.create(idProperties);
- if (path.equals(newPath)) return this;
- Property idProperty = idProperties.get(0); // fast
- return new LocationWithPathAndProperty(newPath, idProperty);
+ if (newPath == null) return Location.create(getIdProperties());
+ if (getPath().equals(newPath)) return this;
+ Property idProperty = getIdProperties().get(0); // fast
+ return Location.create(newPath, idProperty);
}
/**
@@ -181,10 +127,10 @@
*/
@Override
public Location with( UUID uuid ) {
- Property idProperty = idProperties.get(0); // fast
- if (uuid == null) return Location.create(path);
+ Property idProperty = getIdProperties().get(0); // fast
+ if (uuid == null) return Location.create(getPath());
assert !DnaLexicon.UUID.equals(idProperty.getName());
Property newUuidProperty = new BasicSingleValueProperty(DnaLexicon.UUID, uuid);
- return Location.create(path, idProperty, newUuidProperty);
+ return Location.create(getPath(), idProperty, newUuidProperty);
}
}
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/LocationWithPathAndUuid.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/LocationWithPathAndUuid.java 2009-11-25
18:15:33 UTC (rev 1350)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/LocationWithPathAndUuid.java 2009-11-25
20:18:20 UTC (rev 1351)
@@ -23,13 +23,8 @@
*/
package org.jboss.dna.graph;
-import java.util.Collections;
-import java.util.List;
import java.util.UUID;
import net.jcip.annotations.Immutable;
-import org.jboss.dna.common.util.CheckArg;
-import org.jboss.dna.common.util.HashCode;
-import org.jboss.dna.graph.property.Name;
import org.jboss.dna.graph.property.Path;
import org.jboss.dna.graph.property.Property;
import org.jboss.dna.graph.property.basic.BasicSingleValueProperty;
@@ -41,13 +36,10 @@
* @see Location
*/
@Immutable
-final class LocationWithPathAndUuid extends Location {
+final class LocationWithPathAndUuid extends LocationWithPathAndProperty {
- private final Path path;
- private final List<Property> idProperties;
+ private final UUID uuid;
- private final int hashCode;
-
/**
* Create a new location with a given path and identification property.
*
@@ -56,102 +48,34 @@
*/
LocationWithPathAndUuid( Path path,
UUID uuid ) {
- assert path != null;
+ super(path, new BasicSingleValueProperty(DnaLexicon.UUID, uuid));
assert uuid != null;
- this.path = path;
- this.idProperties = Collections.singletonList((Property)new
BasicSingleValueProperty(DnaLexicon.UUID, uuid));
-
- // Paths are immutable, Properties are immutable, the idProperties list
- // is wrapped in an unmodifiableList by the Location factory methods...
- // ... so we can cache the hash code.
- hashCode = HashCode.compute(this.path, idProperties);
+ this.uuid = uuid;
}
/**
* {@inheritDoc}
*
- * @see Location#getPath()
- */
- @Override
- public final Path getPath() {
- return path;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.jboss.dna.graph.Location#hasPath()
- */
- @Override
- public final boolean hasPath() {
- return true;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see Location#getIdProperties()
- */
- @Override
- public final List<Property> getIdProperties() {
- return idProperties;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see Location#hasIdProperties()
- */
- @Override
- public final boolean hasIdProperties() {
- return true;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see Location#getIdProperty(Name)
- */
- @Override
- public final Property getIdProperty( Name name ) {
- CheckArg.isNotNull(name, "name");
- Property property = idProperties.get(0); // this is fast
- return property.getName().equals(name) ? property : null;
- }
-
- /**
- * {@inheritDoc}
- *
* @see Location#getUuid()
*/
@Override
public final UUID getUuid() {
- return (UUID)idProperties.get(0).getFirstValue(); // this is fast, and we know
this is a UUID object
+ return uuid;
}
/**
* {@inheritDoc}
*
- * @see Location#hashCode()
- */
- @Override
- public int hashCode() {
- return hashCode;
- }
-
- /**
- * {@inheritDoc}
- *
* @see Location#with(Property)
*/
@Override
- public Location with( Property newIdProperty ) {
- if (newIdProperty == null || newIdProperty.isEmpty()) return this;
- Property idProperty = idProperties.get(0); // fast
- if (newIdProperty.getName().equals(idProperty.getName())) {
- return new LocationWithPathAndProperty(path, newIdProperty);
+ public Location with( Property idProperty ) {
+ if (idProperty == null || idProperty.isEmpty()) return this;
+ if (DnaLexicon.UUID.equals(idProperty.getName())) {
+ if (idProperty.isSingle() && uuid.equals(idProperty.getFirstValue()))
return this;
+ return Location.create(getPath(), idProperty);
}
- return Location.create(path, idProperty, newIdProperty);
+ return Location.create(getPath(), getIdProperties().get(0), idProperty);
}
/**
@@ -160,11 +84,10 @@
* @see Location#with(Path)
*/
@Override
- public Location with( Path newPath ) {
- if (newPath == null) return Location.create(idProperties);
- if (path.equals(newPath)) return this;
- Property idProperty = idProperties.get(0); // fast
- return new LocationWithPathAndProperty(newPath, idProperty);
+ public Location with( Path path ) {
+ if (path == null) return Location.create(uuid);
+ if (getPath().equals(path)) return this;
+ return Location.create(path, uuid);
}
/**
@@ -174,8 +97,8 @@
*/
@Override
public Location with( UUID uuid ) {
- if (uuid == null) return Location.create(path);
- if (uuid.equals(getUuid())) return this;
- return new LocationWithPathAndUuid(path, uuid);
+ if (uuid == null) return Location.create(getPath());
+ if (uuid.equals(this.uuid)) return this;
+ return Location.create(getPath(), uuid);
}
}
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/LocationWithProperties.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/LocationWithProperties.java 2009-11-25
18:15:33 UTC (rev 1350)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/LocationWithProperties.java 2009-11-25
20:18:20 UTC (rev 1351)
@@ -40,7 +40,7 @@
* @see Location
*/
@Immutable
-final class LocationWithProperties extends Location {
+class LocationWithProperties extends Location {
private final List<Property> idProperties;
private final int hashCode;
@@ -57,7 +57,7 @@
// Paths are immutable, Properties are immutable, the idProperties list
// is wrapped in an unmodifiableList by the Location factory methods...
// ... so we can cache the hash code.
- hashCode = HashCode.compute(null, idProperties);
+ hashCode = HashCode.compute(idProperties);
}
/**
@@ -128,7 +128,7 @@
}
newIdProperties.add(newIdProperty);
newIdProperties = Collections.unmodifiableList(newIdProperties);
- return new LocationWithProperties(newIdProperties);
+ return create(newIdProperties);
}
/**
@@ -139,7 +139,7 @@
@Override
public Location with( Path newPath ) {
if (newPath == null) return this;
- return new LocationWithPathAndProperties(newPath, idProperties);
+ return create(newPath, idProperties);
}
/**
@@ -159,6 +159,6 @@
List<Property> newIdProperties = new
ArrayList<Property>(idProperties.size() + 1);
newIdProperties.addAll(idProperties);
newIdProperties.add(newProperty);
- return new LocationWithProperties(newIdProperties);
+ return create(newIdProperties);
}
}
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/LocationWithProperty.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/LocationWithProperty.java 2009-11-25
18:15:33 UTC (rev 1350)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/LocationWithProperty.java 2009-11-25
20:18:20 UTC (rev 1351)
@@ -29,7 +29,6 @@
import java.util.UUID;
import net.jcip.annotations.Immutable;
import org.jboss.dna.common.util.CheckArg;
-import org.jboss.dna.common.util.HashCode;
import org.jboss.dna.graph.property.Name;
import org.jboss.dna.graph.property.Path;
import org.jboss.dna.graph.property.Property;
@@ -42,78 +41,28 @@
* @see Location
*/
@Immutable
-final class LocationWithProperty extends Location {
+final class LocationWithProperty extends LocationWithProperties {
- protected final List<Property> idProperties;
-
- private final int hashCode;
-
/**
* Create a new location with a given path and identification property.
*
* @param idProperty the identification property
*/
LocationWithProperty( Property idProperty ) {
+ super(Collections.singletonList(idProperty));
assert idProperty != null;
assert !idProperty.isEmpty();
- // The path could be null
- this.idProperties = Collections.singletonList(idProperty);
-
- // Paths are immutable, Properties are immutable, the idProperties list
- // is wrapped in an unmodifiableList by the Location factory methods...
- // ... so we can cache the hash code.
- hashCode = HashCode.compute(null, idProperties);
}
/**
* {@inheritDoc}
*
- * @see Location#getPath()
- */
- @Override
- public final Path getPath() {
- return null;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.jboss.dna.graph.Location#hasPath()
- */
- @Override
- public boolean hasPath() {
- return false;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see Location#getIdProperties()
- */
- @Override
- public final List<Property> getIdProperties() {
- return idProperties;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see Location#hasIdProperties()
- */
- @Override
- public final boolean hasIdProperties() {
- return true;
- }
-
- /**
- * {@inheritDoc}
- *
* @see Location#getIdProperty(Name)
*/
@Override
public final Property getIdProperty( Name name ) {
CheckArg.isNotNull(name, "name");
- Property property = idProperties.get(0); // this is fast
+ Property property = getIdProperties().get(0); // this is fast
return property.getName().equals(name) ? property : null;
}
@@ -124,7 +73,7 @@
*/
@Override
public UUID getUuid() {
- Property property = idProperties.get(0); // this is fast
+ Property property = getIdProperties().get(0); // this is fast
if (DnaLexicon.UUID.equals(property.getName())) {
Object value = property.getFirstValue();
if (value instanceof UUID) return (UUID)value;
@@ -136,29 +85,19 @@
/**
* {@inheritDoc}
*
- * @see Location#hashCode()
- */
- @Override
- public int hashCode() {
- return hashCode;
- }
-
- /**
- * {@inheritDoc}
- *
* @see Location#with(Property)
*/
@Override
public Location with( Property newIdProperty ) {
if (newIdProperty == null || newIdProperty.isEmpty()) return this;
- Property idProperty = idProperties.get(0); // fast
+ Property idProperty = getIdProperties().get(0); // fast
if (newIdProperty.getName().equals(idProperty.getName())) {
return Location.create(newIdProperty);
}
- List<Property> newIdProperties = new
ArrayList<Property>(idProperties.size() + 1);
+ List<Property> newIdProperties = new
ArrayList<Property>(getIdProperties().size() + 1);
newIdProperties.add(newIdProperty);
- newIdProperties.addAll(idProperties);
- return new LocationWithProperties(newIdProperties);
+ newIdProperties.addAll(getIdProperties());
+ return Location.create(newIdProperties);
}
/**
@@ -169,8 +108,8 @@
@Override
public Location with( Path newPath ) {
if (newPath == null) return this;
- Property idProperty = idProperties.get(0); // fast
- return new LocationWithPathAndProperty(newPath, idProperty);
+ Property idProperty = getIdProperties().get(0); // fast
+ return Location.create(newPath, idProperty);
}
/**
@@ -181,13 +120,13 @@
@Override
public Location with( UUID uuid ) {
if (uuid == null) return this;
- Property idProperty = idProperties.get(0); // fast
+ Property idProperty = getIdProperties().get(0); // fast
if (DnaLexicon.UUID.equals(idProperty.getName())) {
- return new LocationWithUuid(uuid);
+ return Location.create(uuid);
}
- List<Property> newIdProperties = new
ArrayList<Property>(idProperties.size() + 1);
+ List<Property> newIdProperties = new
ArrayList<Property>(getIdProperties().size() + 1);
newIdProperties.add(new BasicSingleValueProperty(DnaLexicon.UUID, uuid));
- newIdProperties.addAll(idProperties);
- return new LocationWithProperties(newIdProperties);
+ newIdProperties.addAll(getIdProperties());
+ return Location.create(newIdProperties);
}
}
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/LocationWithUuid.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/LocationWithUuid.java 2009-11-25
18:15:33 UTC (rev 1350)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/LocationWithUuid.java 2009-11-25
20:18:20 UTC (rev 1351)
@@ -130,7 +130,7 @@
*/
@Override
public Location with( UUID uuid ) {
- return new LocationWithUuid(uuid);
+ return Location.create(uuid);
}
/**
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/federation/ProjectedNode.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/federation/ProjectedNode.java 2009-11-25
18:15:33 UTC (rev 1350)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/federation/ProjectedNode.java 2009-11-25
20:18:20 UTC (rev 1351)
@@ -140,7 +140,7 @@
super(locationInSource);
this.projection = projection;
this.federatedLocation = locationInFederated;
- this.sameLocationAsOriginal = locationInSource.equals(locationInFederated);
+ this.sameLocationAsOriginal = locationInSource.isSame(locationInFederated);
}
protected ProxyNode( Projection projection,
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/observe/NetChangeObserver.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/observe/NetChangeObserver.java 2009-11-25
18:15:33 UTC (rev 1350)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/observe/NetChangeObserver.java 2009-11-25
20:18:20 UTC (rev 1351)
@@ -303,7 +303,7 @@
if (that == this) return true;
if (this.hc != that.hc) return false;
if (!this.workspaceName.equals(that.workspaceName)) return false;
- if (!this.location.equals(that.location)) return false;
+ if (!this.location.isSame(that.location)) return false;
return true;
}
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/process/MergeJoinComponent.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/process/MergeJoinComponent.java 2009-11-25
18:15:33 UTC (rev 1350)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/query/process/MergeJoinComponent.java 2009-11-25
20:18:20 UTC (rev 1351)
@@ -178,7 +178,7 @@
for (int i = columns.getColumnCount(); i != columns.getLocationCount(); ++i) {
Location location = (Location)tuple1[i];
Location location2 = (Location)tuple2[i];
- if (!location.equals(location2)) return false;
+ if (!location.isSame(location2)) return false;
}
return true;
}
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/BatchRequestBuilder.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/BatchRequestBuilder.java 2009-11-25
18:15:33 UTC (rev 1350)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/BatchRequestBuilder.java 2009-11-25
20:18:20 UTC (rev 1351)
@@ -426,7 +426,7 @@
// If there's a pending request ...
if (pendingRequest != null) {
// Compare the supplied location with that of the pending request
- if (pendingRequest.location.equals(on)) {
+ if (pendingRequest.location.isSame(on)) {
// They are the same location, so we can add the properties to the
pending request ...
pendingRequest.pendingProperties.put(property.getName(), property);
return this;
@@ -456,7 +456,7 @@
// If there's a pending request ...
if (pendingRequest != null) {
// Compare the supplied location with that of the pending request
- if (pendingRequest.location.equals(on)) {
+ if (pendingRequest.location.isSame(on)) {
// They are the same location, so we can add the properties to the
pending request ...
for (Property property : properties) {
pendingRequest.pendingProperties.put(property.getName(), property);
@@ -492,7 +492,7 @@
// If there's a pending request ...
if (pendingRequest != null) {
// Compare the supplied location with that of the pending request
- if (pendingRequest.location.equals(on)) {
+ if (pendingRequest.location.isSame(on)) {
// They are the same location, so we can add the properties to the
pending request ...
pendingRequest.pendingProperties.put(propertyName, null);
return this;
@@ -523,7 +523,7 @@
// If there's a pending request ...
if (pendingRequest != null) {
// Compare the supplied location with that of the pending request
- if (pendingRequest.location.equals(on)) {
+ if (pendingRequest.location.isSame(on)) {
// They are the same location, so we can add the properties to the
pending request ...
for (Name propertyName : propertyNames) {
pendingRequest.pendingProperties.put(propertyName, null);
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/CloneBranchRequest.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/CloneBranchRequest.java 2009-11-25
18:15:33 UTC (rev 1350)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/CloneBranchRequest.java 2009-11-25
20:18:20 UTC (rev 1351)
@@ -176,8 +176,8 @@
public void setActualLocations( Location fromLocation,
Location intoLocation ) {
checkNotFrozen();
- if (!from.isSame(fromLocation)) { // not same if actual is null
- throw new
IllegalArgumentException(GraphI18n.actualLocationIsNotSameAsInputLocation.text(fromLocation,
from));
+ if (!from.equals(fromLocation)) { // not same if actual is null
+ throw new
IllegalArgumentException(GraphI18n.actualLocationNotEqualToInputLocation.text(fromLocation,
from));
}
CheckArg.isNotNull(intoLocation, "intoLocation");
assert fromLocation != null;
@@ -306,8 +306,8 @@
if (obj == this) return true;
if (this.getClass().isInstance(obj)) {
CloneBranchRequest that = (CloneBranchRequest)obj;
- if (!this.from().equals(that.from())) return false;
- if (!this.into().equals(that.into())) return false;
+ if (!this.from().isSame(that.from())) return false;
+ if (!this.into().isSame(that.into())) return false;
if (!this.fromWorkspace.equals(that.fromWorkspace)) return false;
if (!this.intoWorkspace.equals(that.intoWorkspace)) return false;
return true;
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/CopyBranchRequest.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/CopyBranchRequest.java 2009-11-25
18:15:33 UTC (rev 1350)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/CopyBranchRequest.java 2009-11-25
20:18:20 UTC (rev 1351)
@@ -212,8 +212,8 @@
public void setActualLocations( Location fromLocation,
Location intoLocation ) {
checkNotFrozen();
- if (!from.isSame(fromLocation)) { // not same if actual is null
- throw new
IllegalArgumentException(GraphI18n.actualLocationIsNotSameAsInputLocation.text(fromLocation,
from));
+ if (!from.equals(fromLocation)) { // not same if actual is null
+ throw new
IllegalArgumentException(GraphI18n.actualLocationNotEqualToInputLocation.text(fromLocation,
from));
}
CheckArg.isNotNull(intoLocation, "intoLocation");
assert fromLocation != null;
@@ -313,8 +313,8 @@
if (obj == this) return true;
if (this.getClass().isInstance(obj)) {
CopyBranchRequest that = (CopyBranchRequest)obj;
- if (!this.from().equals(that.from())) return false;
- if (!this.into().equals(that.into())) return false;
+ if (!this.from().isSame(that.from())) return false;
+ if (!this.into().isSame(that.into())) return false;
if (!this.nodeConflictBehavior().equals(that.nodeConflictBehavior())) return
false;
if (!this.fromWorkspace.equals(that.fromWorkspace)) return false;
if (!this.intoWorkspace.equals(that.intoWorkspace)) return false;
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/CreateNodeRequest.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/CreateNodeRequest.java 2009-11-25
18:15:33 UTC (rev 1350)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/CreateNodeRequest.java 2009-11-25
20:18:20 UTC (rev 1351)
@@ -282,7 +282,7 @@
public void setActualLocationOfNode( Location actual ) {
checkNotFrozen();
CheckArg.isNotNull(actual, "actual");
- if (!under.isSame(actual, false)) { // not same if actual is null
+ if (!under.equals(actual, false)) { // not same if actual is null
}
assert actual != null;
if (!actual.hasPath()) {
@@ -290,7 +290,7 @@
}
assert actual.hasPath();
if (under.hasPath() &&
!under.getPath().equals(actual.getPath().getParent())) {
- throw new
IllegalArgumentException(GraphI18n.actualLocationIsNotSameAsInputLocation.text(actual,
under));
+ throw new
IllegalArgumentException(GraphI18n.actualLocationNotEqualToInputLocation.text(actual,
under));
}
this.actualLocation = actual;
}
@@ -366,7 +366,7 @@
if (obj == this) return true;
if (this.getClass().isInstance(obj)) {
CreateNodeRequest that = (CreateNodeRequest)obj;
- if (!this.under().equals(that.under())) return false;
+ if (!this.under().isSame(that.under())) return false;
if (!this.conflictBehavior().equals(that.conflictBehavior())) return false;
if (!this.inWorkspace().equals(that.conflictBehavior())) return false;
if (!this.properties().equals(that.properties())) return false;
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/DeleteBranchRequest.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/DeleteBranchRequest.java 2009-11-25
18:15:33 UTC (rev 1350)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/DeleteBranchRequest.java 2009-11-25
20:18:20 UTC (rev 1351)
@@ -94,8 +94,8 @@
*/
public void setActualLocationOfNode( Location actual ) {
checkNotFrozen();
- if (!at.isSame(actual)) { // not same if actual is null
- throw new
IllegalArgumentException(GraphI18n.actualLocationIsNotSameAsInputLocation.text(actual,
at));
+ if (!at.equals(actual)) { // not same if actual is null
+ throw new
IllegalArgumentException(GraphI18n.actualLocationNotEqualToInputLocation.text(actual,
at));
}
assert actual != null;
if (!actual.hasPath()) {
@@ -175,7 +175,7 @@
if (obj == this) return true;
if (this.getClass().isInstance(obj)) {
DeleteBranchRequest that = (DeleteBranchRequest)obj;
- if (!this.at().equals(that.at())) return false;
+ if (!this.at().isSame(that.at())) return false;
if (!this.inWorkspace().equals(that.inWorkspace())) return false;
return true;
}
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/DeleteChildrenRequest.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/DeleteChildrenRequest.java 2009-11-25
18:15:33 UTC (rev 1350)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/DeleteChildrenRequest.java 2009-11-25
20:18:20 UTC (rev 1351)
@@ -98,8 +98,8 @@
*/
public void setActualLocationOfNode( Location actual ) {
checkNotFrozen();
- if (!at.isSame(actual)) { // not same if actual is null
- throw new
IllegalArgumentException(GraphI18n.actualLocationIsNotSameAsInputLocation.text(actual,
at));
+ if (!at.equals(actual)) { // not same if actual is null
+ throw new
IllegalArgumentException(GraphI18n.actualLocationNotEqualToInputLocation.text(actual,
at));
}
assert actual != null;
if (!actual.hasPath()) {
@@ -240,7 +240,7 @@
if (obj == this) return true;
if (this.getClass().isInstance(obj)) {
DeleteChildrenRequest that = (DeleteChildrenRequest)obj;
- if (!this.at().equals(that.at())) return false;
+ if (!this.at().isSame(that.at())) return false;
if (!this.inWorkspace().equals(that.inWorkspace())) return false;
return true;
}
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/LockBranchRequest.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/LockBranchRequest.java 2009-11-25
18:15:33 UTC (rev 1350)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/LockBranchRequest.java 2009-11-25
20:18:20 UTC (rev 1351)
@@ -128,8 +128,8 @@
*/
public void setActualLocation( Location actualLocation ) {
checkNotFrozen();
- if (!at.isSame(actualLocation)) { // not same if actual is null
- throw new
IllegalArgumentException(GraphI18n.actualLocationIsNotSameAsInputLocation.text(actualLocation,
at));
+ if (!at.equals(actualLocation)) { // not same if actual is null
+ throw new
IllegalArgumentException(GraphI18n.actualLocationNotEqualToInputLocation.text(actualLocation,
at));
}
assert actualLocation != null;
if (!actualLocation.hasPath()) {
@@ -210,7 +210,7 @@
if (this.getClass().isInstance(obj)) {
LockBranchRequest that = (LockBranchRequest)obj;
if (this.lockTimeoutInMillis() != that.lockTimeoutInMillis()) return false;
- if (!this.at().equals(that.at())) return false;
+ if (!this.at().isSame(that.at())) return false;
if (this.lockScope() != that.lockScope()) return false;
if (!this.inWorkspace().equals(that.inWorkspace())) return false;
return true;
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/MoveBranchRequest.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/MoveBranchRequest.java 2009-11-25
18:15:33 UTC (rev 1350)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/MoveBranchRequest.java 2009-11-25
20:18:20 UTC (rev 1351)
@@ -236,8 +236,8 @@
checkNotFrozen();
CheckArg.isNotNull(oldLocation, "oldLocation");
CheckArg.isNotNull(newLocation, "newLocation");
- if (!from.isSame(oldLocation)) { // not same if actual is null
- throw new
IllegalArgumentException(GraphI18n.actualLocationIsNotSameAsInputLocation.text(oldLocation,
from));
+ if (!from.equals(oldLocation)) { // not same if actual is null
+ throw new
IllegalArgumentException(GraphI18n.actualLocationNotEqualToInputLocation.text(oldLocation,
from));
}
if (!oldLocation.hasPath()) {
throw new
IllegalArgumentException(GraphI18n.actualOldLocationMustHavePath.text(oldLocation));
@@ -246,12 +246,12 @@
throw new
IllegalArgumentException(GraphI18n.actualNewLocationMustHavePath.text(newLocation));
}
if (into() != null && into().hasPath() &&
!newLocation.getPath().getParent().isSameAs(into.getPath())) {
- throw new
IllegalArgumentException(GraphI18n.actualLocationIsNotSameAsInputLocation.text(newLocation,
into));
+ throw new
IllegalArgumentException(GraphI18n.actualLocationNotEqualToInputLocation.text(newLocation,
into));
}
Name actualNewName = newLocation.getPath().getLastSegment().getName();
Name expectedNewName = desiredName() != null ? desiredName() :
oldLocation.getPath().getLastSegment().getName();
if (!actualNewName.equals(expectedNewName)) {
- throw new
IllegalArgumentException(GraphI18n.actualLocationIsNotSameAsInputLocation.text(newLocation,
into));
+ throw new
IllegalArgumentException(GraphI18n.actualLocationNotEqualToInputLocation.text(newLocation,
into));
}
this.actualOldLocation = oldLocation;
this.actualNewLocation = newLocation;
@@ -350,8 +350,8 @@
if (obj == this) return true;
if (this.getClass().isInstance(obj)) {
MoveBranchRequest that = (MoveBranchRequest)obj;
- if (!this.from().equals(that.from())) return false;
- if (!this.into().equals(that.into())) return false;
+ if (!this.from().isSame(that.from())) return false;
+ if (!this.into().isSame(that.into())) return false;
if (!this.conflictBehavior().equals(that.conflictBehavior())) return false;
if (!this.workspaceName.equals(that.workspaceName)) return false;
return true;
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/ReadAllChildrenRequest.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/ReadAllChildrenRequest.java 2009-11-25
18:15:33 UTC (rev 1350)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/ReadAllChildrenRequest.java 2009-11-25
20:18:20 UTC (rev 1351)
@@ -194,8 +194,8 @@
*/
public void setActualLocationOfNode( Location actualLocation ) {
checkNotFrozen();
- if (!this.of.isSame(actualLocation)) { // not same if actualLocation is null
- throw new
IllegalArgumentException(GraphI18n.actualLocationIsNotSameAsInputLocation.text(actualLocation,
of));
+ if (!this.of.equals(actualLocation)) { // not same if actualLocation is null
+ throw new
IllegalArgumentException(GraphI18n.actualLocationNotEqualToInputLocation.text(actualLocation,
of));
}
assert actualLocation != null;
if (!actualLocation.hasPath()) {
@@ -244,7 +244,7 @@
if (obj == this) return true;
if (this.getClass().isInstance(obj)) {
ReadAllChildrenRequest that = (ReadAllChildrenRequest)obj;
- if (!this.of().equals(that.of())) return false;
+ if (!this.of().isSame(that.of())) return false;
if (!this.inWorkspace().equals(that.inWorkspace())) return false;
return true;
}
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/ReadAllPropertiesRequest.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/ReadAllPropertiesRequest.java 2009-11-25
18:15:33 UTC (rev 1350)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/ReadAllPropertiesRequest.java 2009-11-25
20:18:20 UTC (rev 1351)
@@ -195,8 +195,8 @@
*/
public void setActualLocationOfNode( Location actual ) {
checkNotFrozen();
- if (!at.isSame(actual)) { // not same if actual is null
- throw new
IllegalArgumentException(GraphI18n.actualLocationIsNotSameAsInputLocation.text(actual,
at));
+ if (!at.equals(actual)) { // not same if actual is null
+ throw new
IllegalArgumentException(GraphI18n.actualLocationNotEqualToInputLocation.text(actual,
at));
}
assert actual != null;
if (!actual.hasPath()) {
@@ -245,7 +245,7 @@
if (obj == this) return true;
if (this.getClass().isInstance(obj)) {
ReadAllPropertiesRequest that = (ReadAllPropertiesRequest)obj;
- if (!this.at().equals(that.at())) return false;
+ if (!this.at().isSame(that.at())) return false;
if (!this.inWorkspace().equals(that.inWorkspace())) return false;
return true;
}
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/ReadBlockOfChildrenRequest.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/ReadBlockOfChildrenRequest.java 2009-11-25
18:15:33 UTC (rev 1350)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/ReadBlockOfChildrenRequest.java 2009-11-25
20:18:20 UTC (rev 1351)
@@ -240,8 +240,8 @@
*/
public void setActualLocationOfNode( Location actual ) {
checkNotFrozen();
- if (!of.isSame(actual)) { // not same if actual is null
- throw new
IllegalArgumentException(GraphI18n.actualLocationIsNotSameAsInputLocation.text(actual,
of));
+ if (!of.equals(actual)) { // not same if actual is null
+ throw new
IllegalArgumentException(GraphI18n.actualLocationNotEqualToInputLocation.text(actual,
of));
}
assert actual != null;
if (!actual.hasPath()) {
@@ -291,7 +291,7 @@
if (obj == this) return true;
if (this.getClass().isInstance(obj)) {
ReadBlockOfChildrenRequest that = (ReadBlockOfChildrenRequest)obj;
- if (!this.of().equals(that.of())) return false;
+ if (!this.of().isSame(that.of())) return false;
if (this.startingAtIndex() != that.startingAtIndex()) return false;
if (this.count() != that.count()) return false;
if (!this.inWorkspace().equals(that.inWorkspace())) return false;
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/ReadBranchRequest.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/ReadBranchRequest.java 2009-11-25
18:15:33 UTC (rev 1350)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/ReadBranchRequest.java 2009-11-25
20:18:20 UTC (rev 1351)
@@ -367,8 +367,8 @@
* location} as the {@link #at() current location}, or if the actual location
does not have a path.
*/
public void setActualLocationOfNode( Location actual ) {
- if (!at.isSame(actual)) { // not same if actual is null
- throw new
IllegalArgumentException(GraphI18n.actualLocationIsNotSameAsInputLocation.text(actual,
at));
+ if (!at.equals(actual)) { // not same if actual is null
+ throw new
IllegalArgumentException(GraphI18n.actualLocationNotEqualToInputLocation.text(actual,
at));
}
assert actual != null;
if (!actual.hasPath()) {
@@ -418,7 +418,7 @@
if (obj == this) return true;
if (this.getClass().isInstance(obj)) {
ReadBranchRequest that = (ReadBranchRequest)obj;
- if (!this.at().equals(that.at())) return false;
+ if (!this.at().isSame(that.at())) return false;
if (this.maximumDepth() != that.maximumDepth()) return false;
if (!this.inWorkspace().equals(that.inWorkspace())) return false;
return true;
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/ReadNextBlockOfChildrenRequest.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/ReadNextBlockOfChildrenRequest.java 2009-11-25
18:15:33 UTC (rev 1350)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/ReadNextBlockOfChildrenRequest.java 2009-11-25
20:18:20 UTC (rev 1351)
@@ -210,7 +210,7 @@
public void setActualLocationOfStartingAfterNode( Location actual ) {
checkNotFrozen();
if (!startingAfter.isSame(actual)) { // not same if actual is null
- throw new
IllegalArgumentException(GraphI18n.actualLocationIsNotSameAsInputLocation.text(actual,
startingAfter));
+ throw new
IllegalArgumentException(GraphI18n.actualLocationNotEqualToInputLocation.text(actual,
startingAfter));
}
assert actual != null;
if (!actual.hasPath()) {
@@ -260,7 +260,7 @@
if (obj == this) return true;
if (this.getClass().isInstance(obj)) {
ReadNextBlockOfChildrenRequest that = (ReadNextBlockOfChildrenRequest)obj;
- if (!this.startingAfter().equals(that.startingAfter())) return false;
+ if (!this.startingAfter().isSame(that.startingAfter())) return false;
if (this.count() != that.count()) return false;
if (!this.inWorkspace().equals(that.inWorkspace())) return false;
return true;
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/ReadNodeRequest.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/ReadNodeRequest.java 2009-11-25
18:15:33 UTC (rev 1350)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/ReadNodeRequest.java 2009-11-25
20:18:20 UTC (rev 1351)
@@ -259,8 +259,8 @@
*/
public void setActualLocationOfNode( Location actual ) {
checkNotFrozen();
- if (!at.isSame(actual)) { // not same if actual is null
- throw new
IllegalArgumentException(GraphI18n.actualLocationIsNotSameAsInputLocation.text(actual,
at));
+ if (!at.equals(actual)) { // not same if actual is null
+ throw new
IllegalArgumentException(GraphI18n.actualLocationNotEqualToInputLocation.text(actual,
at));
}
assert actual != null;
if (!actual.hasPath()) {
@@ -311,7 +311,7 @@
if (obj == this) return true;
if (this.getClass().isInstance(obj)) {
ReadNodeRequest that = (ReadNodeRequest)obj;
- if (!this.at().equals(that.at())) return false;
+ if (!this.at().isSame(that.at())) return false;
if (!this.inWorkspace().equals(that.inWorkspace())) return false;
return true;
}
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/ReadPropertyRequest.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/ReadPropertyRequest.java 2009-11-25
18:15:33 UTC (rev 1350)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/ReadPropertyRequest.java 2009-11-25
20:18:20 UTC (rev 1351)
@@ -134,8 +134,8 @@
*/
public void setActualLocationOfNode( Location actual ) {
checkNotFrozen();
- if (!on.isSame(actual)) { // not same if actual is null
- throw new
IllegalArgumentException(GraphI18n.actualLocationIsNotSameAsInputLocation.text(actual,
on));
+ if (!on.equals(actual)) { // not same if actual is null
+ throw new
IllegalArgumentException(GraphI18n.actualLocationNotEqualToInputLocation.text(actual,
on));
}
assert actual != null;
if (!actual.hasPath()) {
@@ -185,7 +185,7 @@
if (obj == this) return true;
if (this.getClass().isInstance(obj)) {
ReadPropertyRequest that = (ReadPropertyRequest)obj;
- if (!this.on().equals(that.on())) return false;
+ if (!this.on().isSame(that.on())) return false;
if (!this.named().equals(that.named())) return false;
if (!this.inWorkspace().equals(that.inWorkspace())) return false;
return true;
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/RemovePropertyRequest.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/RemovePropertyRequest.java 2009-11-25
18:15:33 UTC (rev 1350)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/RemovePropertyRequest.java 2009-11-25
20:18:20 UTC (rev 1351)
@@ -111,7 +111,7 @@
public void setActualLocationOfNode( Location actual ) {
checkNotFrozen();
if (!from.isSame(actual)) { // not same if actual is null
- throw new
IllegalArgumentException(GraphI18n.actualLocationIsNotSameAsInputLocation.text(actual,
from));
+ throw new
IllegalArgumentException(GraphI18n.actualLocationNotEqualToInputLocation.text(actual,
from));
}
assert actual != null;
if (!actual.hasPath()) {
@@ -171,7 +171,7 @@
if (obj == this) return true;
if (this.getClass().isInstance(obj)) {
RemovePropertyRequest that = (RemovePropertyRequest)obj;
- if (!this.from().equals(that.from())) return false;
+ if (!this.from().isSame(that.from())) return false;
if (!this.propertyName().equals(that.propertyName())) return false;
if (!this.inWorkspace().equals(that.inWorkspace())) return false;
return true;
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/RenameNodeRequest.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/RenameNodeRequest.java 2009-11-25
18:15:33 UTC (rev 1350)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/RenameNodeRequest.java 2009-11-25
20:18:20 UTC (rev 1351)
@@ -117,11 +117,11 @@
Location newLocation ) {
checkNotFrozen();
if (!at.isSame(oldLocation)) { // not same if actual is null
- throw new
IllegalArgumentException(GraphI18n.actualLocationIsNotSameAsInputLocation.text(oldLocation,
at));
+ throw new
IllegalArgumentException(GraphI18n.actualLocationNotEqualToInputLocation.text(oldLocation,
at));
}
assert oldLocation != null;
if (newLocation == null) {
- throw new
IllegalArgumentException(GraphI18n.actualLocationIsNotSameAsInputLocation.text(newLocation,
at));
+ throw new
IllegalArgumentException(GraphI18n.actualLocationNotEqualToInputLocation.text(newLocation,
at));
}
if (!oldLocation.hasPath()) {
throw new
IllegalArgumentException(GraphI18n.actualOldLocationMustHavePath.text(oldLocation));
@@ -226,7 +226,7 @@
if (obj == this) return true;
if (this.getClass().isInstance(obj)) {
RenameNodeRequest that = (RenameNodeRequest)obj;
- if (!this.at().equals(that.at())) return false;
+ if (!this.at().isSame(that.at())) return false;
if (!this.toName().equals(that.toName())) return false;
if (!this.inWorkspace().equals(that.inWorkspace())) return false;
return true;
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/SetPropertyRequest.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/SetPropertyRequest.java 2009-11-25
18:15:33 UTC (rev 1350)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/SetPropertyRequest.java 2009-11-25
20:18:20 UTC (rev 1351)
@@ -111,8 +111,8 @@
*/
public void setActualLocationOfNode( Location actual ) {
checkNotFrozen();
- if (!on.isSame(actual)) { // not same if actual is null
- throw new
IllegalArgumentException(GraphI18n.actualLocationIsNotSameAsInputLocation.text(actual,
on));
+ if (!on.equals(actual)) { // not same if actual is null
+ throw new
IllegalArgumentException(GraphI18n.actualLocationNotEqualToInputLocation.text(actual,
on));
}
assert actual != null;
if (!actual.hasPath()) {
@@ -172,7 +172,7 @@
if (obj == this) return true;
if (this.getClass().isInstance(obj)) {
SetPropertyRequest that = (SetPropertyRequest)obj;
- if (!this.on().equals(that.on())) return false;
+ if (!this.on().isSame(that.on())) return false;
if (!this.property().equals(that.property())) return false;
if (!this.inWorkspace().equals(that.inWorkspace())) return false;
return true;
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/UnlockBranchRequest.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/UnlockBranchRequest.java 2009-11-25
18:15:33 UTC (rev 1350)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/UnlockBranchRequest.java 2009-11-25
20:18:20 UTC (rev 1351)
@@ -95,7 +95,7 @@
public void setActualLocation( Location actualLocation ) {
checkNotFrozen();
if (!at.isSame(actualLocation)) { // not same if actual is null
- throw new
IllegalArgumentException(GraphI18n.actualLocationIsNotSameAsInputLocation.text(actualLocation,
at));
+ throw new
IllegalArgumentException(GraphI18n.actualLocationNotEqualToInputLocation.text(actualLocation,
at));
}
assert actualLocation != null;
if (!actualLocation.hasPath()) {
@@ -175,7 +175,7 @@
if (obj == this) return true;
if (this.getClass().isInstance(obj)) {
UnlockBranchRequest that = (UnlockBranchRequest)obj;
- if (!this.at().equals(that.at())) return false;
+ if (!this.at().isSame(that.at())) return false;
if (!this.inWorkspace().equals(that.inWorkspace())) return false;
return true;
}
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/UpdatePropertiesRequest.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/UpdatePropertiesRequest.java 2009-11-25
18:15:33 UTC (rev 1350)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/UpdatePropertiesRequest.java 2009-11-25
20:18:20 UTC (rev 1351)
@@ -128,8 +128,8 @@
*/
public void setActualLocationOfNode( Location actual ) {
checkNotFrozen();
- if (!on.isSame(actual)) { // not same if actual is null
- throw new
IllegalArgumentException(GraphI18n.actualLocationIsNotSameAsInputLocation.text(actual,
on));
+ if (!on.equals(actual)) { // not same if actual is null
+ throw new
IllegalArgumentException(GraphI18n.actualLocationNotEqualToInputLocation.text(actual,
on));
}
assert actual != null;
if (!actual.hasPath()) {
@@ -189,7 +189,7 @@
if (obj == this) return true;
if (this.getClass().isInstance(obj)) {
UpdatePropertiesRequest that = (UpdatePropertiesRequest)obj;
- if (!this.on().equals(that.on())) return false;
+ if (!this.on().isSame(that.on())) return false;
if (!this.properties().equals(that.properties())) return false;
if (!this.inWorkspace().equals(that.inWorkspace())) return false;
return true;
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/UpdateValuesRequest.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/UpdateValuesRequest.java 2009-11-25
18:15:33 UTC (rev 1350)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/UpdateValuesRequest.java 2009-11-25
20:18:20 UTC (rev 1351)
@@ -127,8 +127,8 @@
public void setActualLocation(Location actual, List<Object> actualAddedValues,
List<Object> actualRemovedValues) {
checkNotFrozen();
- if (!on.isSame(actual)) { // not same if actual is null
- throw new
IllegalArgumentException(GraphI18n.actualLocationIsNotSameAsInputLocation.text(actual,
on));
+ if (!on.equals(actual)) { // not same if actual is null
+ throw new
IllegalArgumentException(GraphI18n.actualLocationNotEqualToInputLocation.text(actual,
on));
}
assert actual != null;
if (!actual.hasPath()) {
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/VerifyNodeExistsRequest.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/VerifyNodeExistsRequest.java 2009-11-25
18:15:33 UTC (rev 1350)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/VerifyNodeExistsRequest.java 2009-11-25
20:18:20 UTC (rev 1351)
@@ -93,8 +93,8 @@
*/
public void setActualLocationOfNode( Location actual ) {
checkNotFrozen();
- if (!at.isSame(actual)) { // not same if actual is null
- throw new
IllegalArgumentException(GraphI18n.actualLocationIsNotSameAsInputLocation.text(actual,
at));
+ if (!at.equals(actual)) { // not same if actual is null
+ throw new
IllegalArgumentException(GraphI18n.actualLocationNotEqualToInputLocation.text(actual,
at));
}
assert actual != null;
if (!actual.hasPath()) {
@@ -155,7 +155,7 @@
if (obj == this) return true;
if (this.getClass().isInstance(obj)) {
VerifyNodeExistsRequest that = (VerifyNodeExistsRequest)obj;
- if (!this.at().equals(that.at())) return false;
+ if (!this.at().isSame(that.at())) return false;
if (!this.inWorkspace().equals(that.inWorkspace())) return false;
return true;
}
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/processor/RequestProcessor.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/processor/RequestProcessor.java 2009-11-25
18:15:33 UTC (rev 1350)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/processor/RequestProcessor.java 2009-11-25
20:18:20 UTC (rev 1351)
@@ -38,7 +38,6 @@
import org.jboss.dna.graph.Location;
import org.jboss.dna.graph.cache.CachePolicy;
import org.jboss.dna.graph.connector.LockFailedException;
-import org.jboss.dna.graph.connector.RepositorySourceCapabilities;
import org.jboss.dna.graph.observe.Changes;
import org.jboss.dna.graph.observe.Observer;
import org.jboss.dna.graph.property.DateTime;
@@ -549,7 +548,7 @@
if (count > request.count()) break;
if (!found) {
// Set to true if we find the child we're looking for ...
- found = child.equals(request.startingAfter());
+ found = child.isSame(request.startingAfter());
} else {
// Add the child to the block ...
++count;
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/session/GraphSession.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/session/GraphSession.java 2009-11-25
18:15:33 UTC (rev 1350)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/session/GraphSession.java 2009-11-25
20:18:20 UTC (rev 1351)
@@ -1442,7 +1442,7 @@
org.jboss.dna.graph.Node persistentNode =
cache.store.getNodeAt(getLocation());
// Check the actual location ...
Location actualLocation = persistentNode.getLocation();
- if (!this.location.equals(actualLocation)) {
+ if (!this.location.isSame(actualLocation)) {
// The actual location is changed, so update it ...
this.location = actualLocation;
}
@@ -1452,7 +1452,7 @@
// Then read the node from the store ...
Subgraph subgraph =
cache.store.getSubgraphOfDepth(depth).at(getLocation());
Location actualLocation = subgraph.getLocation();
- if (!this.location.equals(actualLocation)) {
+ if (!this.location.isSame(actualLocation)) {
// The actual location is changed, so update it ...
this.location = actualLocation;
}
@@ -2708,7 +2708,7 @@
Node<Payload, PropertyPayload> that = (Node<Payload,
PropertyPayload>)obj;
if (this.isStale() || that.isStale()) return false;
if (!this.nodeId.equals(that.nodeId)) return false;
- return this.location.equals(that.location);
+ return this.location.isSame(that.location);
}
return false;
}
Modified: trunk/dna-graph/src/main/resources/org/jboss/dna/graph/GraphI18n.properties
===================================================================
--- trunk/dna-graph/src/main/resources/org/jboss/dna/graph/GraphI18n.properties 2009-11-25
18:15:33 UTC (rev 1350)
+++ trunk/dna-graph/src/main/resources/org/jboss/dna/graph/GraphI18n.properties 2009-11-25
20:18:20 UTC (rev 1351)
@@ -61,7 +61,7 @@
unableToCreateReferenceToNodeWithoutUuid = Unable to set a reference to node {0} since it
has no UUID
unableToCopyToLocationWithoutAPath = Unable to copy node "{0}" to
"{1}" since the desired location has no path
unableToCopyToTheRoot = Unable to copy node "{0}" to "{1}" since the
desired location is the root node
-actualLocationIsNotSameAsInputLocation = The actual location of {0} is not the same as
the current location of {1}
+actualLocationNotEqualToInputLocation = The actual location of {0} is not equal to the
current location of {1}
actualLocationIsNotChildOfInputLocation = The actual location of {0} is not a child of
the specified location {1}
actualLocationIsNotAtCorrectChildSegment = The last segment of the actual location of {0}
does not have the requested child segment {1}
actualLocationDoesNotHaveCorrectChildName = The last segment of the actual location of
{0} does not have the requested child name {1}
Modified: trunk/dna-graph/src/test/java/org/jboss/dna/graph/LocationTest.java
===================================================================
--- trunk/dna-graph/src/test/java/org/jboss/dna/graph/LocationTest.java 2009-11-25
18:15:33 UTC (rev 1350)
+++ trunk/dna-graph/src/test/java/org/jboss/dna/graph/LocationTest.java 2009-11-25
20:18:20 UTC (rev 1351)
@@ -128,11 +128,11 @@
}
@Test
- public void locationsWithSamePathsAndDifferentPropertyAreNotEqual() {
+ public void locationsWithSamePathsAndDifferentPropertyAreEqual() {
Location locationA1 = Location.create(pathA, propA);
Location locationA2 = Location.create(pathA, propB);
- assertThat("Locations created with identical paths and different property
must not be equal", locationA1, not(locationA2));
+ assertThat("Locations created with identical paths and different property
must not be equal", locationA1.equals(locationA2), is(true));
}
@Test
@@ -187,8 +187,8 @@
Location locationA2 = Location.create(pathA, propListABU);
assertThat("Locations created with identical paths and different properties
must not be equal",
- locationA1,
- not(locationA2));
+ locationA1.equals(locationA2),
+ is(true));
}
@Test
Modified:
trunk/dna-graph/src/test/java/org/jboss/dna/graph/connector/test/AbstractConnectorTest.java
===================================================================
---
trunk/dna-graph/src/test/java/org/jboss/dna/graph/connector/test/AbstractConnectorTest.java 2009-11-25
18:15:33 UTC (rev 1350)
+++
trunk/dna-graph/src/test/java/org/jboss/dna/graph/connector/test/AbstractConnectorTest.java 2009-11-25
20:18:20 UTC (rev 1351)
@@ -447,7 +447,7 @@
// Check the result has the correct location ...
assertThat("The node that was read doesn't have the expected
location",
- result.getLocation().isSame(location, true),
+ result.getLocation().equals(location),
is(true));
}
@@ -667,7 +667,7 @@
assertThat(subgraph2, is(notNullValue()));
// Shortcut ...
- if (subgraph1.getLocation().equals(subgraph2.getLocation())) return;
+ if (subgraph1.getLocation().isSame(subgraph2.getLocation())) return;
Path rootPath1 = subgraph1.getRoot().getLocation().getPath();
Path rootPath2 = subgraph2.getRoot().getLocation().getPath();
@@ -738,7 +738,7 @@
// Check the locations ...
Location location1 = node1.getLocation();
Location location2 = node2.getLocation();
- assertThat(location1.isSame(location2, true), is(true));
+ assertThat(location1.isSame(location2), is(true));
// Check the paths ...
assertThat(location1.getPath(), is(location2.getPath()));
Modified:
trunk/dna-graph/src/test/java/org/jboss/dna/graph/connector/test/ReadableConnectorTest.java
===================================================================
---
trunk/dna-graph/src/test/java/org/jboss/dna/graph/connector/test/ReadableConnectorTest.java 2009-11-25
18:15:33 UTC (rev 1350)
+++
trunk/dna-graph/src/test/java/org/jboss/dna/graph/connector/test/ReadableConnectorTest.java 2009-11-25
20:18:20 UTC (rev 1351)
@@ -93,7 +93,7 @@
Node root = graph.getNodeAt("/");
for (int i = 0; i != 10; ++i) {
Node anotherRoot = graph.getNodeAt("/");
- assertThat(anotherRoot.getLocation().equals(root.getLocation()), is(true));
+ assertThat(anotherRoot.getLocation().isSame(root.getLocation()), is(true));
assertThat(anotherRoot.getLocation().getPath(),
is(root.getLocation().getPath()));
assertThat(anotherRoot.getLocation().getIdProperties(),
is(root.getLocation().getIdProperties()));
}
@@ -117,7 +117,7 @@
}
// Find the root node using the identification properties ...
Node anotherRoot = graph.getNodeAt(firstProperty, additionalProperties);
- assertThat(anotherRoot.getLocation().equals(root.getLocation()), is(true));
+ assertThat(anotherRoot.getLocation().isSame(root.getLocation()), is(true));
assertThat(anotherRoot.getLocation().getPath(),
is(root.getLocation().getPath()));
assertThat(anotherRoot.getLocation().getIdProperties(),
is(root.getLocation().getIdProperties()));
}
@@ -131,7 +131,7 @@
if (uuid != null) {
// Find the root node using the identification properties ...
Node anotherRoot = graph.getNodeAt(uuid);
- assertThat(anotherRoot.getLocation().equals(root.getLocation()), is(true));
+ assertThat(anotherRoot.getLocation().isSame(root.getLocation()), is(true));
assertThat(anotherRoot.getLocation().getPath(),
is(root.getLocation().getPath()));
assertThat(anotherRoot.getLocation().getIdProperties(),
is(root.getLocation().getIdProperties()));
assertThat(anotherRoot.getLocation().getUuid(),
is(root.getLocation().getUuid()));
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-11-25 18:15:33
UTC (rev 1350)
+++ trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/AbstractJcrNode.java 2009-11-25 20:18:20
UTC (rev 1351)
@@ -1773,7 +1773,7 @@
if (obj instanceof AbstractJcrNode) {
AbstractJcrNode that = (AbstractJcrNode)obj;
if (this.cache != that.cache) return false;
- return this.location.equals(that.location);
+ return this.location.isSame(that.location);
}
return false;
}