DNA SVN: r1316 - in trunk: dna-integration-tests/src/test/java/org/jboss/dna/test/integration and 3 other directories.
by dna-commits@lists.jboss.org
Author: bcarothers
Date: 2009-10-30 17:34:28 -0400 (Fri, 30 Oct 2009)
New Revision: 1316
Modified:
trunk/dna-graph/src/test/java/org/jboss/dna/graph/connector/test/WritableConnectorTest.java
trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/JpaRepositoryTckTest.java
trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/DnaLexicon.java
trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/WorkspaceLockManager.java
trunk/dna-jcr/src/main/resources/org/jboss/dna/jcr/dna_builtins.cnd
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/basic/BasicRequestProcessor.java
Log:
DNA-518 JPA connector fails to properly clone or update from another workspace
The previous patch fixed the originally declared issue, but exposed a few regressions. The committed patch fixes most of those regressions and corrects a significant design flaw in the original locking implementation (using jcr:uuid to refer to another nodes uuid).
However, this patch does not correct two key defects. JCR imports (session and workspace) that include collisions with existing nodes that share a UUID will fail if the removeExisting flag is set to true. There is also a minor defect with moving locked nodes on this connector.
Since the original defect is addressed, this defect can be resolved and two new defects can be opened for the other regressions.
Modified: trunk/dna-graph/src/test/java/org/jboss/dna/graph/connector/test/WritableConnectorTest.java
===================================================================
--- trunk/dna-graph/src/test/java/org/jboss/dna/graph/connector/test/WritableConnectorTest.java 2009-10-29 21:25:06 UTC (rev 1315)
+++ trunk/dna-graph/src/test/java/org/jboss/dna/graph/connector/test/WritableConnectorTest.java 2009-10-30 21:34:28 UTC (rev 1316)
@@ -40,6 +40,7 @@
import org.jboss.dna.common.util.IoUtil;
import org.jboss.dna.graph.DnaLexicon;
import org.jboss.dna.graph.Graph;
+import org.jboss.dna.graph.JcrLexicon;
import org.jboss.dna.graph.Node;
import org.jboss.dna.graph.Subgraph;
import org.jboss.dna.graph.connector.RepositorySource;
@@ -1020,7 +1021,16 @@
}
private UUID uuidFor( Node node ) {
- return (UUID)node.getProperty(DnaLexicon.UUID).getFirstValue();
+ UUID uuid = null;
+ if (node.getLocation().getUuid() != null) {
+ uuid = node.getLocation().getUuid();
+ }
+
+ if (uuid == null && (node.getProperty(JcrLexicon.UUID) != null)) {
+ uuid = (UUID)node.getProperty(JcrLexicon.UUID).getFirstValue();
+ }
+
+ return uuid;
}
protected void assertReference( String fromNodePath,
Modified: trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/JpaRepositoryTckTest.java
===================================================================
--- trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/JpaRepositoryTckTest.java 2009-10-29 21:25:06 UTC (rev 1315)
+++ trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/JpaRepositoryTckTest.java 2009-10-30 21:34:28 UTC (rev 1316)
@@ -24,10 +24,147 @@
package org.jboss.dna.test.integration;
import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.apache.jackrabbit.test.api.AddNodeTest;
+import org.apache.jackrabbit.test.api.CheckPermissionTest;
+import org.apache.jackrabbit.test.api.ImpersonateTest;
+import org.apache.jackrabbit.test.api.NamespaceRegistryTest;
+import org.apache.jackrabbit.test.api.NodeAddMixinTest;
+import org.apache.jackrabbit.test.api.NodeCanAddMixinTest;
+import org.apache.jackrabbit.test.api.NodeItemIsModifiedTest;
+import org.apache.jackrabbit.test.api.NodeItemIsNewTest;
+import org.apache.jackrabbit.test.api.NodeOrderableChildNodesTest;
+import org.apache.jackrabbit.test.api.NodeRemoveMixinTest;
+import org.apache.jackrabbit.test.api.NodeTest;
+import org.apache.jackrabbit.test.api.PropertyItemIsModifiedTest;
+import org.apache.jackrabbit.test.api.PropertyItemIsNewTest;
+import org.apache.jackrabbit.test.api.PropertyTest;
+import org.apache.jackrabbit.test.api.RepositoryLoginTest;
+import org.apache.jackrabbit.test.api.SerializationTest;
+import org.apache.jackrabbit.test.api.SessionTest;
+import org.apache.jackrabbit.test.api.SetPropertyAssumeTypeTest;
+import org.apache.jackrabbit.test.api.SetPropertyBooleanTest;
+import org.apache.jackrabbit.test.api.SetPropertyCalendarTest;
+import org.apache.jackrabbit.test.api.SetPropertyConstraintViolationExceptionTest;
+import org.apache.jackrabbit.test.api.SetPropertyDoubleTest;
+import org.apache.jackrabbit.test.api.SetPropertyInputStreamTest;
+import org.apache.jackrabbit.test.api.SetPropertyLongTest;
+import org.apache.jackrabbit.test.api.SetPropertyNodeTest;
+import org.apache.jackrabbit.test.api.SetPropertyStringTest;
+import org.apache.jackrabbit.test.api.SetPropertyValueTest;
+import org.apache.jackrabbit.test.api.SetValueBinaryTest;
+import org.apache.jackrabbit.test.api.SetValueBooleanTest;
+import org.apache.jackrabbit.test.api.SetValueConstraintViolationExceptionTest;
+import org.apache.jackrabbit.test.api.SetValueDateTest;
+import org.apache.jackrabbit.test.api.SetValueDoubleTest;
+import org.apache.jackrabbit.test.api.SetValueLongTest;
+import org.apache.jackrabbit.test.api.SetValueReferenceTest;
+import org.apache.jackrabbit.test.api.SetValueStringTest;
+import org.apache.jackrabbit.test.api.SetValueValueFormatExceptionTest;
+import org.apache.jackrabbit.test.api.SetValueVersionExceptionTest;
+import org.apache.jackrabbit.test.api.ValueFactoryTest;
+import org.apache.jackrabbit.test.api.WorkspaceCloneReferenceableTest;
+import org.apache.jackrabbit.test.api.WorkspaceCloneSameNameSibsTest;
+import org.apache.jackrabbit.test.api.WorkspaceCloneTest;
+import org.apache.jackrabbit.test.api.WorkspaceCloneVersionableTest;
+import org.apache.jackrabbit.test.api.WorkspaceCopyBetweenWorkspacesReferenceableTest;
+import org.apache.jackrabbit.test.api.WorkspaceCopyBetweenWorkspacesSameNameSibsTest;
+import org.apache.jackrabbit.test.api.WorkspaceCopyBetweenWorkspacesTest;
+import org.apache.jackrabbit.test.api.WorkspaceCopyBetweenWorkspacesVersionableTest;
+import org.apache.jackrabbit.test.api.WorkspaceCopyReferenceableTest;
+import org.apache.jackrabbit.test.api.WorkspaceCopySameNameSibsTest;
+import org.apache.jackrabbit.test.api.WorkspaceCopyTest;
+import org.apache.jackrabbit.test.api.WorkspaceCopyVersionableTest;
+import org.apache.jackrabbit.test.api.WorkspaceMoveReferenceableTest;
+import org.apache.jackrabbit.test.api.WorkspaceMoveSameNameSibsTest;
+import org.apache.jackrabbit.test.api.WorkspaceMoveTest;
+import org.apache.jackrabbit.test.api.WorkspaceMoveVersionableTest;
public class JpaRepositoryTckTest {
public static Test suite() {
- return AbstractRepositoryTckTest.readWriteRepositorySuite("jpa");
+ TestSuite suite = AbstractRepositoryTckTest.readOnlyRepositorySuite("jpa");
+ suite.addTest(new LevelTwoFeatureTests());
+ // suite.addTest(org.apache.jackrabbit.test.api.lock.TestAll.suite());
+
+ return suite;
+
}
+
+ private static class LevelTwoFeatureTests extends TestSuite {
+ protected LevelTwoFeatureTests() {
+ super("JCR Level 2 API Tests");
+ // We currently don't pass the tests in those suites that are commented out
+ // See https://jira.jboss.org/jira/browse/DNA-285
+
+ // level 2 tests
+ addTestSuite(AddNodeTest.class);
+ addTestSuite(NamespaceRegistryTest.class);
+ // addTestSuite(ReferencesTest.class);
+ addTestSuite(SessionTest.class);
+ // addTestSuite(SessionUUIDTest.class);
+ addTestSuite(NodeTest.class);
+ // addTestSuite(NodeUUIDTest.class);
+ addTestSuite(NodeOrderableChildNodesTest.class);
+ addTestSuite(PropertyTest.class);
+
+ addTestSuite(SetValueBinaryTest.class);
+ addTestSuite(SetValueBooleanTest.class);
+ addTestSuite(SetValueDateTest.class);
+ addTestSuite(SetValueDoubleTest.class);
+ addTestSuite(SetValueLongTest.class);
+ addTestSuite(SetValueReferenceTest.class);
+ addTestSuite(SetValueStringTest.class);
+ addTestSuite(SetValueConstraintViolationExceptionTest.class);
+ addTestSuite(SetValueValueFormatExceptionTest.class);
+ addTestSuite(SetValueVersionExceptionTest.class);
+
+ addTestSuite(SetPropertyBooleanTest.class);
+ addTestSuite(SetPropertyCalendarTest.class);
+ addTestSuite(SetPropertyDoubleTest.class);
+ addTestSuite(SetPropertyInputStreamTest.class);
+ addTestSuite(SetPropertyLongTest.class);
+ addTestSuite(SetPropertyNodeTest.class);
+ addTestSuite(SetPropertyStringTest.class);
+ addTestSuite(SetPropertyValueTest.class);
+ addTestSuite(SetPropertyConstraintViolationExceptionTest.class);
+ addTestSuite(SetPropertyAssumeTypeTest.class);
+
+ addTestSuite(NodeItemIsModifiedTest.class);
+ addTestSuite(NodeItemIsNewTest.class);
+ addTestSuite(PropertyItemIsModifiedTest.class);
+ addTestSuite(PropertyItemIsNewTest.class);
+
+ addTestSuite(NodeAddMixinTest.class);
+ addTestSuite(NodeCanAddMixinTest.class);
+ addTestSuite(NodeRemoveMixinTest.class);
+
+ addTestSuite(WorkspaceCloneReferenceableTest.class);
+ addTestSuite(WorkspaceCloneSameNameSibsTest.class);
+ addTestSuite(WorkspaceCloneTest.class);
+ addTestSuite(WorkspaceCloneVersionableTest.class);
+ addTestSuite(WorkspaceCopyBetweenWorkspacesReferenceableTest.class);
+ addTestSuite(WorkspaceCopyBetweenWorkspacesSameNameSibsTest.class);
+ addTestSuite(WorkspaceCopyBetweenWorkspacesTest.class);
+ addTestSuite(WorkspaceCopyBetweenWorkspacesVersionableTest.class);
+ addTestSuite(WorkspaceCopyReferenceableTest.class);
+ addTestSuite(WorkspaceCopySameNameSibsTest.class);
+ addTestSuite(WorkspaceCopyTest.class);
+ addTestSuite(WorkspaceCopyVersionableTest.class);
+ addTestSuite(WorkspaceMoveReferenceableTest.class);
+ addTestSuite(WorkspaceMoveSameNameSibsTest.class);
+ addTestSuite(WorkspaceMoveTest.class);
+ addTestSuite(WorkspaceMoveVersionableTest.class);
+
+ addTestSuite(RepositoryLoginTest.class);
+ addTestSuite(ImpersonateTest.class);
+ addTestSuite(CheckPermissionTest.class);
+
+ // addTestSuite(DocumentViewImportTest.class);
+ addTestSuite(SerializationTest.class);
+
+ addTestSuite(ValueFactoryTest.class);
+ }
+ }
+
}
Modified: trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/DnaLexicon.java
===================================================================
--- trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/DnaLexicon.java 2009-10-29 21:25:06 UTC (rev 1315)
+++ trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/DnaLexicon.java 2009-10-30 21:34:28 UTC (rev 1316)
@@ -37,7 +37,7 @@
public static final Name IS_HELD_BY_SESSION = new BasicName(Namespace.URI, "isHeldBySession");
public static final Name IS_SESSION_SCOPED = new BasicName(Namespace.URI, "isSessionScoped");
public static final Name LOCK = new BasicName(Namespace.URI, "lock");
- public static final Name LOCKED_NODE = new BasicName(Namespace.URI, "lockedNode");
+ public static final Name LOCKED_UUID = new BasicName(Namespace.URI, "lockedUuid");
public static final Name LOCKS = new BasicName(Namespace.URI, "locks");
public static final Name NAMESPACE = new BasicName(Namespace.URI, "namespace");
public static final Name NODE_TYPES = new BasicName(Namespace.URI, "nodeTypes");
Modified: trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/WorkspaceLockManager.java
===================================================================
--- trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/WorkspaceLockManager.java 2009-10-29 21:25:06 UTC (rev 1315)
+++ trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/WorkspaceLockManager.java 2009-10-30 21:34:28 UTC (rev 1316)
@@ -94,9 +94,8 @@
batch.create(pathFactory.create(locksPath, pathFactory.createSegment(lockUuid.toString())),
propFactory.create(JcrLexicon.PRIMARY_TYPE, DnaLexicon.LOCK),
- propFactory.create(JcrLexicon.UUID, nodeUuid.toString()),
propFactory.create(DnaLexicon.WORKSPACE, workspaceName),
- propFactory.create(DnaLexicon.LOCKED_NODE, nodeUuid.toString()),
+ propFactory.create(DnaLexicon.LOCKED_UUID, nodeUuid.toString()),
propFactory.create(DnaLexicon.IS_SESSION_SCOPED, isSessionScoped),
// This gets set after the lock succeeds and the lock token gets added to the session
propFactory.create(DnaLexicon.IS_HELD_BY_SESSION, false),
Modified: trunk/dna-jcr/src/main/resources/org/jboss/dna/jcr/dna_builtins.cnd
===================================================================
--- trunk/dna-jcr/src/main/resources/org/jboss/dna/jcr/dna_builtins.cnd 2009-10-29 21:25:06 UTC (rev 1315)
+++ trunk/dna-jcr/src/main/resources/org/jboss/dna/jcr/dna_builtins.cnd 2009-10-30 21:34:28 UTC (rev 1316)
@@ -44,9 +44,8 @@
+ * (nt:nodeType) = nt:nodeType protected version
[dna:lock] > nt:base
-- dna:lockedNode (string) protected ignore
+- dna:lockedUuid (string) protected ignore
- jcr:lockOwner (string) protected ignore
-- jcr:uuid (string) protected ignore
- dna:sessionScope (boolean) protected ignore
- jcr:isDeep (boolean) protected ignore
- dna:isHeldBySession (boolean) protected ignore
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-10-29 21:25:06 UTC (rev 1315)
+++ trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/model/basic/BasicRequestProcessor.java 2009-10-30 21:34:28 UTC (rev 1316)
@@ -228,6 +228,16 @@
}
}
+ if (uuid == null) {
+ for (Property property : request.properties()) {
+ if (property.getName().equals(JcrLexicon.UUID)) {
+ uuid = uuidFactory.create(property.getFirstValue());
+ uuidString = stringFactory.create(property.getFirstValue());
+ break;
+ }
+ }
+ }
+
switch (request.conflictBehavior()) {
case DO_NOT_REPLACE:
case UPDATE:
@@ -1154,7 +1164,7 @@
Name desiredName,
Path.Segment desiredSegment,
Map<String, String> oldUuidsToNewUuids,
- Map<String, ChildEntity> addedLocations,
+ Map<Location, ChildEntity> addedLocations,
Map<String, Location> deletedLocations ) {
assert fromWorkspace != null;
assert intoWorkspace != null;
@@ -1186,9 +1196,12 @@
case REPLACE_EXISTING_NODE:
try {
if (desiredSegment != null) {
- existingLocation = getActualLocation(intoWorkspace,
- Location.create(pathFactory.create(actualNewParent.location.getPath(),
- desiredSegment)));
+ Location nLocation = Location.create(pathFactory.create(actualNewParent.location.getPath(),
+ desiredSegment));
+ existingLocation = getActualLocation(intoWorkspace, nLocation);
+ nLocation = Location.create(nLocation.getPath(), UUID.fromString(existingLocation.uuid));
+ assert nLocation.getUuid() != null;
+ deletedLocations.putAll(computeDeletedLocations(intoWorkspace, nLocation, true));
newUuid = existingLocation.childEntity.getId().getChildUuidString();
} else {
@@ -1225,11 +1238,12 @@
} else {
// Now add the new copy of the original ...
boolean allowSnS = original.getAllowsSameNameChildren();
+ if (desiredName == null) desiredName = desiredSegment.getName();
newLocation = addNewChild(intoWorkspace.getId(), actualNewParent, newUuid, desiredName, allowSnS);
}
assert newLocation != null;
- addedLocations.put(newLocation.uuid, newLocation.childEntity);
+ addedLocations.put(newLocation.location, newLocation.childEntity);
return newLocation;
}
@@ -1278,7 +1292,7 @@
// Walk through the original nodes, creating new ChildEntity object (i.e., copy) for each original ...
List<ChildEntity> originalNodes = query.getNodes(true, true);
Iterator<ChildEntity> originalIter = originalNodes.iterator();
- Map<String, ChildEntity> addedLocations = new HashMap<String, ChildEntity>();
+ Map<Location, ChildEntity> addedLocations = new HashMap<Location, ChildEntity>();
Map<String, Location> deletedLocations = new HashMap<String, Location>();
// Start with the original (top-level) node first, since we need to add it to the list of children ...
@@ -1475,7 +1489,7 @@
// Walk through the original nodes, creating new ChildEntity object (i.e., copy) for each original ...
List<ChildEntity> originalNodes = query.getNodes(true, true);
Iterator<ChildEntity> originalIter = originalNodes.iterator();
- Map<String, ChildEntity> addedLocations = new HashMap<String, ChildEntity>();
+ Map<Location, ChildEntity> addedLocations = new HashMap<Location, ChildEntity>();
Map<String, Location> deletedLocations = new HashMap<String, Location>();
// Start with the original (top-level) node first, since we need to add it to the list of children ...
@@ -1618,17 +1632,18 @@
* Now we need to clean up any nodes that were descendants of the old copies of the
* nodes but are not descendants of the new copies.
*/
- deletedLocations.keySet().removeAll(addedLocations.keySet());
+ Map<String, Location> netDeletedLocations = new HashMap<String, Location>(deletedLocations);
+ netDeletedLocations.values().removeAll(addedLocations.keySet());
- if (deletedLocations.size() > 0) {
+ if (netDeletedLocations.size() > 0) {
// Verify referential integrity: that none of the deleted nodes are referenced by nodes not being deleted.
List<ReferenceEntity> invalidReferences = ReferenceEntity.getReferencesToUuids(intoWorkspace.getId(),
- deletedLocations.keySet(),
+ netDeletedLocations.keySet(),
entities);
for (Iterator<ReferenceEntity> iter = invalidReferences.iterator(); iter.hasNext();) {
ReferenceEntity invalidRef = iter.next();
- if (deletedLocations.keySet().contains(invalidRef.getId().getFromUuidString())) {
+ if (netDeletedLocations.keySet().contains(invalidRef.getId().getFromUuidString())) {
iter.remove();
}
}
@@ -1657,14 +1672,21 @@
/*
* This list of values that were deleted is expected to be fairly small
*/
- for (Location location : deletedLocations.values()) {
+ for (Location location : netDeletedLocations.values()) {
ActualLocation node = getActualLocation(intoWorkspace, location);
- entities.remove(node.childEntity);
+ ChildEntity entity = node.childEntity;
+
+ if (entity != null) {
+ entities.remove(node.childEntity);
+ }
PropertiesEntity.deletePropertiesFor(intoWorkspace.getId(), node.uuid, entities);
}
// Remove from the cache of children locations all entries for deleted nodes ...
- cache.removeBranch(intoWorkspaceId, deletedLocations.values());
+ cache.removeBranch(intoWorkspaceId, netDeletedLocations.values());
+ }
+
+ if (!deletedLocations.isEmpty()) {
removedLocations = Collections.unmodifiableSet(new HashSet<Location>(deletedLocations.values()));
}
LargeValueEntity.deleteUnused(entities);
@@ -2077,6 +2099,11 @@
Location fromLocation = request.from();
ActualLocation actualLocation = getActualLocation(workspace, fromLocation);
+ if (actualLocation.childEntity == null) {
+ actualLocation = new ActualLocation(actualLocation.location, actualLocation.uuid, findNode(workspaceId,
+ actualLocation.uuid));
+ }
+
actualOldLocation = actualLocation.location;
Path oldPath = actualOldLocation.getPath();
14 years, 6 months
DNA SVN: r1315 - trunk/dna-graph/src/main/java/org/jboss/dna/graph/observe.
by dna-commits@lists.jboss.org
Author: rhauch
Date: 2009-10-29 17:25:06 -0400 (Thu, 29 Oct 2009)
New Revision: 1315
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/observe/NetChangeObserver.java
Log:
DNA-456 Corrected behavior of NetChangeObserver and how it records lock and unlock state in the NetChange objects
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-10-28 19:27:45 UTC (rev 1314)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/observe/NetChangeObserver.java 2009-10-29 21:25:06 UTC (rev 1315)
@@ -63,7 +63,9 @@
NODE_REMOVED,
PROPERTY_ADDED,
PROPERTY_REMOVED,
- PROPERTY_CHANGED;
+ PROPERTY_CHANGED,
+ NODE_LOCKED,
+ NODE_UNLOCKED;
}
protected NetChangeObserver() {
@@ -350,7 +352,6 @@
}
private enum LockAction {
- NO_CHANGE,
LOCKED,
UNLOCKED;
}
@@ -364,7 +365,6 @@
private final Set<Property> modifiedProperties = new HashSet<Property>();
private final Set<Name> removedProperties = new HashSet<Name>();
private EnumSet<ChangeType> eventTypes = EnumSet.noneOf(ChangeType.class);
- private LockAction lockAction = LockAction.NO_CHANGE;
protected NetChangeDetails() {
}
@@ -372,15 +372,16 @@
public void setLockAction( LockAction lockAction ) {
switch (lockAction) {
case LOCKED:
- // always mark as locked
- this.lockAction = lockAction;
+ // always mark as locked and remove any unlocked state
+ eventTypes.add(ChangeType.NODE_LOCKED);
+ eventTypes.remove(ChangeType.NODE_UNLOCKED);
break;
case UNLOCKED:
- // mark as unlock or unchanged if previously locked ...
- this.lockAction = this.lockAction == LockAction.LOCKED ? LockAction.UNLOCKED : lockAction;
+ if (!eventTypes.remove(ChangeType.NODE_LOCKED)) {
+ // It was not previously locked by this change set, so we should unlock it ...
+ eventTypes.add(ChangeType.NODE_UNLOCKED);
+ }
break;
- case NO_CHANGE:
- break;
}
}
@@ -404,13 +405,6 @@
}
/**
- * @return lockAction
- */
- public LockAction getLockAction() {
- return lockAction;
- }
-
- /**
* @return nodeAction
*/
public EnumSet<ChangeType> getEventTypes() {
14 years, 6 months
DNA SVN: r1314 - trunk.
by dna-commits@lists.jboss.org
Author: steve.jacobs
Date: 2009-10-28 15:27:45 -0400 (Wed, 28 Oct 2009)
New Revision: 1314
Modified:
trunk/.gitignore
Log:
added Eclipse bin directory to the .gitignore file
Modified: trunk/.gitignore
===================================================================
--- trunk/.gitignore 2009-10-28 14:43:17 UTC (rev 1313)
+++ trunk/.gitignore 2009-10-28 19:27:45 UTC (rev 1314)
@@ -62,3 +62,5 @@
/extensions/dna-sequencer-msoffice/target
/extensions/dna-sequencer-xml/target
/extensions/dna-sequencer-zip/target
+
+/tools/org.jboss.dna.eclipse.jcr.rest.client/bin
14 years, 6 months
DNA SVN: r1313 - in trunk: dna-graph/src/main/java/org/jboss/dna/graph/request/processor and 3 other directories.
by dna-commits@lists.jboss.org
Author: rhauch
Date: 2009-10-28 10:43:17 -0400 (Wed, 28 Oct 2009)
New Revision: 1313
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/observe/Changes.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/observe/NetChangeObserver.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/processor/RequestProcessor.java
trunk/dna-repository/src/main/java/org/jboss/dna/repository/RepositoryService.java
trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencer/SequencingService.java
trunk/dna-repository/src/test/java/org/jboss/dna/repository/sequencer/StreamSequencerAdapterTest.java
Log:
DNA-456 Changed the NetChangeObserver functionality so that there is a NetChanges object that corresponds to the Changes object, where the NetChanges contains all of the individual NetChange objects corresponding to the ChangeRequest objects in the Changes object. This means that we still keep the notion of atomic set of changes.
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/observe/Changes.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/observe/Changes.java 2009-10-28 00:41:28 UTC (rev 1312)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/observe/Changes.java 2009-10-28 14:43:17 UTC (rev 1313)
@@ -24,7 +24,7 @@
package org.jboss.dna.graph.observe;
import java.io.Serializable;
-import java.util.Iterator;
+import java.util.Collections;
import java.util.List;
import net.jcip.annotations.Immutable;
import org.jboss.dna.graph.SecurityContext;
@@ -35,15 +35,15 @@
* A set of changes that were made atomically. Each change is in the form of a frozen {@link ChangeRequest}.
*/
@Immutable
-public final class Changes implements Iterable<ChangeRequest>, Comparable<Changes>, Serializable {
+public class Changes implements Comparable<Changes>, Serializable {
private static final long serialVersionUID = 1L;
- private final String processId;
- private final String userName;
- private final String sourceName;
- private final DateTime timestamp;
- private final List<ChangeRequest> changeRequests;
+ protected final String processId;
+ protected final String userName;
+ protected final String sourceName;
+ protected final DateTime timestamp;
+ protected final List<ChangeRequest> changeRequests;
public Changes( String userName,
String sourceName,
@@ -57,13 +57,33 @@
String sourceName,
DateTime timestamp,
List<ChangeRequest> requests ) {
+ assert requests != null;
+ assert !requests.isEmpty();
this.userName = userName;
this.sourceName = sourceName;
this.timestamp = timestamp;
- this.changeRequests = requests;
+ this.changeRequests = Collections.unmodifiableList(requests);
this.processId = processId != null ? processId : "";
+ assert this.userName != null;
+ assert this.sourceName != null;
+ assert this.timestamp != null;
+ assert this.changeRequests != null;
+ assert this.processId != null;
}
+ protected Changes( Changes changes ) {
+ this.userName = changes.userName;
+ this.sourceName = changes.sourceName;
+ this.timestamp = changes.timestamp;
+ this.changeRequests = changes.changeRequests;
+ this.processId = changes.processId;
+ assert this.userName != null;
+ assert this.sourceName != null;
+ assert this.timestamp != null;
+ assert this.changeRequests != null;
+ assert this.processId != null;
+ }
+
/**
* Get the user that made these changes.
*
@@ -102,12 +122,12 @@
}
/**
- * {@inheritDoc}
+ * Get the list of changes.
*
- * @see java.lang.Iterable#iterator()
+ * @return the immutable list of change requests; never null and never empty
*/
- public Iterator<ChangeRequest> iterator() {
- return this.changeRequests.iterator();
+ public List<ChangeRequest> getChangeRequests() {
+ return changeRequests;
}
/**
@@ -148,4 +168,18 @@
}
return false;
}
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ if (processId.length() != 0) {
+ return getTimestamp() + " @" + getUserName() + " [" + getSourceName() + "] - " + changeRequests.size() + " events";
+ }
+ return getTimestamp() + " @" + getUserName() + " #" + getProcessId() + " [" + getSourceName() + "] - "
+ + changeRequests.size() + " events";
+ }
}
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-10-28 00:41:28 UTC (rev 1312)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/observe/NetChangeObserver.java 2009-10-28 14:43:17 UTC (rev 1313)
@@ -27,6 +27,8 @@
import java.util.EnumSet;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
@@ -42,8 +44,10 @@
import org.jboss.dna.graph.request.CreateNodeRequest;
import org.jboss.dna.graph.request.DeleteBranchRequest;
import org.jboss.dna.graph.request.DeleteChildrenRequest;
+import org.jboss.dna.graph.request.LockBranchRequest;
import org.jboss.dna.graph.request.RemovePropertyRequest;
import org.jboss.dna.graph.request.SetPropertyRequest;
+import org.jboss.dna.graph.request.UnlockBranchRequest;
import org.jboss.dna.graph.request.UpdatePropertiesRequest;
/**
@@ -74,7 +78,7 @@
public void notify( Changes changes ) {
Map<String, Map<Location, NetChangeDetails>> detailsByLocationByWorkspace = new HashMap<String, Map<Location, NetChangeDetails>>();
// Process each of the events, extracting the node path and property details for each ...
- for (ChangeRequest change : changes) {
+ for (ChangeRequest change : changes.getChangeRequests()) {
Location location = change.changedLocation();
String workspace = change.changedWorkspace();
@@ -129,37 +133,84 @@
}
childDetails.addEventType(ChangeType.NODE_REMOVED);
}
+ } else if (change instanceof LockBranchRequest) {
+ details.setLockAction(LockAction.LOCKED);
+ } else if (change instanceof UnlockBranchRequest) {
+ details.setLockAction(LockAction.UNLOCKED);
}
}
// Walk through the net changes ...
- String sourceName = changes.getSourceName();
+ List<NetChange> netChanges = new LinkedList<NetChange>();
for (Map.Entry<String, Map<Location, NetChangeDetails>> byWorkspaceEntry : detailsByLocationByWorkspace.entrySet()) {
String workspaceName = byWorkspaceEntry.getKey();
// Iterate over the entries. Since we've used a TreeSet, we'll get these with the lower paths first ...
for (Map.Entry<Location, NetChangeDetails> entry : byWorkspaceEntry.getValue().entrySet()) {
Location location = entry.getKey();
NetChangeDetails details = entry.getValue();
- notify(new NetChange(sourceName, workspaceName, location, details.getEventTypes(),
- details.getModifiedProperties(), details.getRemovedProperties()));
+ netChanges.add(new NetChange(workspaceName, location, details.getEventTypes(), details.getModifiedProperties(),
+ details.getRemovedProperties()));
}
}
+ // Now notify of all of the changes ...
+ notify(new NetChanges(changes, netChanges));
}
/**
- * Method that is called for each net change.
+ * Method that is called for the set of net changes.
*
- * @param change the net change; never null
+ * @param netChanges the net changes; never null
*/
- protected abstract void notify( NetChange change );
+ protected abstract void notify( NetChanges netChanges );
/**
+ * A set of net changes that were made atomically. Each change is in the form of a frozen {@link ChangeRequest}, and the net
+ * change is in the form.
+ */
+ @Immutable
+ public static final class NetChanges extends Changes {
+ private static final long serialVersionUID = 1L;
+
+ private final List<NetChange> netChanges;
+
+ public NetChanges( Changes changes,
+ List<NetChange> netChanges ) {
+ super(changes);
+ assert netChanges != null;
+ assert !netChanges.isEmpty();
+ this.netChanges = Collections.unmodifiableList(netChanges);
+ }
+
+ /**
+ * Get the list of net changes.
+ *
+ * @return the immutable list of net changes; never null and never empty
+ */
+ public List<NetChange> getNetChanges() {
+ return this.netChanges;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ if (processId.length() != 0) {
+ return getTimestamp() + " @" + getUserName() + " [" + getSourceName() + "] - " + netChanges.size() + " changes";
+ }
+ return getTimestamp() + " @" + getUserName() + " #" + getProcessId() + " [" + getSourceName() + "] - "
+ + netChanges.size() + " changes";
+ }
+ }
+
+ /**
* A notification of changes to a node.
*/
@Immutable
- public static class NetChange {
+ public static final class NetChange {
- private final String sourceName;
private final String workspaceName;
private final Location location;
private final EnumSet<ChangeType> eventTypes;
@@ -167,16 +218,13 @@
private final Set<Name> removedProperties;
private final int hc;
- public NetChange( String sourceName,
- String workspaceName,
+ public NetChange( String workspaceName,
Location location,
EnumSet<ChangeType> eventTypes,
Set<Property> modifiedProperties,
Set<Name> removedProperties ) {
- assert sourceName != null;
assert workspaceName != null;
assert location != null;
- this.sourceName = sourceName;
this.workspaceName = workspaceName;
this.location = location;
this.hc = HashCode.compute(this.workspaceName, this.location);
@@ -195,13 +243,6 @@
}
/**
- * @return repositorySourceName
- */
- public String getRepositorySourceName() {
- return this.sourceName;
- }
-
- /**
* @return repositoryWorkspaceName
*/
public String getRepositoryWorkspaceName() {
@@ -308,6 +349,12 @@
}
}
+ private enum LockAction {
+ NO_CHANGE,
+ LOCKED,
+ UNLOCKED;
+ }
+
/**
* Internal utility class used in the computation of the net changes.
*/
@@ -317,10 +364,26 @@
private final Set<Property> modifiedProperties = new HashSet<Property>();
private final Set<Name> removedProperties = new HashSet<Name>();
private EnumSet<ChangeType> eventTypes = EnumSet.noneOf(ChangeType.class);
+ private LockAction lockAction = LockAction.NO_CHANGE;
protected NetChangeDetails() {
}
+ public void setLockAction( LockAction lockAction ) {
+ switch (lockAction) {
+ case LOCKED:
+ // always mark as locked
+ this.lockAction = lockAction;
+ break;
+ case UNLOCKED:
+ // mark as unlock or unchanged if previously locked ...
+ this.lockAction = this.lockAction == LockAction.LOCKED ? LockAction.UNLOCKED : lockAction;
+ break;
+ case NO_CHANGE:
+ break;
+ }
+ }
+
public void addEventType( ChangeType eventType ) {
this.eventTypes.add(eventType);
}
@@ -341,6 +404,13 @@
}
/**
+ * @return lockAction
+ */
+ public LockAction getLockAction() {
+ return lockAction;
+ }
+
+ /**
* @return nodeAction
*/
public EnumSet<ChangeType> getEventTypes() {
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-10-28 00:41:28 UTC (rev 1312)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/processor/RequestProcessor.java 2009-10-28 14:43:17 UTC (rev 1313)
@@ -847,6 +847,7 @@
// Publish any changes ...
if (observer != null && !this.changes.isEmpty()) {
String userName = context.getSecurityContext() != null ? context.getSecurityContext().getUserName() : null;
+ if (userName == null) userName = "";
Changes changes = new Changes(userName, getSourceName(), getNowInUtc(), this.changes);
observer.notify(changes);
}
Modified: trunk/dna-repository/src/main/java/org/jboss/dna/repository/RepositoryService.java
===================================================================
--- trunk/dna-repository/src/main/java/org/jboss/dna/repository/RepositoryService.java 2009-10-28 00:41:28 UTC (rev 1312)
+++ trunk/dna-repository/src/main/java/org/jboss/dna/repository/RepositoryService.java 2009-10-28 14:43:17 UTC (rev 1313)
@@ -446,44 +446,47 @@
}
protected class ConfigurationChangeObserver extends NetChangeObserver {
+
/**
* {@inheritDoc}
*
- * @see org.jboss.dna.graph.observe.NetChangeObserver#notify(org.jboss.dna.graph.observe.NetChangeObserver.NetChange)
+ * @see org.jboss.dna.graph.observe.NetChangeObserver#notify(org.jboss.dna.graph.observe.NetChangeObserver.NetChanges)
*/
@Override
- protected void notify( NetChange change ) {
- if (!getConfigurationSourceName().equals(change.getRepositorySourceName())) return;
- if (!getConfigurationWorkspaceName().equals(change.getRepositoryWorkspaceName())) return;
- Path changedPath = change.getPath();
- Path configPath = getPathToConfigurationRoot();
- if (!changedPath.isAtOrBelow(getPathToConfigurationRoot())) return;
- boolean changedNodeIsPotentiallySource = configPath.size() + 1 == changedPath.size();
+ protected void notify( NetChanges netChanges ) {
+ if (!getConfigurationSourceName().equals(netChanges.getSourceName())) return;
+ for (NetChange change : netChanges.getNetChanges()) {
+ if (!getConfigurationWorkspaceName().equals(change.getRepositoryWorkspaceName())) return;
+ Path changedPath = change.getPath();
+ Path configPath = getPathToConfigurationRoot();
+ if (!changedPath.isAtOrBelow(getPathToConfigurationRoot())) return;
+ boolean changedNodeIsPotentiallySource = configPath.size() + 1 == changedPath.size();
- // At this point, we know that something inside the configuration changed, so figure out what happened ...
- if (changedNodeIsPotentiallySource && change.includes(ChangeType.NODE_REMOVED)) {
- // Then potentially a source with the supplied name has been removed ...
- String sourceName = changedPath.getLastSegment().getName().getLocalName();
- getRepositoryLibrary().removeSource(sourceName);
- } else {
- // The add/change/remove is either at or below a source, so try to create a new source for it ...
- Path sourcePath = changedNodeIsPotentiallySource ? changedPath : changedPath.subpath(0, configPath.size() + 1);
- Problems problems = new SimpleProblems();
- // Now read the node and create the source ...
- Graph graph = Graph.create(getConfigurationSourceName(), getRepositoryLibrary(), getExecutionEnvironment());
- try {
- String workspaceName = getConfigurationWorkspaceName();
- if (workspaceName != null) graph.useWorkspace(workspaceName);
- Map<Name, Property> properties = graph.getPropertiesByName().on(sourcePath);
- RepositorySource source = createRepositorySource(sourcePath, properties, problems);
- if (source != null) {
- // It was the config for a source, so try to add or replace an existing source ...
- getRepositoryLibrary().addSource(source, true);
- }
- } catch (PathNotFoundException e) {
- // No source was found, and this is okay (since it may just been deleted)...
+ // At this point, we know that something inside the configuration changed, so figure out what happened ...
+ if (changedNodeIsPotentiallySource && change.includes(ChangeType.NODE_REMOVED)) {
+ // Then potentially a source with the supplied name has been removed ...
String sourceName = changedPath.getLastSegment().getName().getLocalName();
getRepositoryLibrary().removeSource(sourceName);
+ } else {
+ // The add/change/remove is either at or below a source, so try to create a new source for it ...
+ Path sourcePath = changedNodeIsPotentiallySource ? changedPath : changedPath.subpath(0, configPath.size() + 1);
+ Problems problems = new SimpleProblems();
+ // Now read the node and create the source ...
+ Graph graph = Graph.create(getConfigurationSourceName(), getRepositoryLibrary(), getExecutionEnvironment());
+ try {
+ String workspaceName = getConfigurationWorkspaceName();
+ if (workspaceName != null) graph.useWorkspace(workspaceName);
+ Map<Name, Property> properties = graph.getPropertiesByName().on(sourcePath);
+ RepositorySource source = createRepositorySource(sourcePath, properties, problems);
+ if (source != null) {
+ // It was the config for a source, so try to add or replace an existing source ...
+ getRepositoryLibrary().addSource(source, true);
+ }
+ } catch (PathNotFoundException e) {
+ // No source was found, and this is okay (since it may just been deleted)...
+ String sourceName = changedPath.getLastSegment().getName().getLocalName();
+ getRepositoryLibrary().removeSource(sourceName);
+ }
}
}
}
Modified: trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencer/SequencingService.java
===================================================================
--- trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencer/SequencingService.java 2009-10-28 00:41:28 UTC (rev 1312)
+++ trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencer/SequencingService.java 2009-10-28 14:43:17 UTC (rev 1313)
@@ -23,9 +23,9 @@
*/
package org.jboss.dna.repository.sequencer;
-import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -49,7 +49,9 @@
import org.jboss.dna.graph.connector.RepositorySource;
import org.jboss.dna.graph.observe.ChangeObserver;
import org.jboss.dna.graph.observe.NetChangeObserver;
+import org.jboss.dna.graph.observe.NetChangeObserver.ChangeType;
import org.jboss.dna.graph.observe.NetChangeObserver.NetChange;
+import org.jboss.dna.graph.observe.NetChangeObserver.NetChanges;
import org.jboss.dna.graph.property.Name;
import org.jboss.dna.graph.property.Path;
import org.jboss.dna.graph.property.Property;
@@ -388,95 +390,103 @@
* Do the work of processing by sequencing the node. This method is called by the {@link #executorService executor service}
* when it performs it's work on the enqueued {@link NetChange NetChange runnable objects}.
*
- * @param change the change describing the node to be processed.
+ * @param changes the change describing the node to be processed.
*/
- protected void processChange( NetChange change ) {
+ protected void processChange( NetChanges changes ) {
final ExecutionContext context = this.getExecutionContext();
final Logger logger = context.getLogger(getClass());
assert logger != null;
try {
- final String repositorySourceName = change.getRepositorySourceName();
- final String repositoryWorkspaceName = change.getRepositoryWorkspaceName();
+ List<Sequencer> allSequencers = null;
+ final String repositorySourceName = changes.getSourceName();
+ for (NetChange change : changes.getNetChanges()) {
+ // Go through each net change, and only process node/property adds and property changes ...
+ if (change.includes(ChangeType.NODE_ADDED, ChangeType.PROPERTY_ADDED, ChangeType.PROPERTY_CHANGED)) {
+ final String repositoryWorkspaceName = change.getRepositoryWorkspaceName();
- // Figure out which sequencers accept this path,
- // and track which output nodes should be passed to each sequencer...
- final Path nodePath = change.getPath();
- final String nodePathStr = context.getValueFactories().getStringFactory().create(nodePath);
- Map<SequencerCall, Set<RepositoryNodePath>> sequencerCalls = new HashMap<SequencerCall, Set<RepositoryNodePath>>();
- List<Sequencer> allSequencers = this.sequencerLibrary.getInstances();
- List<Sequencer> sequencers = new ArrayList<Sequencer>(allSequencers.size());
- for (Sequencer sequencer : allSequencers) {
- final SequencerConfig config = sequencer.getConfiguration();
- for (SequencerPathExpression pathExpression : config.getPathExpressions()) {
- for (Property property : change.getModifiedProperties()) {
- Name propertyName = property.getName();
- String propertyNameStr = context.getValueFactories().getStringFactory().create(propertyName);
- String path = nodePathStr + "/@" + propertyNameStr;
- SequencerPathExpression.Matcher matcher = pathExpression.matcher(path);
- if (matcher.matches()) {
- // String selectedPath = matcher.getSelectedPath();
- RepositoryNodePath outputPath = RepositoryNodePath.parse(matcher.getOutputPath(),
- repositorySourceName,
- repositoryWorkspaceName);
- SequencerCall call = new SequencerCall(sequencer, propertyNameStr);
- // Record the output path ...
- Set<RepositoryNodePath> outputPaths = sequencerCalls.get(call);
- if (outputPaths == null) {
- outputPaths = new HashSet<RepositoryNodePath>();
- sequencerCalls.put(call, outputPaths);
+ // Figure out which sequencers accept this path,
+ // and track which output nodes should be passed to each sequencer...
+ final Path nodePath = change.getPath();
+ final String nodePathStr = context.getValueFactories().getStringFactory().create(nodePath);
+ Map<SequencerCall, Set<RepositoryNodePath>> sequencerCalls = new HashMap<SequencerCall, Set<RepositoryNodePath>>();
+ if (allSequencers == null) {
+ allSequencers = this.sequencerLibrary.getInstances();
+ }
+ List<Sequencer> sequencers = new LinkedList<Sequencer>();
+ for (Sequencer sequencer : allSequencers) {
+ final SequencerConfig config = sequencer.getConfiguration();
+ for (SequencerPathExpression pathExpression : config.getPathExpressions()) {
+ for (Property property : change.getModifiedProperties()) {
+ Name propertyName = property.getName();
+ String propertyNameStr = context.getValueFactories().getStringFactory().create(propertyName);
+ String path = nodePathStr + "/@" + propertyNameStr;
+ SequencerPathExpression.Matcher matcher = pathExpression.matcher(path);
+ if (matcher.matches()) {
+ // String selectedPath = matcher.getSelectedPath();
+ RepositoryNodePath outputPath = RepositoryNodePath.parse(matcher.getOutputPath(),
+ repositorySourceName,
+ repositoryWorkspaceName);
+ SequencerCall call = new SequencerCall(sequencer, propertyNameStr);
+ // Record the output path ...
+ Set<RepositoryNodePath> outputPaths = sequencerCalls.get(call);
+ if (outputPaths == null) {
+ outputPaths = new HashSet<RepositoryNodePath>();
+ sequencerCalls.put(call, outputPaths);
+ }
+ outputPaths.add(outputPath);
+ sequencers.add(sequencer);
+ break;
+ }
}
- outputPaths.add(outputPath);
- sequencers.add(sequencer);
- break;
}
}
- }
- }
- RepositorySource source = repositoryLibrary.getSource(repositorySourceName);
- Graph graph = Graph.create(source, context);
- Node node = null;
- if (!sequencers.isEmpty()) {
+ RepositorySource source = repositoryLibrary.getSource(repositorySourceName);
+ Graph graph = Graph.create(source, context);
+ Node node = null;
+ if (!sequencers.isEmpty()) {
- // Find the changed node ...
- node = graph.getNodeAt(nodePath);
+ // Find the changed node ...
+ node = graph.getNodeAt(nodePath);
- // Figure out which sequencers should run ...
- sequencers = this.sequencerSelector.selectSequencers(sequencers, node, change);
- }
- if (sequencers.isEmpty()) {
- this.statistics.recordNodeSkipped();
- if (logger.isDebugEnabled()) {
- logger.trace("Skipping '{0}': no sequencers matched this condition", change);
- }
- } else {
- // Run each of those sequencers ...
- for (Map.Entry<SequencerCall, Set<RepositoryNodePath>> entry : sequencerCalls.entrySet()) {
+ // Figure out which sequencers should run ...
+ sequencers = this.sequencerSelector.selectSequencers(sequencers, node, change);
+ }
+ if (sequencers.isEmpty()) {
+ this.statistics.recordNodeSkipped();
+ if (logger.isDebugEnabled()) {
+ logger.trace("Skipping '{0}': no sequencers matched this condition", change);
+ }
+ } else {
+ // Run each of those sequencers ...
+ for (Map.Entry<SequencerCall, Set<RepositoryNodePath>> entry : sequencerCalls.entrySet()) {
- final SequencerCall sequencerCall = entry.getKey();
- final Set<RepositoryNodePath> outputPaths = entry.getValue();
- final Sequencer sequencer = sequencerCall.getSequencer();
- final String sequencerName = sequencer.getConfiguration().getName();
- final String propertyName = sequencerCall.getSequencedPropertyName();
+ final SequencerCall sequencerCall = entry.getKey();
+ final Set<RepositoryNodePath> outputPaths = entry.getValue();
+ final Sequencer sequencer = sequencerCall.getSequencer();
+ final String sequencerName = sequencer.getConfiguration().getName();
+ final String propertyName = sequencerCall.getSequencedPropertyName();
- // Get the paths to the nodes where the sequencer should write it's output ...
- assert outputPaths != null && outputPaths.size() != 0;
+ // Get the paths to the nodes where the sequencer should write it's output ...
+ assert outputPaths != null && outputPaths.size() != 0;
- // Create a new execution context for each sequencer
- final SimpleProblems problems = new SimpleProblems();
- SequencerContext sequencerContext = new SequencerContext(context, graph);
- try {
- sequencer.execute(node, propertyName, change, outputPaths, sequencerContext, problems);
- sequencerContext.getDestination().submit();
- } catch (SequencerException e) {
- logger.error(e, RepositoryI18n.errorWhileSequencingNode, sequencerName, change);
+ // Create a new execution context for each sequencer
+ final SimpleProblems problems = new SimpleProblems();
+ SequencerContext sequencerContext = new SequencerContext(context, graph);
+ try {
+ sequencer.execute(node, propertyName, change, outputPaths, sequencerContext, problems);
+ sequencerContext.getDestination().submit();
+ } catch (SequencerException e) {
+ logger.error(e, RepositoryI18n.errorWhileSequencingNode, sequencerName, change);
+ }
+ }
+ this.statistics.recordNodeSequenced();
}
}
- this.statistics.recordNodeSequenced();
}
} catch (Throwable e) {
- logger.error(e, RepositoryI18n.errorFindingSequencersToRunAgainstNode, change);
+ logger.error(e, RepositoryI18n.errorFindingSequencersToRunAgainstNode, changes);
}
}
@@ -594,22 +604,19 @@
/**
* {@inheritDoc}
*
- * @see org.jboss.dna.graph.observe.NetChangeObserver#notify(org.jboss.dna.graph.observe.NetChangeObserver.NetChange)
+ * @see org.jboss.dna.graph.observe.NetChangeObserver#notify(org.jboss.dna.graph.observe.NetChangeObserver.NetChanges)
*/
@Override
- protected void notify( final NetChange change ) {
- // Only care about new nodes or nodes that have new/changed properies ...
- if (change.includes(ChangeType.NODE_ADDED, ChangeType.PROPERTY_ADDED, ChangeType.PROPERTY_CHANGED)) {
- try {
- getExecutorService().execute(new Runnable() {
+ protected void notify( final NetChanges netChanges ) {
+ try {
+ getExecutorService().execute(new Runnable() {
- public void run() {
- processChange(change);
- }
- });
- } catch (RejectedExecutionException e) {
- // The executor service has been shut down, so do nothing with this set of changes
- }
+ public void run() {
+ processChange(netChanges);
+ }
+ });
+ } catch (RejectedExecutionException e) {
+ // The executor service has been shut down, so do nothing with this set of changes
}
}
}
Modified: trunk/dna-repository/src/test/java/org/jboss/dna/repository/sequencer/StreamSequencerAdapterTest.java
===================================================================
--- trunk/dna-repository/src/test/java/org/jboss/dna/repository/sequencer/StreamSequencerAdapterTest.java 2009-10-28 00:41:28 UTC (rev 1312)
+++ trunk/dna-repository/src/test/java/org/jboss/dna/repository/sequencer/StreamSequencerAdapterTest.java 2009-10-28 14:43:17 UTC (rev 1313)
@@ -131,9 +131,8 @@
Location location = Location.create(context.getValueFactories().getPathFactory().create("/a/b/c"));
Property sequencedProperty = inputNode.getProperty("sequencedProperty");
- NetChange nodeChange = new NetChange(repositorySourceName, repositoryWorkspaceName, location,
- EnumSet.of(ChangeType.PROPERTY_CHANGED), Collections.singleton(sequencedProperty),
- null);
+ NetChange nodeChange = new NetChange(repositoryWorkspaceName, location, EnumSet.of(ChangeType.PROPERTY_CHANGED),
+ Collections.singleton(sequencedProperty), null);
Set<RepositoryNodePath> outputPaths = new HashSet<RepositoryNodePath>();
outputPaths.add(new RepositoryNodePath(repositorySourceName, repositoryWorkspaceName, "/d/e"));
sequencerOutput.setProperty("alpha/beta", "isSomething", true);
@@ -190,9 +189,8 @@
// Set up the node changes ...
Location location = Location.create(context.getValueFactories().getPathFactory().create("/a/b/c"));
Property sequencedProperty = nodeC.getProperty("sequencedProperty");
- NetChange nodeChange = new NetChange(repositorySourceName, repositoryWorkspaceName, location,
- EnumSet.of(ChangeType.PROPERTY_CHANGED), Collections.singleton(sequencedProperty),
- null);
+ NetChange nodeChange = new NetChange(repositoryWorkspaceName, location, EnumSet.of(ChangeType.PROPERTY_CHANGED),
+ Collections.singleton(sequencedProperty), null);
// Set up the output directory ...
Set<RepositoryNodePath> outputPaths = new HashSet<RepositoryNodePath>();
@@ -226,9 +224,8 @@
// Set up the node changes ...
Location location = Location.create(context.getValueFactories().getPathFactory().create("/a/b/c"));
Property sequencedProperty = nodeC.getProperty("sequencedProperty");
- NetChange nodeChange = new NetChange(repositorySourceName, repositoryWorkspaceName, location,
- EnumSet.of(ChangeType.PROPERTY_CHANGED), Collections.singleton(sequencedProperty),
- null);
+ NetChange nodeChange = new NetChange(repositoryWorkspaceName, location, EnumSet.of(ChangeType.PROPERTY_CHANGED),
+ Collections.singleton(sequencedProperty), null);
// Set up the output directory ...
Set<RepositoryNodePath> outputPaths = new HashSet<RepositoryNodePath>();
@@ -262,9 +259,8 @@
// Set up the node changes ...
Location location = Location.create(context.getValueFactories().getPathFactory().create("/a/b/c"));
Property sequencedProperty = nodeC.getProperty("sequencedProperty");
- NetChange nodeChange = new NetChange(repositorySourceName, repositoryWorkspaceName, location,
- EnumSet.of(ChangeType.PROPERTY_CHANGED), Collections.singleton(sequencedProperty),
- null);
+ NetChange nodeChange = new NetChange(repositoryWorkspaceName, location, EnumSet.of(ChangeType.PROPERTY_CHANGED),
+ Collections.singleton(sequencedProperty), null);
// Set up the output directory ...
Set<RepositoryNodePath> outputPaths = new HashSet<RepositoryNodePath>();
@@ -303,9 +299,8 @@
// Set up the node changes ...
Location location = Location.create(context.getValueFactories().getPathFactory().create("/a/b/c"));
Property sequencedProperty = nodeC.getProperty("sequencedProperty");
- NetChange nodeChange = new NetChange(repositorySourceName, repositoryWorkspaceName, location,
- EnumSet.of(ChangeType.PROPERTY_CHANGED), Collections.singleton(sequencedProperty),
- null);
+ NetChange nodeChange = new NetChange(repositoryWorkspaceName, location, EnumSet.of(ChangeType.PROPERTY_CHANGED),
+ Collections.singleton(sequencedProperty), null);
// Set up the output directory ...
Set<RepositoryNodePath> outputPaths = new HashSet<RepositoryNodePath>();
@@ -348,9 +343,8 @@
// Set up the node changes ...
Location location = Location.create(context.getValueFactories().getPathFactory().create("/a/b/c"));
Property sequencedProperty = nodeC.getProperty("sequencedProperty");
- NetChange nodeChange = new NetChange(repositorySourceName, repositoryWorkspaceName, location,
- EnumSet.of(ChangeType.PROPERTY_CHANGED), Collections.singleton(sequencedProperty),
- null);
+ NetChange nodeChange = new NetChange(repositoryWorkspaceName, location, EnumSet.of(ChangeType.PROPERTY_CHANGED),
+ Collections.singleton(sequencedProperty), null);
// Set up the output directory ...
Set<RepositoryNodePath> outputPaths = new HashSet<RepositoryNodePath>();
14 years, 6 months
DNA SVN: r1312 - trunk/dna-graph/src/main/java/org/jboss/dna/graph/request.
by dna-commits@lists.jboss.org
Author: bcarothers
Date: 2009-10-27 20:41:28 -0400 (Tue, 27 Oct 2009)
New Revision: 1312
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/UnlockBranchRequest.java
Log:
Corrected implementation of changedLocation to be consistent with usage in CreateNodeRequest.
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-10-27 20:02:40 UTC (rev 1311)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/LockBranchRequest.java 2009-10-28 00:41:28 UTC (rev 1312)
@@ -167,7 +167,7 @@
*/
@Override
public Location changedLocation() {
- return at;
+ return actualLocation;
}
/**
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-10-27 20:02:40 UTC (rev 1311)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/UnlockBranchRequest.java 2009-10-28 00:41:28 UTC (rev 1312)
@@ -133,7 +133,7 @@
*/
@Override
public Location changedLocation() {
- return at;
+ return actualLocation;
}
/**
14 years, 6 months
DNA SVN: r1311 - trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/processor.
by dna-commits@lists.jboss.org
Author: bcarothers
Date: 2009-10-27 16:02:40 -0400 (Tue, 27 Oct 2009)
New Revision: 1311
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/processor/RequestProcessor.java
Log:
DNA-457 Add JSR-170 Locking Optional Feature
The attached patch (DNA-457_fixed_RequestProcessor.patch) corrects the default RequestProcessor implementation to populate the actual location on the request, looking up the path for the node if necessary.
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-10-27 19:12:46 UTC (rev 1310)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/processor/RequestProcessor.java 2009-10-27 20:02:40 UTC (rev 1311)
@@ -866,6 +866,21 @@
* @param request the request
*/
public void process( LockBranchRequest request ) {
+ Location actualLocation = request.at();
+ if (!actualLocation.hasPath()) {
+ VerifyNodeExistsRequest nodeExists = new VerifyNodeExistsRequest(request.at(), request.inWorkspace());
+
+ process(nodeExists);
+
+ if (nodeExists.hasError()) {
+ request.setError(nodeExists.getError());
+ return;
+ }
+
+ actualLocation = nodeExists.getActualLocationOfNode();
+ }
+
+ request.setActualLocation(actualLocation);
}
/**
@@ -879,6 +894,21 @@
* @param request the request
*/
public void process( UnlockBranchRequest request ) {
+ Location actualLocation = request.at();
+ if (!actualLocation.hasPath()) {
+ VerifyNodeExistsRequest nodeExists = new VerifyNodeExistsRequest(request.at(), request.inWorkspace());
+
+ process(nodeExists);
+
+ if (nodeExists.hasError()) {
+ request.setError(nodeExists.getError());
+ return;
+ }
+
+ actualLocation = nodeExists.getActualLocationOfNode();
+ }
+
+ request.setActualLocation(actualLocation);
}
/**
14 years, 6 months
DNA SVN: r1310 - trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/federation.
by dna-commits@lists.jboss.org
Author: rhauch
Date: 2009-10-27 15:12:46 -0400 (Tue, 27 Oct 2009)
New Revision: 1310
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/federation/ForkRequestProcessor.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/federation/JoinMirrorRequestProcessor.java
Log:
DNA-457 Added support for the new LockBranchRequest and UnlockBranchRequest classes in the federation connector.
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/federation/ForkRequestProcessor.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/federation/ForkRequestProcessor.java 2009-10-27 16:37:53 UTC (rev 1309)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/federation/ForkRequestProcessor.java 2009-10-27 19:12:46 UTC (rev 1310)
@@ -66,18 +66,23 @@
import org.jboss.dna.graph.request.GetWorkspacesRequest;
import org.jboss.dna.graph.request.InvalidRequestException;
import org.jboss.dna.graph.request.InvalidWorkspaceException;
+import org.jboss.dna.graph.request.LockBranchRequest;
import org.jboss.dna.graph.request.MoveBranchRequest;
import org.jboss.dna.graph.request.ReadAllChildrenRequest;
import org.jboss.dna.graph.request.ReadAllPropertiesRequest;
+import org.jboss.dna.graph.request.ReadBlockOfChildrenRequest;
import org.jboss.dna.graph.request.ReadBranchRequest;
+import org.jboss.dna.graph.request.ReadNextBlockOfChildrenRequest;
import org.jboss.dna.graph.request.ReadNodeRequest;
import org.jboss.dna.graph.request.ReadPropertyRequest;
import org.jboss.dna.graph.request.RemovePropertyRequest;
import org.jboss.dna.graph.request.RenameNodeRequest;
import org.jboss.dna.graph.request.Request;
import org.jboss.dna.graph.request.SetPropertyRequest;
+import org.jboss.dna.graph.request.UnlockBranchRequest;
import org.jboss.dna.graph.request.UnsupportedRequestException;
import org.jboss.dna.graph.request.UpdatePropertiesRequest;
+import org.jboss.dna.graph.request.UpdateValuesRequest;
import org.jboss.dna.graph.request.VerifyNodeExistsRequest;
import org.jboss.dna.graph.request.VerifyWorkspaceRequest;
import org.jboss.dna.graph.request.processor.RequestProcessor;
@@ -839,6 +844,26 @@
/**
* {@inheritDoc}
*
+ * @see org.jboss.dna.graph.request.processor.RequestProcessor#process(org.jboss.dna.graph.request.ReadBlockOfChildrenRequest)
+ */
+ @Override
+ public void process( ReadBlockOfChildrenRequest request ) {
+ super.process(request);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.graph.request.processor.RequestProcessor#process(org.jboss.dna.graph.request.ReadNextBlockOfChildrenRequest)
+ */
+ @Override
+ public void process( ReadNextBlockOfChildrenRequest request ) {
+ super.process(request);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
* @see org.jboss.dna.graph.request.processor.RequestProcessor#process(org.jboss.dna.graph.request.ReadAllPropertiesRequest)
*/
@Override
@@ -1129,6 +1154,42 @@
/**
* {@inheritDoc}
*
+ * @see org.jboss.dna.graph.request.processor.RequestProcessor#process(org.jboss.dna.graph.request.UpdateValuesRequest)
+ */
+ @Override
+ public void process( UpdateValuesRequest request ) {
+ // Figure out where this request is projected ...
+ ProjectedNode projectedNode = project(request.on(), request.inWorkspace(), request, true);
+ if (projectedNode == null) return;
+
+ // Create the federated request ...
+ FederatedRequest federatedRequest = new FederatedRequest(request);
+
+ // Any non-read request should be submitted to the first ProxyNode ...
+ while (projectedNode != null) {
+ if (projectedNode.isProxy()) {
+ ProxyNode proxy = projectedNode.asProxy();
+ // Create and submit a request for the projection ...
+ UpdateValuesRequest pushDownRequest = new UpdateValuesRequest(proxy.workspaceName(), proxy.location(),
+ request.property(), request.addedValues(),
+ request.removedValues());
+ federatedRequest.add(pushDownRequest, proxy.isSameLocationAsOriginal(), false, proxy.projection());
+
+ // Submit the requests for processing and then STOP ...
+ submit(federatedRequest);
+ return;
+ }
+ assert projectedNode.isPlaceholder();
+ projectedNode = projectedNode.next();
+ }
+ // Unable to perform this update ...
+ String msg = GraphI18n.unableToUpdatePlaceholder.text(readable(request.on()), request.inWorkspace(), getSourceName());
+ request.setError(new UnsupportedRequestException(msg));
+ }
+
+ /**
+ * {@inheritDoc}
+ *
* @see org.jboss.dna.graph.request.processor.RequestProcessor#process(org.jboss.dna.graph.request.SetPropertyRequest)
*/
@Override
@@ -1498,6 +1559,75 @@
/**
* {@inheritDoc}
*
+ * @see org.jboss.dna.graph.request.processor.RequestProcessor#process(org.jboss.dna.graph.request.LockBranchRequest)
+ */
+ @Override
+ public void process( LockBranchRequest request ) {
+ // Figure out where this request is projected ...
+ ProjectedNode projectedNode = project(request.at(), request.inWorkspace(), request, true);
+ if (projectedNode == null) return;
+
+ // Create the federated request ...
+ FederatedRequest federatedRequest = new FederatedRequest(request);
+
+ // Any non-read request should be submitted to the first ProxyNode ...
+ while (projectedNode != null) {
+ if (projectedNode.isProxy()) {
+ ProxyNode proxy = projectedNode.asProxy();
+ // Create and submit a request for the projection ...
+ LockBranchRequest pushDownRequest = new LockBranchRequest(proxy.location(), proxy.workspaceName(),
+ request.lockScope(), request.lockTimeoutInMillis());
+ federatedRequest.add(pushDownRequest, proxy.isSameLocationAsOriginal(), false, proxy.projection());
+
+ // Submit the requests for processing and then STOP ...
+ submit(federatedRequest);
+ return;
+ }
+ assert projectedNode.isPlaceholder();
+ projectedNode = projectedNode.next();
+ }
+ // Unable to perform this update ...
+ String msg = GraphI18n.unableToUpdatePlaceholder.text(readable(request.at()), request.inWorkspace(), getSourceName());
+ request.setError(new UnsupportedRequestException(msg));
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.graph.request.processor.RequestProcessor#process(org.jboss.dna.graph.request.UnlockBranchRequest)
+ */
+ @Override
+ public void process( UnlockBranchRequest request ) {
+ // Figure out where this request is projected ...
+ ProjectedNode projectedNode = project(request.at(), request.inWorkspace(), request, true);
+ if (projectedNode == null) return;
+
+ // Create the federated request ...
+ FederatedRequest federatedRequest = new FederatedRequest(request);
+
+ // Any non-read request should be submitted to the first ProxyNode ...
+ while (projectedNode != null) {
+ if (projectedNode.isProxy()) {
+ ProxyNode proxy = projectedNode.asProxy();
+ // Create and submit a request for the projection ...
+ UnlockBranchRequest pushDownRequest = new UnlockBranchRequest(proxy.location(), proxy.workspaceName());
+ federatedRequest.add(pushDownRequest, proxy.isSameLocationAsOriginal(), false, proxy.projection());
+
+ // Submit the requests for processing and then STOP ...
+ submit(federatedRequest);
+ return;
+ }
+ assert projectedNode.isPlaceholder();
+ projectedNode = projectedNode.next();
+ }
+ // Unable to perform this update ...
+ String msg = GraphI18n.unableToUpdatePlaceholder.text(readable(request.at()), request.inWorkspace(), getSourceName());
+ request.setError(new UnsupportedRequestException(msg));
+ }
+
+ /**
+ * {@inheritDoc}
+ *
* @see org.jboss.dna.graph.request.processor.RequestProcessor#process(org.jboss.dna.graph.request.VerifyWorkspaceRequest)
*/
@Override
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/federation/JoinMirrorRequestProcessor.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/federation/JoinMirrorRequestProcessor.java 2009-10-27 16:37:53 UTC (rev 1309)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/federation/JoinMirrorRequestProcessor.java 2009-10-27 19:12:46 UTC (rev 1310)
@@ -39,8 +39,10 @@
import org.jboss.dna.graph.request.CreateNodeRequest;
import org.jboss.dna.graph.request.CreateWorkspaceRequest;
import org.jboss.dna.graph.request.DeleteBranchRequest;
+import org.jboss.dna.graph.request.DeleteChildrenRequest;
import org.jboss.dna.graph.request.DestroyWorkspaceRequest;
import org.jboss.dna.graph.request.GetWorkspacesRequest;
+import org.jboss.dna.graph.request.LockBranchRequest;
import org.jboss.dna.graph.request.MoveBranchRequest;
import org.jboss.dna.graph.request.ReadAllChildrenRequest;
import org.jboss.dna.graph.request.ReadAllPropertiesRequest;
@@ -53,7 +55,9 @@
import org.jboss.dna.graph.request.RenameNodeRequest;
import org.jboss.dna.graph.request.Request;
import org.jboss.dna.graph.request.SetPropertyRequest;
+import org.jboss.dna.graph.request.UnlockBranchRequest;
import org.jboss.dna.graph.request.UpdatePropertiesRequest;
+import org.jboss.dna.graph.request.UpdateValuesRequest;
import org.jboss.dna.graph.request.VerifyNodeExistsRequest;
import org.jboss.dna.graph.request.VerifyWorkspaceRequest;
import org.jboss.dna.graph.request.processor.RequestProcessor;
@@ -306,6 +310,20 @@
/**
* {@inheritDoc}
*
+ * @see org.jboss.dna.graph.request.processor.RequestProcessor#process(org.jboss.dna.graph.request.UpdateValuesRequest)
+ */
+ @Override
+ public void process( UpdateValuesRequest request ) {
+ UpdateValuesRequest source = (UpdateValuesRequest)federatedRequest.getFirstProjectedRequest().getRequest();
+ if (checkErrorOrCancel(request, source)) return;
+ request.setActualLocation(source.getActualLocationOfNode(),
+ request.getActualAddedValues(),
+ request.getActualRemovedValues());
+ }
+
+ /**
+ * {@inheritDoc}
+ *
* @see org.jboss.dna.graph.request.processor.RequestProcessor#process(org.jboss.dna.graph.request.CopyBranchRequest)
*/
@Override
@@ -343,6 +361,18 @@
/**
* {@inheritDoc}
*
+ * @see org.jboss.dna.graph.request.processor.RequestProcessor#process(org.jboss.dna.graph.request.DeleteChildrenRequest)
+ */
+ @Override
+ public void process( DeleteChildrenRequest request ) {
+ DeleteChildrenRequest source = (DeleteChildrenRequest)federatedRequest.getFirstProjectedRequest().getRequest();
+ if (checkErrorOrCancel(request, source)) return;
+ request.setActualLocationOfNode(source.getActualLocationOfNode());
+ }
+
+ /**
+ * {@inheritDoc}
+ *
* @see org.jboss.dna.graph.request.processor.RequestProcessor#process(org.jboss.dna.graph.request.MoveBranchRequest)
*/
@Override
@@ -355,6 +385,30 @@
/**
* {@inheritDoc}
*
+ * @see org.jboss.dna.graph.request.processor.RequestProcessor#process(org.jboss.dna.graph.request.LockBranchRequest)
+ */
+ @Override
+ public void process( LockBranchRequest request ) {
+ LockBranchRequest source = (LockBranchRequest)federatedRequest.getFirstProjectedRequest().getRequest();
+ if (checkErrorOrCancel(request, source)) return;
+ request.setActualLocation(source.getActualLocation());
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.graph.request.processor.RequestProcessor#process(org.jboss.dna.graph.request.UnlockBranchRequest)
+ */
+ @Override
+ public void process( UnlockBranchRequest request ) {
+ UnlockBranchRequest source = (UnlockBranchRequest)federatedRequest.getFirstProjectedRequest().getRequest();
+ if (checkErrorOrCancel(request, source)) return;
+ request.setActualLocation(source.getActualLocation());
+ }
+
+ /**
+ * {@inheritDoc}
+ *
* @see org.jboss.dna.graph.request.processor.RequestProcessor#process(org.jboss.dna.graph.request.VerifyWorkspaceRequest)
*/
@Override
14 years, 6 months
DNA SVN: r1309 - trunk/tools/org.jboss.dna.eclipse.jcr.rest.client/src/org/jboss/dna/eclipse/jcr/rest/client/views.
by dna-commits@lists.jboss.org
Author: elvisisking
Date: 2009-10-27 12:37:53 -0400 (Tue, 27 Oct 2009)
New Revision: 1309
Modified:
trunk/tools/org.jboss.dna.eclipse.jcr.rest.client/src/org/jboss/dna/eclipse/jcr/rest/client/views/DnaContentProvider.java
Log:
Changed server retry wait time from 10 secs to 2 secs. This is the time to wait before trying to connect again.
Modified: trunk/tools/org.jboss.dna.eclipse.jcr.rest.client/src/org/jboss/dna/eclipse/jcr/rest/client/views/DnaContentProvider.java
===================================================================
--- trunk/tools/org.jboss.dna.eclipse.jcr.rest.client/src/org/jboss/dna/eclipse/jcr/rest/client/views/DnaContentProvider.java 2009-10-26 16:05:53 UTC (rev 1308)
+++ trunk/tools/org.jboss.dna.eclipse.jcr.rest.client/src/org/jboss/dna/eclipse/jcr/rest/client/views/DnaContentProvider.java 2009-10-27 16:37:53 UTC (rev 1309)
@@ -73,7 +73,7 @@
/**
* If a server connection cannot be established, wait this amount of time before trying again.
*/
- private static final long RETRY_DURATION = 10000;
+ private static final long RETRY_DURATION = 2000;
// ===========================================================================================================================
// Class Methods
14 years, 6 months
DNA SVN: r1308 - trunk/dna-graph/src/main/java/org/jboss/dna/graph.
by dna-commits@lists.jboss.org
Author: rhauch
Date: 2009-10-26 12:05:53 -0400 (Mon, 26 Oct 2009)
New Revision: 1308
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/Graph.java
Log:
Merge branch 'patches'
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-10-26 16:01:30 UTC (rev 1307)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/Graph.java 2009-10-26 16:05:53 UTC (rev 1308)
@@ -465,7 +465,7 @@
* @return an object that allows the scope of the lock to be defined
*/
public LockScope<LockTimeout<Conjunction<Graph>>> lock( Property firstIdProperty,
- Property... additionalIdProperties ) {
+ Property... additionalIdProperties ) {
return lock(Location.create(firstIdProperty, additionalIdProperties));
}
@@ -2006,13 +2006,15 @@
}
public List<Location> under( Location at ) {
- return requests.readBlockOfChildren(at, getCurrentWorkspaceName(), startingIndex, blockSize).getChildren();
+ return requests.readBlockOfChildren(at, getCurrentWorkspaceName(), startingIndex, blockSize)
+ .getChildren();
}
};
}
public List<Location> startingAfter( final Location previousSibling ) {
- return requests.readNextBlockOfChildren(previousSibling, getCurrentWorkspaceName(), blockSize).getChildren();
+ return requests.readNextBlockOfChildren(previousSibling, getCurrentWorkspaceName(), blockSize)
+ .getChildren();
}
public List<Location> startingAfter( String pathOfPreviousSibling ) {
@@ -2666,7 +2668,7 @@
* @return an object that allows the scope of the lock to be defined
*/
public LockScope<LockTimeout<BatchConjunction>> lock( Property firstIdProperty,
- Property... additionalIdProperties ) {
+ Property... additionalIdProperties ) {
return lock(Location.create(firstIdProperty, additionalIdProperties));
}
@@ -4740,6 +4742,7 @@
org.jboss.dna.graph.request.LockBranchRequest.LockScope lockScope,
long lockTimeoutInMillis );
+ @SuppressWarnings( "synthetic-access" )
public LockTimeout<T> andItsDescendants() {
return new LockTimeout<T>() {
@@ -4756,6 +4759,7 @@
};
}
+ @SuppressWarnings( "synthetic-access" )
public LockTimeout<T> only() {
return new LockTimeout<T>() {
@@ -6424,7 +6428,10 @@
}
public SubgraphNode getNode( Name relativePath ) {
- Path path = getGraph().getContext().getValueFactories().getPathFactory().create(getLocation().getPath(), relativePath);
+ Path path = getGraph().getContext()
+ .getValueFactories()
+ .getPathFactory()
+ .create(getLocation().getPath(), relativePath);
path = path.getNormalizedPath();
return getNode(path);
}
14 years, 6 months
DNA SVN: r1307 - trunk/dna-jcr/src/main/java/org/jboss/dna/jcr.
by dna-commits@lists.jboss.org
Author: rhauch
Date: 2009-10-26 12:01:30 -0400 (Mon, 26 Oct 2009)
New Revision: 1307
Modified:
trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/WorkspaceLockManager.java
Log:
Removed unused exception from JavaDoc
Modified: trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/WorkspaceLockManager.java
===================================================================
--- trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/WorkspaceLockManager.java 2009-10-23 00:54:08 UTC (rev 1306)
+++ trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/WorkspaceLockManager.java 2009-10-26 16:01:30 UTC (rev 1307)
@@ -244,8 +244,9 @@
ValueFactory<Boolean> booleanFactory = context.getValueFactories().getBooleanFactory();
PathFactory pathFactory = context.getValueFactories().getPathFactory();
- org.jboss.dna.graph.Node lockNode = repository.createSystemGraph().getNodeAt(pathFactory.create(locksPath,
- pathFactory.createSegment(lockToken)));
+ org.jboss.dna.graph.Node lockNode = repository.createSystemGraph()
+ .getNodeAt(pathFactory.create(locksPath,
+ pathFactory.createSegment(lockToken)));
return booleanFactory.create(lockNode.getProperty(DnaLexicon.IS_HELD_BY_SESSION).getFirstValue());
@@ -294,7 +295,6 @@
*
* @param nodeLocation the node UUID
* @return the corresponding lock, possibly null if there is no such lock
- * @throws RepositoryException if there is a problem obtaining the information for a lock
*/
DnaLock lockFor( Location nodeLocation ) {
UUID nodeUuid = uuidFor(nodeLocation);
14 years, 6 months