You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by ju...@apache.org on 2013/05/20 14:10:37 UTC
svn commit: r1484442 - in
/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data:
AbstractDataStore.java FileDataStore.java db/DbDataStore.java
Author: jukka
Date: Mon May 20 12:10:36 2013
New Revision: 1484442
URL: http://svn.apache.org/r1484442
Log:
JCR-3534: Efficient copying of binaries across repositories with the same data store
Add a default implementation of the getRecord() method to the new AbstractDataStore base class
Modified:
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/AbstractDataStore.java
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/FileDataStore.java
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/db/DbDataStore.java
Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/AbstractDataStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/AbstractDataStore.java?rev=1484442&r1=1484441&r2=1484442&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/AbstractDataStore.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/AbstractDataStore.java Mon May 20 12:10:36 2013
@@ -37,7 +37,17 @@ public abstract class AbstractDataStore
//---------------------------------------------------------< DataStore >--
- @Override
+ public DataRecord getRecord(DataIdentifier identifier)
+ throws DataStoreException {
+ DataRecord record = getRecordIfStored(identifier);
+ if (record != null) {
+ return record;
+ } else {
+ throw new DataStoreException(
+ "Record " + identifier + " does not exist");
+ }
+ }
+
public DataIdentifier getIdentifierFromReference(String reference) {
int colon = reference.indexOf(':');
if (colon != -1) {
Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/FileDataStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/FileDataStore.java?rev=1484442&r1=1484441&r2=1484442&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/FileDataStore.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/FileDataStore.java Mon May 20 12:10:36 2013
@@ -133,23 +133,16 @@ public class FileDataStore extends Abstr
directory.mkdirs();
}
- public DataRecord getRecordIfStored(DataIdentifier identifier) throws DataStoreException {
- return getRecord(identifier, true);
- }
-
/**
* Get a data record for the given identifier.
- * This method only checks if the file exists if the verify flag is set.
- * If the verify flag is set and the file doesn't exist, the method returns null.
*
* @param identifier the identifier
- * @param verify whether to check if the file exists
* @return the data record or null
*/
- private DataRecord getRecord(DataIdentifier identifier, boolean verify) throws DataStoreException {
+ public DataRecord getRecordIfStored(DataIdentifier identifier) throws DataStoreException {
File file = getFile(identifier);
synchronized (this) {
- if (verify && !file.exists()) {
+ if (!file.exists()) {
return null;
}
if (minModifiedDate != 0) {
@@ -163,19 +156,6 @@ public class FileDataStore extends Abstr
}
}
- /**
- * Returns the record with the given identifier. Note that this method
- * performs no sanity checks on the given identifier. It is up to the
- * caller to ensure that only identifiers of previously created data
- * records are used.
- *
- * @param identifier data identifier
- * @return identified data record
- */
- public DataRecord getRecord(DataIdentifier identifier) throws DataStoreException {
- return getRecord(identifier, false);
- }
-
private void usesIdentifier(DataIdentifier identifier) {
inUse.put(identifier, new WeakReference<DataIdentifier>(identifier));
}
Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/db/DbDataStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/db/DbDataStore.java?rev=1484442&r1=1484441&r2=1484442&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/db/DbDataStore.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/db/DbDataStore.java Mon May 20 12:10:36 2013
@@ -562,14 +562,6 @@ public class DbDataStore extends Abstrac
}
}
- public DataRecord getRecord(DataIdentifier identifier) throws DataStoreException {
- DataRecord record = getRecordIfStored(identifier);
- if (record == null) {
- throw new DataStoreException("Record not found: " + identifier);
- }
- return record;
- }
-
/**
* Open the input stream. This method sets those fields of the caller
* that need to be closed once the input stream is read.