Index: main/java/org/apache/jackrabbit/core/data/FSBackend.java =================================================================== --- main/java/org/apache/jackrabbit/core/data/FSBackend.java (revision 1678122) +++ main/java/org/apache/jackrabbit/core/data/FSBackend.java (working copy) @@ -45,7 +45,7 @@ private Properties properties; - private String path; + private String fsPath; private CachingDataStore store; @@ -53,11 +53,11 @@ private String config; - File pathDir; + File fsPathDir; private ThreadPoolExecutor asyncWriteExecuter; - public static final String PATH = "path"; + public static final String FS_BACKEND_PATH = "fsBackendPath"; /** * Logger instance. @@ -100,21 +100,21 @@ throws DataStoreException { this.store = store; this.homeDir = homeDir; - this.path = prop.getProperty(PATH); - if (this.path == null || "".equals(this.path)) { + this.fsPath = prop.getProperty(FS_BACKEND_PATH); + if (this.fsPath == null || "".equals(this.fsPath)) { throw new DataStoreException("Could not initialize FSBackend from " - + config + ". [" + PATH + "] property not found."); + + config + ". [" + FS_BACKEND_PATH + "] property not found."); } - pathDir = new File(this.path); - if (pathDir.exists() && pathDir.isFile()) { + fsPathDir = new File(this.fsPath); + if (fsPathDir.exists() && fsPathDir.isFile()) { throw new DataStoreException("Can not create a directory " - + "because a file exists with the same name: " + this.path); + + "because a file exists with the same name: " + this.fsPath); } - if( !pathDir.exists()) { - boolean created = pathDir.mkdirs(); + if (!fsPathDir.exists()) { + boolean created = fsPathDir.mkdirs(); if (!created) { throw new DataStoreException("Could not create directory: " - + pathDir.getAbsolutePath()); + + fsPathDir.getAbsolutePath()); } } asyncWriteExecuter = (ThreadPoolExecutor) Executors.newFixedThreadPool( @@ -172,8 +172,10 @@ try { FileUtils.copyFile(src, dest); } catch (IOException ioe) { + LOG.error("failed to copy [{}] to [{}]", + src.getAbsolutePath(), dest.getAbsolutePath()); throw new DataStoreException("Not able to write file [" - + identifier + "]"); + + identifier + "]", ioe); } } } @@ -209,7 +211,7 @@ public Iterator getAllIdentifiers() throws DataStoreException { ArrayList files = new ArrayList(); - for (File file : pathDir.listFiles()) { + for (File file : fsPathDir.listFiles()) { if (file.isDirectory()) { // skip top-level files listRecursive(files, file); } @@ -298,7 +300,7 @@ public Set deleteAllOlderThan(long min) throws DataStoreException { Set deleteIdSet = new HashSet(30); - for (File file : pathDir.listFiles()) { + for (File file : fsPathDir.listFiles()) { if (file.isDirectory()) { // skip top-level files deleteOlderRecursive(file, min, deleteIdSet); } @@ -340,7 +342,7 @@ */ private File getFile(DataIdentifier identifier) { String string = identifier.toString(); - File file = this.pathDir; + File file = this.fsPathDir; file = new File(file, string.substring(0, 2)); file = new File(file, string.substring(2, 4)); file = new File(file, string.substring(4, 6)); @@ -418,7 +420,7 @@ // Only iterate & delete if parent directory of the blob file is // child // of the base directory and if it is empty - while (FileUtils.directoryContains(pathDir, parent)) { + while (FileUtils.directoryContains(fsPathDir, parent)) { String[] entries = parent.list(); if (entries == null) { LOG.warn("Failed to list directory {}", Index: test/java/org/apache/jackrabbit/core/data/TestCachingFDS.java =================================================================== --- test/java/org/apache/jackrabbit/core/data/TestCachingFDS.java (revision 1678122) +++ test/java/org/apache/jackrabbit/core/data/TestCachingFDS.java (working copy) @@ -38,16 +38,16 @@ protected DataStore createDataStore() throws RepositoryException { CachingFDS cacheFDS = new CachingFDS(); Properties props = loadProperties("/fs.properties"); - String pathValue = props.getProperty("path"); + String pathValue = props.getProperty(FSBackend.FS_BACKEND_PATH); if (pathValue != null && !"".equals(pathValue.trim())) { - path = pathValue + "/cachingFds" + "-" + fsPath = pathValue + "/cachingFds" + "-" + String.valueOf(randomGen.nextInt(100000)) + "-" + String.valueOf(randomGen.nextInt(100000)); } else { - path = dataStoreDir + "/cachingFds"; + fsPath = dataStoreDir + "/cachingFds"; } - props.setProperty("path", path); - LOG.info("path [{}] set.", path); + props.setProperty(FSBackend.FS_BACKEND_PATH, fsPath); + LOG.info("fsBackendPath [{}] set.", fsPath); cacheFDS.setProperties(props); cacheFDS.setSecret("12345"); cacheFDS.init(dataStoreDir); @@ -79,5 +79,4 @@ fail(e.getMessage()); } } - } Index: test/java/org/apache/jackrabbit/core/data/TestCachingFDSCacheOff.java =================================================================== --- test/java/org/apache/jackrabbit/core/data/TestCachingFDSCacheOff.java (revision 1678122) +++ test/java/org/apache/jackrabbit/core/data/TestCachingFDSCacheOff.java (working copy) @@ -27,19 +27,19 @@ public class TestCachingFDSCacheOff extends TestFileDataStore { protected static final Logger LOG = LoggerFactory.getLogger(TestCachingFDS.class); - + protected DataStore createDataStore() throws RepositoryException { CachingFDS cacheFDS = new CachingFDS(); Properties props = loadProperties("/fs.properties"); - String pathValue = props.getProperty("path"); + String pathValue = props.getProperty(FSBackend.FS_BACKEND_PATH); if (pathValue != null && !"".equals(pathValue.trim())) { - path = pathValue + "/cachingFds" + "-" + fsPath = pathValue + "/cachingFds" + "-" + String.valueOf(randomGen.nextInt(100000)) + "-" + String.valueOf(randomGen.nextInt(100000)); } else { - path = dataStoreDir + "/cachingFDS"; + fsPath = dataStoreDir + "/cachingFDS"; } - props.setProperty("path", path); + props.setProperty(FSBackend.FS_BACKEND_PATH, fsPath); cacheFDS.setProperties(props); cacheFDS.setSecret("12345"); cacheFDS.setCacheSize(0); Index: test/java/org/apache/jackrabbit/core/data/TestFileDataStore.java =================================================================== --- test/java/org/apache/jackrabbit/core/data/TestFileDataStore.java (revision 1678122) +++ test/java/org/apache/jackrabbit/core/data/TestFileDataStore.java (working copy) @@ -33,22 +33,22 @@ protected static final Logger LOG = LoggerFactory.getLogger(TestFileDataStore.class); - protected String path; + String fsPath; @Override protected DataStore createDataStore() throws RepositoryException { FileDataStore fds = new FileDataStore(); Properties props = loadProperties("/fs.properties"); - String pathValue = props.getProperty("path"); + String pathValue = props.getProperty(FSBackend.FS_BACKEND_PATH); if (pathValue != null && !"".equals(pathValue.trim())) { - path = pathValue + "/fds" + "-" + fsPath = pathValue + "/fds" + "-" + String.valueOf(randomGen.nextInt(100000)) + "-" + String.valueOf(randomGen.nextInt(100000)); } else { - path = dataStoreDir + "/repository/datastore"; + fsPath = dataStoreDir + "/repository/datastore"; } - LOG.info("path [{}] set.", path); - fds.setPath(path); + LOG.info("path [{}] set.", fsPath); + fds.setPath(fsPath); fds.init(dataStoreDir); return fds; } @@ -55,8 +55,8 @@ @Override protected void tearDown() { - LOG.info("cleaning path [{}]", path); - File f = new File(path); + LOG.info("cleaning fsPath [{}]", fsPath); + File f = new File(fsPath); try { for (int i = 0; i < 4 && f.exists(); i++) { FileUtils.deleteQuietly(f); @@ -67,5 +67,4 @@ } super.tearDown(); } - } Index: test/resources/fs.properties =================================================================== --- test/resources/fs.properties (revision 1678122) +++ test/resources/fs.properties (working copy) @@ -14,4 +14,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # - +fsBackendPath=