jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From resc...@apache.org
Subject svn commit: r1576690 [7/10] - in /jackrabbit/trunk: examples/jackrabbit-firsthops/ examples/jackrabbit-firsthops/src/main/resources/ jackrabbit-aws-ext/ jackrabbit-aws-ext/src/main/java/org/apache/jackrabbit/aws/ext/ jackrabbit-aws-ext/src/main/java/or...
Date Wed, 12 Mar 2014 11:05:08 GMT
Modified: jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/data/db/DerbyDataStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/data/db/DerbyDataStore.java?rev=1576690&r1=1576689&r2=1576690&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/data/db/DerbyDataStore.java (original)
+++ jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/data/db/DerbyDataStore.java Wed Mar 12 11:05:06 2014
@@ -1,53 +1,53 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.core.data.db;
-
-import java.sql.SQLException;
-
-import javax.sql.DataSource;
-
-import org.apache.jackrabbit.core.data.DataStoreException;
-import org.apache.jackrabbit.core.util.db.ConnectionHelper;
-import org.apache.jackrabbit.core.util.db.DerbyConnectionHelper;
-
-/**
- * The Derby data store closes the database when the data store is closed
- * (embedded databases only).
- */
-public class DerbyDataStore extends DbDataStore {
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    protected ConnectionHelper createConnectionHelper(DataSource dataSrc) throws Exception {
-        return new DerbyConnectionHelper(dataSrc, false);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public synchronized void close() throws DataStoreException {
-        super.close();
-        try {
-            ((DerbyConnectionHelper) conHelper).shutDown(getDriver());
-        } catch (SQLException e) {
-            throw new DataStoreException(e);
-        }
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.core.data.db;
+
+import java.sql.SQLException;
+
+import javax.sql.DataSource;
+
+import org.apache.jackrabbit.core.data.DataStoreException;
+import org.apache.jackrabbit.core.util.db.ConnectionHelper;
+import org.apache.jackrabbit.core.util.db.DerbyConnectionHelper;
+
+/**
+ * The Derby data store closes the database when the data store is closed
+ * (embedded databases only).
+ */
+public class DerbyDataStore extends DbDataStore {
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected ConnectionHelper createConnectionHelper(DataSource dataSrc) throws Exception {
+        return new DerbyConnectionHelper(dataSrc, false);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public synchronized void close() throws DataStoreException {
+        super.close();
+        try {
+            ((DerbyConnectionHelper) conHelper).shutDown(getDriver());
+        } catch (SQLException e) {
+            throw new DataStoreException(e);
+        }
+    }
+}

Propchange: jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/data/db/DerbyDataStore.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/data/db/TempFileInputStream.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/data/db/TempFileInputStream.java?rev=1576690&r1=1576689&r2=1576690&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/data/db/TempFileInputStream.java (original)
+++ jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/data/db/TempFileInputStream.java Wed Mar 12 11:05:06 2014
@@ -1,148 +1,148 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.core.data.db;
-
-import java.io.BufferedInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.commons.io.input.AutoCloseInputStream;
-
-/**
- * An input stream from a temporary file. The file is deleted when the stream is
- * closed, fully read, or garbage collected.
- * <p>
- * This class does not support mark/reset. It is always to be wrapped
- * using a BufferedInputStream.
- */
-public class TempFileInputStream extends AutoCloseInputStream {
-
-    private final File file;
-    private boolean closed;
-    private boolean delayedResourceCleanup = true;
-
-    /**
-     * Copy the data to a file and close the input stream afterwards.
-     *
-     * @param in the input stream
-     * @param file the target file
-     * @return the size of the file
-     */
-    public static long writeToFileAndClose(InputStream in, File file) throws IOException {
-        OutputStream out = new FileOutputStream(file);
-        IOUtils.copy(in, out);
-        out.close();
-        in.close();
-        return file.length();
-    }
-
-    /**
-     * Construct a new temporary file input stream.
-     * The file is deleted if the input stream is closed or fully read and 
-     * delayedResourceCleanup was set to true. Otherwise you must call {@link #deleteFile()}.
-     * Deleting is only attempted once.
-     *
-     * @param file the temporary file
-     * @param delayedResourceCleanup
-     */
-    public TempFileInputStream(File file, boolean delayedResourceCleanup) throws FileNotFoundException {
-        super(new BufferedInputStream(new FileInputStream(file)));
-        this.file = file;
-        this.delayedResourceCleanup = delayedResourceCleanup;
-    }
-
-    public File getFile() {
-    	return file;
-    }
-    
-    public void deleteFile() {
-	    file.delete();
-	}
-
-	private int closeIfEOF(int read) throws IOException {
-        if (read < 0) {
-            close();
-        }
-        return read;
-    }
-
-    public void close() throws IOException {
-        if (!closed) {
-            in.close();
-            if (!delayedResourceCleanup) {
-            	deleteFile();
-            }
-            closed = true;
-        }
-    }
-
-    public int available() throws IOException {
-        return in.available();
-    }
-
-    /**
-     * This method does nothing.
-     */
-    public void mark(int readlimit) {
-        // do nothing
-    }
-
-    /**
-     * Check whether mark and reset are supported.
-     *
-     * @return false
-     */
-    public boolean markSupported() {
-        return false;
-    }
-
-    public long skip(long n) throws IOException {
-        return in.skip(n);
-    }
-
-    public void reset() throws IOException {
-        in.reset();
-    }
-
-    public int read(byte[] b, int off, int len) throws IOException {
-        if (closed) {
-            return -1;
-        }
-        return closeIfEOF(in.read(b, off, len));
-    }
-
-    public int read(byte[] b) throws IOException {
-        if (closed) {
-            return -1;
-        }
-        return closeIfEOF(in.read(b));
-    }
-
-    public int read() throws IOException {
-        if (closed) {
-            return -1;
-        }
-        return closeIfEOF(in.read());
-    }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.core.data.db;
+
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.io.input.AutoCloseInputStream;
+
+/**
+ * An input stream from a temporary file. The file is deleted when the stream is
+ * closed, fully read, or garbage collected.
+ * <p>
+ * This class does not support mark/reset. It is always to be wrapped
+ * using a BufferedInputStream.
+ */
+public class TempFileInputStream extends AutoCloseInputStream {
+
+    private final File file;
+    private boolean closed;
+    private boolean delayedResourceCleanup = true;
+
+    /**
+     * Copy the data to a file and close the input stream afterwards.
+     *
+     * @param in the input stream
+     * @param file the target file
+     * @return the size of the file
+     */
+    public static long writeToFileAndClose(InputStream in, File file) throws IOException {
+        OutputStream out = new FileOutputStream(file);
+        IOUtils.copy(in, out);
+        out.close();
+        in.close();
+        return file.length();
+    }
+
+    /**
+     * Construct a new temporary file input stream.
+     * The file is deleted if the input stream is closed or fully read and 
+     * delayedResourceCleanup was set to true. Otherwise you must call {@link #deleteFile()}.
+     * Deleting is only attempted once.
+     *
+     * @param file the temporary file
+     * @param delayedResourceCleanup
+     */
+    public TempFileInputStream(File file, boolean delayedResourceCleanup) throws FileNotFoundException {
+        super(new BufferedInputStream(new FileInputStream(file)));
+        this.file = file;
+        this.delayedResourceCleanup = delayedResourceCleanup;
+    }
+
+    public File getFile() {
+    	return file;
+    }
+    
+    public void deleteFile() {
+	    file.delete();
+	}
+
+	private int closeIfEOF(int read) throws IOException {
+        if (read < 0) {
+            close();
+        }
+        return read;
+    }
+
+    public void close() throws IOException {
+        if (!closed) {
+            in.close();
+            if (!delayedResourceCleanup) {
+            	deleteFile();
+            }
+            closed = true;
+        }
+    }
+
+    public int available() throws IOException {
+        return in.available();
+    }
+
+    /**
+     * This method does nothing.
+     */
+    public void mark(int readlimit) {
+        // do nothing
+    }
+
+    /**
+     * Check whether mark and reset are supported.
+     *
+     * @return false
+     */
+    public boolean markSupported() {
+        return false;
+    }
+
+    public long skip(long n) throws IOException {
+        return in.skip(n);
+    }
+
+    public void reset() throws IOException {
+        in.reset();
+    }
+
+    public int read(byte[] b, int off, int len) throws IOException {
+        if (closed) {
+            return -1;
+        }
+        return closeIfEOF(in.read(b, off, len));
+    }
+
+    public int read(byte[] b) throws IOException {
+        if (closed) {
+            return -1;
+        }
+        return closeIfEOF(in.read(b));
+    }
+
+    public int read() throws IOException {
+        if (closed) {
+            return -1;
+        }
+        return closeIfEOF(in.read());
+    }
+
+}

Propchange: jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/data/db/TempFileInputStream.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/fs/BasedFileSystem.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/fs/BasedFileSystem.java?rev=1576690&r1=1576689&r2=1576690&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/fs/BasedFileSystem.java (original)
+++ jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/fs/BasedFileSystem.java Wed Mar 12 11:05:06 2014
@@ -1,187 +1,187 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.core.fs;
-
-import java.io.InputStream;
-import java.io.OutputStream;
-
-
-/**
- * A <code>BasedFileSystem</code> represents a 'file system in a file system'.
- */
-public class BasedFileSystem implements FileSystem {
-
-    protected final FileSystem fsBase;
-
-    protected final String basePath;
-
-    /**
-     * Creates a new <code>BasedFileSystem</code>
-     *
-     * @param fsBase      the <code>FileSystem</code> the new file system should be based on
-     * @param relRootPath the root path relative to <code>fsBase</code>'s root
-     */
-    public BasedFileSystem(FileSystem fsBase, String relRootPath) {
-        if (fsBase == null) {
-            throw new IllegalArgumentException("invalid file system argument");
-        }
-        this.fsBase = fsBase;
-
-        if (relRootPath == null) {
-            throw new IllegalArgumentException("invalid null path argument");
-        }
-        if (relRootPath.equals(SEPARATOR)) {
-            throw new IllegalArgumentException("invalid path argument");
-        }
-        if (!relRootPath.startsWith(SEPARATOR)) {
-            relRootPath = SEPARATOR + relRootPath;
-        }
-        if (relRootPath.endsWith(SEPARATOR)) {
-            relRootPath = relRootPath.substring(0, relRootPath.length() - 1);
-
-        }
-        this.basePath = relRootPath;
-    }
-
-    protected String buildBasePath(String path) {
-        if (path.startsWith(SEPARATOR)) {
-            if (path.length() == 1) {
-                return basePath;
-            } else {
-                return basePath + path;
-            }
-        } else {
-            return basePath + SEPARATOR + path;
-        }
-    }
-
-    //-----------------------------------------------------------< FileSystem >
-    /**
-     * {@inheritDoc}
-     */
-    public void init() throws FileSystemException {
-        // check base path
-        if (!fsBase.isFolder(basePath)) {
-            fsBase.createFolder(basePath);
-        }
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void close() throws FileSystemException {
-        // do nothing; base file system should be closed explicitly
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void createFolder(String folderPath) throws FileSystemException {
-        fsBase.createFolder(buildBasePath(folderPath));
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void deleteFile(String filePath) throws FileSystemException {
-        fsBase.deleteFile(buildBasePath(filePath));
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void deleteFolder(String folderPath) throws FileSystemException {
-        fsBase.deleteFolder(buildBasePath(folderPath));
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public boolean exists(String path) throws FileSystemException {
-        return fsBase.exists(buildBasePath(path));
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public InputStream getInputStream(String filePath) throws FileSystemException {
-        return fsBase.getInputStream(buildBasePath(filePath));
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public OutputStream getOutputStream(String filePath) throws FileSystemException {
-        return fsBase.getOutputStream(buildBasePath(filePath));
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public boolean hasChildren(String path) throws FileSystemException {
-        return fsBase.hasChildren(buildBasePath(path));
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public boolean isFile(String path) throws FileSystemException {
-        return fsBase.isFile(buildBasePath(path));
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public boolean isFolder(String path) throws FileSystemException {
-        return fsBase.isFolder(buildBasePath(path));
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public long lastModified(String path) throws FileSystemException {
-        return fsBase.lastModified(buildBasePath(path));
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public long length(String filePath) throws FileSystemException {
-        return fsBase.length(buildBasePath(filePath));
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public String[] list(String folderPath) throws FileSystemException {
-        return fsBase.list(buildBasePath(folderPath));
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public String[] listFiles(String folderPath) throws FileSystemException {
-        return fsBase.listFiles(buildBasePath(folderPath));
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public String[] listFolders(String folderPath) throws FileSystemException {
-        return fsBase.listFolders(buildBasePath(folderPath));
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.core.fs;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+
+
+/**
+ * A <code>BasedFileSystem</code> represents a 'file system in a file system'.
+ */
+public class BasedFileSystem implements FileSystem {
+
+    protected final FileSystem fsBase;
+
+    protected final String basePath;
+
+    /**
+     * Creates a new <code>BasedFileSystem</code>
+     *
+     * @param fsBase      the <code>FileSystem</code> the new file system should be based on
+     * @param relRootPath the root path relative to <code>fsBase</code>'s root
+     */
+    public BasedFileSystem(FileSystem fsBase, String relRootPath) {
+        if (fsBase == null) {
+            throw new IllegalArgumentException("invalid file system argument");
+        }
+        this.fsBase = fsBase;
+
+        if (relRootPath == null) {
+            throw new IllegalArgumentException("invalid null path argument");
+        }
+        if (relRootPath.equals(SEPARATOR)) {
+            throw new IllegalArgumentException("invalid path argument");
+        }
+        if (!relRootPath.startsWith(SEPARATOR)) {
+            relRootPath = SEPARATOR + relRootPath;
+        }
+        if (relRootPath.endsWith(SEPARATOR)) {
+            relRootPath = relRootPath.substring(0, relRootPath.length() - 1);
+
+        }
+        this.basePath = relRootPath;
+    }
+
+    protected String buildBasePath(String path) {
+        if (path.startsWith(SEPARATOR)) {
+            if (path.length() == 1) {
+                return basePath;
+            } else {
+                return basePath + path;
+            }
+        } else {
+            return basePath + SEPARATOR + path;
+        }
+    }
+
+    //-----------------------------------------------------------< FileSystem >
+    /**
+     * {@inheritDoc}
+     */
+    public void init() throws FileSystemException {
+        // check base path
+        if (!fsBase.isFolder(basePath)) {
+            fsBase.createFolder(basePath);
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void close() throws FileSystemException {
+        // do nothing; base file system should be closed explicitly
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void createFolder(String folderPath) throws FileSystemException {
+        fsBase.createFolder(buildBasePath(folderPath));
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void deleteFile(String filePath) throws FileSystemException {
+        fsBase.deleteFile(buildBasePath(filePath));
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void deleteFolder(String folderPath) throws FileSystemException {
+        fsBase.deleteFolder(buildBasePath(folderPath));
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean exists(String path) throws FileSystemException {
+        return fsBase.exists(buildBasePath(path));
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public InputStream getInputStream(String filePath) throws FileSystemException {
+        return fsBase.getInputStream(buildBasePath(filePath));
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public OutputStream getOutputStream(String filePath) throws FileSystemException {
+        return fsBase.getOutputStream(buildBasePath(filePath));
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean hasChildren(String path) throws FileSystemException {
+        return fsBase.hasChildren(buildBasePath(path));
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isFile(String path) throws FileSystemException {
+        return fsBase.isFile(buildBasePath(path));
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isFolder(String path) throws FileSystemException {
+        return fsBase.isFolder(buildBasePath(path));
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public long lastModified(String path) throws FileSystemException {
+        return fsBase.lastModified(buildBasePath(path));
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public long length(String filePath) throws FileSystemException {
+        return fsBase.length(buildBasePath(filePath));
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String[] list(String folderPath) throws FileSystemException {
+        return fsBase.list(buildBasePath(folderPath));
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String[] listFiles(String folderPath) throws FileSystemException {
+        return fsBase.listFiles(buildBasePath(folderPath));
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String[] listFolders(String folderPath) throws FileSystemException {
+        return fsBase.listFolders(buildBasePath(folderPath));
+    }
+}

Propchange: jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/fs/BasedFileSystem.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/fs/FileSystem.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/fs/FileSystem.java?rev=1576690&r1=1576689&r2=1576690&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/fs/FileSystem.java (original)
+++ jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/fs/FileSystem.java Wed Mar 12 11:05:06 2014
@@ -1,206 +1,206 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.core.fs;
-
-import java.io.InputStream;
-import java.io.OutputStream;
-
-/**
- * The <code>FileSystem</code> interface is an abstraction of a virtual
- * file system. The similarities of its method names with with the methods
- * of the <code>java.io.File</code> class are intentional.
- * <br>
- * Implementations of this interface expose a file system-like resource.
- * File system-like resources include WebDAV-enabled servers, local file systems,
- * and so forth.
- */
-public interface FileSystem {
-
-    /**
-     * File separator
-     */
-    String SEPARATOR = "/";
-
-    /**
-     * File separator character
-     */
-    char SEPARATOR_CHAR = '/';
-
-    /**
-     * Initialize the file system
-     *
-     * @throws FileSystemException if the file system initialization fails
-     */
-    void init() throws FileSystemException;
-
-    /**
-     * Close the file system. After calling this method, the file system is no
-     * longer accessible.
-     *
-     * @throws FileSystemException
-     */
-    void close() throws FileSystemException;
-
-    /**
-     * Returns an input stream of the contents of the file denoted by this path.
-     *
-     * @param filePath the path of the file.
-     * @return an input stream of the contents of the file.
-     * @throws FileSystemException if the file does not exist
-     *                             or if it cannot be read from
-     */
-    InputStream getInputStream(String filePath) throws FileSystemException;
-
-    /**
-     * Returns an output stream for writing bytes to the file denoted by this path.
-     * The file will be created if it doesn't exist. If the file exists, its contents
-     * will be overwritten.
-     *
-     * @param filePath the path of the file.
-     * @return an output stream for writing bytes to the file.
-     * @throws FileSystemException if the file cannot be written to or created
-     */
-    OutputStream getOutputStream(String filePath) throws FileSystemException;
-
-    /**
-     * Creates the folder named by this path, including any necessary but
-     * nonexistent parent folders. Note that if this operation fails it
-     * may have succeeded in creating some of the necessary parent folders.
-     *
-     * @param folderPath the path of the folder to be created.
-     * @throws FileSystemException if a file system entry denoted by path
-     *                             already exists or if another error occurs.
-     */
-    void createFolder(String folderPath) throws FileSystemException;
-
-    /**
-     * Tests whether the file system entry denoted by this path exists.
-     *
-     * @param path the path of a file system entry.
-     * @return true if the file system entry at path exists; false otherwise.
-     * @throws FileSystemException
-     */
-    boolean exists(String path) throws FileSystemException;
-
-    /**
-     * Tests whether the file system entry denoted by this path exists and
-     * is a file.
-     *
-     * @param path the path of a file system entry.
-     * @return true if the file system entry at path is a file; false otherwise.
-     * @throws FileSystemException
-     */
-    boolean isFile(String path) throws FileSystemException;
-
-    /**
-     * Tests whether the file system entry denoted by this path exists and
-     * is a folder.
-     *
-     * @param path the path of a file system entry.
-     * @return true if the file system entry at path is a folder; false otherwise.
-     * @throws FileSystemException
-     */
-    boolean isFolder(String path) throws FileSystemException;
-
-    /**
-     * Tests whether the file system entry denoted by this path has child entries.
-     *
-     * @param path the path of a file system entry.
-     * @return true if the file system entry at path has child entries; false otherwise.
-     * @throws FileSystemException
-     */
-    boolean hasChildren(String path) throws FileSystemException;
-
-    /**
-     * Returns the length of the file denoted by this path.
-     *
-     * @param filePath the path of the file.
-     * @return The length, in bytes, of the file denoted by this path,
-     *         or -1L if the length can't be determined.
-     * @throws FileSystemException if the path does not denote an existing file.
-     */
-    long length(String filePath) throws FileSystemException;
-
-    /**
-     * Returns the time that the file system entry denoted by this path
-     * was last modified.
-     *
-     * @param path the path of a file system entry.
-     * @return A long value representing the time the file system entry was
-     *         last modified, measured in milliseconds since the epoch
-     *         (00:00:00 GMT, January 1, 1970), or 0L if the modification
-     *         time can't be determined.
-     * @throws FileSystemException if the file system entry does not exist.
-     */
-    long lastModified(String path) throws FileSystemException;
-
-    /**
-     * Returns an array of strings naming the files and folders
-     * in the folder denoted by this path.
-     *
-     * @param folderPath the path of the folder whose contents is to be listed.
-     * @return an array of strings naming the files and folders
-     *         in the folder denoted by this path.
-     * @throws FileSystemException if this path does not denote a folder or if
-     *                             another error occurs.
-     */
-    String[] list(String folderPath) throws FileSystemException;
-
-    /**
-     * Returns an array of strings naming the files in the folder
-     * denoted by this path.
-     *
-     * @param folderPath the path of the folder whose contents is to be listed.
-     * @return an array of strings naming the files in the folder
-     *         denoted by this path.
-     * @throws FileSystemException if this path does not denote a folder or if
-     *                             another error occurs.
-     */
-    String[] listFiles(String folderPath) throws FileSystemException;
-
-    /**
-     * Returns an array of strings naming the folders in the folder
-     * denoted by this path.
-     *
-     * @param folderPath the path of the folder whose contents is to be listed.
-     * @return an array of strings naming the folders in the folder
-     *         denoted by this path.
-     * @throws FileSystemException if this path does not denote a folder or if
-     *                             another error occurs.
-     */
-    String[] listFolders(String folderPath) throws FileSystemException;
-
-    /**
-     * Deletes the file denoted by this path.
-     *
-     * @param filePath the path of the file to be deleted.
-     * @throws FileSystemException if this path does not denote a file or if
-     *                             another error occurs.
-     */
-    void deleteFile(String filePath) throws FileSystemException;
-
-    /**
-     * Deletes the folder denoted by this path. Any contents of this folder
-     * (folders and files) will be deleted recursively.
-     *
-     * @param folderPath the path of the folder to be deleted.
-     * @throws FileSystemException if this path does not denote a folder or if
-     *                             another error occurs.
-     */
-    void deleteFolder(String folderPath) throws FileSystemException;
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.core.fs;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+
+/**
+ * The <code>FileSystem</code> interface is an abstraction of a virtual
+ * file system. The similarities of its method names with with the methods
+ * of the <code>java.io.File</code> class are intentional.
+ * <br>
+ * Implementations of this interface expose a file system-like resource.
+ * File system-like resources include WebDAV-enabled servers, local file systems,
+ * and so forth.
+ */
+public interface FileSystem {
+
+    /**
+     * File separator
+     */
+    String SEPARATOR = "/";
+
+    /**
+     * File separator character
+     */
+    char SEPARATOR_CHAR = '/';
+
+    /**
+     * Initialize the file system
+     *
+     * @throws FileSystemException if the file system initialization fails
+     */
+    void init() throws FileSystemException;
+
+    /**
+     * Close the file system. After calling this method, the file system is no
+     * longer accessible.
+     *
+     * @throws FileSystemException
+     */
+    void close() throws FileSystemException;
+
+    /**
+     * Returns an input stream of the contents of the file denoted by this path.
+     *
+     * @param filePath the path of the file.
+     * @return an input stream of the contents of the file.
+     * @throws FileSystemException if the file does not exist
+     *                             or if it cannot be read from
+     */
+    InputStream getInputStream(String filePath) throws FileSystemException;
+
+    /**
+     * Returns an output stream for writing bytes to the file denoted by this path.
+     * The file will be created if it doesn't exist. If the file exists, its contents
+     * will be overwritten.
+     *
+     * @param filePath the path of the file.
+     * @return an output stream for writing bytes to the file.
+     * @throws FileSystemException if the file cannot be written to or created
+     */
+    OutputStream getOutputStream(String filePath) throws FileSystemException;
+
+    /**
+     * Creates the folder named by this path, including any necessary but
+     * nonexistent parent folders. Note that if this operation fails it
+     * may have succeeded in creating some of the necessary parent folders.
+     *
+     * @param folderPath the path of the folder to be created.
+     * @throws FileSystemException if a file system entry denoted by path
+     *                             already exists or if another error occurs.
+     */
+    void createFolder(String folderPath) throws FileSystemException;
+
+    /**
+     * Tests whether the file system entry denoted by this path exists.
+     *
+     * @param path the path of a file system entry.
+     * @return true if the file system entry at path exists; false otherwise.
+     * @throws FileSystemException
+     */
+    boolean exists(String path) throws FileSystemException;
+
+    /**
+     * Tests whether the file system entry denoted by this path exists and
+     * is a file.
+     *
+     * @param path the path of a file system entry.
+     * @return true if the file system entry at path is a file; false otherwise.
+     * @throws FileSystemException
+     */
+    boolean isFile(String path) throws FileSystemException;
+
+    /**
+     * Tests whether the file system entry denoted by this path exists and
+     * is a folder.
+     *
+     * @param path the path of a file system entry.
+     * @return true if the file system entry at path is a folder; false otherwise.
+     * @throws FileSystemException
+     */
+    boolean isFolder(String path) throws FileSystemException;
+
+    /**
+     * Tests whether the file system entry denoted by this path has child entries.
+     *
+     * @param path the path of a file system entry.
+     * @return true if the file system entry at path has child entries; false otherwise.
+     * @throws FileSystemException
+     */
+    boolean hasChildren(String path) throws FileSystemException;
+
+    /**
+     * Returns the length of the file denoted by this path.
+     *
+     * @param filePath the path of the file.
+     * @return The length, in bytes, of the file denoted by this path,
+     *         or -1L if the length can't be determined.
+     * @throws FileSystemException if the path does not denote an existing file.
+     */
+    long length(String filePath) throws FileSystemException;
+
+    /**
+     * Returns the time that the file system entry denoted by this path
+     * was last modified.
+     *
+     * @param path the path of a file system entry.
+     * @return A long value representing the time the file system entry was
+     *         last modified, measured in milliseconds since the epoch
+     *         (00:00:00 GMT, January 1, 1970), or 0L if the modification
+     *         time can't be determined.
+     * @throws FileSystemException if the file system entry does not exist.
+     */
+    long lastModified(String path) throws FileSystemException;
+
+    /**
+     * Returns an array of strings naming the files and folders
+     * in the folder denoted by this path.
+     *
+     * @param folderPath the path of the folder whose contents is to be listed.
+     * @return an array of strings naming the files and folders
+     *         in the folder denoted by this path.
+     * @throws FileSystemException if this path does not denote a folder or if
+     *                             another error occurs.
+     */
+    String[] list(String folderPath) throws FileSystemException;
+
+    /**
+     * Returns an array of strings naming the files in the folder
+     * denoted by this path.
+     *
+     * @param folderPath the path of the folder whose contents is to be listed.
+     * @return an array of strings naming the files in the folder
+     *         denoted by this path.
+     * @throws FileSystemException if this path does not denote a folder or if
+     *                             another error occurs.
+     */
+    String[] listFiles(String folderPath) throws FileSystemException;
+
+    /**
+     * Returns an array of strings naming the folders in the folder
+     * denoted by this path.
+     *
+     * @param folderPath the path of the folder whose contents is to be listed.
+     * @return an array of strings naming the folders in the folder
+     *         denoted by this path.
+     * @throws FileSystemException if this path does not denote a folder or if
+     *                             another error occurs.
+     */
+    String[] listFolders(String folderPath) throws FileSystemException;
+
+    /**
+     * Deletes the file denoted by this path.
+     *
+     * @param filePath the path of the file to be deleted.
+     * @throws FileSystemException if this path does not denote a file or if
+     *                             another error occurs.
+     */
+    void deleteFile(String filePath) throws FileSystemException;
+
+    /**
+     * Deletes the folder denoted by this path. Any contents of this folder
+     * (folders and files) will be deleted recursively.
+     *
+     * @param folderPath the path of the folder to be deleted.
+     * @throws FileSystemException if this path does not denote a folder or if
+     *                             another error occurs.
+     */
+    void deleteFolder(String folderPath) throws FileSystemException;
+
+}

Propchange: jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/fs/FileSystem.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/fs/FileSystemException.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/fs/FileSystemException.java?rev=1576690&r1=1576689&r2=1576690&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/fs/FileSystemException.java (original)
+++ jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/fs/FileSystemException.java Wed Mar 12 11:05:06 2014
@@ -1,49 +1,49 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.core.fs;
-
-/**
- * The <code>FileSystemException</code> signals an error within a file system
- * operation. FileSystemExceptions are thrown by {@link FileSystem}
- * implementations.
- */
-public class FileSystemException extends Exception {
-
-    /**
-     * Constructs a new instance of this class with the specified detail
-     * message.
-     *
-     * @param message the detail message. The detail message is saved for
-     *                later retrieval by the {@link #getMessage()} method.
-     */
-    public FileSystemException(String message) {
-        super(message);
-    }
-
-    /**
-     * Constructs a new instance of this class with the specified detail
-     * message and root cause.
-     *
-     * @param message   the detail message. The detail message is saved for
-     *                  later retrieval by the {@link #getMessage()} method.
-     * @param rootCause root failure cause
-     */
-    public FileSystemException(String message, Throwable rootCause) {
-        super(message, rootCause);
-    }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.core.fs;
+
+/**
+ * The <code>FileSystemException</code> signals an error within a file system
+ * operation. FileSystemExceptions are thrown by {@link FileSystem}
+ * implementations.
+ */
+public class FileSystemException extends Exception {
+
+    /**
+     * Constructs a new instance of this class with the specified detail
+     * message.
+     *
+     * @param message the detail message. The detail message is saved for
+     *                later retrieval by the {@link #getMessage()} method.
+     */
+    public FileSystemException(String message) {
+        super(message);
+    }
+
+    /**
+     * Constructs a new instance of this class with the specified detail
+     * message and root cause.
+     *
+     * @param message   the detail message. The detail message is saved for
+     *                  later retrieval by the {@link #getMessage()} method.
+     * @param rootCause root failure cause
+     */
+    public FileSystemException(String message, Throwable rootCause) {
+        super(message, rootCause);
+    }
+
+}

Propchange: jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/fs/FileSystemException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/fs/FileSystemFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/fs/FileSystemFactory.java?rev=1576690&r1=1576689&r2=1576690&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/fs/FileSystemFactory.java (original)
+++ jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/fs/FileSystemFactory.java Wed Mar 12 11:05:06 2014
@@ -1,40 +1,40 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.core.fs;
-
-import javax.jcr.RepositoryException;
-
-
-/**
- * Factory interface for creating {@link FileSystem} instances. Used
- * to decouple the repository internals from the repository configuration
- * mechanism.
- */
-public interface FileSystemFactory {
-
-    /**
-     * Creates, initializes, and returns a {@link FileSystem} instance
-     * for use by the repository. Note that no information is passed from
-     * the client, so all required configuration information must be
-     * encapsulated in the factory.
-     *
-     * @return initialized file system
-     * @throws RepositoryException if the file system can not be created
-     */
-    FileSystem getFileSystem() throws RepositoryException;
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.core.fs;
+
+import javax.jcr.RepositoryException;
+
+
+/**
+ * Factory interface for creating {@link FileSystem} instances. Used
+ * to decouple the repository internals from the repository configuration
+ * mechanism.
+ */
+public interface FileSystemFactory {
+
+    /**
+     * Creates, initializes, and returns a {@link FileSystem} instance
+     * for use by the repository. Note that no information is passed from
+     * the client, so all required configuration information must be
+     * encapsulated in the factory.
+     *
+     * @return initialized file system
+     * @throws RepositoryException if the file system can not be created
+     */
+    FileSystem getFileSystem() throws RepositoryException;
+
+}

Propchange: jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/fs/FileSystemFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/fs/FileSystemPathUtil.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/fs/FileSystemPathUtil.java?rev=1576690&r1=1576689&r2=1576690&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/fs/FileSystemPathUtil.java (original)
+++ jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/fs/FileSystemPathUtil.java Wed Mar 12 11:05:06 2014
@@ -1,229 +1,229 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.core.fs;
-
-import java.io.ByteArrayOutputStream;
-import java.util.BitSet;
-
-
-/**
- * Utility class for handling paths in a file system.
- */
-public final class FileSystemPathUtil {
-
-    /**
-     * Array of lowercase hexadecimal characters used in creating hex escapes.
-     */
-    private static final char[] HEX_TABLE = "0123456789abcdef".toCharArray();
-
-    /**
-     * The escape character used to mark hex escape sequences.
-     */
-    private static final char ESCAPE_CHAR = '%';
-
-    /**
-     * The list of characters that are not encoded by the <code>escapeName(String)</code>
-     * and <code>unescape(String)</code> methods. They contains the characters
-     * which can safely be used in file names:
-     */
-    public static final BitSet SAFE_NAMECHARS;
-
-    /**
-     * The list of characters that are not encoded by the <code>escapePath(String)</code>
-     * and <code>unescape(String)</code> methods. They contains the characters
-     * which can safely be used in file paths:
-     */
-    public static final BitSet SAFE_PATHCHARS;
-
-    static {
-        // build list of valid name characters
-        SAFE_NAMECHARS = new BitSet(256);
-        int i;
-        for (i = 'a'; i <= 'z'; i++) {
-            SAFE_NAMECHARS.set(i);
-        }
-        for (i = 'A'; i <= 'Z'; i++) {
-            SAFE_NAMECHARS.set(i);
-        }
-        for (i = '0'; i <= '9'; i++) {
-            SAFE_NAMECHARS.set(i);
-        }
-        SAFE_NAMECHARS.set('-');
-        SAFE_NAMECHARS.set('_');
-        SAFE_NAMECHARS.set('.');
-
-        // build list of valid path characters (includes name characters)
-        SAFE_PATHCHARS = (BitSet) SAFE_NAMECHARS.clone();
-        SAFE_PATHCHARS.set(FileSystem.SEPARATOR_CHAR);
-    }
-
-    /**
-     * private constructor
-     */
-    private FileSystemPathUtil() {
-    }
-
-    /**
-     * Escapes the given string using URL encoding for all bytes not included
-     * in the given set of safe characters.
-     *
-     * @param s the string to escape
-     * @param safeChars set of safe characters (bytes)
-     * @return escaped string
-     */
-    private static String escape(String s, BitSet safeChars) {
-        byte[] bytes = s.getBytes();
-        StringBuilder out = new StringBuilder(bytes.length);
-        for (int i = 0; i < bytes.length; i++) {
-            int c = bytes[i] & 0xff;
-            if (safeChars.get(c) && c != ESCAPE_CHAR) {
-                out.append((char) c);
-            } else {
-                out.append(ESCAPE_CHAR);
-                out.append(HEX_TABLE[(c >> 4) & 0x0f]);
-                out.append(HEX_TABLE[(c) & 0x0f]);
-            }
-        }
-        return out.toString();
-    }
-
-    /**
-     * Encodes the specified <code>path</code>. Same as
-     * <code>{@link #escapeName(String)}</code> except that the separator
-     * character <b><code>/</code></b> is regarded as a legal path character
-     * that needs no escaping.
-     *
-     * @param path the path to encode.
-     * @return the escaped path
-     */
-    public static String escapePath(String path) {
-        return escape(path, SAFE_PATHCHARS);
-    }
-
-    /**
-     * Encodes the specified <code>name</code>. Same as
-     * <code>{@link #escapePath(String)}</code> except that the separator character
-     * <b><code>/</code></b> is regarded as an illegal character that needs
-     * escaping.
-     *
-     * @param name the name to encode.
-     * @return the escaped name
-     */
-    public static String escapeName(String name) {
-        return escape(name, SAFE_NAMECHARS);
-    }
-
-    /**
-     * Decodes the specified path/name.
-     *
-     * @param pathOrName the escaped path/name
-     * @return the unescaped path/name
-     */
-    public static String unescape(String pathOrName) {
-        ByteArrayOutputStream out = new ByteArrayOutputStream(pathOrName.length());
-        for (int i = 0; i < pathOrName.length(); i++) {
-            char c = pathOrName.charAt(i);
-            if (c == ESCAPE_CHAR) {
-                try {
-                    out.write(Integer.parseInt(pathOrName.substring(i + 1, i + 3), 16));
-                } catch (NumberFormatException e) {
-                    IllegalArgumentException iae = new IllegalArgumentException("Failed to unescape escape sequence");
-                    iae.initCause(e);
-                    throw iae;
-                }
-                i += 2;
-            } else {
-                out.write(c);
-            }
-        }
-        return new String(out.toByteArray());
-    }
-
-    /**
-     * Tests whether the specified path represents the root path, i.e. "/".
-     *
-     * @param path path to test
-     * @return true if the specified path represents the root path; false otherwise.
-     */
-    public static boolean denotesRoot(String path) {
-        return path.equals(FileSystem.SEPARATOR);
-    }
-
-    /**
-     * Checks if <code>path</code> is a valid path.
-     *
-     * @param path the path to be checked
-     * @throws FileSystemException If <code>path</code> is not a valid path
-     */
-    public static void checkFormat(String path) throws FileSystemException {
-        if (path == null) {
-            throw new FileSystemException("null path");
-        }
-
-        // path must be absolute, i.e. starting with '/'
-        if (!path.startsWith(FileSystem.SEPARATOR)) {
-            throw new FileSystemException("not an absolute path: " + path);
-        }
-
-        // trailing '/' is not allowed (except for root path)
-        if (path.endsWith(FileSystem.SEPARATOR) && path.length() > 1) {
-            throw new FileSystemException("malformed path: " + path);
-        }
-
-        String[] names = path.split(FileSystem.SEPARATOR);
-        for (int i = 1; i < names.length; i++) {
-            // name must not be empty
-            if (names[i].length() == 0) {
-                throw new FileSystemException("empty name: " + path);
-            }
-            // leading/trailing whitespace is not allowed
-            String trimmed = names[i].trim();
-            if (!trimmed.equals(names[i])) {
-                throw new FileSystemException("illegal leading or trailing whitespace in name: " + path);
-            }
-        }
-    }
-
-    /**
-     * Returns the parent directory of the specified <code>path</code>.
-     *
-     * @param path a file system path denoting a directory or a file.
-     * @return the parent directory.
-     */
-    public static String getParentDir(String path) {
-        int pos = path.lastIndexOf(FileSystem.SEPARATOR_CHAR);
-        if (pos > 0) {
-            return path.substring(0, pos);
-        }
-        return FileSystem.SEPARATOR;
-    }
-
-    /**
-     * Returns the name of the specified <code>path</code>.
-     *
-     * @param path a file system path denoting a directory or a file.
-     * @return the name.
-     */
-    public static String getName(String path) {
-        int pos = path.lastIndexOf(FileSystem.SEPARATOR_CHAR);
-        if (pos != -1) {
-            return path.substring(pos + 1);
-        }
-        return path;
-    }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.core.fs;
+
+import java.io.ByteArrayOutputStream;
+import java.util.BitSet;
+
+
+/**
+ * Utility class for handling paths in a file system.
+ */
+public final class FileSystemPathUtil {
+
+    /**
+     * Array of lowercase hexadecimal characters used in creating hex escapes.
+     */
+    private static final char[] HEX_TABLE = "0123456789abcdef".toCharArray();
+
+    /**
+     * The escape character used to mark hex escape sequences.
+     */
+    private static final char ESCAPE_CHAR = '%';
+
+    /**
+     * The list of characters that are not encoded by the <code>escapeName(String)</code>
+     * and <code>unescape(String)</code> methods. They contains the characters
+     * which can safely be used in file names:
+     */
+    public static final BitSet SAFE_NAMECHARS;
+
+    /**
+     * The list of characters that are not encoded by the <code>escapePath(String)</code>
+     * and <code>unescape(String)</code> methods. They contains the characters
+     * which can safely be used in file paths:
+     */
+    public static final BitSet SAFE_PATHCHARS;
+
+    static {
+        // build list of valid name characters
+        SAFE_NAMECHARS = new BitSet(256);
+        int i;
+        for (i = 'a'; i <= 'z'; i++) {
+            SAFE_NAMECHARS.set(i);
+        }
+        for (i = 'A'; i <= 'Z'; i++) {
+            SAFE_NAMECHARS.set(i);
+        }
+        for (i = '0'; i <= '9'; i++) {
+            SAFE_NAMECHARS.set(i);
+        }
+        SAFE_NAMECHARS.set('-');
+        SAFE_NAMECHARS.set('_');
+        SAFE_NAMECHARS.set('.');
+
+        // build list of valid path characters (includes name characters)
+        SAFE_PATHCHARS = (BitSet) SAFE_NAMECHARS.clone();
+        SAFE_PATHCHARS.set(FileSystem.SEPARATOR_CHAR);
+    }
+
+    /**
+     * private constructor
+     */
+    private FileSystemPathUtil() {
+    }
+
+    /**
+     * Escapes the given string using URL encoding for all bytes not included
+     * in the given set of safe characters.
+     *
+     * @param s the string to escape
+     * @param safeChars set of safe characters (bytes)
+     * @return escaped string
+     */
+    private static String escape(String s, BitSet safeChars) {
+        byte[] bytes = s.getBytes();
+        StringBuilder out = new StringBuilder(bytes.length);
+        for (int i = 0; i < bytes.length; i++) {
+            int c = bytes[i] & 0xff;
+            if (safeChars.get(c) && c != ESCAPE_CHAR) {
+                out.append((char) c);
+            } else {
+                out.append(ESCAPE_CHAR);
+                out.append(HEX_TABLE[(c >> 4) & 0x0f]);
+                out.append(HEX_TABLE[(c) & 0x0f]);
+            }
+        }
+        return out.toString();
+    }
+
+    /**
+     * Encodes the specified <code>path</code>. Same as
+     * <code>{@link #escapeName(String)}</code> except that the separator
+     * character <b><code>/</code></b> is regarded as a legal path character
+     * that needs no escaping.
+     *
+     * @param path the path to encode.
+     * @return the escaped path
+     */
+    public static String escapePath(String path) {
+        return escape(path, SAFE_PATHCHARS);
+    }
+
+    /**
+     * Encodes the specified <code>name</code>. Same as
+     * <code>{@link #escapePath(String)}</code> except that the separator character
+     * <b><code>/</code></b> is regarded as an illegal character that needs
+     * escaping.
+     *
+     * @param name the name to encode.
+     * @return the escaped name
+     */
+    public static String escapeName(String name) {
+        return escape(name, SAFE_NAMECHARS);
+    }
+
+    /**
+     * Decodes the specified path/name.
+     *
+     * @param pathOrName the escaped path/name
+     * @return the unescaped path/name
+     */
+    public static String unescape(String pathOrName) {
+        ByteArrayOutputStream out = new ByteArrayOutputStream(pathOrName.length());
+        for (int i = 0; i < pathOrName.length(); i++) {
+            char c = pathOrName.charAt(i);
+            if (c == ESCAPE_CHAR) {
+                try {
+                    out.write(Integer.parseInt(pathOrName.substring(i + 1, i + 3), 16));
+                } catch (NumberFormatException e) {
+                    IllegalArgumentException iae = new IllegalArgumentException("Failed to unescape escape sequence");
+                    iae.initCause(e);
+                    throw iae;
+                }
+                i += 2;
+            } else {
+                out.write(c);
+            }
+        }
+        return new String(out.toByteArray());
+    }
+
+    /**
+     * Tests whether the specified path represents the root path, i.e. "/".
+     *
+     * @param path path to test
+     * @return true if the specified path represents the root path; false otherwise.
+     */
+    public static boolean denotesRoot(String path) {
+        return path.equals(FileSystem.SEPARATOR);
+    }
+
+    /**
+     * Checks if <code>path</code> is a valid path.
+     *
+     * @param path the path to be checked
+     * @throws FileSystemException If <code>path</code> is not a valid path
+     */
+    public static void checkFormat(String path) throws FileSystemException {
+        if (path == null) {
+            throw new FileSystemException("null path");
+        }
+
+        // path must be absolute, i.e. starting with '/'
+        if (!path.startsWith(FileSystem.SEPARATOR)) {
+            throw new FileSystemException("not an absolute path: " + path);
+        }
+
+        // trailing '/' is not allowed (except for root path)
+        if (path.endsWith(FileSystem.SEPARATOR) && path.length() > 1) {
+            throw new FileSystemException("malformed path: " + path);
+        }
+
+        String[] names = path.split(FileSystem.SEPARATOR);
+        for (int i = 1; i < names.length; i++) {
+            // name must not be empty
+            if (names[i].length() == 0) {
+                throw new FileSystemException("empty name: " + path);
+            }
+            // leading/trailing whitespace is not allowed
+            String trimmed = names[i].trim();
+            if (!trimmed.equals(names[i])) {
+                throw new FileSystemException("illegal leading or trailing whitespace in name: " + path);
+            }
+        }
+    }
+
+    /**
+     * Returns the parent directory of the specified <code>path</code>.
+     *
+     * @param path a file system path denoting a directory or a file.
+     * @return the parent directory.
+     */
+    public static String getParentDir(String path) {
+        int pos = path.lastIndexOf(FileSystem.SEPARATOR_CHAR);
+        if (pos > 0) {
+            return path.substring(0, pos);
+        }
+        return FileSystem.SEPARATOR;
+    }
+
+    /**
+     * Returns the name of the specified <code>path</code>.
+     *
+     * @param path a file system path denoting a directory or a file.
+     * @return the name.
+     */
+    public static String getName(String path) {
+        int pos = path.lastIndexOf(FileSystem.SEPARATOR_CHAR);
+        if (pos != -1) {
+            return path.substring(pos + 1);
+        }
+        return path;
+    }
+
+}

Propchange: jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/fs/FileSystemPathUtil.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/fs/FileSystemResource.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/fs/FileSystemResource.java?rev=1576690&r1=1576689&r2=1576690&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/fs/FileSystemResource.java (original)
+++ jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/fs/FileSystemResource.java Wed Mar 12 11:05:06 2014
@@ -1,226 +1,226 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.core.fs;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.jackrabbit.core.fs.FileSystemPathUtil;
-
-/**
- * A <code>FileSystemResource</code> represents a resource (i.e. file) in a
- * <code>FileSystem</code>.
- */
-public class FileSystemResource {
-
-    protected final FileSystem fs;
-
-    protected final String path;
-
-    static {
-        // preload FileSystemPathUtil to prevent classloader issues during shutdown
-        FileSystemPathUtil.class.hashCode();
-    }
-
-    /**
-     * Creates a new <code>FileSystemResource</code>
-     *
-     * @param fs   the <code>FileSystem</code> where the resource is located
-     * @param path the path of the resource in the <code>FileSystem</code>
-     */
-    public FileSystemResource(FileSystem fs, String path) {
-        if (fs == null) {
-            throw new IllegalArgumentException("invalid file system argument");
-        }
-        this.fs = fs;
-
-        if (path == null) {
-            throw new IllegalArgumentException("invalid path argument");
-        }
-        this.path = path;
-    }
-
-    /**
-     * Returns the <code>FileSystem</code> where this resource is located.
-     *
-     * @return the <code>FileSystem</code> where this resource is located.
-     */
-    public FileSystem getFileSystem() {
-        return fs;
-    }
-
-    /**
-     * Returns the path of this resource.
-     *
-     * @return the path of this resource.
-     */
-    public String getPath() {
-        return path;
-    }
-
-    /**
-     * Returns the parent directory of this resource.
-     *
-     * @return the parent directory.
-     */
-    public String getParentDir() {
-        return FileSystemPathUtil.getParentDir(path);
-    }
-
-    /**
-     * Returns the name of this resource.
-     *
-     * @return the name.
-     */
-    public String getName() {
-        return FileSystemPathUtil.getName(path);
-    }
-
-    /**
-     * Creates the parent directory of this resource, including any necessary
-     * but nonexistent parent directories.
-     *
-     * @throws FileSystemException
-     */
-    public synchronized void makeParentDirs() throws FileSystemException {
-        String parentDir = getParentDir();
-        if (!fs.exists(parentDir)) {
-            fs.createFolder(parentDir);
-        }
-    }
-
-    /**
-     * Deletes this resource.
-     * Same as <code>{@link #delete(false)}</code>.
-     *
-     * @see FileSystem#deleteFile
-     */
-    public void delete() throws FileSystemException {
-        delete(false);
-    }
-
-    /**
-     * Deletes this resource.
-     *
-     * @param pruneEmptyParentDirs if <code>true</code>, empty parent folders will
-     *                             automatically be deleted
-     * @see FileSystem#deleteFile
-     */
-    public synchronized void delete(boolean pruneEmptyParentDirs) throws FileSystemException {
-        fs.deleteFile(path);
-        if (pruneEmptyParentDirs) {
-            // prune empty parent folders
-            String parentDir = FileSystemPathUtil.getParentDir(path);
-            while (!parentDir.equals(FileSystem.SEPARATOR)
-                    && fs.exists(parentDir)
-                    && !fs.hasChildren(parentDir)) {
-                fs.deleteFolder(parentDir);
-                parentDir = FileSystemPathUtil.getParentDir(parentDir);
-            }
-        }
-    }
-
-    /**
-     * @see FileSystem#exists
-     */
-    public boolean exists() throws FileSystemException {
-        return fs.exists(path);
-    }
-
-    /**
-     * @see FileSystem#getInputStream
-     */
-    public InputStream getInputStream() throws FileSystemException {
-        return fs.getInputStream(path);
-    }
-
-    /**
-     * Spools this resource to the given output stream.
-     *
-     * @param out output stream where to spool the resource
-     * @throws FileSystemException if the input stream for this resource could
-     *                             not be obtained
-     * @throws IOException         if an error occurs while while spooling
-     * @see FileSystem#getInputStream
-     */
-    public void spool(OutputStream out) throws FileSystemException, IOException {
-        InputStream in = fs.getInputStream(path);
-        try {
-            IOUtils.copy(in, out);
-        } finally {
-            IOUtils.closeQuietly(in);
-        }
-    }
-
-    /**
-     * @see FileSystem#getOutputStream
-     */
-    public OutputStream getOutputStream() throws FileSystemException {
-        return fs.getOutputStream(path);
-    }
-
-    /**
-     * @see FileSystem#lastModified
-     */
-    public long lastModified() throws FileSystemException {
-        return fs.lastModified(path);
-    }
-
-    /**
-     * @see FileSystem#length
-     */
-    public long length() throws FileSystemException {
-        return fs.length(path);
-    }
-
-    //-------------------------------------------< java.lang.Object overrides >
-    /**
-     * Returns the path string of this resource. This is just the
-     * string returned by the <code>{@link #getPath}</code> method.
-     *
-     * @return The path string of this resource
-     */
-    public String toString() {
-        return getPath();
-    }
-
-    public boolean equals(Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj instanceof FileSystemResource) {
-            FileSystemResource other = (FileSystemResource) obj;
-            return (path == null ? other.path == null : path.equals(other.path))
-                    && (fs == null ? other.fs == null : fs.equals(other.fs));
-        }
-        return false;
-    }
-
-    /**
-     * Returns zero to satisfy the Object equals/hashCode contract.
-     * This class is mutable and not meant to be used as a hash key.
-     *
-     * @return always zero
-     * @see Object#hashCode()
-     */
-    public int hashCode() {
-        return 0;
-    }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.core.fs;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.jackrabbit.core.fs.FileSystemPathUtil;
+
+/**
+ * A <code>FileSystemResource</code> represents a resource (i.e. file) in a
+ * <code>FileSystem</code>.
+ */
+public class FileSystemResource {
+
+    protected final FileSystem fs;
+
+    protected final String path;
+
+    static {
+        // preload FileSystemPathUtil to prevent classloader issues during shutdown
+        FileSystemPathUtil.class.hashCode();
+    }
+
+    /**
+     * Creates a new <code>FileSystemResource</code>
+     *
+     * @param fs   the <code>FileSystem</code> where the resource is located
+     * @param path the path of the resource in the <code>FileSystem</code>
+     */
+    public FileSystemResource(FileSystem fs, String path) {
+        if (fs == null) {
+            throw new IllegalArgumentException("invalid file system argument");
+        }
+        this.fs = fs;
+
+        if (path == null) {
+            throw new IllegalArgumentException("invalid path argument");
+        }
+        this.path = path;
+    }
+
+    /**
+     * Returns the <code>FileSystem</code> where this resource is located.
+     *
+     * @return the <code>FileSystem</code> where this resource is located.
+     */
+    public FileSystem getFileSystem() {
+        return fs;
+    }
+
+    /**
+     * Returns the path of this resource.
+     *
+     * @return the path of this resource.
+     */
+    public String getPath() {
+        return path;
+    }
+
+    /**
+     * Returns the parent directory of this resource.
+     *
+     * @return the parent directory.
+     */
+    public String getParentDir() {
+        return FileSystemPathUtil.getParentDir(path);
+    }
+
+    /**
+     * Returns the name of this resource.
+     *
+     * @return the name.
+     */
+    public String getName() {
+        return FileSystemPathUtil.getName(path);
+    }
+
+    /**
+     * Creates the parent directory of this resource, including any necessary
+     * but nonexistent parent directories.
+     *
+     * @throws FileSystemException
+     */
+    public synchronized void makeParentDirs() throws FileSystemException {
+        String parentDir = getParentDir();
+        if (!fs.exists(parentDir)) {
+            fs.createFolder(parentDir);
+        }
+    }
+
+    /**
+     * Deletes this resource.
+     * Same as <code>{@link #delete(false)}</code>.
+     *
+     * @see FileSystem#deleteFile
+     */
+    public void delete() throws FileSystemException {
+        delete(false);
+    }
+
+    /**
+     * Deletes this resource.
+     *
+     * @param pruneEmptyParentDirs if <code>true</code>, empty parent folders will
+     *                             automatically be deleted
+     * @see FileSystem#deleteFile
+     */
+    public synchronized void delete(boolean pruneEmptyParentDirs) throws FileSystemException {
+        fs.deleteFile(path);
+        if (pruneEmptyParentDirs) {
+            // prune empty parent folders
+            String parentDir = FileSystemPathUtil.getParentDir(path);
+            while (!parentDir.equals(FileSystem.SEPARATOR)
+                    && fs.exists(parentDir)
+                    && !fs.hasChildren(parentDir)) {
+                fs.deleteFolder(parentDir);
+                parentDir = FileSystemPathUtil.getParentDir(parentDir);
+            }
+        }
+    }
+
+    /**
+     * @see FileSystem#exists
+     */
+    public boolean exists() throws FileSystemException {
+        return fs.exists(path);
+    }
+
+    /**
+     * @see FileSystem#getInputStream
+     */
+    public InputStream getInputStream() throws FileSystemException {
+        return fs.getInputStream(path);
+    }
+
+    /**
+     * Spools this resource to the given output stream.
+     *
+     * @param out output stream where to spool the resource
+     * @throws FileSystemException if the input stream for this resource could
+     *                             not be obtained
+     * @throws IOException         if an error occurs while while spooling
+     * @see FileSystem#getInputStream
+     */
+    public void spool(OutputStream out) throws FileSystemException, IOException {
+        InputStream in = fs.getInputStream(path);
+        try {
+            IOUtils.copy(in, out);
+        } finally {
+            IOUtils.closeQuietly(in);
+        }
+    }
+
+    /**
+     * @see FileSystem#getOutputStream
+     */
+    public OutputStream getOutputStream() throws FileSystemException {
+        return fs.getOutputStream(path);
+    }
+
+    /**
+     * @see FileSystem#lastModified
+     */
+    public long lastModified() throws FileSystemException {
+        return fs.lastModified(path);
+    }
+
+    /**
+     * @see FileSystem#length
+     */
+    public long length() throws FileSystemException {
+        return fs.length(path);
+    }
+
+    //-------------------------------------------< java.lang.Object overrides >
+    /**
+     * Returns the path string of this resource. This is just the
+     * string returned by the <code>{@link #getPath}</code> method.
+     *
+     * @return The path string of this resource
+     */
+    public String toString() {
+        return getPath();
+    }
+
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof FileSystemResource) {
+            FileSystemResource other = (FileSystemResource) obj;
+            return (path == null ? other.path == null : path.equals(other.path))
+                    && (fs == null ? other.fs == null : fs.equals(other.fs));
+        }
+        return false;
+    }
+
+    /**
+     * Returns zero to satisfy the Object equals/hashCode contract.
+     * This class is mutable and not meant to be used as a hash key.
+     *
+     * @return always zero
+     * @see Object#hashCode()
+     */
+    public int hashCode() {
+        return 0;
+    }
+
+}

Propchange: jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/fs/FileSystemResource.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/fs/RandomAccessOutputStream.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/fs/RandomAccessOutputStream.java?rev=1576690&r1=1576689&r2=1576690&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/fs/RandomAccessOutputStream.java (original)
+++ jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/fs/RandomAccessOutputStream.java Wed Mar 12 11:05:06 2014
@@ -1,39 +1,39 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.core.fs;
-
-import java.io.IOException;
-import java.io.OutputStream;
-
-/**
- * Extends the regular <code>java.io.OutputStream</code> with a random
- * access facility. Multiple <code>write()</code> operations can be
- * positioned off sequence with the {@link #seek} method.
- *
- * @deprecated this class should no longer be used
- */
-public abstract class RandomAccessOutputStream extends OutputStream {
-
-    /**
-     * Sets the current position in the resource where the next write
-     * will occur.
-     *
-     * @param position the new position in the resource.
-     * @throws IOException if an error occurs while seeking to the position.
-     */
-    public abstract void seek(long position) throws IOException;
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.core.fs;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+/**
+ * Extends the regular <code>java.io.OutputStream</code> with a random
+ * access facility. Multiple <code>write()</code> operations can be
+ * positioned off sequence with the {@link #seek} method.
+ *
+ * @deprecated this class should no longer be used
+ */
+public abstract class RandomAccessOutputStream extends OutputStream {
+
+    /**
+     * Sets the current position in the resource where the next write
+     * will occur.
+     *
+     * @param position the new position in the resource.
+     * @throws IOException if an error occurs while seeking to the position.
+     */
+    public abstract void seek(long position) throws IOException;
+}

Propchange: jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/fs/RandomAccessOutputStream.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message