Author: bcarothers
Date: 2010-01-01 12:19:43 -0500 (Fri, 01 Jan 2010)
New Revision: 1511
Removed:
trunk/extensions/dna-connector-filesystem/src/main/java/org/jboss/dna/connector/filesystem/FileSystemTransaction.java
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/path/DefaultPathNode.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/path/PathRepository.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/path/PathRepositoryConnection.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/path/PathRequestProcessor.java
trunk/extensions/dna-connector-filesystem/src/main/java/org/jboss/dna/connector/filesystem/FileSystemRepository.java
Log:
DNA-519 SVN Connector integration test runs in a very long time
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/path/DefaultPathNode.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/path/DefaultPathNode.java 2010-01-01
13:28:22 UTC (rev 1510)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/path/DefaultPathNode.java 2010-01-01
17:19:43 UTC (rev 1511)
@@ -1,6 +1,7 @@
package org.jboss.dna.graph.connector.path;
import java.util.Collections;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
@@ -37,6 +38,21 @@
this.childSegments = childSegments;
}
+ public DefaultPathNode( Path path,
+ UUID uuid,
+ Iterable<Property> properties,
+ List<Segment> childSegments ) {
+ super();
+ this.path = path;
+ this.uuid = uuid;
+ this.childSegments = childSegments;
+ this.properties = new HashMap<Name, Property>();
+
+ for (Property property : properties) {
+ this.properties.put(property.getName(), property);
+ }
+ }
+
public List<Segment> getChildSegments() {
return this.childSegments;
}
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/path/PathRepository.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/path/PathRepository.java 2010-01-01
13:28:22 UTC (rev 1510)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/path/PathRepository.java 2010-01-01
17:19:43 UTC (rev 1511)
@@ -6,6 +6,9 @@
import java.util.concurrent.ConcurrentMap;
import net.jcip.annotations.ThreadSafe;
import org.jboss.dna.common.util.CheckArg;
+import org.jboss.dna.graph.ExecutionContext;
+import org.jboss.dna.graph.connector.RepositoryContext;
+import org.jboss.dna.graph.observe.Observer;
@ThreadSafe
public abstract class PathRepository {
@@ -106,21 +109,21 @@
*/
protected abstract void initialize();
- /**
- * Begin a transaction, hinting whether the transaction will be used only to read the
content. If this is called, then the
- * transaction must be either {@link PathRepositoryTransaction#commit() committed}
or
- * {@link PathRepositoryTransaction#rollback() rolled back}.
- *
- * @param readonly true if the transaction will not modify any content, or false if
changes are to be made
- * @return the transaction; never null
- * @see PathRepositoryTransaction#commit()
- * @see PathRepositoryTransaction#rollback()
- */
- public PathRepositoryTransaction startTransaction( boolean readonly ) {
+ public boolean isWritable() {
+ return false;
+ }
- // Read-only repositories can return a default NOP implementation
- return new PathRepositoryTransaction() {
+ PathRequestProcessor createRequestProcessor( ExecutionContext context,
+ PathRepositorySource source ) {
+ RepositoryContext repositoryContext = source.getRepositoryContext();
+ Observer observer = repositoryContext != null ? repositoryContext.getObserver() :
null;
+ boolean updatesAllowed = source.areUpdatesAllowed();
+ /**
+ * Read-only implementations can use a NOP transaction.
+ */
+ PathRepositoryTransaction txn = new PathRepositoryTransaction() {
+
public void commit() {
}
@@ -128,9 +131,7 @@
}
};
- }
- public boolean isWritable() {
- return false;
+ return new PathRequestProcessor(context, this, observer, updatesAllowed, txn);
}
}
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/path/PathRepositoryConnection.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/path/PathRepositoryConnection.java 2010-01-01
13:28:22 UTC (rev 1510)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/path/PathRepositoryConnection.java 2010-01-01
17:19:43 UTC (rev 1511)
@@ -7,11 +7,8 @@
import org.jboss.dna.graph.ExecutionContext;
import org.jboss.dna.graph.cache.CachePolicy;
import org.jboss.dna.graph.connector.RepositoryConnection;
-import org.jboss.dna.graph.connector.RepositoryContext;
import org.jboss.dna.graph.connector.RepositorySourceException;
-import org.jboss.dna.graph.observe.Observer;
import org.jboss.dna.graph.request.Request;
-import org.jboss.dna.graph.request.processor.RequestProcessor;
public class PathRepositoryConnection implements RepositoryConnection {
@@ -78,10 +75,8 @@
}
// Do any commands update/write?
- PathRepositoryTransaction txn =
repository.startTransaction(request.isReadOnly());
- RepositoryContext repositoryContext = this.source.getRepositoryContext();
- Observer observer = repositoryContext != null ? repositoryContext.getObserver() :
null;
- RequestProcessor processor = new PathRequestProcessor(context, this.repository,
observer, source.areUpdatesAllowed());
+ PathRequestProcessor processor = repository.createRequestProcessor(context,
source);
+ PathRepositoryTransaction txn = processor.getTransaction();
boolean commit = true;
try {
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/path/PathRequestProcessor.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/path/PathRequestProcessor.java 2010-01-01
13:28:22 UTC (rev 1510)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/path/PathRequestProcessor.java 2010-01-01
17:19:43 UTC (rev 1511)
@@ -51,15 +51,18 @@
private final PathFactory pathFactory;
private final PathRepository repository;
private final boolean updatesAllowed;
+ private final PathRepositoryTransaction txn;
public PathRequestProcessor( ExecutionContext context,
PathRepository repository,
Observer observer,
- boolean updatesAllowed ) {
+ boolean updatesAllowed,
+ PathRepositoryTransaction txn ) {
super(repository.getSourceName(), context, observer);
this.repository = repository;
pathFactory = context.getValueFactories().getPathFactory();
this.updatesAllowed = updatesAllowed;
+ this.txn = txn;
}
protected boolean updatesAllowed( Request request ) {
@@ -575,4 +578,15 @@
return node;
}
+ /**
+ * Returns the transaction associated with this request processor. This transaction
must eventually either be
+ * {@link PathRepositoryTransaction#commit() committed} or {@link
PathRepositoryTransaction#rollback() rolled back}.
+ *
+ * @return the transaction associated with this request processor; never null
+ * @see PathRepositoryTransaction#commit()
+ * @see PathRepositoryTransaction#rollback()
+ */
+ public PathRepositoryTransaction getTransaction() {
+ return this.txn;
+ }
}
Modified:
trunk/extensions/dna-connector-filesystem/src/main/java/org/jboss/dna/connector/filesystem/FileSystemRepository.java
===================================================================
---
trunk/extensions/dna-connector-filesystem/src/main/java/org/jboss/dna/connector/filesystem/FileSystemRepository.java 2010-01-01
13:28:22 UTC (rev 1510)
+++
trunk/extensions/dna-connector-filesystem/src/main/java/org/jboss/dna/connector/filesystem/FileSystemRepository.java 2010-01-01
17:19:43 UTC (rev 1511)
@@ -49,7 +49,6 @@
import org.jboss.dna.graph.connector.path.AbstractWritablePathWorkspace;
import org.jboss.dna.graph.connector.path.DefaultPathNode;
import org.jboss.dna.graph.connector.path.PathNode;
-import org.jboss.dna.graph.connector.path.PathRepositoryTransaction;
import org.jboss.dna.graph.connector.path.WritablePathRepository;
import org.jboss.dna.graph.connector.path.WritablePathWorkspace;
import org.jboss.dna.graph.mimetype.MimeTypeDetector;
@@ -171,11 +170,6 @@
return null;
}
- @Override
- public PathRepositoryTransaction startTransaction( boolean readonly ) {
- return new FileSystemTransaction();
- }
-
/**
* Writable workspace implementation for file system-backed workspaces
*/
Deleted:
trunk/extensions/dna-connector-filesystem/src/main/java/org/jboss/dna/connector/filesystem/FileSystemTransaction.java
===================================================================
---
trunk/extensions/dna-connector-filesystem/src/main/java/org/jboss/dna/connector/filesystem/FileSystemTransaction.java 2010-01-01
13:28:22 UTC (rev 1510)
+++
trunk/extensions/dna-connector-filesystem/src/main/java/org/jboss/dna/connector/filesystem/FileSystemTransaction.java 2010-01-01
17:19:43 UTC (rev 1511)
@@ -1,53 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.connector.filesystem;
-
-import org.jboss.dna.graph.connector.path.PathRepositoryTransaction;
-
-/**
- * A transaction returned by the {@link FileSystemRepository#startTransaction(boolean)}.
- */
-public class FileSystemTransaction implements PathRepositoryTransaction {
-
- /**
- * Commit any changes that have been made to the repository. This method may throw
runtime exceptions if there are failures
- * committing the changes, but the transaction is still expected to be closed.
- *
- * @see #rollback()
- * @see FileSystemRepository#startTransaction(boolean)
- */
- public void commit() {
- }
-
- /**
- * Rollback any changes that have been made to this repository. This method may throw
runtime exceptions if there are failures
- * rolling back the changes, but the transaction is still expected to be closed.
- *
- * @see #commit()
- * @see FileSystemRepository#startTransaction(boolean)
- */
- public void rollback() {
- }
-
-}