Author: rhauch
Date: 2009-06-04 12:32:16 -0400 (Thu, 04 Jun 2009)
New Revision: 971
Added:
trunk/docs/examples/gettingstarted/sequencers/src/main/resources/sequencing.cnd
Removed:
trunk/docs/examples/gettingstarted/sequencers/src/main/resources/jackrabbitNodeTypes.cnd
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/Graph.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/federation/Projection.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/io/GraphBatchDestination.java
trunk/dna-graph/src/test/java/org/jboss/dna/graph/connector/federation/ProjectionPathRuleTest.java
trunk/dna-graph/src/test/java/org/jboss/dna/graph/connector/inmemory/InMemoryRepositoryWorkspaceTest.java
trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrConfiguration.java
trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrEngine.java
trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrI18n.java
trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrSession.java
trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/SessionCache.java
trunk/dna-jcr/src/main/resources/org/jboss/dna/jcr/JcrI18n.properties
trunk/dna-repository/src/main/java/org/jboss/dna/repository/DnaConfiguration.java
trunk/dna-repository/src/main/java/org/jboss/dna/repository/DnaEngine.java
trunk/dna-repository/src/main/java/org/jboss/dna/repository/RepositoryI18n.java
trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencer/StreamSequencerAdapter.java
trunk/dna-repository/src/main/resources/org/jboss/dna/repository/RepositoryI18n.properties
trunk/dna-repository/src/test/java/org/jboss/dna/repository/DnaConfigurationTest.java
trunk/docs/examples/gettingstarted/sequencers/pom.xml
trunk/docs/examples/gettingstarted/sequencers/src/main/java/org/jboss/example/dna/sequencer/ConsoleInput.java
trunk/docs/examples/gettingstarted/sequencers/src/main/java/org/jboss/example/dna/sequencer/SequencingClient.java
trunk/docs/examples/gettingstarted/sequencers/src/main/java/org/jboss/example/dna/sequencer/UserInterface.java
trunk/docs/examples/gettingstarted/sequencers/src/test/java/org/jboss/example/dna/sequencer/MockUserInterface.java
trunk/docs/examples/gettingstarted/sequencers/src/test/java/org/jboss/example/dna/sequencer/SequencingClientTest.java
trunk/extensions/dna-connector-svn/src/test/java/org/jboss/dna/connector/svn/SVNConnectorTestUtil.java
Log:
DNA-389 Further changes to make the JcrConfiguration and JcrEngine easier to use while
also correcting a few problems. Additional changes to the sequencing example toward
getting it working again.
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-06-03 20:26:37 UTC
(rev 970)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/Graph.java 2009-06-04 16:32:16 UTC
(rev 971)
@@ -2676,8 +2676,9 @@
protected Batch submit( Location parent,
String workspaceName,
Name childName,
- Collection<Property> properties ) {
- requestQueue.createNode(parent, workspaceName, childName,
properties.iterator());
+ Collection<Property> properties,
+ NodeConflictBehavior behavior ) {
+ requestQueue.createNode(parent, workspaceName, childName,
properties.iterator(), behavior);
return Batch.this;
}
@@ -2751,157 +2752,6 @@
}
/**
- * Begin the request to create a node located at the supplied path if there is no
such node already.
- * <p>
- * Like all other methods on the {@link Batch}, the request will be performed
when the {@link #execute()} method is
- * called.
- * </p>
- *
- * @param atPath the path to the node that is to be created.
- * @return the object that can be used to specify addition properties for the new
node to be copied or the location of the
- * node where the node is to be created
- */
- public Create<Batch> createIfMissing( String atPath ) {
- return createIfMissing(createPath(atPath));
- }
-
- /**
- * Begin the request to create a node located at the supplied path if there is no
such node already.
- * <p>
- * Like all other methods on the {@link Batch}, the request will be performed
when the {@link #execute()} method is
- * called.
- * </p>
- *
- * @param atPath the path to the node that is to be created.
- * @param property a property for the new node
- * @return the object that can be used to specify addition properties for the new
node to be copied or the location of the
- * node where the node is to be created
- */
- public Create<Batch> createIfMissing( String atPath,
- Property property ) {
- return createIfMissing(createPath(atPath)).with(property);
- }
-
- /**
- * Begin the request to create a node located at the supplied path if there is no
such node already.
- * <p>
- * Like all other methods on the {@link Batch}, the request will be performed
when the {@link #execute()} method is
- * called.
- * </p>
- *
- * @param atPath the path to the node that is to be created.
- * @param firstProperty a property for the new node
- * @param additionalProperties additional properties for the new node
- * @return the object that can be used to specify addition properties for the new
node to be copied or the location of the
- * node where the node is to be created
- */
- public Create<Batch> createIfMissing( String atPath,
- Property firstProperty,
- Property... additionalProperties ) {
- return createIfMissing(createPath(atPath)).with(firstProperty,
additionalProperties);
- }
-
- /**
- * Begin the request to create a node located at the supplied path if there is no
such node already.
- * <p>
- * Like all other methods on the {@link Batch}, the request will be performed
when the {@link #execute()} method is
- * called.
- * </p>
- *
- * @param at the path to the node that is to be created.
- * @return the object that can be used to specify addition properties for the new
node to be copied or the location of the
- * node where the node is to be created
- */
- public final Create<Batch> createIfMissing( Path at ) {
- assertNotExecuted();
- CheckArg.isNotNull(at, "at");
- Path parent = at.getParent();
- Name name = at.getLastSegment().getName();
- return createIfMissing(Location.create(parent), name);
- }
-
- protected final CreateAction<Batch> createIfMissing( Location parent,
- Name child ) {
- return new CreateAction<Batch>(this, parent, getCurrentWorkspaceName(),
child) {
- @Override
- protected Batch submit( Location parent,
- String workspaceName,
- Name childName,
- Collection<Property> properties ) {
- requestQueue.createNode(parent, workspaceName, childName,
properties.iterator(), NodeConflictBehavior.UPDATE);
- return Batch.this;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.jboss.dna.graph.Graph.Executable#execute()
- */
- public Results execute() {
- and();
- return Batch.this.execute();
- }
- };
- }
-
- /**
- * Begin the request to create a node located at the supplied path.
- * <p>
- * Like all other methods on the {@link Batch}, the request will be performed
when the {@link #execute()} method is
- * called.
- * </p>
- *
- * @param at the path to the node that is to be created.
- * @param properties the iterator over the properties for the new node
- * @return the object that can be used to specify addition properties for the new
node to be copied or the location of the
- * node where the node is to be created
- */
- public Create<Batch> createIfMissing( Path at,
- Iterable<Property> properties ) {
- Create<Batch> action = createIfMissing(at);
- for (Property property : properties) {
- action.and(property);
- }
- return action;
- }
-
- /**
- * Begin the request to create a node located at the supplied path if there is no
such node already.
- * <p>
- * Like all other methods on the {@link Batch}, the request will be performed
when the {@link #execute()} method is
- * called.
- * </p>
- *
- * @param at the path to the node that is to be created.
- * @param property a property for the new node
- * @return the object that can be used to specify addition properties for the new
node to be copied or the location of the
- * node where the node is to be created
- */
- public Create<Batch> createIfMissing( Path at,
- Property property ) {
- return createIfMissing(at).with(property);
- }
-
- /**
- * Begin the request to create a node located at the supplied path if there is no
such node already.
- * <p>
- * Like all other methods on the {@link Batch}, the request will be performed
when the {@link #execute()} method is
- * called.
- * </p>
- *
- * @param at the path to the node that is to be created.
- * @param firstProperty a property for the new node
- * @param additionalProperties additional properties for the new node
- * @return the object that can be used to specify addition properties for the new
node to be copied or the location of the
- * node where the node is to be created
- */
- public Create<Batch> createIfMissing( Path at,
- Property firstProperty,
- Property... additionalProperties ) {
- return createIfMissing(at).with(firstProperty, additionalProperties);
- }
-
- /**
* Begin the request to create a node under the existing parent node at the
supplied location. This request is submitted
* to the repository after the returned components are completed.
*
@@ -3913,9 +3763,9 @@
}
/**
- * A component that defines the location before which a node should be copied or
moved. This is similar to an
- * {@link Into}, but it allows for placing a node at a particular location within the
new destination, rather than
- * always placing the moved or copied node as the last child of the new parent.
+ * A component that defines the location before which a node should be copied or
moved. This is similar to an {@link Into},
+ * but it allows for placing a node at a particular location within the new
destination, rather than always placing the moved
+ * or copied node as the last child of the new parent.
*
* @param <Next> The interface that is to be returned when this request is
completed
* @author Randall Hauch
@@ -3989,7 +3839,7 @@
* @return the interface for additional requests or actions
*/
Next before( Property firstParentIdProperty,
- Property... additionalParentIdProperties );
+ Property... additionalParentIdProperties );
}
/**
@@ -4154,6 +4004,38 @@
*/
public interface Create<Next> extends Conjunction<Next>,
Executable<Node> {
/**
+ * Create the node only if there is no existing node with the same {@link
Path.Segment#getName() name} (ignoring
+ * {@link Path.Segment#getIndex() same-name-sibling indexes}).
+ *
+ * @return this interface for continued specification of the request
+ */
+ Create<Next> ifAbsent();
+
+ /**
+ * Create the node if it does not exist, or update any existing node that has the
same {@link Path.Segment#getName() name}
+ * (ignoring {@link Path.Segment#getIndex() same-name-sibling indexes}).
+ *
+ * @return this interface for continued specification of the request
+ */
+ Create<Next> orUpdate();
+
+ /**
+ * Create the node if it does not exist, or replace any existing node that has
the same {@link Path.Segment#getName()
+ * name} (ignoring {@link Path.Segment#getIndex() same-name-sibling indexes}).
+ *
+ * @return this interface for continued specification of the request
+ */
+ Create<Next> orReplace();
+
+ /**
+ * Create the node if it does not exist by appending or adjusting the {@link
Path.Segment#getIndex() same-name-sibling
+ * index}). This is the default behavior.
+ *
+ * @return this interface for continued specification of the request
+ */
+ Create<Next> byAppending();
+
+ /**
* Specify the UUID that should the new node should have. This is an alias for
{@link #and(UUID)}.
*
* @param uuid the UUID
@@ -5822,8 +5704,8 @@
* @return this object, for method chaining
*/
protected T submit( Locations from,
- Location into,
- Name newName ) {
+ Location into,
+ Name newName ) {
return submit(from, into, null, newName);
}
@@ -5851,7 +5733,7 @@
public T into( String into ) {
return submit(from, Location.create(createPath(into)), newName);
}
-
+
public T before( Location before ) {
return submit(from, null, before, newName);
}
@@ -5865,7 +5747,7 @@
}
public T before( Property firstIdProperty,
- Property... additionalIdProperties ) {
+ Property... additionalIdProperties ) {
return submit(from, null, Location.create(firstIdProperty,
additionalIdProperties), newName);
}
@@ -5875,7 +5757,7 @@
public T before( String before ) {
return submit(from, null, Location.create(createPath(before)), newName);
- }
+ }
}
@NotThreadSafe
@@ -5993,6 +5875,7 @@
private final Name childName;
private final Map<Name, Property> properties = new HashMap<Name,
Property>();
private boolean submitted = false;
+ private NodeConflictBehavior conflictBehavior = NodeConflictBehavior.APPEND;
/*package*/CreateAction( T afterConjunction,
Location parent,
@@ -6004,6 +5887,46 @@
this.childName = childName;
}
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.graph.Graph.Create#ifAbsent()
+ */
+ public Create<T> ifAbsent() {
+ conflictBehavior = NodeConflictBehavior.DO_NOT_REPLACE;
+ return this;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.graph.Graph.Create#orReplace()
+ */
+ public Create<T> orReplace() {
+ conflictBehavior = NodeConflictBehavior.REPLACE;
+ return this;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.graph.Graph.Create#orUpdate()
+ */
+ public Create<T> orUpdate() {
+ conflictBehavior = NodeConflictBehavior.UPDATE;
+ return this;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.graph.Graph.Create#byAppending()
+ */
+ public Create<T> byAppending() {
+ conflictBehavior = NodeConflictBehavior.APPEND;
+ return this;
+ }
+
public Create<T> and( UUID uuid ) {
PropertyFactory factory = getContext().getPropertyFactory();
properties.put(DnaLexicon.UUID, factory.create(DnaLexicon.UUID, uuid));
@@ -6078,12 +6001,13 @@
protected abstract T submit( Location parent,
String workspaceName,
Name childName,
- Collection<Property> properties );
+ Collection<Property> properties,
+ NodeConflictBehavior conflictBehavior );
@Override
public T and() {
if (!submitted) {
- submit(parent, workspaceName, childName, this.properties.values());
+ submit(parent, workspaceName, childName, this.properties.values(),
this.conflictBehavior);
submitted = true;
}
return super.and();
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/federation/Projection.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/federation/Projection.java 2009-06-03
20:26:37 UTC (rev 970)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/federation/Projection.java 2009-06-04
16:32:16 UTC (rev 971)
@@ -575,8 +575,8 @@
public PathRule( Path repositoryPath,
Path sourcePath,
Path... exceptions ) {
- assert sourcePath != null;
- assert repositoryPath != null;
+ CheckArg.isNotNull(sourcePath, "sourcePath");
+ CheckArg.isNotNull(repositoryPath, "repositoryPath");
this.sourcePath = sourcePath;
this.repositoryPath = repositoryPath;
if (exceptions == null || exceptions.length == 0) {
@@ -589,15 +589,21 @@
this.exceptions = Collections.unmodifiableList(exceptionList);
}
this.hc = HashCode.compute(sourcePath, repositoryPath, exceptions);
- assert exceptionPathsAreRelative();
+ if (this.exceptions != null) {
+ for (Path path : this.exceptions) {
+ if (path.isAbsolute()) {
+ throw new
IllegalArgumentException(GraphI18n.pathIsNotRelative.text(path));
+ }
+ }
+ }
this.topLevelRepositoryPaths =
Collections.singletonList(getPathInRepository());
}
public PathRule( Path repositoryPath,
Path sourcePath,
List<Path> exceptions ) {
- assert sourcePath != null;
- assert repositoryPath != null;
+ CheckArg.isNotNull(sourcePath, "sourcePath");
+ CheckArg.isNotNull(repositoryPath, "repositoryPath");
this.sourcePath = sourcePath;
this.repositoryPath = repositoryPath;
if (exceptions == null || exceptions.isEmpty()) {
@@ -606,17 +612,14 @@
this.exceptions = Collections.unmodifiableList(new
ArrayList<Path>(exceptions));
}
this.hc = HashCode.compute(sourcePath, repositoryPath, exceptions);
- assert exceptionPathsAreRelative();
- this.topLevelRepositoryPaths =
Collections.singletonList(getPathInRepository());
- }
-
- private boolean exceptionPathsAreRelative() {
if (this.exceptions != null) {
for (Path path : this.exceptions) {
- if (path.isAbsolute()) return false;
+ if (path.isAbsolute()) {
+ throw new
IllegalArgumentException(GraphI18n.pathIsNotRelative.text(path));
+ }
}
}
- return true;
+ this.topLevelRepositoryPaths =
Collections.singletonList(getPathInRepository());
}
/**
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/io/GraphBatchDestination.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/io/GraphBatchDestination.java 2009-06-03
20:26:37 UTC (rev 970)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/io/GraphBatchDestination.java 2009-06-04
16:32:16 UTC (rev 971)
@@ -27,7 +27,9 @@
import net.jcip.annotations.NotThreadSafe;
import org.jboss.dna.graph.ExecutionContext;
import org.jboss.dna.graph.Graph;
+import org.jboss.dna.graph.NodeConflictBehavior;
import org.jboss.dna.graph.Graph.Batch;
+import org.jboss.dna.graph.Graph.Create;
import org.jboss.dna.graph.property.Path;
import org.jboss.dna.graph.property.Property;
@@ -92,11 +94,31 @@
public void create( Path path,
List<Property> properties ) {
assert properties != null;
+ Create<Batch> create = null;
if (properties.isEmpty()) {
- batch.create(path).and();
+ create = batch.create(path);
} else {
- batch.create(path, properties).and();
+ create = batch.create(path, properties);
}
+ assert create != null;
+ NodeConflictBehavior behavior = createBehaviorFor(path);
+ if (behavior != null) {
+ switch (behavior) {
+ case APPEND:
+ create.byAppending();
+ break;
+ case REPLACE:
+ create.orReplace();
+ break;
+ case UPDATE:
+ create.byAppending();
+ break;
+ case DO_NOT_REPLACE:
+ create.byAppending();
+ break;
+ }
+ }
+ create.and();
}
/**
@@ -108,22 +130,43 @@
public void create( Path path,
Property firstProperty,
Property... additionalProperties ) {
+ Create<Batch> create = null;
if (firstProperty == null) {
- batch.create(path).and();
+ create = batch.create(path);
} else {
- batch.create(path, firstProperty, additionalProperties).and();
+ create = batch.create(path, firstProperty, additionalProperties);
}
+ assert create != null;
+ NodeConflictBehavior behavior = createBehaviorFor(path);
+ if (behavior != null) {
+ switch (behavior) {
+ case APPEND:
+ create.byAppending();
+ break;
+ case REPLACE:
+ create.orReplace();
+ break;
+ case UPDATE:
+ create.byAppending();
+ break;
+ case DO_NOT_REPLACE:
+ create.byAppending();
+ break;
+ }
+ }
+ create.and();
}
/**
* {@inheritDoc}
- *
- * @see
org.jboss.dna.graph.io.Destination#setProperties(org.jboss.dna.graph.property.Path,
org.jboss.dna.graph.property.Property[])
+ *
+ * @see
org.jboss.dna.graph.io.Destination#setProperties(org.jboss.dna.graph.property.Path,
+ * org.jboss.dna.graph.property.Property[])
*/
- public void setProperties( Path path,
+ public void setProperties( Path path,
Property... properties ) {
if (properties == null) return;
-
+
batch.set(properties).on(path);
}
@@ -135,6 +178,16 @@
public void submit() {
// Execute only if we're not ignoring submits ...
if (!this.ignoreSubmit && !batch.hasExecuted()) batch.execute();
+ }
+ /**
+ * Override this method in a subclass to control the {@link NodeConflictBehavior}
that should be used when creating the node
+ * at the supplied path. By default, this method returns null.
+ *
+ * @param path the path of the new node
+ * @return the conflict behavior, or null if {@link NodeConflictBehavior#UPDATE}
should be used
+ */
+ protected NodeConflictBehavior createBehaviorFor( Path path ) {
+ return null;
}
}
Modified:
trunk/dna-graph/src/test/java/org/jboss/dna/graph/connector/federation/ProjectionPathRuleTest.java
===================================================================
---
trunk/dna-graph/src/test/java/org/jboss/dna/graph/connector/federation/ProjectionPathRuleTest.java 2009-06-03
20:26:37 UTC (rev 970)
+++
trunk/dna-graph/src/test/java/org/jboss/dna/graph/connector/federation/ProjectionPathRuleTest.java 2009-06-04
16:32:16 UTC (rev 971)
@@ -80,19 +80,19 @@
assertThat(rule.getExceptionsToRule(), hasItems(validExceptions));
}
- @Test( expected = AssertionError.class )
+ @Test( expected = IllegalArgumentException.class )
public void
shouldFailToCreateInstanceWithNullRepositoryPathAndValidSourcePathAndNoExceptions() {
repositoryPath = null;
new Projection.PathRule(repositoryPath, sourcePath);
}
- @Test( expected = AssertionError.class )
+ @Test( expected = IllegalArgumentException.class )
public void
shouldFailToCreateInstanceWithValidRepositoryPathAndNullSourcePathAndNoExceptions() {
sourcePath = null;
new Projection.PathRule(repositoryPath, sourcePath);
}
- @Test( expected = AssertionError.class )
+ @Test( expected = IllegalArgumentException.class )
public void
shouldFailToCreateInstanceWithValidRepositoryPathAndValidSourcePathAndAbsoluteExceptions()
{
Path relativePath = validExceptions[0];
Path absolutePath = pathFactory.create("/j/k/l/m");
Modified:
trunk/dna-graph/src/test/java/org/jboss/dna/graph/connector/inmemory/InMemoryRepositoryWorkspaceTest.java
===================================================================
---
trunk/dna-graph/src/test/java/org/jboss/dna/graph/connector/inmemory/InMemoryRepositoryWorkspaceTest.java 2009-06-03
20:26:37 UTC (rev 970)
+++
trunk/dna-graph/src/test/java/org/jboss/dna/graph/connector/inmemory/InMemoryRepositoryWorkspaceTest.java 2009-06-04
16:32:16 UTC (rev 971)
@@ -30,7 +30,6 @@
import static org.hamcrest.core.IsSame.sameInstance;
import static org.junit.Assert.assertThat;
import static org.junit.matchers.JUnitMatchers.hasItems;
-import static org.mockito.Mockito.mock;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
@@ -101,17 +100,6 @@
assertThat(workspace.getRoot().getProperties().size(), is(0));
}
- @Test( expected = AssertionError.class )
- public void shouldNotAllowNodeToBeRemovedUsingNullEnvironment() {
- InMemoryNode node = mock(InMemoryNode.class);
- workspace.removeNode(null, node);
- }
-
- @Test( expected = AssertionError.class )
- public void shouldNotAllowNullNodeToBeRemoved() {
- workspace.removeNode(context, null);
- }
-
@Test
public void shouldCreateNodesByPath() {
Name name_a = nameFactory.create("a");
@@ -274,7 +262,7 @@
Name propName = nameFactory.create("prop");
node_b.setProperty(propertyFactory.create(propName, "node_b"));
node_b2.setProperty(propertyFactory.create(propName, "node_b2"));
-
+
assertThat(workspace.getNodesByUuid().size(), is(7));
assertThat(workspace.getNode(pathFactory.create("/")),
is(sameInstance(workspace.getRoot())));
assertThat(workspace.getNode(pathFactory.create("/a")),
is(sameInstance(node_a)));
@@ -296,8 +284,10 @@
assertThat(workspace.getNode(pathFactory.create("/d/b[2]")),
is(sameInstance(node_b2)));
assertThat(workspace.getNode(pathFactory.create("/d/b[1]")),
is(sameInstance(node_b)));
assertThat(workspace.getNode(pathFactory.create("/d/b[1]/c")),
is(sameInstance(node_c)));
-
assertThat(workspace.getNode(pathFactory.create("/d/b[1]")).getProperty(propName).getFirstValue().toString(),
is("node_b"));
-
assertThat(workspace.getNode(pathFactory.create("/d/b[2]")).getProperty(propName).getFirstValue().toString(),
is("node_b2"));
+
assertThat(workspace.getNode(pathFactory.create("/d/b[1]")).getProperty(propName).getFirstValue().toString(),
+ is("node_b"));
+
assertThat(workspace.getNode(pathFactory.create("/d/b[2]")).getProperty(propName).getFirstValue().toString(),
+ is("node_b2"));
// Move after the last node
workspace.moveNode(context, node_b, null, workspace, root, null);
Modified: trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrConfiguration.java
===================================================================
--- trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrConfiguration.java 2009-06-03
20:26:37 UTC (rev 970)
+++ trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrConfiguration.java 2009-06-04
16:32:16 UTC (rev 971)
@@ -604,7 +604,7 @@
Path nodeTypesPath = subpath(DnaLexicon.NODE_TYPES);
createIfMissing(DnaLexicon.NODE_TYPES).and();
- // Now set up the destination ...
+ // Now set up the destination, but make it so that ...
Destination destination = new GraphBatchDestination(batch, true); // will NOT
be executed
// And create the importer that will load the CND content into the repository
...
Modified: trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrEngine.java
===================================================================
--- trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrEngine.java 2009-06-03 20:26:37 UTC
(rev 970)
+++ trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrEngine.java 2009-06-04 16:32:16 UTC
(rev 971)
@@ -144,12 +144,7 @@
// Register all the the node types ...
Node nodeTypesNode = subgraph.getNode(DnaLexicon.NODE_TYPES);
if (nodeTypesNode != null) {
- try {
- repository.getRepositoryTypeManager().registerNodeTypes(subgraph,
nodeTypesNode.getLocation());
- } catch (RepositoryException e) {
- // Error registering the node types ...
- getProblems().addError(e, JcrI18n.errorRegisteringNodeTypes,
repositoryName);
- }
+ repository.getRepositoryTypeManager().registerNodeTypes(subgraph,
nodeTypesNode.getLocation());// throws exception
}
return repository;
Modified: trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrI18n.java
===================================================================
--- trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrI18n.java 2009-06-03 20:26:37 UTC
(rev 970)
+++ trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrI18n.java 2009-06-04 16:32:16 UTC
(rev 971)
@@ -60,7 +60,6 @@
public static I18n unableToRemapUriNotRegisteredInNamespaceRegistry;
public static I18n unableToRemapUriUsingPrefixUsedInNamespaceRegistry;
- public static I18n errorRegisteringNodeTypes;
public static I18n errorWhileInitializingTheNamespaceRegistry;
public static I18n invalidRelativePath;
public static I18n invalidPathParameter;
Modified: trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrSession.java
===================================================================
--- trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrSession.java 2009-06-03 20:26:37 UTC
(rev 970)
+++ trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrSession.java 2009-06-04 16:32:16 UTC
(rev 971)
@@ -218,6 +218,10 @@
return graph.batch();
}
+ String sourceName() {
+ return this.repository.getRepositorySourceName();
+ }
+
/**
* {@inheritDoc}
*
@@ -329,9 +333,10 @@
this.checkPermission(executionContext.getValueFactories().getPathFactory().create(path),
actions);
}
-
- public void checkPermission( Path path, String actions) {
-
+
+ public void checkPermission( Path path,
+ String actions ) {
+
CheckArg.isNotNull(path, "path");
CheckArg.isNotEmpty(actions, "actions");
Modified: trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/SessionCache.java
===================================================================
--- trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/SessionCache.java 2009-06-03 20:26:37
UTC (rev 970)
+++ trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/SessionCache.java 2009-06-04 16:32:16
UTC (rev 971)
@@ -204,6 +204,10 @@
return workspaceName;
}
+ String sourceName() {
+ return session.sourceName();
+ }
+
ExecutionContext context() {
return context;
}
@@ -2085,7 +2089,8 @@
throw new ItemNotFoundException(JcrI18n.itemNotFoundWithUuid.text(uuid,
workspaceName, e.getLocalizedMessage()));
} catch (RepositorySourceException e) {
throw new RepositoryException(
-
JcrI18n.errorWhileFindingNodeWithUuid.text(uuid, workspaceName,
e.getLocalizedMessage()));
+
JcrI18n.errorWhileFindingNodeWithUuid.text(uuid, workspaceName, e.getLocalizedMessage()),
+ e);
}
}
@@ -2234,7 +2239,7 @@
}
if (definition == null) {
String msg = JcrI18n.nodeDefinitionCouldNotBeDeterminedForNode.text(path,
workspaceName);
- throw new RepositorySourceException(msg);
+ throw new RepositorySourceException(sourceName(), msg);
}
}
@@ -2248,7 +2253,7 @@
if (primaryType == null) {
Path path = location.getPath();
String msg =
JcrI18n.missingNodeTypeForExistingNode.text(primaryTypeName.getString(namespaces), path,
workspaceName);
- throw new RepositorySourceException(msg);
+ throw new RepositorySourceException(sourceName(), msg);
}
if (primaryType.isNodeType(JcrMixLexicon.REFERENCEABLE)) referenceable = true;
Modified: trunk/dna-jcr/src/main/resources/org/jboss/dna/jcr/JcrI18n.properties
===================================================================
--- trunk/dna-jcr/src/main/resources/org/jboss/dna/jcr/JcrI18n.properties 2009-06-03
20:26:37 UTC (rev 970)
+++ trunk/dna-jcr/src/main/resources/org/jboss/dna/jcr/JcrI18n.properties 2009-06-04
16:32:16 UTC (rev 971)
@@ -50,7 +50,6 @@
unableToRemapUriNotRegisteredInNamespaceRegistry = Unable to remap the namespace
"{1}" to prefix "{0}" because the URI is not already registered in the
workspace's namespace registry
unableToRemapUriUsingPrefixUsedInNamespaceRegistry = Unable to remap the namespace
"{1}" to prefix "{0}" because the prefix is already used as the prefix
for the namespace "{2}" in the workspace's namespace registry
-errorRegisteringNodeTypes = Error while registering the node types for repository
"{0}"
errorWhileInitializingTheNamespaceRegistry = Error while initializing the namespace
registry for workspace "{0}"
invalidRelativePath = "{0}" is not a valid relative path
invalidPathParameter = The "{1}" parameter value "{0}" was not a
valid path
@@ -123,4 +122,4 @@
allNodeTypeTemplatesMustComeFromSameSession=All node type templates must be created from
the same javax.jcr.Session
nodeNotReferenceable=Only referenceable nodes may be the value of reference properties
-noPendingChangesAllowed=This operation cannot be performed when the session has pending
changes
\ No newline at end of file
+noPendingChangesAllowed=This operation cannot be performed when the session has pending
changes
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-03
20:26:37 UTC (rev 970)
+++
trunk/dna-repository/src/main/java/org/jboss/dna/repository/DnaConfiguration.java 2009-06-04
16:32:16 UTC (rev 971)
@@ -976,11 +976,11 @@
protected Graph.Create<Graph.Batch> createIfMissing( Name child,
String... segments ) {
Path nodePath = context.getValueFactories().getPathFactory().create(path,
child);
- Graph.Create<Graph.Batch> result = batch.createIfMissing(nodePath);
+ Graph.Create<Graph.Batch> result = batch.create(nodePath).orUpdate();
for (String name : segments) {
result.and();
nodePath = context.getValueFactories().getPathFactory().create(nodePath,
name);
- result = batch.createIfMissing(nodePath);
+ result = batch.create(nodePath).orUpdate();
}
return result;
}
@@ -994,7 +994,7 @@
*/
protected Graph.Create<Graph.Batch> createIfMissing( Name segment ) {
Path nodePath = context.getValueFactories().getPathFactory().create(path,
segment);
- Graph.Create<Graph.Batch> result = batch.createIfMissing(nodePath);
+ Graph.Create<Graph.Batch> result = batch.create(nodePath).orUpdate();
return result;
}
@@ -1013,7 +1013,7 @@
for (Name name : segments) {
if (result != null) result.and();
nodePath = context.getValueFactories().getPathFactory().create(nodePath,
name);
- result = batch.createIfMissing(nodePath);
+ result = batch.create(nodePath).orUpdate();
}
return result;
}
Modified: trunk/dna-repository/src/main/java/org/jboss/dna/repository/DnaEngine.java
===================================================================
--- trunk/dna-repository/src/main/java/org/jboss/dna/repository/DnaEngine.java 2009-06-03
20:26:37 UTC (rev 970)
+++ trunk/dna-repository/src/main/java/org/jboss/dna/repository/DnaEngine.java 2009-06-04
16:32:16 UTC (rev 971)
@@ -31,9 +31,11 @@
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import net.jcip.annotations.Immutable;
+import org.jboss.dna.common.collection.Problem;
import org.jboss.dna.common.collection.Problems;
import org.jboss.dna.common.collection.SimpleProblems;
import org.jboss.dna.common.util.CheckArg;
+import org.jboss.dna.common.util.Logger;
import org.jboss.dna.graph.ExecutionContext;
import org.jboss.dna.graph.Graph;
import org.jboss.dna.graph.JcrLexicon;
@@ -240,6 +242,16 @@
* @see #shutdown()
*/
public void start() {
+ if (getProblems().hasErrors()) {
+ // First log the messages ...
+ Logger log = Logger.getLogger(getClass());
+ log.error(RepositoryI18n.errorsPreventStarting);
+ for (Problem problem : getProblems()) {
+ log.error(problem.getMessage(), problem.getParameters());
+ }
+ // Then throw an exception ...
+ throw new
IllegalStateException(RepositoryI18n.errorsPreventStarting.text());
+ }
repositoryService.getAdministrator().start();
sequencingService.getAdministrator().start();
}
Modified: trunk/dna-repository/src/main/java/org/jboss/dna/repository/RepositoryI18n.java
===================================================================
---
trunk/dna-repository/src/main/java/org/jboss/dna/repository/RepositoryI18n.java 2009-06-03
20:26:37 UTC (rev 970)
+++
trunk/dna-repository/src/main/java/org/jboss/dna/repository/RepositoryI18n.java 2009-06-04
16:32:16 UTC (rev 971)
@@ -124,6 +124,7 @@
// Engine
public static I18n engineIsNotRunning;
+ public static I18n errorsPreventStarting;
static {
try {
Modified:
trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencer/StreamSequencerAdapter.java
===================================================================
---
trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencer/StreamSequencerAdapter.java 2009-06-03
20:26:37 UTC (rev 970)
+++
trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencer/StreamSequencerAdapter.java 2009-06-04
16:32:16 UTC (rev 971)
@@ -34,6 +34,7 @@
import org.jboss.dna.common.collection.Problems;
import org.jboss.dna.graph.Node;
import org.jboss.dna.graph.observe.NetChangeObserver.NetChange;
+import org.jboss.dna.graph.property.Binary;
import org.jboss.dna.graph.property.Path;
import org.jboss.dna.graph.property.PathFactory;
import org.jboss.dna.graph.property.Property;
@@ -90,18 +91,21 @@
// Get the property that contains the data, given by 'propertyName' ...
Property sequencedProperty = input.getProperty(sequencedPropertyName);
- if (sequencedProperty == null) {
+ if (sequencedProperty == null || sequencedProperty.isEmpty()) {
String msg =
RepositoryI18n.unableToFindPropertyForSequencing.text(sequencedPropertyName,
input.getLocation());
throw new SequencerException(msg);
}
// Get the binary property with the image content, and build the image metadata
from the image ...
- SequencerOutputMap output = new
SequencerOutputMap(context.getExecutionContext().getValueFactories());
+ ValueFactories factories = context.getExecutionContext().getValueFactories();
+ SequencerOutputMap output = new SequencerOutputMap(factories);
InputStream stream = null;
Throwable firstError = null;
+ Binary binary =
factories.getBinaryFactory().create(sequencedProperty.getFirstValue());
+ binary.acquire();
try {
// Parallel the JCR lemma for converting objects into streams
- stream = new ByteArrayInputStream(sequencedProperty.toString().getBytes());
+ stream = binary.getStream();
StreamSequencerContext StreamSequencerContext =
createStreamSequencerContext(input,
sequencedProperty,
context,
@@ -111,20 +115,24 @@
// Record the error ...
firstError = t;
} finally {
- if (stream != null) {
- // Always close the stream, recording the error if we've not yet seen
an error
- try {
- stream.close();
- } catch (Throwable t) {
- if (firstError == null) firstError = t;
- } finally {
- stream = null;
+ try {
+ if (stream != null) {
+ // Always close the stream, recording the error if we've not yet
seen an error
+ try {
+ stream.close();
+ } catch (Throwable t) {
+ if (firstError == null) firstError = t;
+ } finally {
+ stream = null;
+ }
}
+ if (firstError != null) {
+ // Wrap and throw the first error that we saw ...
+ throw new SequencerException(firstError);
+ }
+ } finally {
+ binary.release();
}
- if (firstError != null) {
- // Wrap and throw the first error that we saw ...
- throw new SequencerException(firstError);
- }
}
// Find each output node and save the image metadata there ...
Modified:
trunk/dna-repository/src/main/resources/org/jboss/dna/repository/RepositoryI18n.properties
===================================================================
---
trunk/dna-repository/src/main/resources/org/jboss/dna/repository/RepositoryI18n.properties 2009-06-03
20:26:37 UTC (rev 970)
+++
trunk/dna-repository/src/main/resources/org/jboss/dna/repository/RepositoryI18n.properties 2009-06-04
16:32:16 UTC (rev 971)
@@ -102,3 +102,4 @@
errorStartingRepositoryService = Error while starting repository service
engineIsNotRunning = The engine is not running; make sure it was started.
+errorsPreventStarting = The engine has errors and cannot be started
\ No newline at end of file
Modified:
trunk/dna-repository/src/test/java/org/jboss/dna/repository/DnaConfigurationTest.java
===================================================================
---
trunk/dna-repository/src/test/java/org/jboss/dna/repository/DnaConfigurationTest.java 2009-06-03
20:26:37 UTC (rev 970)
+++
trunk/dna-repository/src/test/java/org/jboss/dna/repository/DnaConfigurationTest.java 2009-06-04
16:32:16 UTC (rev 971)
@@ -138,7 +138,7 @@
assertThat(file.exists(), is(true));
assertThat(file.canRead(), is(true));
assertThat(file.isFile(), is(true));
- URL fileUrl = file.toURL();
+ URL fileUrl = file.toURI().toURL();
assertThat(fileUrl, is(notNullValue()));
configuration.loadFrom(fileUrl);
@@ -177,7 +177,7 @@
public void shouldLoadConfigurationEvenAfterAlreadyHavingLoadedConfiguration() throws
Exception {
configuration.loadFrom("src/test/resources/config/configRepository.xml");
configuration.loadFrom(new
File("src/test/resources/config/configRepository.xml"));
- configuration.loadFrom(new
File("src/test/resources/config/configRepository.xml").toURL());
+ configuration.loadFrom(new
File("src/test/resources/config/configRepository.xml").toURI().toURL());
assertThat(configuration.getProblems().isEmpty(), is(true));
}
Modified: trunk/docs/examples/gettingstarted/sequencers/pom.xml
===================================================================
--- trunk/docs/examples/gettingstarted/sequencers/pom.xml 2009-06-03 20:26:37 UTC (rev
970)
+++ trunk/docs/examples/gettingstarted/sequencers/pom.xml 2009-06-04 16:32:16 UTC (rev
971)
@@ -63,27 +63,17 @@
<artifactId>jcr</artifactId>
</dependency>
<!--
- Test cases use JUnit
- -->
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <!--
JAAS implementation (and dependencies)
-->
<dependency>
<groupId>org.jboss.security</groupId>
<artifactId>jboss-idtrust</artifactId>
<version>2.0.2.CR1</version>
- <scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.security</groupId>
<artifactId>jboss-security-spi-bare</artifactId>
<version>2.0.2.SP6</version>
- <scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.security</groupId>
@@ -99,6 +89,13 @@
<artifactId>serializer</artifactId>
</exclusion>
</exclusions>
+ </dependency>
+ <!--
+ Test cases use JUnit
+ -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
Modified:
trunk/docs/examples/gettingstarted/sequencers/src/main/java/org/jboss/example/dna/sequencer/ConsoleInput.java
===================================================================
---
trunk/docs/examples/gettingstarted/sequencers/src/main/java/org/jboss/example/dna/sequencer/ConsoleInput.java 2009-06-03
20:26:37 UTC (rev 970)
+++
trunk/docs/examples/gettingstarted/sequencers/src/main/java/org/jboss/example/dna/sequencer/ConsoleInput.java 2009-06-04
16:32:16 UTC (rev 971)
@@ -198,4 +198,8 @@
sb.append("\n");
return sb.toString();
}
+
+ public void displayError( Exception e ) {
+ System.err.println(e.getMessage());
+ }
}
Modified:
trunk/docs/examples/gettingstarted/sequencers/src/main/java/org/jboss/example/dna/sequencer/SequencingClient.java
===================================================================
---
trunk/docs/examples/gettingstarted/sequencers/src/main/java/org/jboss/example/dna/sequencer/SequencingClient.java 2009-06-03
20:26:37 UTC (rev 970)
+++
trunk/docs/examples/gettingstarted/sequencers/src/main/java/org/jboss/example/dna/sequencer/SequencingClient.java 2009-06-04
16:32:16 UTC (rev 971)
@@ -47,9 +47,6 @@
import org.jboss.dna.jcr.JcrRepository;
import org.jboss.dna.repository.sequencer.SequencingService;
import org.jboss.dna.repository.util.SessionFactory;
-import org.jboss.dna.sequencer.image.ImageMetadataSequencer;
-import org.jboss.dna.sequencer.java.JavaMetadataSequencer;
-import org.jboss.dna.sequencer.mp3.Mp3MetadataSequencer;
import org.jboss.security.config.IDTrustConfiguration;
/**
@@ -72,7 +69,9 @@
throw new IllegalStateException(ex);
}
- // Configure the DNA JCR engine ...
+ // Configure the DNA JCR engine. This could be done by loading a configuration
from a file, or by
+ // using a (local or remote) configuration repository, or by setting up the
configuration programmatically.
+ // This example uses the programmatic approach...
String repositoryId = "content";
String workspaceName = "default";
JcrConfiguration config = new JcrConfiguration();
@@ -83,9 +82,7 @@
.setProperty("defaultWorkspaceName", workspaceName);
// Set up the JCR repository to use the source ...
config.repository(repositoryId)
-
.addNodeTypes(ImageMetadataSequencer.class.getResource("org/jboss/dna/sequencer/image/images.cnd"))
-
.addNodeTypes(Mp3MetadataSequencer.class.getResource("org/jboss/dna/sequencer/mp3/mp3.cnd"))
-
.addNodeTypes(JavaMetadataSequencer.class.getResource("org/jboss/dna/sequencer/java/javaSource.cnd"))
+ .addNodeTypes("sequencing.cnd")
.setSource("store")
.setOption(JcrRepository.Option.JAAS_LOGIN_CONFIG_NAME,
"dna-jcr");
// Set up the image sequencer ...
@@ -97,13 +94,15 @@
.andOutputtingTo("/images/$1");
// Set up the MP3 sequencer ...
config.sequencer("MP3 Sequencer")
- .usingClass(Mp3MetadataSequencer.class)
+ .usingClass("org.jboss.dna.sequencer.mp3.Mp3MetadataSequencer")
+ .loadedFromClasspath()
.setDescription("Sequences mp3 files to extract the id3 tags of the
audio file")
.sequencingFrom("//(*.mp3[*])/jcr:content[@jcr:data]")
.andOutputtingTo("/mp3s/$1");
// Set up the Java source file sequencer ...
config.sequencer("Java Sequencer")
- .usingClass(JavaMetadataSequencer.class)
+
.usingClass("org.jboss.dna.sequencer.java.JavaMetadataSequencer")
+ .loadedFromClasspath()
.setDescription("Sequences mp3 files to extract the id3 tags of the
audio file")
.sequencingFrom("//(*.mp3[*])/jcr:content[@jcr:data]")
.andOutputtingTo("/mp3s/$1");
Modified:
trunk/docs/examples/gettingstarted/sequencers/src/main/java/org/jboss/example/dna/sequencer/UserInterface.java
===================================================================
---
trunk/docs/examples/gettingstarted/sequencers/src/main/java/org/jboss/example/dna/sequencer/UserInterface.java 2009-06-03
20:26:37 UTC (rev 970)
+++
trunk/docs/examples/gettingstarted/sequencers/src/main/java/org/jboss/example/dna/sequencer/UserInterface.java 2009-06-04
16:32:16 UTC (rev 971)
@@ -37,4 +37,6 @@
public String getRepositoryPath( String defaultPath ) throws
IllegalArgumentException, IOException;
public void displaySearchResults( List<ContentInfo> contentInfo ) throws
IOException;
+
+ public void displayError( Exception e );
}
Deleted:
trunk/docs/examples/gettingstarted/sequencers/src/main/resources/jackrabbitNodeTypes.cnd
===================================================================
---
trunk/docs/examples/gettingstarted/sequencers/src/main/resources/jackrabbitNodeTypes.cnd 2009-06-03
20:26:37 UTC (rev 970)
+++
trunk/docs/examples/gettingstarted/sequencers/src/main/resources/jackrabbitNodeTypes.cnd 2009-06-04
16:32:16 UTC (rev 971)
@@ -1,264 +0,0 @@
-<jcr='http://www.jcp.org/jcr/1.0'>
-<nt='http://www.jcp.org/jcr/nt/1.0'>
-<mix='http://www.jcp.org/jcr/mix/1.0'>
-<image='http://jboss.org/dna/images/1.0'>
-<mp3='http://jboss.org/dna/mp3/1.0'>
-<java='http://www.jboss.org/dna/java/1.0'>
-
-// ----------------------------------------------------------
-// JCR Pre-defined Mixin Types that are not loaded by default
-// ----------------------------------------------------------
-
-[mix:mimeTyped] mixin
- - jcr:mimeType (string)
- - jcr:encoding (string)
-
-
-// -------------------
-// DNA Image Sequencer
-// -------------------
-
-/**
- * Node type that defines the metadata for an image
- */
-[image:metadata] > nt:unstructured, mix:mimeTyped
- - image:formatName (string) mandatory
- < 'JPEG', 'GIF', 'PNG', 'BMP', 'PCX',
'IFF', 'RAS', 'PBM', 'PGM', 'PPM', 'PSD'
- - image:width (long)
- - image:height (long)
- - image:bitsPerPixel (long)
- - image:progressive (boolean)
- - image:numberOfImages (long)
- - image:physicalWidthDpi (long)
- - image:physicalHeightDpi (long)
- - image:physicalWidthInches (long)
- - image:physicalHeightInches (long)
-
-// -------------------
-// DNA MP3 Sequencer
-// -------------------
-
-/**
- * Node type that defines the metadata for an MP3 audio file
- */
-[mp3:metadata] > nt:unstructured, mix:mimeTyped
- - mp3:title (string)
- - mp3:author (string)
- - mp3:album (string)
- - mp3:year (long)
- - mp3:comment (string)
-
-// -------------------
-// DNA Java Sequencer
-// -------------------
-
-/**
- * Node types that define metadata for a Java source file
- */
-/**
- * Element-value
- */
-[java:elementValue] > nt:unstructured
- + java:kindOfvalues (java:conditionalExpression, java:annotationDeclaration,
java:elementValueArrayInitializer) mandatory
-
-/**
- * Modifiers
- */
-[java:modifierDeclaration] > nt:unstructured
- - java:modifierName (string) mandatory
-
-/**
- * Expression element-value type
- */
-[java:conditionalExpression] > nt:unstructured
- - java:expression (string)
-
-/**
- * Array initializer element-value type
- */
-[java:elementValueArrayInitializer] > nt:unstructured
- + java:elementValue (java:elementValue) = java:elementValue multiple
-
-/**
- * Identifier
- */
-[java:identifier] > nt:unstructured
- - java:identifierName (String) mandatory
- + java:value (java:elementValue) = java:elementValue mandatory
-
-/**
- * Element-value pair
- */
-[java:elementValuePair] > nt:unstructured
- + java:identifier (java:identifier) mandatory
-
-/**
- * Annotation type
- */
-[java:annotationDeclaration] > nt:unstructured
- + java:annotationType (java:normalAnnotation, java:markerAnnotation,
java:singleElementAnnotation) mandatory
-
-/**
- * Normal annotation e.g. @Entity(name="Customer")
- */
-[java:normalAnnotation] > nt:unstructured
- - java:normalAnnotationName (string) mandatory
- + java:elementValuePair (java:elementValuePair)
-
-/**
- * Marker annotation e.g. @GET
- */
-[java:markerAnnotation] > nt:unstructured
- - java:markerAnnotationName (string) mandatory
-
-/**
- * Single element annotation e.g. @Path("/book")
- */
-[java:singleElementAnnotation] > nt:unstructured
- - java:singleElementAnnotationNam
- + java:value (java:elementValue) = java:elementValue mandatory
-
-/**
- * Formal parameter
- */
-[java:formalParameter] > nt:unstructured
- + java:type (java:primitiveType, java:arrayType, java:simpleType, java:qualifiedType,
java:wildcardType, java:parameterizedType)
-
-/**
- * Primitive type:
- * - Integral type ('byte', 'short', 'int', 'long',
'char')
- * - Floating point type ('float', 'double')
- * - Boolean type ('boolean')
- * - No return type ('void')
- */
-[java:primitiveType] > nt:unstructured
- - java:primitiveTypeDescription (string)
- + java:modifier (java:modifierDeclaration) = java:modifierDeclaration
- - java:primitiveTypeName (string) mandatory
- + java:primitiveVariable (java:variable) = java:variable
-
- [java:variable] > nt:unstructured
- - java:variableName (string) mandatory
-
-/**
- * java:arrayType
- */
-[java:arrayType] > nt:unstructured
- - java:arrayTypeDescription (string)
- + java:arrayTypeModifier (java:modifierDeclaration) = java:modifierDeclaration
- - java:arrayTypeName (string) mandatory
- + java:arrayTypeVariable (java:variable) = java:variable
-
-[java:simpleType] > nt:unstructured
- - java:simpleTypeDescription (string)
- + java:simpleTypeModifier (java:modifierDeclaration) = java:modifierDeclaration
- - java:simpleTypeName (string) mandatory
- + java:simpleTypeVariable (java:variable) = java:variable
-
-[java:qualifiedType] > nt:unstructured
- - java:qualifiedTypeDescription (string)
- + java:qualifiedTypeModifier (java:modifierDeclaration) = java:modifierDeclaration
- - java:qualifiedTypeName (string) mandatory
- + java:qualifiedTypeVariable (java:variable) = java:variable
-
-[java:wildcardType] > nt:unstructured
- - java:wildcardTypeDescription (string)
- + java:wildcardTypeModifier (java:modifierDeclaration) = java:modifierDeclaration
- - java:wildcardTypeName (string) mandatory
- + java:wildcardTypeVariable (java:variable) = java:variable
-
-[java:parameterizedType] > nt:unstructured
- - java:parameterizedTypeDescription (string)
- + java:parameterizedTypeModifier (java:modifierDeclaration) = java:modifierDeclaration
- - java:parameterizedTypeName (string) mandatory
- + java:parameterizedTypeVariable (java:variable) = java:variable
-
-/**
- * Field type
- */
-[java:fieldType] > nt:unstructured
- + java:type (java:primitiveType, java:arrayType, java:simpleType, java:qualifiedType,
java:wildcardType, java:parameterizedType) mandatory multiple
-
- /**
- * Method declaration
- */
-[java:methodDeclaration] > nt:unstructured
- - java:methodDescription (string)
- + java:modifier (java:modifierDeclaration) = java:modifierDeclaration
- + java:resultType (java:primitiveType, java:arrayType, java:simpleType,
java:qualifiedType, java:wildcardType, java:parameterizedType) mandatory
- - java:methodName (string) mandatory
- + java:parameter (java:formalParameter) multiple
-
-/**
- * Constructor declarations
- */
-[java:constructorDeclaration] > nt:unstructured
- - java:constructorDescription (string)
- + java:modifier (java:modifierDeclaration) = java:modifierDeclaration
- - java:constructorName (string) mandatory
- + java:parameter (java:formalParameter)
-
-
-/**
- * Package declarations
- */
-[java:packageDeclaration] > nt:unstructured
- + java:annotation (java:annotationDeclaration) = java:annotationDeclaration
- - java:packageKeyword (string)
- < 'package'
- - java:packageName (string) mandatory
-
-/**
- * Import declarations
- */
-[java:singleTypeImportDeclaration] > nt:unstructured
- - java:singleTypeImportkeyword (string) mandatory
- < 'import'
- - java:singleImportName (string) mandatory
-
-[java:typeImportOnDemandDeclaration] > nt:unstructured
- - java:onDemandImportKeyword (string) mandatory
- < 'import'
- - java:onDemandImportName (string) mandatory
-
- [java:importDeclaration] > nt:unstructured
- + java:singleImport (java:singleTypeImportDeclaration) =
java:singleTypeImportDeclaration
- + java:importOnDemand (java:typeImportOnDemandDeclaration) =
java:typeImportOnDemandDeclaration
-
-
-/**
- * Class declaration
- *
- * The body of class declares members (fields and methods and nested classes and
interfaces),
- * instance and static initializers, and constructors
- */
-[java:normalClassDeclaration] > nt:unstructured
- - java:description (string)
- + java:modifier (java:modifierDeclaration) = java:modifierDeclaration
- - java:normalClassName (string) mandatory
- + java:field (java:fieldType) = java:fieldType multiple
- + java:method (java:methodDeclaration) = java:methodDeclaration multiple
- + java:constructor (java:constructorDeclaration) = java:constructorDeclaration multiple
-
-[java:enumDeclaration] > nt:unstructured // TODO
-
-[java:classDeclaration] > nt:unstructured
- + java:normalClass (java:normalClassDeclaration) = java:normalClassDeclaration
- + java:enum (java:enumDeclaration) = java:enumDeclaration
-
-/**
- * Interface declaration
- *
- * The body of class declares members (fields and methods and nested classes and
interfaces),
- * instance and static initializers, and constructors
- */
-[java:interfaceDeclaration] > nt:unstructured
-
-
-/**
- * Compilation unit
- */
-[java:compilationUnit] > nt:unstructured
- + java:package (java:packageDeclaration) = java:packageDeclaration
- + java:import (java:importDeclaration) = java:importDeclaration
- + java:unitType (java:classDeclaration, java:interfaceDeclaration)
Copied: trunk/docs/examples/gettingstarted/sequencers/src/main/resources/sequencing.cnd
(from rev 970,
trunk/docs/examples/gettingstarted/sequencers/src/main/resources/jackrabbitNodeTypes.cnd)
===================================================================
--- trunk/docs/examples/gettingstarted/sequencers/src/main/resources/sequencing.cnd
(rev 0)
+++
trunk/docs/examples/gettingstarted/sequencers/src/main/resources/sequencing.cnd 2009-06-04
16:32:16 UTC (rev 971)
@@ -0,0 +1,266 @@
+<jcr='http://www.jcp.org/jcr/1.0'>
+<nt='http://www.jcp.org/jcr/nt/1.0'>
+<mix='http://www.jcp.org/jcr/mix/1.0'>
+<image='http://jboss.org/dna/images/1.0'>
+<mp3='http://jboss.org/dna/mp3/1.0'>
+<java='http://www.jboss.org/dna/java/1.0'>
+
+// ----------------------------------------------------------
+// JCR Pre-defined Mixin Types that are not loaded by default
+// ----------------------------------------------------------
+
+[mix:mimeTyped] mixin
+ - jcr:mimeType (string)
+ - jcr:encoding (string)
+
+
+// -------------------
+// DNA Image Sequencer
+// -------------------
+
+/**
+ * Node type that defines the metadata for an image
+ */
+[image:metadata] > nt:unstructured, mix:mimeTyped
+ - image:formatName (string) mandatory
+ < 'JPEG', 'GIF', 'PNG', 'BMP', 'PCX',
'IFF', 'RAS', 'PBM', 'PGM', 'PPM', 'PSD'
+ - image:width (long)
+ - image:height (long)
+ - image:bitsPerPixel (long)
+ - image:progressive (boolean)
+ - image:numberOfImages (long)
+ - image:physicalWidthDpi (long)
+ - image:physicalHeightDpi (long)
+ - image:physicalWidthInches (long)
+ - image:physicalHeightInches (long)
+
+// -------------------
+// DNA MP3 Sequencer
+// -------------------
+
+/**
+ * Node type that defines the metadata for an MP3 audio file
+ */
+[mp3:metadata] > nt:unstructured, mix:mimeTyped
+ - mp3:title (string)
+ - mp3:author (string)
+ - mp3:album (string)
+ - mp3:year (long)
+ - mp3:comment (string)
+
+// -------------------
+// DNA Java Sequencer
+// -------------------
+
+//------------------------------------------------------------------------------
+// N O D E T Y P E S
+//------------------------------------------------------------------------------
+
+/**
+ * Element-value
+ */
+[java:elementValue] > nt:unstructured
+ + java:kindOfvalues (java:conditionalExpression, java:annotationDeclaration,
java:elementValueArrayInitializer) mandatory
+
+/**
+ * Modifiers
+ */
+[java:modifierDeclaration] > nt:unstructured
+ - java:modifierName (string) mandatory
+
+/**
+ * Expression element-value type
+ */
+[java:conditionalExpression] > nt:unstructured
+ - java:expression (string)
+
+/**
+ * Array initializer element-value type
+ */
+[java:elementValueArrayInitializer] > nt:unstructured
+ + java:elementValue (java:elementValue) = java:elementValue multiple
+
+/**
+ * Identifier
+ */
+[java:identifier] > nt:unstructured
+ - java:identifierName (String) mandatory
+ + java:value (java:elementValue) = java:elementValue mandatory
+
+/**
+ * Element-value pair
+ */
+[java:elementValuePair] > nt:unstructured
+ + java:identifier (java:identifier) mandatory
+
+/**
+ * Annotation type
+ */
+[java:annotationDeclaration] > nt:unstructured
+ + java:annotationType (java:normalAnnotation, java:markerAnnotation,
java:singleElementAnnotation) mandatory
+
+/**
+ * Normal annotation e.g. @Entity(name="Customer")
+ */
+[java:normalAnnotation] > nt:unstructured
+ - java:normalAnnotationName (string) mandatory
+ + java:elementValuePair (java:elementValuePair)
+
+/**
+ * Marker annotation e.g. @GET
+ */
+[java:markerAnnotation] > nt:unstructured
+ - java:markerAnnotationName (string) mandatory
+
+/**
+ * Single element annotation e.g. @Path("/book")
+ */
+[java:singleElementAnnotation] > nt:unstructured
+ - java:singleElementAnnotationName (string) mandatory
+ + java:value (java:elementValue) = java:elementValue mandatory
+
+/**
+ * Formal parameter
+ */
+[java:formalParameter] > nt:unstructured
+ + java:type (java:primitiveType, java:arrayType, java:simpleType, java:qualifiedType,
java:wildcardType, java:parameterizedType)
+
+/**
+ * Primitive type:
+ * - Integral type ('byte', 'short', 'int', 'long',
'char')
+ * - Floating point type ('float', 'double')
+ * - Boolean type ('boolean')
+ * - No return type ('void')
+ */
+[java:primitiveType] > nt:unstructured
+ - java:primitiveTypeDescription (string)
+ + java:modifier (java:modifierDeclaration) = java:modifierDeclaration
+ - java:primitiveTypeName (string) mandatory
+ + java:primitiveVariable (java:variable) = java:variable
+
+ [java:variable] > nt:unstructured
+ - java:variableName (string) mandatory
+
+/**
+ * java:arrayType
+ */
+[java:arrayType] > nt:unstructured
+ - java:arrayTypeDescription (string)
+ + java:arrayTypeModifier (java:modifierDeclaration) = java:modifierDeclaration
+ - java:arrayTypeName (string) mandatory
+ + java:arrayTypeVariable (java:variable) = java:variable
+
+[java:simpleType] > nt:unstructured
+ - java:simpleTypeDescription (string)
+ + java:simpleTypeModifier (java:modifierDeclaration) = java:modifierDeclaration
+ - java:simpleTypeName (string) mandatory
+ + java:simpleTypeVariable (java:variable) = java:variable
+
+[java:qualifiedType] > nt:unstructured
+ - java:qualifiedTypeDescription (string)
+ + java:qualifiedTypeModifier (java:modifierDeclaration) = java:modifierDeclaration
+ - java:qualifiedTypeName (string) mandatory
+ + java:qualifiedTypeVariable (java:variable) = java:variable
+
+[java:wildcardType] > nt:unstructured
+ - java:wildcardTypeDescription (string)
+ + java:wildcardTypeModifier (java:modifierDeclaration) = java:modifierDeclaration
+ - java:wildcardTypeName (string) mandatory
+ + java:wildcardTypeVariable (java:variable) = java:variable
+
+[java:parameterizedType] > nt:unstructured
+ - java:parameterizedTypeDescription (string)
+ + java:parameterizedTypeModifier (java:modifierDeclaration) = java:modifierDeclaration
+ - java:parameterizedTypeName (string) mandatory
+ + java:parameterizedTypeVariable (java:variable) = java:variable
+
+/**
+ * Field type
+ */
+[java:fieldType] > nt:unstructured
+ + java:type (java:primitiveType, java:arrayType, java:simpleType, java:qualifiedType,
java:wildcardType, java:parameterizedType) mandatory multiple
+
+ /**
+ * Method declaration
+ */
+[java:methodDeclaration] > nt:unstructured
+ - java:methodDescription (string)
+ + java:modifier (java:modifierDeclaration) = java:modifierDeclaration
+ + java:resultType (java:primitiveType, java:arrayType, java:simpleType,
java:qualifiedType, java:wildcardType, java:parameterizedType) mandatory
+ - java:methodName (string) mandatory
+ + java:parameter (java:formalParameter) multiple
+
+/**
+ * Constructor declarations
+ */
+[java:constructorDeclaration] > nt:unstructured
+ - java:constructorDescription (string)
+ + java:modifier (java:modifierDeclaration) = java:modifierDeclaration
+ - java:constructorName (string) mandatory
+ + java:parameter (java:formalParameter)
+
+
+/**
+ * Package declarations
+ */
+[java:packageDeclaration] > nt:unstructured
+ + java:annotation (java:annotationDeclaration) = java:annotationDeclaration
+ - java:packageKeyword (string)
+ < 'package'
+ - java:packageName (string) mandatory
+
+/**
+ * Import declarations
+ */
+[java:singleTypeImportDeclaration] > nt:unstructured
+ - java:singleTypeImportkeyword (string) mandatory
+ < 'import'
+ - java:singleImportName (string) mandatory
+
+[java:typeImportOnDemandDeclaration] > nt:unstructured
+ - java:onDemandImportKeyword (string) mandatory
+ < 'import'
+ - java:onDemandImportName (string) mandatory
+
+ [java:importDeclaration] > nt:unstructured
+ + java:singleImport (java:singleTypeImportDeclaration) =
java:singleTypeImportDeclaration
+ + java:importOnDemand (java:typeImportOnDemandDeclaration) =
java:typeImportOnDemandDeclaration
+
+
+/**
+ * Class declaration
+ *
+ * The body of class declares members (fields and methods and nested classes and
interfaces),
+ * instance and static initializers, and constructors
+ */
+[java:normalClassDeclaration] > nt:unstructured
+ - java:description (string)
+ + java:modifier (java:modifierDeclaration) = java:modifierDeclaration
+ - java:normalClassName (string) mandatory
+ + java:field (java:fieldType) = java:fieldType multiple
+ + java:method (java:methodDeclaration) = java:methodDeclaration multiple
+ + java:constructor (java:constructorDeclaration) = java:constructorDeclaration multiple
+
+[java:enumDeclaration] > nt:unstructured // TODO
+
+[java:classDeclaration] > nt:unstructured
+ + java:normalClass (java:normalClassDeclaration) = java:normalClassDeclaration
+ + java:enum (java:enumDeclaration) = java:enumDeclaration
+
+/**
+ * Interface declaration
+ *
+ * The body of class declares members (fields and methods and nested classes and
interfaces),
+ * instance and static initializers, and constructors
+ */
+[java:interfaceDeclaration] > nt:unstructured
+
+
+/**
+ * Compilation unit
+ */
+[java:compilationUnit] > nt:unstructured
+ + java:package (java:packageDeclaration) = java:packageDeclaration
+ + java:import (java:importDeclaration) = java:importDeclaration
+ + java:unitType (java:classDeclaration, java:interfaceDeclaration)
+
\ No newline at end of file
Modified:
trunk/docs/examples/gettingstarted/sequencers/src/test/java/org/jboss/example/dna/sequencer/MockUserInterface.java
===================================================================
---
trunk/docs/examples/gettingstarted/sequencers/src/test/java/org/jboss/example/dna/sequencer/MockUserInterface.java 2009-06-03
20:26:37 UTC (rev 970)
+++
trunk/docs/examples/gettingstarted/sequencers/src/test/java/org/jboss/example/dna/sequencer/MockUserInterface.java 2009-06-04
16:32:16 UTC (rev 971)
@@ -27,8 +27,6 @@
import static org.junit.Assert.assertThat;
import java.net.URL;
import java.util.List;
-import org.jboss.example.dna.sequencer.ContentInfo;
-import org.jboss.example.dna.sequencer.UserInterface;
/**
* @author Randall Hauch
@@ -72,4 +70,13 @@
return this.repositoryPath != null ? this.repositoryPath : defaultPath;
}
+ /**
+ * {@inheritDoc}
+ *
+ * @see
org.jboss.example.dna.sequencer.UserInterface#displayError(java.lang.Exception)
+ */
+ public void displayError( Exception e ) {
+ // Do nothing
+ }
+
}
Modified:
trunk/docs/examples/gettingstarted/sequencers/src/test/java/org/jboss/example/dna/sequencer/SequencingClientTest.java
===================================================================
---
trunk/docs/examples/gettingstarted/sequencers/src/test/java/org/jboss/example/dna/sequencer/SequencingClientTest.java 2009-06-03
20:26:37 UTC (rev 970)
+++
trunk/docs/examples/gettingstarted/sequencers/src/test/java/org/jboss/example/dna/sequencer/SequencingClientTest.java 2009-06-04
16:32:16 UTC (rev 971)
@@ -34,7 +34,6 @@
import org.jboss.dna.graph.connector.inmemory.InMemoryRepositorySource;
import org.jboss.dna.jcr.JcrConfiguration;
import org.jboss.dna.jcr.JcrRepository;
-import org.jboss.dna.sequencer.image.ImageMetadataSequencer;
import org.jboss.dna.sequencer.java.JavaMetadataSequencer;
import org.jboss.dna.sequencer.mp3.Mp3MetadataSequencer;
import org.junit.After;
@@ -73,10 +72,7 @@
.setProperty("defaultWorkspaceName", workspaceName);
// Set up the JCR repository to use the source ...
config.repository(repositoryId)
-
.addNodeTypes(ImageMetadataSequencer.class.getClassLoader().getResource("org/jboss/dna/sequencer/image/images.cnd"))
-
.addNodeTypes(Mp3MetadataSequencer.class.getClassLoader().getResource("org/jboss/dna/sequencer/mp3/mp3.cnd"))
- .addNodeTypes(JavaMetadataSequencer.class.getClassLoader()
-
.getResource("org/jboss/dna/sequencer/java/javaSource.cnd"))
+
.addNodeTypes(getClass().getClassLoader().getResource("sequencing.cnd"))
.setSource("store")
.setOption(JcrRepository.Option.JAAS_LOGIN_CONFIG_NAME,
"dna-jcr");
// Set up the image sequencer ...
@@ -123,7 +119,6 @@
}
- @Ignore
@Test
public void shouldUploadAndSequencePngFile() throws Exception {
client.setUserInterface(new MockUserInterface(this.pngImageUrl,
"/a/b/caution.png", 1));
@@ -132,13 +127,13 @@
// Use a trick to wait until the sequencing has been done by sleeping (to give
the sequencing time to start)
// and to then shut down the DNA services (which will block until all sequencing
has been completed) ...
- Thread.sleep(1000);
+ Thread.sleep(4000);
+ assertThat(client.getStatistics().getNumberOfNodesSequenced(), is(1l));
+
// The sequencers should have run, so perform the search.
// The mock user interface checks the results.
client.search();
-
- assertThat(client.getStatistics().getNumberOfNodesSequenced(), is(1l));
}
@Ignore
Modified:
trunk/extensions/dna-connector-svn/src/test/java/org/jboss/dna/connector/svn/SVNConnectorTestUtil.java
===================================================================
---
trunk/extensions/dna-connector-svn/src/test/java/org/jboss/dna/connector/svn/SVNConnectorTestUtil.java 2009-06-03
20:26:37 UTC (rev 970)
+++
trunk/extensions/dna-connector-svn/src/test/java/org/jboss/dna/connector/svn/SVNConnectorTestUtil.java 2009-06-04
16:32:16 UTC (rev 971)
@@ -45,7 +45,7 @@
*/
public class SVNConnectorTestUtil {
- @SuppressWarnings("unchecked")
+ @SuppressWarnings( "unchecked" )
public static void main( String[] args ) throws Exception {
try {
System.out.println("My repos. ......");
@@ -53,53 +53,47 @@
String username = "sp";
String password = "";
System.out.println(svnUrl);
- SVNRepository trunkWorkspace = createRepository(svnUrl +"/trunk",
username, password);
+ SVNRepository trunkWorkspace = createRepository(svnUrl + "/trunk",
username, password);
System.out.println("Repository location: " +
trunkWorkspace.getLocation().toString());
System.out.println("Repository Root: " +
trunkWorkspace.getRepositoryRoot(true));
System.out.println("Repository UUID: " +
trunkWorkspace.getRepositoryUUID(true));
/**
- * Returns the repository location to which this object is set.
- * It may be the location that was used to create this object
- * (see {@link SVNRepositoryFactory#create(SVNURL)}), or the recent
- * one the object was set to.
+ * Returns the repository location to which this object is set. It may be the
location that was used to create this
+ * object (see {@link SVNRepositoryFactory#create(SVNURL)}), or the recent
one the object was set to.
*/
System.out.println("location: " +
trunkWorkspace.getLocation().getPath());
System.out.println("decoded location: " +
trunkWorkspace.getLocation().toDecodedString());
System.out.println("last seg: " +
getRepositoryWorspaceName(trunkWorkspace));
-
- final Collection<SVNDirEntry> dirEntries =
trunkWorkspace.getDir("",
- -1,
- null,
-
(Collection<SVNDirEntry>)null);
+
+ final Collection<SVNDirEntry> dirEntries =
trunkWorkspace.getDir("", -1, null, (Collection<SVNDirEntry>)null);
for (SVNDirEntry dirEntry : dirEntries) {
- System.out.println("name: " + dirEntry.getName());
+ System.out.println("name: " + dirEntry.getName());
}
-
-////
-// SVNNodeKind nodeKind = trunkWorkspace.checkPath( "/" , -1 );
-// if ( nodeKind == SVNNodeKind.NONE ) {
-// System.err.println( "There is no entry in the workspace "+
trunkWorkspace );
-// System.exit( 1 );
-// } else if ( nodeKind == SVNNodeKind.FILE ) {
-// System.err.println( "The entry at '" + trunkWorkspace +
"' is a file while a directory was expected." );
-// System.exit( 1 );
-// } else {
-// listEntries(trunkWorkspace, "/root");
-//// long latestRevision = trunkWorkspace.getLatestRevision( );
-//// System.out.println( "workspace latest revision: " +
latestRevision );
-//
-////// SVNNodeKind kind = trunkWorkspace.checkPath("/", -1);
-//// if(kind == SVNNodeKind.NONE) {
-//// System.out.println("none");
-//// } else if(kind == SVNNodeKind.UNKNOWN) {
-//// System.out.println("unknown");
-//// } else if(kind == SVNNodeKind.FILE) {
-//// System.out.println("file");
-//// } else if(kind == SVNNodeKind.DIR) {
-// System.out.println("dir");
-//// listEntries(trunkWorkspace,"root");
-// }
+ // //
+ // SVNNodeKind nodeKind = trunkWorkspace.checkPath( "/" , -1 );
+ // if ( nodeKind == SVNNodeKind.NONE ) {
+ // System.err.println( "There is no entry in the workspace "+
trunkWorkspace );
+ // System.exit( 1 );
+ // } else if ( nodeKind == SVNNodeKind.FILE ) {
+ // System.err.println( "The entry at '" + trunkWorkspace +
"' is a file while a directory was expected." );
+ // System.exit( 1 );
+ // } else {
+ // listEntries(trunkWorkspace, "/root");
+ // // long latestRevision = trunkWorkspace.getLatestRevision( );
+ // // System.out.println( "workspace latest revision: " +
latestRevision );
+ //
+ // //// SVNNodeKind kind = trunkWorkspace.checkPath("/", -1);
+ // // if(kind == SVNNodeKind.NONE) {
+ // // System.out.println("none");
+ // // } else if(kind == SVNNodeKind.UNKNOWN) {
+ // // System.out.println("unknown");
+ // // } else if(kind == SVNNodeKind.FILE) {
+ // // System.out.println("file");
+ // // } else if(kind == SVNNodeKind.DIR) {
+ // System.out.println("dir");
+ // // listEntries(trunkWorkspace,"root");
+ // }
} catch (SVNException e) {
e.printStackTrace();
@@ -144,26 +138,26 @@
FileUtil.copy(mySrc, myDst);
// Now set the two path roots
- String url = myDst.getCanonicalFile().toURL().toString();
+ String url = myDst.getCanonicalFile().toURI().toURL().toString();
return url.replaceFirst("file:/", "file://localhost/");
}
-
- @SuppressWarnings("unchecked")
- public static void listEntries( SVNRepository workspace, String path ) throws
SVNException {
- Collection<SVNDirEntry> entries = workspace.getDir( path, -1 , null ,
(Collection) null );
- Iterator<SVNDirEntry> iterator = entries.iterator( );
- while ( iterator.hasNext( ) ) {
- SVNDirEntry entry = iterator.next( );
- System.out.println( "/" + (path.equals( "" ) ?
"" : path + "/" ) + entry.getName( ) +
- " ( author: '" + entry.getAuthor( ) +
"'; revision: " + entry.getRevision( ) +
- "; date: " + entry.getDate( ) + ")"
);
- if ( entry.getKind() == SVNNodeKind.DIR ) {
- listEntries( workspace, ( path.equals( "" ) ) ? entry.getName(
) : path + "/" + entry.getName( ) );
+
+ @SuppressWarnings( "unchecked" )
+ public static void listEntries( SVNRepository workspace,
+ String path ) throws SVNException {
+ Collection<SVNDirEntry> entries = workspace.getDir(path, -1, null,
(Collection)null);
+ Iterator<SVNDirEntry> iterator = entries.iterator();
+ while (iterator.hasNext()) {
+ SVNDirEntry entry = iterator.next();
+ System.out.println("/" + (path.equals("") ? ""
: path + "/") + entry.getName() + " ( author: '" +
entry.getAuthor()
+ + "'; revision: " + entry.getRevision() +
"; date: " + entry.getDate() + ")");
+ if (entry.getKind() == SVNNodeKind.DIR) {
+ listEntries(workspace, (path.equals("")) ? entry.getName() :
path + "/" + entry.getName());
}
}
}
- public static String getRepositoryWorspaceName(SVNRepository repository) {
+ public static String getRepositoryWorspaceName( SVNRepository repository ) {
String[] segments = repository.getLocation().getPath().split("/");
return segments[segments.length - 1];
}