HADOOP-6719. Insert all missing methods in FilterFs.

(Rodrigo Schmidt via dhruba)



git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@937093 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Dhruba Borthakur 2010-04-22 22:47:44 +00:00
parent b183665c7f
commit 1e82194428
3 changed files with 114 additions and 0 deletions

View File

@ -336,6 +336,9 @@ Trunk (unreleased changes)
HADOOP-6690. FilterFileSystem correctly handles setTimes call.
(Rodrigo Schmidt via dhruba)
HADOOP-6719. Insert all missing methods in FilterFs.
(Rodrigo Schmidt via dhruba)
Release 0.21.0 - Unreleased
INCOMPATIBLE CHANGES

View File

@ -16,13 +16,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.EnumSet;
import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.classification.InterfaceStability;
import org.apache.hadoop.fs.FileSystem.Statistics;
import org.apache.hadoop.fs.permission.FsPermission;
import org.apache.hadoop.security.AccessControlException;
import org.apache.hadoop.util.Progressable;
/**
@ -51,11 +55,21 @@ protected FilterFs(AbstractFileSystem fs) throws IOException,
myFs = fs;
}
@Override
protected Statistics getStatistics() {
return myFs.getStatistics();
}
@Override
protected Path getInitialWorkingDirectory() {
return myFs.getInitialWorkingDirectory();
}
@Override
protected Path getHomeDirectory() {
return myFs.getHomeDirectory();
}
@Override
protected FSDataOutputStream createInternal(Path f,
EnumSet<CreateFlag> flag, FsPermission absolutePermission, int bufferSize,
@ -102,6 +116,12 @@ protected FileStatus getFileLinkStatus(final Path f)
return myFs.getFileLinkStatus(f);
}
@Override
protected FsStatus getFsStatus(final Path f) throws AccessControlException,
FileNotFoundException, UnresolvedLinkException, IOException {
return myFs.getFsStatus(f);
}
@Override
protected FsStatus getFsStatus() throws IOException {
return myFs.getFsStatus();
@ -117,6 +137,21 @@ protected int getUriDefaultPort() {
return myFs.getUriDefaultPort();
}
@Override
protected URI getUri() {
return myFs.getUri();
}
@Override
protected void checkPath(Path path) {
myFs.checkPath(path);
}
@Override
protected String getUriPath(final Path p) {
return myFs.getUriPath(p);
}
@Override
protected FileStatus[] listStatus(Path f)
throws IOException, UnresolvedLinkException {
@ -132,6 +167,13 @@ protected void mkdir(Path dir, FsPermission permission, boolean createParent)
}
@Override
protected FSDataInputStream open(final Path f) throws AccessControlException,
FileNotFoundException, UnresolvedLinkException, IOException {
checkPath(f);
return myFs.open(f);
}
@Override
protected FSDataInputStream open(Path f, int bufferSize)
throws IOException, UnresolvedLinkException {
@ -147,6 +189,14 @@ protected void renameInternal(Path src, Path dst)
myFs.rename(src, dst, Options.Rename.NONE);
}
@Override
protected void renameInternal(final Path src, final Path dst,
boolean overwrite) throws AccessControlException,
FileAlreadyExistsException, FileNotFoundException,
ParentNotDirectoryException, UnresolvedLinkException, IOException {
myFs.renameInternal(src, dst, overwrite);
}
@Override
protected void setOwner(Path f, String username, String groupname)
throws IOException, UnresolvedLinkException {

View File

@ -0,0 +1,61 @@
/**
* 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.hadoop.fs;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.net.URI;
import junit.framework.TestCase;
import org.apache.commons.logging.Log;
public class TestFilterFs extends TestCase {
private static final Log LOG = FileSystem.LOG;
public static class DontCheck {
public void checkScheme(URI uri, String supportedScheme) { }
}
public void testFilterFileSystem() throws Exception {
for (Method m : AbstractFileSystem.class.getDeclaredMethods()) {
if (Modifier.isStatic(m.getModifiers()))
continue;
if (Modifier.isPrivate(m.getModifiers()))
continue;
if (Modifier.isFinal(m.getModifiers()))
continue;
try {
DontCheck.class.getMethod(m.getName(), m.getParameterTypes());
LOG.info("Skipping " + m);
} catch (NoSuchMethodException exc) {
LOG.info("Testing " + m);
try{
FilterFs.class.getDeclaredMethod(m.getName(), m.getParameterTypes());
}
catch(NoSuchMethodException exc2){
LOG.error("FilterFileSystem doesn't implement " + m);
throw exc2;
}
}
}
}
}