Author: rhauch
Date: 2009-06-11 05:21:34 -0400 (Thu, 11 Jun 2009)
New Revision: 1039
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/Location.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/LocationWithPathAndProperties.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/LocationWithProperties.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/federation/FederatedRepositoryConnection.java
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/JoinRequestProcessor.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/federation/ProjectorWithPlaceholders.java
trunk/dna-repository/src/main/java/org/jboss/dna/repository/DnaConfiguration.java
trunk/docs/examples/gettingstarted/pom.xml
trunk/docs/examples/gettingstarted/repositories/src/main/java/org/jboss/example/dna/repository/RepositoryClient.java
trunk/docs/examples/gettingstarted/repositories/src/test/java/org/jboss/example/dna/repository/RepositoryClientUsingJcrTest.java
trunk/pom.xml
Log:
DNA-449 Fixed all of the issues with the federated connector and use by our JCR
implementation. All code builds, and all tests pass.
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-06-11 09:21:06
UTC (rev 1038)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/Location.java 2009-06-11 09:21:34
UTC (rev 1039)
@@ -208,7 +208,7 @@
for (Property property : remainingIdProperties) {
if (names.add(property.getName())) idProperties.add(property);
}
- return new LocationWithPathAndProperties(null, idProperties);
+ return new LocationWithProperties(idProperties);
}
/**
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-06-11
09:21:06 UTC (rev 1038)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/LocationWithPathAndProperties.java 2009-06-11
09:21:34 UTC (rev 1039)
@@ -55,6 +55,7 @@
*/
LocationWithPathAndProperties( Path path,
List<Property> idProperties ) {
+ assert path != null;
assert idProperties != null;
assert !idProperties.isEmpty();
this.path = path;
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-06-11
09:21:06 UTC (rev 1038)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/LocationWithProperties.java 2009-06-11
09:21:34 UTC (rev 1039)
@@ -138,7 +138,7 @@
*/
@Override
public Location with( Path newPath ) {
- if (newPath == null || this.getPath().equals(newPath)) return this;
+ if (newPath == null) return this;
return new LocationWithPathAndProperties(newPath, idProperties);
}
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/federation/FederatedRepositoryConnection.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/federation/FederatedRepositoryConnection.java 2009-06-11
09:21:06 UTC (rev 1038)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/federation/FederatedRepositoryConnection.java 2009-06-11
09:21:34 UTC (rev 1039)
@@ -156,7 +156,7 @@
// Figure out whether we should asynchronously do the forking ...
boolean synchronousStep1 = shouldProcessSynchronously(request);
- final boolean awaitAllSubtasks = true;
+ final boolean awaitAllSubtasks = false;
// Prepare for trace-level logging ...
if (stopwatch != null) stopwatch.start();
@@ -180,7 +180,7 @@
} finally {
fork.close();
}
- requests.add(new NoMoreFederatedRequests());
+ if (!awaitAllSubtasks) requests.add(new NoMoreFederatedRequests());
// At this point, all submitted requests have been processed/forked, so
we can continue with
// the join process, starting with the first submitted request. Note that
the subtasks may
// still be executing, but as the join process operates on a forked
request, it will wait
@@ -195,7 +195,7 @@
} finally {
fork.close();
}
- requests.add(new NoMoreFederatedRequests());
+ if (!awaitAllSubtasks) requests.add(new
NoMoreFederatedRequests());
}
});
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-06-11
09:21:06 UTC (rev 1038)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/federation/ForkRequestProcessor.java 2009-06-11
09:21:34 UTC (rev 1039)
@@ -738,16 +738,19 @@
continue;
}
while (child != null && child.isProxy()) {
- // Take any children so far and simply record a ReadNodeRequest
with results ...
- ReadNodeRequest placeholderRequest = new
ReadNodeRequest(placeholder.location(), request.inWorkspace());
- placeholderRequest.addChildren(children);
- if (firstRequest) {
- firstRequest = false;
-
placeholderRequest.addProperties(placeholder.properties().values());
+ if (!children.isEmpty()) {
+ // Take any children so far and simply record a
ReadNodeRequest with results ...
+ ReadNodeRequest placeholderRequest = new
ReadNodeRequest(placeholder.location(),
+
request.inWorkspace());
+ placeholderRequest.addChildren(children);
+ if (firstRequest) {
+ firstRequest = false;
+
placeholderRequest.addProperties(placeholder.properties().values());
+ }
+
placeholderRequest.setActualLocationOfNode(placeholder.location());
+ federatedRequest.add(placeholderRequest, true, true, null);
+ children = new LinkedList<Location>();
}
-
placeholderRequest.setActualLocationOfNode(placeholder.location());
- federatedRequest.add(placeholderRequest, true, true, null);
- children = new LinkedList<Location>();
// Now issue a VerifyNodeExistsRequest for the child.
// We'll mix these into the federated request along with the
ReadNodeRequests ...
ProxyNode proxy = child.asProxy();
@@ -757,7 +760,7 @@
child = child.next();
}
}
- if (!children.isEmpty()) {
+ if (!children.isEmpty() || firstRequest) {
// Submit the children so far ...
ReadNodeRequest placeholderRequest = new
ReadNodeRequest(placeholder.location(), request.inWorkspace());
placeholderRequest.addChildren(children);
@@ -799,19 +802,25 @@
// This placeholder may have proxy nodes as children, in which case we
need to verify
// their existance to get their actual locations.
List<Location> children = new LinkedList<Location>();
+ boolean firstRequest = true;
for (ProjectedNode child : placeholder.children()) {
if (child.isPlaceholder()) {
children.add(child.location());
continue;
}
while (child != null && child.isProxy()) {
- // Take any children so far and simply record a ReadNodeRequest
with results ...
- ReadAllChildrenRequest placeholderRequest = new
ReadAllChildrenRequest(placeholder.location(),
-
request.inWorkspace());
- placeholderRequest.addChildren(children);
-
placeholderRequest.setActualLocationOfNode(placeholder.location());
- federatedRequest.add(placeholderRequest, true, true, null);
- children = new LinkedList<Location>();
+ if (!children.isEmpty()) {
+ // Take any children so far and simply record a
ReadNodeRequest with results ...
+ ReadAllChildrenRequest placeholderRequest = new
ReadAllChildrenRequest(placeholder.location(),
+
request.inWorkspace());
+ placeholderRequest.addChildren(children);
+ if (firstRequest) {
+ firstRequest = false;
+ }
+
placeholderRequest.setActualLocationOfNode(placeholder.location());
+ federatedRequest.add(placeholderRequest, true, true, null);
+ children = new LinkedList<Location>();
+ }
// Now issue a VerifyNodeExistsRequest for the child.
// We'll mix these into the federated request along with the
ReadNodeRequests ...
ProxyNode proxy = child.asProxy();
@@ -821,11 +830,14 @@
child = child.next();
}
}
- if (!children.isEmpty()) {
+ if (!children.isEmpty() || firstRequest) {
// Submit the children so far ...
ReadAllChildrenRequest placeholderRequest = new
ReadAllChildrenRequest(placeholder.location(),
request.inWorkspace());
placeholderRequest.addChildren(children);
+ if (firstRequest) {
+ firstRequest = false;
+ }
placeholderRequest.setActualLocationOfNode(placeholder.location());
federatedRequest.add(placeholderRequest, true, true, null);
}
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/federation/JoinRequestProcessor.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/federation/JoinRequestProcessor.java 2009-06-11
09:21:06 UTC (rev 1038)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/federation/JoinRequestProcessor.java 2009-06-11
09:21:34 UTC (rev 1039)
@@ -314,6 +314,7 @@
assert federatedPath != null;
actualLocation = actualLocation.with(federatedPath);
}
+ assert actualLocation.getPath() != null;
request.setActualLocationOfNode(actualLocation);
}
}
@@ -328,7 +329,7 @@
// We've lost the name of the child, so we need to recompute the path
...
for (Path path : projection.getPathsInRepository(childInSource.getPath(),
pathFactory)) {
childPath = path;
- if (federatedPath == null) federatedPath = path;
+ if (federatedPath == null) federatedPath = path.getParent();
break;
}
}
@@ -458,7 +459,7 @@
protected Location determineActualLocation( Location actual,
Location inSource,
Projection projection ) {
- if (!actual.hasPath()) {
+ if (actual.getPath() == null) {
if (projection == null) {
// It must be a placeholder node ...
return inSource;
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/federation/ProjectorWithPlaceholders.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/federation/ProjectorWithPlaceholders.java 2009-06-11
09:21:06 UTC (rev 1038)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/federation/ProjectorWithPlaceholders.java 2009-06-11
09:21:34 UTC (rev 1039)
@@ -129,8 +129,12 @@
parentPlaceholder = new PlaceholderNode(location, properties, new
ArrayList<ProjectedNode>());
placeholdersByPath.put(parent, parentPlaceholder);
placeholderNodes.add(parentPlaceholder);
+ parentPlaceholder.children().add(child);
+ } else {
+ // The placeholder already exists, so make sure we're not
adding it to this parent twice ...
+ List<ProjectedNode> children =
parentPlaceholder.children();
+ if (!children.contains(child)) children.add(child);
}
- parentPlaceholder.children().add(child);
child = parentPlaceholder;
path = parent;
}
Modified:
trunk/dna-repository/src/main/java/org/jboss/dna/repository/DnaConfiguration.java
===================================================================
---
trunk/dna-repository/src/main/java/org/jboss/dna/repository/DnaConfiguration.java 2009-06-11
09:21:06 UTC (rev 1038)
+++
trunk/dna-repository/src/main/java/org/jboss/dna/repository/DnaConfiguration.java 2009-06-11
09:21:34 UTC (rev 1039)
@@ -403,8 +403,6 @@
public DnaConfiguration save() {
Graph.Batch changes = this.changes;
if (changes != null && changes.isExecuteRequired()) {
- System.out.println("Execution: ");
- System.out.println(changes);
changes.execute();
}
this.changes = null;
Modified: trunk/docs/examples/gettingstarted/pom.xml
===================================================================
--- trunk/docs/examples/gettingstarted/pom.xml 2009-06-11 09:21:06 UTC (rev 1038)
+++ trunk/docs/examples/gettingstarted/pom.xml 2009-06-11 09:21:34 UTC (rev 1039)
@@ -10,7 +10,7 @@
<modules>
<module>sequencers</module>
- <!--module>repositories</module-->
+ <module>repositories</module>
</modules>
<dependencyManagement>
Modified:
trunk/docs/examples/gettingstarted/repositories/src/main/java/org/jboss/example/dna/repository/RepositoryClient.java
===================================================================
---
trunk/docs/examples/gettingstarted/repositories/src/main/java/org/jboss/example/dna/repository/RepositoryClient.java 2009-06-11
09:21:06 UTC (rev 1038)
+++
trunk/docs/examples/gettingstarted/repositories/src/main/java/org/jboss/example/dna/repository/RepositoryClient.java 2009-06-11
09:21:34 UTC (rev 1039)
@@ -144,11 +144,8 @@
// using the CND format in one or multiple files.
String locationOfCndFiles = userInterface.getLocationOfCndFiles();
configuration.repository("Aircraft").addNodeTypes(locationOfCndFiles +
"/aircraft.cnd");
- configuration.save();
configuration.repository("Cars").addNodeTypes(locationOfCndFiles +
"/cars.cnd");
- configuration.save();
configuration.repository("Vehicles").addNodeTypes(locationOfCndFiles +
"/vehicles.cnd");
- configuration.save();
// Now create the JCR engine ...
engine = configuration.build();
Modified:
trunk/docs/examples/gettingstarted/repositories/src/test/java/org/jboss/example/dna/repository/RepositoryClientUsingJcrTest.java
===================================================================
---
trunk/docs/examples/gettingstarted/repositories/src/test/java/org/jboss/example/dna/repository/RepositoryClientUsingJcrTest.java 2009-06-11
09:21:06 UTC (rev 1038)
+++
trunk/docs/examples/gettingstarted/repositories/src/test/java/org/jboss/example/dna/repository/RepositoryClientUsingJcrTest.java 2009-06-11
09:21:34 UTC (rev 1039)
@@ -56,7 +56,7 @@
@Ignore
@Override
public void shouldHaveContentFromVehiclesRepository() throws Throwable {
- // super.shouldHaveContentFromVehiclesRepository();
+ super.shouldHaveContentFromVehiclesRepository();
}
/**
@@ -69,56 +69,4 @@
public void shouldBeAbleToExecuteTestsRepeatedly() throws Throwable {
// super.shouldBeAbleToExecuteTestsRepeatedly();
}
-
- /**
- * {@inheritDoc}
- *
- * @see
org.jboss.example.dna.repository.RepositoryClientTest#shouldHaveContentFromAircraftRepository()
- */
- @Override
- public void shouldHaveContentFromAircraftRepository() throws Throwable {
- super.shouldHaveContentFromAircraftRepository();
- }
-
- /**
- * {@inheritDoc}
- *
- * @see
org.jboss.example.dna.repository.RepositoryClientTest#shouldHaveContentFromCarsRepository()
- */
- @Override
- public void shouldHaveContentFromCarsRepository() throws Throwable {
- super.shouldHaveContentFromCarsRepository();
- }
-
- /**
- * {@inheritDoc}
- *
- * @see
org.jboss.example.dna.repository.RepositoryClientTest#shouldReturnNullForNonExistantNode()
- */
- @Override
- public void shouldReturnNullForNonExistantNode() throws Throwable {
- super.shouldReturnNullForNonExistantNode();
- }
-
- /**
- * {@inheritDoc}
- *
- * @see
org.jboss.example.dna.repository.RepositoryClientTest#shouldStartupWithoutError()
- */
- @Ignore
- @Override
- public void shouldStartupWithoutError() throws Exception {
- super.shouldStartupWithoutError();
- }
-
- /**
- * {@inheritDoc}
- *
- * @see
org.jboss.example.dna.repository.RepositoryClientTest#shouldStartupWithoutErrorMoreThanOnce()
- */
- @Ignore
- @Override
- public void shouldStartupWithoutErrorMoreThanOnce() throws Exception {
- super.shouldStartupWithoutErrorMoreThanOnce();
- }
}
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2009-06-11 09:21:06 UTC (rev 1038)
+++ trunk/pom.xml 2009-06-11 09:21:34 UTC (rev 1039)
@@ -146,7 +146,7 @@
<module>extensions/dna-web-jcr-rest</module>
<module>extensions/dna-web-jcr-rest-war</module>
<module>dna-integration-tests</module>
- <!--module>docs/examples/gettingstarted</module-->
+ <module>docs/examples/gettingstarted</module>
</modules>
<profiles>