http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/shell/src/main/java/org/apache/accumulo/shell/mock/MockShell.java ---------------------------------------------------------------------- diff --git a/shell/src/main/java/org/apache/accumulo/shell/mock/MockShell.java b/shell/src/main/java/org/apache/accumulo/shell/mock/MockShell.java index f862b68..ce70a02 100644 --- a/shell/src/main/java/org/apache/accumulo/shell/mock/MockShell.java +++ b/shell/src/main/java/org/apache/accumulo/shell/mock/MockShell.java @@ -22,6 +22,7 @@ import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; + import jline.console.ConsoleReader; import org.apache.accumulo.core.client.mock.MockInstance; @@ -33,7 +34,7 @@ import org.apache.accumulo.shell.ShellOptionsJC; */ public class MockShell extends Shell { private static final String NEWLINE = "\n"; - + protected InputStream in; protected OutputStream out; @@ -45,7 +46,7 @@ public class MockShell extends Shell { public boolean config(String... args) { configError = super.config(args); - + // Update the ConsoleReader with the input and output "redirected" try { this.reader = new ConsoleReader(in, out); @@ -53,16 +54,16 @@ public class MockShell extends Shell { printException(e); configError = true; } - + // Don't need this for testing purposes this.reader.setHistoryEnabled(false); this.reader.setPaginationEnabled(false); - + // Make the parsing from the client easier; this.verbose = false; return configError; } - + @Override protected void setInstance(ShellOptionsJC options) { // We always want a MockInstance for this test @@ -72,11 +73,11 @@ public class MockShell extends Shell { public int start() throws IOException { if (configError) return 1; - + String input; if (isVerbose()) printInfo(); - + if (execFile != null) { java.util.Scanner scanner = new java.util.Scanner(execFile, UTF_8.name()); try { @@ -92,22 +93,22 @@ public class MockShell extends Shell { } return exitCode; } - + while (true) { if (hasExited()) return exitCode; - + reader.setPrompt(getDefaultPrompt()); input = reader.readLine(); if (input == null) { reader.println(); return exitCode; } // user canceled - + execCommand(input, false, false); } } - + /** * @param in * the in to set @@ -115,7 +116,7 @@ public class MockShell extends Shell { public void setConsoleInputStream(InputStream in) { this.in = in; } - + /** * @param out * the output stream to set @@ -126,18 +127,18 @@ public class MockShell extends Shell { /** * Convenience method to create the byte-array to hand to the console - * + * * @param commands * An array of commands to run * @return A byte[] input stream which can be handed to the console. */ public static ByteArrayInputStream makeCommands(String... commands) { StringBuilder sb = new StringBuilder(commands.length * 8); - + for (String command : commands) { sb.append(command).append(NEWLINE); } - + return new ByteArrayInputStream(sb.toString().getBytes(UTF_8)); } }
http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/shell/src/test/java/org/apache/accumulo/shell/PasswordConverterTest.java ---------------------------------------------------------------------- diff --git a/shell/src/test/java/org/apache/accumulo/shell/PasswordConverterTest.java b/shell/src/test/java/org/apache/accumulo/shell/PasswordConverterTest.java index 8e03830..75d7293 100644 --- a/shell/src/test/java/org/apache/accumulo/shell/PasswordConverterTest.java +++ b/shell/src/test/java/org/apache/accumulo/shell/PasswordConverterTest.java @@ -38,40 +38,40 @@ import com.beust.jcommander.Parameter; import com.beust.jcommander.ParameterException; public class PasswordConverterTest { - + private class Password { @Parameter(names = "--password", converter = PasswordConverter.class) String password; } - + private String[] argv; private Password password; private static InputStream realIn; - + @BeforeClass public static void saveIn() { realIn = System.in; } - + @Before public void setup() throws IOException { argv = new String[] {"--password", ""}; password = new Password(); - + PipedInputStream in = new PipedInputStream(); PipedOutputStream out = new PipedOutputStream(in); OutputStreamWriter osw = new OutputStreamWriter(out); osw.write("secret"); osw.close(); - + System.setIn(in); } - + @After public void teardown() { System.setIn(realIn); } - + @Test public void testPass() { String expected = String.valueOf(Math.random()); @@ -79,7 +79,7 @@ public class PasswordConverterTest { new JCommander(password, argv); assertEquals(expected, password.password); } - + @Test public void testEnv() { String name = System.getenv().keySet().iterator().next(); @@ -87,7 +87,7 @@ public class PasswordConverterTest { new JCommander(password, argv); assertEquals(System.getenv(name), password.password); } - + @Test public void testFile() throws FileNotFoundException { argv[1] = "file:pom.xml"; @@ -97,8 +97,8 @@ public class PasswordConverterTest { new JCommander(password, argv); assertEquals(expected, password.password); } - - @Test(expected=ParameterException.class) + + @Test(expected = ParameterException.class) public void testNoFile() throws FileNotFoundException { argv[1] = "file:doesnotexist"; new JCommander(password, argv); http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/shell/src/test/java/org/apache/accumulo/shell/ShellConfigTest.java ---------------------------------------------------------------------- diff --git a/shell/src/test/java/org/apache/accumulo/shell/ShellConfigTest.java b/shell/src/test/java/org/apache/accumulo/shell/ShellConfigTest.java index 0e72c8c..ca06c22 100644 --- a/shell/src/test/java/org/apache/accumulo/shell/ShellConfigTest.java +++ b/shell/src/test/java/org/apache/accumulo/shell/ShellConfigTest.java @@ -27,7 +27,6 @@ import java.io.PrintWriter; import jline.console.ConsoleReader; import org.apache.accumulo.core.client.security.tokens.PasswordToken; -import org.apache.accumulo.shell.Shell; import org.apache.accumulo.shell.ShellTest.TestOutputStream; import org.apache.log4j.Level; import org.junit.After; @@ -40,11 +39,11 @@ public class ShellConfigTest { TestOutputStream output; Shell shell; PrintStream out; - + @Before public void setUp() throws Exception { Shell.log.setLevel(Level.ERROR); - + out = System.out; output = new TestOutputStream(); System.setOut(new PrintStream(output)); @@ -52,37 +51,37 @@ public class ShellConfigTest { shell = new Shell(new ConsoleReader(new FileInputStream(FileDescriptor.in), output), new PrintWriter(output)); shell.setLogErrorsToConsole(); } - + @After public void teardown() throws Exception { shell.shutdown(); output.clear(); System.setOut(out); } - + @Test public void testHelp() { assertTrue(shell.config("--help")); assertTrue("Did not print usage", output.get().startsWith("Usage")); } - + @Test public void testBadArg() { assertTrue(shell.config("--bogus")); assertTrue("Did not print usage", output.get().startsWith("Usage")); } - + @Test public void testTokenWithoutOptions() { assertTrue(shell.config("--fake", "-tc", PasswordToken.class.getCanonicalName())); assertFalse(output.get().contains(ParameterException.class.getCanonicalName())); } - + @Test public void testTokenAndOption() { assertFalse(shell.config("--fake", "-tc", PasswordToken.class.getCanonicalName(), "-u", "foo", "-l", "password=foo")); } - + @Test public void testTokenAndOptionAndPassword() { assertTrue(shell.config("--fake", "-tc", PasswordToken.class.getCanonicalName(), "-l", "password=foo", "-p", "bar")); http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/shell/src/test/java/org/apache/accumulo/shell/ShellTest.java ---------------------------------------------------------------------- diff --git a/shell/src/test/java/org/apache/accumulo/shell/ShellTest.java b/shell/src/test/java/org/apache/accumulo/shell/ShellTest.java index 2ce8ed6..82e61fd 100644 --- a/shell/src/test/java/org/apache/accumulo/shell/ShellTest.java +++ b/shell/src/test/java/org/apache/accumulo/shell/ShellTest.java @@ -34,7 +34,6 @@ import java.util.TimeZone; import jline.console.ConsoleReader; import org.apache.accumulo.core.util.format.DateStringFormatter; -import org.apache.accumulo.shell.Shell; import org.apache.log4j.Level; import org.junit.After; import org.junit.Before; @@ -286,12 +285,12 @@ public class ShellTest { input.set("\n\n"); exec("setiter -scan -class org.apache.accumulo.core.iterators.ColumnFamilyCounter -p 30 -name foo", true); - + input.set("bar\nname value\n"); exec("setiter -scan -class org.apache.accumulo.core.iterators.ColumnFamilyCounter -p 31", true); - - //TODO can't verify this as config -t fails, functionality verified in ShellServerIT - + + // TODO can't verify this as config -t fails, functionality verified in ShellServerIT + exec("deletetable t -f", true, "Table: [t] has been deleted"); } } http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/shell/src/test/java/org/apache/accumulo/shell/ShellUtilTest.java ---------------------------------------------------------------------- diff --git a/shell/src/test/java/org/apache/accumulo/shell/ShellUtilTest.java b/shell/src/test/java/org/apache/accumulo/shell/ShellUtilTest.java index c3af70a..9b3be51 100644 --- a/shell/src/test/java/org/apache/accumulo/shell/ShellUtilTest.java +++ b/shell/src/test/java/org/apache/accumulo/shell/ShellUtilTest.java @@ -17,7 +17,7 @@ package org.apache.accumulo.shell; import static java.nio.charset.StandardCharsets.UTF_8; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; import java.io.File; import java.io.FileNotFoundException; @@ -25,7 +25,6 @@ import java.io.IOException; import java.util.List; import org.apache.accumulo.core.util.Base64; -import org.apache.accumulo.shell.ShellUtil; import org.apache.commons.io.FileUtils; import org.apache.hadoop.io.Text; import org.junit.Rule; @@ -55,9 +54,7 @@ public class ShellUtilTest { File testFile = new File(folder.getRoot(), "testFileWithDecode.txt"); FileUtils.writeStringToFile(testFile, FILEDATA); List<Text> output = ShellUtil.scanFile(testFile.getAbsolutePath(), true); - assertEquals( - ImmutableList.of(new Text(Base64.decodeBase64("line1".getBytes(UTF_8))), new Text(Base64.decodeBase64("line2".getBytes(UTF_8)))), - output); + assertEquals(ImmutableList.of(new Text(Base64.decodeBase64("line1".getBytes(UTF_8))), new Text(Base64.decodeBase64("line2".getBytes(UTF_8)))), output); } @Test(expected = FileNotFoundException.class) http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/shell/src/test/java/org/apache/accumulo/shell/commands/DeleteTableCommandTest.java ---------------------------------------------------------------------- diff --git a/shell/src/test/java/org/apache/accumulo/shell/commands/DeleteTableCommandTest.java b/shell/src/test/java/org/apache/accumulo/shell/commands/DeleteTableCommandTest.java index 3cbb227..4877552 100644 --- a/shell/src/test/java/org/apache/accumulo/shell/commands/DeleteTableCommandTest.java +++ b/shell/src/test/java/org/apache/accumulo/shell/commands/DeleteTableCommandTest.java @@ -35,7 +35,7 @@ public class DeleteTableCommandTest { Set<String> tables = new HashSet<String>(Arrays.asList(MetadataTable.NAME, RootTable.NAME, "a1", "a2")); DeleteTableCommand cmd = new DeleteTableCommand(); cmd.pruneTables("a.*", tables); - + Assert.assertEquals(new HashSet<String>(Arrays.asList("a1", "a2")), tables); } http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/shell/src/test/java/org/apache/accumulo/shell/commands/DropUserCommandTest.java ---------------------------------------------------------------------- diff --git a/shell/src/test/java/org/apache/accumulo/shell/commands/DropUserCommandTest.java b/shell/src/test/java/org/apache/accumulo/shell/commands/DropUserCommandTest.java index 2c82bf1..a08edc5 100644 --- a/shell/src/test/java/org/apache/accumulo/shell/commands/DropUserCommandTest.java +++ b/shell/src/test/java/org/apache/accumulo/shell/commands/DropUserCommandTest.java @@ -21,14 +21,13 @@ import jline.console.ConsoleReader; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.admin.SecurityOperations; import org.apache.accumulo.shell.Shell; -import org.apache.accumulo.shell.commands.DropUserCommand; import org.apache.commons.cli.CommandLine; import org.easymock.EasyMock; import org.junit.Before; import org.junit.Test; /** - * + * */ public class DropUserCommandTest { @@ -36,7 +35,7 @@ public class DropUserCommandTest { @Before public void setup() { - cmd = new DropUserCommand(); + cmd = new DropUserCommand(); // Initialize that internal state cmd.getOptions(); @@ -52,7 +51,7 @@ public class DropUserCommandTest { EasyMock.expect(shellState.getConnector()).andReturn(conn); - // The user we want to remove + // The user we want to remove EasyMock.expect(cli.getArgs()).andReturn(new String[] {"user"}); // We're the root user @@ -74,7 +73,7 @@ public class DropUserCommandTest { EasyMock.expectLastCall(); EasyMock.replay(conn, cli, shellState, reader, secOps); - + cmd.execute("dropuser foo -f", cli, shellState); EasyMock.verify(conn, cli, shellState, reader, secOps); http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/shell/src/test/java/org/apache/accumulo/shell/commands/FormatterCommandTest.java ---------------------------------------------------------------------- diff --git a/shell/src/test/java/org/apache/accumulo/shell/commands/FormatterCommandTest.java b/shell/src/test/java/org/apache/accumulo/shell/commands/FormatterCommandTest.java index ddcd243..8a174d2 100644 --- a/shell/src/test/java/org/apache/accumulo/shell/commands/FormatterCommandTest.java +++ b/shell/src/test/java/org/apache/accumulo/shell/commands/FormatterCommandTest.java @@ -41,87 +41,87 @@ import org.junit.Test; public class FormatterCommandTest { ByteArrayOutputStream out = null; InputStream in = null; - + @Test public void test() throws IOException, AccumuloException, AccumuloSecurityException, TableExistsException, ClassNotFoundException { // Keep the Shell AUDIT log off the test output Logger.getLogger(Shell.class).setLevel(Level.WARN); - + final String[] args = new String[] {"--fake", "-u", "root", "-p", ""}; - + final String[] commands = createCommands(); - + in = MockShell.makeCommands(commands); out = new ByteArrayOutputStream(); - + final MockShell shell = new MockShell(in, out); shell.config(args); - + // Can't call createtable in the shell with MockAccumulo shell.getConnector().tableOperations().create("test"); - + try { shell.start(); } catch (Exception e) { Assert.fail("Exception while running commands: " + e.getMessage()); } - + shell.getReader().flush(); - + final String[] output = new String(out.toByteArray()).split("\n\r"); - + boolean formatterOn = false; - + final String[] expectedDefault = new String[] {"row cf:cq [] 1234abcd", "row cf1:cq1 [] 9876fedc", "row2 cf:cq [] 13579bdf", "row2 cf1:cq [] 2468ace"}; - + final String[] expectedFormatted = new String[] {"row cf:cq [] 0x31 0x32 0x33 0x34 0x61 0x62 0x63 0x64", "row cf1:cq1 [] 0x39 0x38 0x37 0x36 0x66 0x65 0x64 0x63", "row2 cf:cq [] 0x31 0x33 0x35 0x37 0x39 0x62 0x64 0x66", "row2 cf1:cq [] 0x32 0x34 0x36 0x38 0x61 0x63 0x65"}; - + int outputIndex = 0; while (outputIndex < output.length) { final String line = output[outputIndex]; - + if (line.startsWith("root@mock-instance")) { if (line.contains("formatter")) { formatterOn = true; } - + outputIndex++; } else if (line.startsWith("row")) { int expectedIndex = 0; String[] comparisonData; - + // Pick the type of data we expect (formatted or default) if (formatterOn) { comparisonData = expectedFormatted; } else { comparisonData = expectedDefault; } - + // Ensure each output is what we expected while (expectedIndex + outputIndex < output.length && expectedIndex < expectedFormatted.length) { Assert.assertEquals(comparisonData[expectedIndex].trim(), output[expectedIndex + outputIndex].trim()); expectedIndex++; } - + outputIndex += expectedIndex; } } } - + private String[] createCommands() { return new String[] {"table test", "insert row cf cq 1234abcd", "insert row cf1 cq1 9876fedc", "insert row2 cf cq 13579bdf", "insert row2 cf1 cq 2468ace", "scan", "formatter -t test -f org.apache.accumulo.core.util.shell.command.FormatterCommandTest$HexFormatter", "scan"}; } - + /** * <p> * Simple <code>Formatter</code> that will convert each character in the Value from decimal to hexadecimal. Will automatically skip over characters in the * value which do not fall within the [0-9,a-f] range. * </p> - * + * * <p> * Example: <code>'0'</code> will be displayed as <code>'0x30'</code> * </p> @@ -129,56 +129,56 @@ public class FormatterCommandTest { public static class HexFormatter implements Formatter { private Iterator<Entry<Key,Value>> iter = null; private boolean printTs = false; - + private final static String tab = "\t"; private final static String newline = "\n"; - + public HexFormatter() {} - + @Override public boolean hasNext() { return this.iter.hasNext(); } - + @Override public String next() { final Entry<Key,Value> entry = iter.next(); - + String key; - + // Observe the timestamps if (printTs) { key = entry.getKey().toString(); } else { key = entry.getKey().toStringNoTime(); } - + final Value v = entry.getValue(); - + // Approximate how much space we'll need final StringBuilder sb = new StringBuilder(key.length() + v.getSize() * 5); - + sb.append(key).append(tab); - + for (byte b : v.get()) { if ((b >= 48 && b <= 57) || (b >= 97 || b <= 102)) { sb.append(String.format("0x%x ", Integer.valueOf(b))); } } - + sb.append(newline); - + return sb.toString(); } - + @Override public void remove() {} - + @Override public void initialize(final Iterable<Entry<Key,Value>> scanner, final boolean printTimestamps) { this.iter = scanner.iterator(); this.printTs = printTimestamps; } } - + } http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/shell/src/test/java/org/apache/accumulo/shell/commands/HistoryCommandTest.java ---------------------------------------------------------------------- diff --git a/shell/src/test/java/org/apache/accumulo/shell/commands/HistoryCommandTest.java b/shell/src/test/java/org/apache/accumulo/shell/commands/HistoryCommandTest.java index 8a5b598..638af3f 100644 --- a/shell/src/test/java/org/apache/accumulo/shell/commands/HistoryCommandTest.java +++ b/shell/src/test/java/org/apache/accumulo/shell/commands/HistoryCommandTest.java @@ -30,7 +30,6 @@ import jline.console.history.History; import jline.console.history.MemoryHistory; import org.apache.accumulo.shell.Shell; -import org.apache.accumulo.shell.commands.HistoryCommand; import org.apache.commons.cli.CommandLine; import org.junit.Assume; import org.junit.Before; http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/shell/src/test/java/org/apache/accumulo/shell/format/DeleterFormatterTest.java ---------------------------------------------------------------------- diff --git a/shell/src/test/java/org/apache/accumulo/shell/format/DeleterFormatterTest.java b/shell/src/test/java/org/apache/accumulo/shell/format/DeleterFormatterTest.java index 0229cee..d99c0f2 100644 --- a/shell/src/test/java/org/apache/accumulo/shell/format/DeleterFormatterTest.java +++ b/shell/src/test/java/org/apache/accumulo/shell/format/DeleterFormatterTest.java @@ -44,7 +44,6 @@ import org.apache.accumulo.core.data.Key; import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.data.Value; import org.apache.accumulo.shell.Shell; -import org.apache.accumulo.shell.format.DeleterFormatter; import org.junit.Before; import org.junit.Test; http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/start/src/main/java/org/apache/accumulo/start/Main.java ---------------------------------------------------------------------- diff --git a/start/src/main/java/org/apache/accumulo/start/Main.java b/start/src/main/java/org/apache/accumulo/start/Main.java index 06ea686..55ee48c 100644 --- a/start/src/main/java/org/apache/accumulo/start/Main.java +++ b/start/src/main/java/org/apache/accumulo/start/Main.java @@ -27,7 +27,7 @@ import org.apache.accumulo.start.classloader.AccumuloClassLoader; import org.apache.log4j.Logger; public class Main { - + private static final Logger log = Logger.getLogger(Main.class); public static void main(String[] args) { @@ -136,7 +136,7 @@ public class Main { try { main = runTMP.getMethod("main", args.getClass()); } catch (Throwable t) { - log.error("Could not run main method on '"+runTMP.getName()+"'.", t); + log.error("Could not run main method on '" + runTMP.getName() + "'.", t); } if (main == null || !Modifier.isPublic(main.getModifiers()) || !Modifier.isStatic(main.getModifiers())) { System.out.println(args[0] + " must implement a public static void main(String args[]) method"); @@ -190,7 +190,7 @@ public class Main { * The {@link Throwable} containing a stack trace to print. */ private static void die(Throwable t) { - log.error("Thread '"+Thread.currentThread().getName()+"' died.", t); + log.error("Thread '" + Thread.currentThread().getName() + "' died.", t); System.exit(1); } http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/start/src/main/java/org/apache/accumulo/start/TestMain.java ---------------------------------------------------------------------- diff --git a/start/src/main/java/org/apache/accumulo/start/TestMain.java b/start/src/main/java/org/apache/accumulo/start/TestMain.java index 9320bfa..e52faba 100644 --- a/start/src/main/java/org/apache/accumulo/start/TestMain.java +++ b/start/src/main/java/org/apache/accumulo/start/TestMain.java @@ -16,11 +16,11 @@ */ package org.apache.accumulo.start; -/** This program tests that the proper exit code is propagated to the shell. +/** + * This program tests that the proper exit code is propagated to the shell. * - * $ ./bin/accumulo org.apache.accumulo.start.TestMain - * $ ./bin/accumulo org.apache.accumulo.start.TestMain badExit - * $ ./bin/accumulo org.apache.accumulo.start.TestMain throw + * $ ./bin/accumulo org.apache.accumulo.start.TestMain $ ./bin/accumulo org.apache.accumulo.start.TestMain badExit $ ./bin/accumulo + * org.apache.accumulo.start.TestMain throw * * The last case tests the proper logging of an exception. */ http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/start/src/main/java/org/apache/accumulo/start/classloader/AccumuloClassLoader.java ---------------------------------------------------------------------- diff --git a/start/src/main/java/org/apache/accumulo/start/classloader/AccumuloClassLoader.java b/start/src/main/java/org/apache/accumulo/start/classloader/AccumuloClassLoader.java index 2db8a5d..25cf646 100644 --- a/start/src/main/java/org/apache/accumulo/start/classloader/AccumuloClassLoader.java +++ b/start/src/main/java/org/apache/accumulo/start/classloader/AccumuloClassLoader.java @@ -42,20 +42,20 @@ import org.w3c.dom.Node; import org.w3c.dom.NodeList; /** - * + * */ public class AccumuloClassLoader { - + public static final String CLASSPATH_PROPERTY_NAME = "general.classpaths"; - + /* @formatter:off */ - public static final String ACCUMULO_CLASSPATH_VALUE = - "$ACCUMULO_CONF_DIR,\n" + - "$ACCUMULO_HOME/lib/[^.].*.jar,\n" + - "$ZOOKEEPER_HOME/zookeeper[^.].*.jar,\n" + + public static final String ACCUMULO_CLASSPATH_VALUE = + "$ACCUMULO_CONF_DIR,\n" + + "$ACCUMULO_HOME/lib/[^.].*.jar,\n" + + "$ZOOKEEPER_HOME/zookeeper[^.].*.jar,\n" + "$HADOOP_CONF_DIR,\n" + - "$HADOOP_PREFIX/[^.].*.jar,\n" + - "$HADOOP_PREFIX/lib/[^.].*.jar,\n" + + "$HADOOP_PREFIX/[^.].*.jar,\n" + + "$HADOOP_PREFIX/lib/[^.].*.jar,\n" + "$HADOOP_PREFIX/share/hadoop/common/.*.jar,\n" + "$HADOOP_PREFIX/share/hadoop/common/lib/.*.jar,\n" + "$HADOOP_PREFIX/share/hadoop/hdfs/.*.jar,\n" + @@ -67,16 +67,16 @@ public class AccumuloClassLoader { "/usr/lib/hadoop-yarn/[^.].*.jar,\n" ; /* @formatter:on */ - + public static final String MAVEN_PROJECT_BASEDIR_PROPERTY_NAME = "general.maven.project.basedir"; public static final String DEFAULT_MAVEN_PROJECT_BASEDIR_VALUE = ""; - + private static String SITE_CONF; - + private static URLClassLoader classloader; - + private static final Logger log = Logger.getLogger(AccumuloClassLoader.class); - + static { String configFile = System.getProperty("org.apache.accumulo.config.file", "accumulo-site.xml"); if (System.getenv("ACCUMULO_CONF_DIR") != null) { @@ -89,11 +89,11 @@ public class AccumuloClassLoader { SITE_CONF = null; } } - + /** * Parses and XML Document for a property node for a <name> with the value propertyName if it finds one the function return that property's value for its * <value> node. If not found the function will return null - * + * * @param d * XMLDocument to search through */ @@ -111,20 +111,20 @@ public class AccumuloClassLoader { } return null; } - + /** * Looks for the site configuration file for Accumulo and if it has a property for propertyName return it otherwise returns defaultValue Should throw an * exception if the default configuration can not be read; - * + * * @param propertyName * Name of the property to pull * @param defaultValue * Value to default to if not found. * @return site or default class path String */ - + public static String getAccumuloString(String propertyName, String defaultValue) { - + try { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); @@ -142,7 +142,7 @@ public class AccumuloClassLoader { throw new IllegalStateException("ClassPath Strings Lookup failed", e); } } - + /** * Replace environment variables in the classpath string with their actual value */ @@ -161,7 +161,7 @@ public class AccumuloClassLoader { } return classpath; } - + /** * Populate the list of URLs with the items in the classpath string */ @@ -169,9 +169,9 @@ public class AccumuloClassLoader { classpath = classpath.trim(); if (classpath.length() == 0) return; - + classpath = replaceEnvVars(classpath, System.getenv()); - + // Try to make a URI out of the classpath URI uri = null; try { @@ -179,7 +179,7 @@ public class AccumuloClassLoader { } catch (URISyntaxException e) { // Not a valid URI } - + if (null == uri || !uri.isAbsolute() || (null != uri.getScheme() && uri.getScheme().equals("file://"))) { // Then treat this URI as a File. // This checks to see if the url string is a dir if it expand and get all jars in that directory @@ -207,9 +207,9 @@ public class AccumuloClassLoader { } else { urls.add(uri.toURL()); } - + } - + private static ArrayList<URL> findAccumuloURLs() throws IOException { String cp = getAccumuloString(AccumuloClassLoader.CLASSPATH_PROPERTY_NAME, AccumuloClassLoader.ACCUMULO_CLASSPATH_VALUE); if (cp == null) @@ -225,7 +225,7 @@ public class AccumuloClassLoader { } return urls; } - + private static Set<String> getMavenClasspaths() { String baseDirname = AccumuloClassLoader.getAccumuloString(MAVEN_PROJECT_BASEDIR_PROPERTY_NAME, DEFAULT_MAVEN_PROJECT_BASEDIR_VALUE); if (baseDirname == null || baseDirname.trim().isEmpty()) @@ -234,7 +234,7 @@ public class AccumuloClassLoader { findMavenTargetClasses(paths, new File(baseDirname.trim()), 0); return paths; } - + private static void findMavenTargetClasses(Set<String> paths, File file, int depth) { if (depth > 3) return; @@ -246,18 +246,18 @@ public class AccumuloClassLoader { paths.add(file.getParentFile().getAbsolutePath() + File.separator + "target" + File.separator + "classes"); } } - + public static synchronized ClassLoader getClassLoader() throws IOException { if (classloader == null) { ArrayList<URL> urls = findAccumuloURLs(); - + ClassLoader parentClassLoader = AccumuloClassLoader.class.getClassLoader(); - + log.debug("Create 2nd tier ClassLoader using URLs: " + urls.toString()); URLClassLoader aClassLoader = new URLClassLoader(urls.toArray(new URL[urls.size()]), parentClassLoader) { @Override protected synchronized Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException { - + if (name.startsWith("org.apache.accumulo.start.classloader.vfs")) { Class<?> c = findLoadedClass(name); if (c == null) { @@ -272,7 +272,7 @@ public class AccumuloClassLoader { }; classloader = aClassLoader; } - + return classloader; } } http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/start/src/main/java/org/apache/accumulo/start/classloader/vfs/AccumuloReloadingVFSClassLoader.java ---------------------------------------------------------------------- diff --git a/start/src/main/java/org/apache/accumulo/start/classloader/vfs/AccumuloReloadingVFSClassLoader.java b/start/src/main/java/org/apache/accumulo/start/classloader/vfs/AccumuloReloadingVFSClassLoader.java index c5e8d8b..88dfd1e 100644 --- a/start/src/main/java/org/apache/accumulo/start/classloader/vfs/AccumuloReloadingVFSClassLoader.java +++ b/start/src/main/java/org/apache/accumulo/start/classloader/vfs/AccumuloReloadingVFSClassLoader.java @@ -29,18 +29,17 @@ import org.apache.commons.vfs2.impl.VFSClassLoader; import org.apache.log4j.Logger; /** - * Classloader that delegates operations to a VFSClassLoader object. This class also listens - * for changes in any of the files/directories that are in the classpath and will recreate - * the delegate object if there is any change in the classpath. + * Classloader that delegates operations to a VFSClassLoader object. This class also listens for changes in any of the files/directories that are in the + * classpath and will recreate the delegate object if there is any change in the classpath. * */ public class AccumuloReloadingVFSClassLoader implements FileListener, ReloadingClassLoader { - + private static final Logger log = Logger.getLogger(AccumuloReloadingVFSClassLoader.class); // set to 5 mins. The rational behind this large time is to avoid a gazillion tservers all asking the name node for info too frequently. private static final int DEFAULT_TIMEOUT = 300000; - + private String uris; private FileObject[] files; private FileSystemManager vfs = null; @@ -48,6 +47,7 @@ public class AccumuloReloadingVFSClassLoader implements FileListener, ReloadingC private DefaultFileMonitor monitor = null; private VFSClassLoader cl = null; private boolean preDelegate; + public String stringify(FileObject[] files) { StringBuilder sb = new StringBuilder(); sb.append('['); @@ -79,13 +79,13 @@ public class AccumuloReloadingVFSClassLoader implements FileListener, ReloadingC throw new RuntimeException(fse); } } - + return cl; } - + private synchronized void setClassloader(VFSClassLoader cl) { this.cl = cl; - + } public AccumuloReloadingVFSClassLoader(String uris, FileSystemManager vfs, ReloadingClassLoader parent, long monitorDelay, boolean preDelegate) @@ -95,7 +95,7 @@ public class AccumuloReloadingVFSClassLoader implements FileListener, ReloadingC this.vfs = vfs; this.parent = parent; this.preDelegate = preDelegate; - + ArrayList<FileObject> pathsToMonitor = new ArrayList<FileObject>(); files = AccumuloVFSClassLoader.resolve(vfs, uris, pathsToMonitor); @@ -103,7 +103,7 @@ public class AccumuloReloadingVFSClassLoader implements FileListener, ReloadingC cl = new VFSClassLoader(files, vfs, parent.getClassLoader()); else cl = new PostDelegatingVFSClassLoader(files, vfs, parent.getClassLoader()); - + monitor = new DefaultFileMonitor(this); monitor.setDelay(monitorDelay); monitor.setRecursive(false); @@ -113,16 +113,15 @@ public class AccumuloReloadingVFSClassLoader implements FileListener, ReloadingC } monitor.start(); } - - public AccumuloReloadingVFSClassLoader(String uris, FileSystemManager vfs, final ReloadingClassLoader parent, boolean preDelegate) - throws FileSystemException { + + public AccumuloReloadingVFSClassLoader(String uris, FileSystemManager vfs, final ReloadingClassLoader parent, boolean preDelegate) throws FileSystemException { this(uris, vfs, parent, DEFAULT_TIMEOUT, preDelegate); } synchronized public FileObject[] getFiles() { return Arrays.copyOf(this.files, this.files.length); } - + /** * Should be ok if this is not called because the thread started by DefaultFileMonitor is a daemon thread */ @@ -148,12 +147,10 @@ public class AccumuloReloadingVFSClassLoader implements FileListener, ReloadingC setClassloader(null); } - - @Override public String toString() { StringBuilder buf = new StringBuilder(); - + for (FileObject f : files) { try { buf.append("\t").append(f.getURL().toString()).append("\n"); @@ -161,11 +158,8 @@ public class AccumuloReloadingVFSClassLoader implements FileListener, ReloadingC log.error("Error getting URL for file", e); } } - + return buf.toString(); } - - - } http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/start/src/main/java/org/apache/accumulo/start/classloader/vfs/AccumuloVFSClassLoader.java ---------------------------------------------------------------------- diff --git a/start/src/main/java/org/apache/accumulo/start/classloader/vfs/AccumuloVFSClassLoader.java b/start/src/main/java/org/apache/accumulo/start/classloader/vfs/AccumuloVFSClassLoader.java index 8195dd2..1cee6d7 100644 --- a/start/src/main/java/org/apache/accumulo/start/classloader/vfs/AccumuloVFSClassLoader.java +++ b/start/src/main/java/org/apache/accumulo/start/classloader/vfs/AccumuloVFSClassLoader.java @@ -46,7 +46,7 @@ import org.apache.log4j.Logger; /** * This class builds a hierarchy of Classloaders in the form of: - * + * * <pre> * SystemClassLoader that loads JVM classes * ^ @@ -58,10 +58,10 @@ import org.apache.log4j.Logger; * ^ * | * AccumuloReloadingVFSClassLoader That loads jars from locations in general.dynamic.classpaths. Used to load jar dynamically. - * + * * </pre> - * - * + * + * */ public class AccumuloVFSClassLoader { @@ -90,7 +90,7 @@ public class AccumuloVFSClassLoader { public static final String VFS_CONTEXT_CLASSPATH_PROPERTY = "general.vfs.context.classpath."; public static final String VFS_CACHE_DIR = "general.vfs.cache.dir"; - + private static ClassLoader parent = null; private static volatile ReloadingClassLoader loader = null; private static final Object lock = new Object(); @@ -219,11 +219,11 @@ public class AccumuloVFSClassLoader { localLoader = createDynamicClassloader(new VFSClassLoader(vfsCP, vfs, parent)); loader = localLoader; - //An HDFS FileSystem and Configuration object were created for each unique HDFS namespace in the call to resolve above. - //The HDFS Client did us a favor and cached these objects so that the next time someone calls FileSystem.get(uri), they - //get the cached object. However, these objects were created not with the system VFS classloader, but the classloader above - //it. We need to override the classloader on the Configuration objects. Ran into an issue were log recovery was being attempted - //and SequenceFile$Reader was trying to instantiate the key class via WritableName.getClass(String, Configuration) + // An HDFS FileSystem and Configuration object were created for each unique HDFS namespace in the call to resolve above. + // The HDFS Client did us a favor and cached these objects so that the next time someone calls FileSystem.get(uri), they + // get the cached object. However, these objects were created not with the system VFS classloader, but the classloader above + // it. We need to override the classloader on the Configuration objects. Ran into an issue were log recovery was being attempted + // and SequenceFile$Reader was trying to instantiate the key class via WritableName.getClass(String, Configuration) for (FileObject fo : vfsCP) { if (fo instanceof HdfsFileObject) { String uri = fo.getName().getRootURI(); @@ -276,7 +276,7 @@ public class AccumuloVFSClassLoader { vfs.addMimeTypeMap("application/zip", "zip"); vfs.setFileContentInfoFactory(new FileContentInfoFilenameFactory()); vfs.setFilesCache(new SoftRefFilesCache()); - File cacheDir = computeTopCacheDir(); + File cacheDir = computeTopCacheDir(); vfs.setReplicator(new UniqueFileReplicator(cacheDir)); vfs.setCacheStrategy(CacheStrategy.ON_RESOLVE); vfs.init(); http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/start/src/main/java/org/apache/accumulo/start/classloader/vfs/ContextManager.java ---------------------------------------------------------------------- diff --git a/start/src/main/java/org/apache/accumulo/start/classloader/vfs/ContextManager.java b/start/src/main/java/org/apache/accumulo/start/classloader/vfs/ContextManager.java index c7bc120..1cf8637 100644 --- a/start/src/main/java/org/apache/accumulo/start/classloader/vfs/ContextManager.java +++ b/start/src/main/java/org/apache/accumulo/start/classloader/vfs/ContextManager.java @@ -27,28 +27,28 @@ import org.apache.commons.vfs2.FileSystemException; import org.apache.commons.vfs2.FileSystemManager; public class ContextManager { - + // there is a lock per context so that one context can initialize w/o blocking another context private class Context { AccumuloReloadingVFSClassLoader loader; ContextConfig cconfig; boolean closed = false; - + Context(ContextConfig cconfig) { this.cconfig = cconfig; } - + synchronized ClassLoader getClassLoader() throws FileSystemException { if (closed) return null; - + if (loader == null) { loader = new AccumuloReloadingVFSClassLoader(cconfig.uris, vfs, parent, cconfig.preDelegation); } - + return loader.getClassLoader(); } - + synchronized void close() { closed = true; if (loader != null) { @@ -57,79 +57,79 @@ public class ContextManager { loader = null; } } - + private Map<String,Context> contexts = new HashMap<String,Context>(); - + private volatile ContextsConfig config; private FileSystemManager vfs; private ReloadingClassLoader parent; - + ContextManager(FileSystemManager vfs, ReloadingClassLoader parent) { this.vfs = vfs; this.parent = parent; } - + public static class ContextConfig { String uris; boolean preDelegation; - + public ContextConfig(String uris, boolean preDelegation) { this.uris = uris; this.preDelegation = preDelegation; } - + @Override public boolean equals(Object o) { if (o instanceof ContextConfig) { ContextConfig oc = (ContextConfig) o; - + return uris.equals(oc.uris) && preDelegation == oc.preDelegation; } - + return false; } - + @Override public int hashCode() { return uris.hashCode() + (preDelegation ? Boolean.TRUE : Boolean.FALSE).hashCode(); } } - + public interface ContextsConfig { ContextConfig getContextConfig(String context); } - + public static class DefaultContextsConfig implements ContextsConfig { - + private Iterable<Entry<String,String>> config; - + public DefaultContextsConfig(Iterable<Entry<String,String>> config) { this.config = config; } - + @Override public ContextConfig getContextConfig(String context) { - + String key = AccumuloVFSClassLoader.VFS_CONTEXT_CLASSPATH_PROPERTY + context; - + String uris = null; boolean preDelegate = true; - + Iterator<Entry<String,String>> iter = config.iterator(); while (iter.hasNext()) { Entry<String,String> entry = iter.next(); if (entry.getKey().equals(key)) { uris = entry.getValue(); } - + if (entry.getKey().equals(key + ".delegation") && entry.getValue().trim().equalsIgnoreCase("post")) { preDelegate = false; } } - + if (uris != null) return new ContextConfig(uris, preDelegate); - + return null; } } @@ -142,22 +142,22 @@ public class ContextManager { throw new IllegalStateException("Context manager config already set"); this.config = config; } - + public ClassLoader getClassLoader(String contextName) throws FileSystemException { - + ContextConfig cconfig = config.getContextConfig(contextName); - + if (cconfig == null) throw new IllegalArgumentException("Unknown context " + contextName); - + Context context = null; Context contextToClose = null; - + synchronized (this) { // only manipulate internal data structs in this sync block... avoid creating or closing classloader, reading config, etc... basically avoid operations // that may block context = contexts.get(contextName); - + if (context == null) { context = new Context(cconfig); contexts.put(contextName, context); @@ -167,20 +167,20 @@ public class ContextManager { contexts.put(contextName, context); } } - + if (contextToClose != null) contextToClose.close(); - + ClassLoader loader = context.getClassLoader(); if (loader == null) { // oops, context was closed by another thread, try again return getClassLoader(contextName); } - + return loader; - + } - + public <U> Class<? extends U> loadClass(String context, String classname, Class<U> extension) throws ClassNotFoundException { try { return getClassLoader(context).loadClass(classname).asSubclass(extension); @@ -188,17 +188,17 @@ public class ContextManager { throw new ClassNotFoundException("IO Error loading class " + classname, e); } } - + public void removeUnusedContexts(Set<String> inUse) { - + Map<String,Context> unused; - + synchronized (this) { unused = new HashMap<String,Context>(contexts); unused.keySet().removeAll(inUse); contexts.keySet().removeAll(unused.keySet()); } - + for (Context context : unused.values()) { // close outside of lock context.close(); http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/start/src/main/java/org/apache/accumulo/start/classloader/vfs/MiniDFSUtil.java ---------------------------------------------------------------------- diff --git a/start/src/main/java/org/apache/accumulo/start/classloader/vfs/MiniDFSUtil.java b/start/src/main/java/org/apache/accumulo/start/classloader/vfs/MiniDFSUtil.java index c822f64..a8e4d60 100644 --- a/start/src/main/java/org/apache/accumulo/start/classloader/vfs/MiniDFSUtil.java +++ b/start/src/main/java/org/apache/accumulo/start/classloader/vfs/MiniDFSUtil.java @@ -20,7 +20,7 @@ import java.io.BufferedReader; import java.io.InputStreamReader; public class MiniDFSUtil { - + public static String computeDatanodeDirectoryPermission() { // MiniDFSCluster will check the permissions on the data directories, but does not // do a good job of setting them properly. We need to get the users umask and set @@ -32,12 +32,12 @@ public class MiniDFSUtil { try { String line = bri.readLine(); p.waitFor(); - + Short umask = Short.parseShort(line.trim(), 8); // Need to set permission to 777 xor umask // leading zero makes java interpret as base 8 int newPermission = 0777 ^ umask; - + return String.format("%03o", newPermission); } finally { bri.close(); @@ -46,5 +46,5 @@ public class MiniDFSUtil { throw new RuntimeException("Error getting umask from O/S", e); } } - + } http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/start/src/main/java/org/apache/accumulo/start/classloader/vfs/PostDelegatingVFSClassLoader.java ---------------------------------------------------------------------- diff --git a/start/src/main/java/org/apache/accumulo/start/classloader/vfs/PostDelegatingVFSClassLoader.java b/start/src/main/java/org/apache/accumulo/start/classloader/vfs/PostDelegatingVFSClassLoader.java index 745401b..307ee73 100644 --- a/start/src/main/java/org/apache/accumulo/start/classloader/vfs/PostDelegatingVFSClassLoader.java +++ b/start/src/main/java/org/apache/accumulo/start/classloader/vfs/PostDelegatingVFSClassLoader.java @@ -22,14 +22,14 @@ import org.apache.commons.vfs2.FileSystemManager; import org.apache.commons.vfs2.impl.VFSClassLoader; /** - * + * */ public class PostDelegatingVFSClassLoader extends VFSClassLoader { - + public PostDelegatingVFSClassLoader(FileObject[] files, FileSystemManager manager, ClassLoader parent) throws FileSystemException { super(files, manager, parent); } - + @Override protected synchronized Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException { Class<?> c = findLoadedClass(name); @@ -39,7 +39,7 @@ public class PostDelegatingVFSClassLoader extends VFSClassLoader { // try finding this class here instead of parent return findClass(name); } catch (ClassNotFoundException e) { - + } return super.loadClass(name, resolve); } http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/start/src/main/java/org/apache/accumulo/start/classloader/vfs/ReloadingClassLoader.java ---------------------------------------------------------------------- diff --git a/start/src/main/java/org/apache/accumulo/start/classloader/vfs/ReloadingClassLoader.java b/start/src/main/java/org/apache/accumulo/start/classloader/vfs/ReloadingClassLoader.java index 9febc45..9de0422 100644 --- a/start/src/main/java/org/apache/accumulo/start/classloader/vfs/ReloadingClassLoader.java +++ b/start/src/main/java/org/apache/accumulo/start/classloader/vfs/ReloadingClassLoader.java @@ -17,7 +17,7 @@ package org.apache.accumulo.start.classloader.vfs; /** - * + * */ public interface ReloadingClassLoader { ClassLoader getClassLoader(); http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/start/src/main/java/org/apache/accumulo/start/classloader/vfs/UniqueFileReplicator.java ---------------------------------------------------------------------- diff --git a/start/src/main/java/org/apache/accumulo/start/classloader/vfs/UniqueFileReplicator.java b/start/src/main/java/org/apache/accumulo/start/classloader/vfs/UniqueFileReplicator.java index e11cf47..ff6e87c 100644 --- a/start/src/main/java/org/apache/accumulo/start/classloader/vfs/UniqueFileReplicator.java +++ b/start/src/main/java/org/apache/accumulo/start/classloader/vfs/UniqueFileReplicator.java @@ -33,7 +33,7 @@ import org.apache.commons.vfs2.provider.VfsComponentContext; import org.apache.log4j.Logger; /** - * + * */ public class UniqueFileReplicator implements VfsComponent, FileReplicator { http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/start/src/main/java/org/apache/accumulo/start/classloader/vfs/providers/HdfsFileAttributes.java ---------------------------------------------------------------------- diff --git a/start/src/main/java/org/apache/accumulo/start/classloader/vfs/providers/HdfsFileAttributes.java b/start/src/main/java/org/apache/accumulo/start/classloader/vfs/providers/HdfsFileAttributes.java index c088956..bfdd561 100644 --- a/start/src/main/java/org/apache/accumulo/start/classloader/vfs/providers/HdfsFileAttributes.java +++ b/start/src/main/java/org/apache/accumulo/start/classloader/vfs/providers/HdfsFileAttributes.java @@ -18,43 +18,42 @@ package org.apache.accumulo.start.classloader.vfs.providers; /** * HDFS file content attributes. - * + * * @since 2.1 */ -public enum HdfsFileAttributes -{ - /** - * Last access time. - */ - LAST_ACCESS_TIME, +public enum HdfsFileAttributes { + /** + * Last access time. + */ + LAST_ACCESS_TIME, - /** - * Block size. - */ - BLOCK_SIZE, + /** + * Block size. + */ + BLOCK_SIZE, - /** - * Group. - */ - GROUP, + /** + * Group. + */ + GROUP, - /** - * Owner. - */ - OWNER, + /** + * Owner. + */ + OWNER, - /** - * Permissions. - */ - PERMISSIONS, + /** + * Permissions. + */ + PERMISSIONS, - /** - * Length. - */ - LENGTH, + /** + * Length. + */ + LENGTH, - /** - * Modification time. - */ - MODIFICATION_TIME; + /** + * Modification time. + */ + MODIFICATION_TIME; } http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/start/src/main/java/org/apache/accumulo/start/classloader/vfs/providers/HdfsFileContentInfoFactory.java ---------------------------------------------------------------------- diff --git a/start/src/main/java/org/apache/accumulo/start/classloader/vfs/providers/HdfsFileContentInfoFactory.java b/start/src/main/java/org/apache/accumulo/start/classloader/vfs/providers/HdfsFileContentInfoFactory.java index c3f3a76..2621255 100644 --- a/start/src/main/java/org/apache/accumulo/start/classloader/vfs/providers/HdfsFileContentInfoFactory.java +++ b/start/src/main/java/org/apache/accumulo/start/classloader/vfs/providers/HdfsFileContentInfoFactory.java @@ -24,27 +24,25 @@ import org.apache.commons.vfs2.impl.DefaultFileContentInfo; /** * Creates FileContentInfo instances for HDFS. - * + * * @since 2.1 */ -public class HdfsFileContentInfoFactory implements FileContentInfoFactory -{ - private static final String CONTENT = "text/plain"; - private static final String ENCODING = "UTF-8"; +public class HdfsFileContentInfoFactory implements FileContentInfoFactory { + private static final String CONTENT = "text/plain"; + private static final String ENCODING = "UTF-8"; - /** - * Creates a FileContentInfo for a the given FileContent. - * - * @param fileContent - * Use this FileContent to create a matching FileContentInfo - * @return a FileContentInfo for the given FileContent with content set to "text/plain" and encoding set to "UTF-8" - * @throws FileSystemException - * when a problem occurs creating the FileContentInfo. - */ - @Override - public FileContentInfo create(final FileContent fileContent) throws FileSystemException - { - return new DefaultFileContentInfo(CONTENT, ENCODING); - } + /** + * Creates a FileContentInfo for a the given FileContent. + * + * @param fileContent + * Use this FileContent to create a matching FileContentInfo + * @return a FileContentInfo for the given FileContent with content set to "text/plain" and encoding set to "UTF-8" + * @throws FileSystemException + * when a problem occurs creating the FileContentInfo. + */ + @Override + public FileContentInfo create(final FileContent fileContent) throws FileSystemException { + return new DefaultFileContentInfo(CONTENT, ENCODING); + } } http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/start/src/main/java/org/apache/accumulo/start/classloader/vfs/providers/HdfsFileObject.java ---------------------------------------------------------------------- diff --git a/start/src/main/java/org/apache/accumulo/start/classloader/vfs/providers/HdfsFileObject.java b/start/src/main/java/org/apache/accumulo/start/classloader/vfs/providers/HdfsFileObject.java index 2cb0d5f..6849073 100644 --- a/start/src/main/java/org/apache/accumulo/start/classloader/vfs/providers/HdfsFileObject.java +++ b/start/src/main/java/org/apache/accumulo/start/classloader/vfs/providers/HdfsFileObject.java @@ -35,322 +35,269 @@ import org.apache.hadoop.fs.Path; /** * A VFS representation of an HDFS file. - * + * * @since 2.1 */ -public class HdfsFileObject extends AbstractFileObject -{ - private final HdfsFileSystem fs; - private final FileSystem hdfs; - private final Path path; - private FileStatus stat; +public class HdfsFileObject extends AbstractFileObject { + private final HdfsFileSystem fs; + private final FileSystem hdfs; + private final Path path; + private FileStatus stat; - /** - * Constructs a new HDFS FileObject - * - * @param name - * FileName - * @param fs - * HdfsFileSystem instance - * @param hdfs - * Hadoop FileSystem instance - * @param p - * Path to the file in HDFS - */ - protected HdfsFileObject(final AbstractFileName name, final HdfsFileSystem fs, final FileSystem hdfs, final Path p) - { - super(name, fs); - this.fs = fs; - this.hdfs = hdfs; - this.path = p; - } + /** + * Constructs a new HDFS FileObject + * + * @param name + * FileName + * @param fs + * HdfsFileSystem instance + * @param hdfs + * Hadoop FileSystem instance + * @param p + * Path to the file in HDFS + */ + protected HdfsFileObject(final AbstractFileName name, final HdfsFileSystem fs, final FileSystem hdfs, final Path p) { + super(name, fs); + this.fs = fs; + this.hdfs = hdfs; + this.path = p; + } - /** - * @see org.apache.commons.vfs2.provider.AbstractFileObject#canRenameTo(org.apache.commons.vfs2.FileObject) - */ - @Override - public boolean canRenameTo(final FileObject newfile) - { - throw new UnsupportedOperationException(); - } + /** + * @see org.apache.commons.vfs2.provider.AbstractFileObject#canRenameTo(org.apache.commons.vfs2.FileObject) + */ + @Override + public boolean canRenameTo(final FileObject newfile) { + throw new UnsupportedOperationException(); + } - /** - * @see org.apache.commons.vfs2.provider.AbstractFileObject#doAttach() - */ - @Override - protected void doAttach() throws Exception - { - try - { - this.stat = this.hdfs.getFileStatus(this.path); - } - catch (final FileNotFoundException e) - { - this.stat = null; - return; - } + /** + * @see org.apache.commons.vfs2.provider.AbstractFileObject#doAttach() + */ + @Override + protected void doAttach() throws Exception { + try { + this.stat = this.hdfs.getFileStatus(this.path); + } catch (final FileNotFoundException e) { + this.stat = null; + return; } + } - /** - * @see org.apache.commons.vfs2.provider.AbstractFileObject#doGetAttributes() - */ - @Override - protected Map<String, Object> doGetAttributes() throws Exception - { - if (null == this.stat) - { - return super.doGetAttributes(); - } - else - { - final Map<String, Object> attrs = new HashMap<String, Object>(); - attrs.put(HdfsFileAttributes.LAST_ACCESS_TIME.toString(), this.stat.getAccessTime()); - attrs.put(HdfsFileAttributes.BLOCK_SIZE.toString(), this.stat.getBlockSize()); - attrs.put(HdfsFileAttributes.GROUP.toString(), this.stat.getGroup()); - attrs.put(HdfsFileAttributes.OWNER.toString(), this.stat.getOwner()); - attrs.put(HdfsFileAttributes.PERMISSIONS.toString(), this.stat.getPermission().toString()); - attrs.put(HdfsFileAttributes.LENGTH.toString(), this.stat.getLen()); - attrs.put(HdfsFileAttributes.MODIFICATION_TIME.toString(), this.stat.getModificationTime()); - return attrs; - } + /** + * @see org.apache.commons.vfs2.provider.AbstractFileObject#doGetAttributes() + */ + @Override + protected Map<String,Object> doGetAttributes() throws Exception { + if (null == this.stat) { + return super.doGetAttributes(); + } else { + final Map<String,Object> attrs = new HashMap<String,Object>(); + attrs.put(HdfsFileAttributes.LAST_ACCESS_TIME.toString(), this.stat.getAccessTime()); + attrs.put(HdfsFileAttributes.BLOCK_SIZE.toString(), this.stat.getBlockSize()); + attrs.put(HdfsFileAttributes.GROUP.toString(), this.stat.getGroup()); + attrs.put(HdfsFileAttributes.OWNER.toString(), this.stat.getOwner()); + attrs.put(HdfsFileAttributes.PERMISSIONS.toString(), this.stat.getPermission().toString()); + attrs.put(HdfsFileAttributes.LENGTH.toString(), this.stat.getLen()); + attrs.put(HdfsFileAttributes.MODIFICATION_TIME.toString(), this.stat.getModificationTime()); + return attrs; } + } - /** - * @see org.apache.commons.vfs2.provider.AbstractFileObject#doGetContentSize() - */ - @Override - protected long doGetContentSize() throws Exception - { - return stat.getLen(); - } + /** + * @see org.apache.commons.vfs2.provider.AbstractFileObject#doGetContentSize() + */ + @Override + protected long doGetContentSize() throws Exception { + return stat.getLen(); + } - /** - * @see org.apache.commons.vfs2.provider.AbstractFileObject#doGetInputStream() - */ - @Override - protected InputStream doGetInputStream() throws Exception - { - return this.hdfs.open(this.path); - } + /** + * @see org.apache.commons.vfs2.provider.AbstractFileObject#doGetInputStream() + */ + @Override + protected InputStream doGetInputStream() throws Exception { + return this.hdfs.open(this.path); + } - /** - * @see org.apache.commons.vfs2.provider.AbstractFileObject#doGetLastModifiedTime() - */ - @Override - protected long doGetLastModifiedTime() throws Exception - { - if (null != this.stat) - { - return this.stat.getModificationTime(); - } - else - { - return -1; - } + /** + * @see org.apache.commons.vfs2.provider.AbstractFileObject#doGetLastModifiedTime() + */ + @Override + protected long doGetLastModifiedTime() throws Exception { + if (null != this.stat) { + return this.stat.getModificationTime(); + } else { + return -1; } + } - /** - * @see org.apache.commons.vfs2.provider.AbstractFileObject#doGetRandomAccessContent - * (org.apache.commons.vfs2.util.RandomAccessMode) - */ - @Override - protected RandomAccessContent doGetRandomAccessContent(final RandomAccessMode mode) throws Exception - { - if (mode.equals(RandomAccessMode.READWRITE)) - { - throw new UnsupportedOperationException(); - } - return new HdfsRandomAccessContent(this.path, this.hdfs); + /** + * @see org.apache.commons.vfs2.provider.AbstractFileObject#doGetRandomAccessContent (org.apache.commons.vfs2.util.RandomAccessMode) + */ + @Override + protected RandomAccessContent doGetRandomAccessContent(final RandomAccessMode mode) throws Exception { + if (mode.equals(RandomAccessMode.READWRITE)) { + throw new UnsupportedOperationException(); } + return new HdfsRandomAccessContent(this.path, this.hdfs); + } - /** - * @see org.apache.commons.vfs2.provider.AbstractFileObject#doGetType() - */ - @Override - //TODO Remove deprecation warning suppression when Hadoop1 support is dropped - @SuppressWarnings("deprecation") - protected FileType doGetType() throws Exception - { - try - { - doAttach(); - if (null == stat) - { - return FileType.IMAGINARY; - } - if (stat.isDir()) - { - return FileType.FOLDER; - } - else - { - return FileType.FILE; - } - } - catch (final FileNotFoundException fnfe) - { - return FileType.IMAGINARY; - } + /** + * @see org.apache.commons.vfs2.provider.AbstractFileObject#doGetType() + */ + @Override + // TODO Remove deprecation warning suppression when Hadoop1 support is dropped + @SuppressWarnings("deprecation") + protected FileType doGetType() throws Exception { + try { + doAttach(); + if (null == stat) { + return FileType.IMAGINARY; + } + if (stat.isDir()) { + return FileType.FOLDER; + } else { + return FileType.FILE; + } + } catch (final FileNotFoundException fnfe) { + return FileType.IMAGINARY; } + } - /** - * @see org.apache.commons.vfs2.provider.AbstractFileObject#doIsHidden() - */ - @Override - protected boolean doIsHidden() throws Exception - { - return false; - } + /** + * @see org.apache.commons.vfs2.provider.AbstractFileObject#doIsHidden() + */ + @Override + protected boolean doIsHidden() throws Exception { + return false; + } - /** - * @see org.apache.commons.vfs2.provider.AbstractFileObject#doIsReadable() - */ - @Override - protected boolean doIsReadable() throws Exception - { - return true; - } + /** + * @see org.apache.commons.vfs2.provider.AbstractFileObject#doIsReadable() + */ + @Override + protected boolean doIsReadable() throws Exception { + return true; + } - /** - * @see org.apache.commons.vfs2.provider.AbstractFileObject#doIsSameFile(org.apache.commons.vfs2.FileObject) - */ - @Override - protected boolean doIsSameFile(final FileObject destFile) throws FileSystemException - { - throw new UnsupportedOperationException(); - } + /** + * @see org.apache.commons.vfs2.provider.AbstractFileObject#doIsSameFile(org.apache.commons.vfs2.FileObject) + */ + @Override + protected boolean doIsSameFile(final FileObject destFile) throws FileSystemException { + throw new UnsupportedOperationException(); + } - /** - * @see org.apache.commons.vfs2.provider.AbstractFileObject#doIsWriteable() - */ - @Override - protected boolean doIsWriteable() throws Exception - { - return false; - } + /** + * @see org.apache.commons.vfs2.provider.AbstractFileObject#doIsWriteable() + */ + @Override + protected boolean doIsWriteable() throws Exception { + return false; + } - /** - * @see org.apache.commons.vfs2.provider.AbstractFileObject#doListChildren() - */ - @Override - protected String[] doListChildren() throws Exception - { - if (this.doGetType() != FileType.FOLDER) - { - throw new FileNotFolderException(this); - } - - final FileStatus[] files = this.hdfs.listStatus(this.path); - final String[] children = new String[files.length]; - int i = 0; - for (final FileStatus status : files) - { - children[i++] = status.getPath().getName(); - } - return children; + /** + * @see org.apache.commons.vfs2.provider.AbstractFileObject#doListChildren() + */ + @Override + protected String[] doListChildren() throws Exception { + if (this.doGetType() != FileType.FOLDER) { + throw new FileNotFolderException(this); } - /** - * @see org.apache.commons.vfs2.provider.AbstractFileObject#doListChildrenResolved() - */ - @Override - protected FileObject[] doListChildrenResolved() throws Exception - { - if (this.doGetType() != FileType.FOLDER) - { - return null; - } - final String[] children = doListChildren(); - final FileObject[] fo = new FileObject[children.length]; - for (int i = 0; i < children.length; i++) - { - final Path p = new Path(this.path, children[i]); - fo[i] = this.fs.resolveFile(p.toUri().toString()); - } - return fo; + final FileStatus[] files = this.hdfs.listStatus(this.path); + final String[] children = new String[files.length]; + int i = 0; + for (final FileStatus status : files) { + children[i++] = status.getPath().getName(); } + return children; + } - /** - * @see org.apache.commons.vfs2.provider.AbstractFileObject#doRemoveAttribute(java.lang.String) - */ - @Override - protected void doRemoveAttribute(final String attrName) throws Exception - { - throw new UnsupportedOperationException(); + /** + * @see org.apache.commons.vfs2.provider.AbstractFileObject#doListChildrenResolved() + */ + @Override + protected FileObject[] doListChildrenResolved() throws Exception { + if (this.doGetType() != FileType.FOLDER) { + return null; } - - /** - * @see org.apache.commons.vfs2.provider.AbstractFileObject#doSetAttribute(java.lang.String, java.lang.Object) - */ - @Override - protected void doSetAttribute(final String attrName, final Object value) throws Exception - { - throw new UnsupportedOperationException(); + final String[] children = doListChildren(); + final FileObject[] fo = new FileObject[children.length]; + for (int i = 0; i < children.length; i++) { + final Path p = new Path(this.path, children[i]); + fo[i] = this.fs.resolveFile(p.toUri().toString()); } + return fo; + } - /** - * @see org.apache.commons.vfs2.provider.AbstractFileObject#doSetLastModifiedTime(long) - */ - @Override - protected boolean doSetLastModifiedTime(final long modtime) throws Exception - { - throw new UnsupportedOperationException(); - } + /** + * @see org.apache.commons.vfs2.provider.AbstractFileObject#doRemoveAttribute(java.lang.String) + */ + @Override + protected void doRemoveAttribute(final String attrName) throws Exception { + throw new UnsupportedOperationException(); + } - /** - * @see java.lang.Object#equals(java.lang.Object) - */ - @Override - public boolean equals(final Object o) - { - if (null == o) - { - return false; - } - if (o == this) - { - return true; - } - if (o instanceof HdfsFileObject) - { - final HdfsFileObject other = (HdfsFileObject) o; - if (other.path.equals(this.path)) - { - return true; - } - } - return false; - } + /** + * @see org.apache.commons.vfs2.provider.AbstractFileObject#doSetAttribute(java.lang.String, java.lang.Object) + */ + @Override + protected void doSetAttribute(final String attrName, final Object value) throws Exception { + throw new UnsupportedOperationException(); + } + + /** + * @see org.apache.commons.vfs2.provider.AbstractFileObject#doSetLastModifiedTime(long) + */ + @Override + protected boolean doSetLastModifiedTime(final long modtime) throws Exception { + throw new UnsupportedOperationException(); + } - /** - * @see org.apache.commons.vfs2.provider.AbstractFileObject#exists() - * @return boolean true if file exists, false if not - */ - @Override - public boolean exists() throws FileSystemException - { - try - { - doAttach(); - return this.stat != null; - } - catch (final FileNotFoundException fne) - { - return false; - } - catch (final Exception e) - { - throw new FileSystemException("Unable to check existance ", e); - } + /** + * @see java.lang.Object#equals(java.lang.Object) + */ + @Override + public boolean equals(final Object o) { + if (null == o) { + return false; } + if (o == this) { + return true; + } + if (o instanceof HdfsFileObject) { + final HdfsFileObject other = (HdfsFileObject) o; + if (other.path.equals(this.path)) { + return true; + } + } + return false; + } - /** - * @see java.lang.Object#hashCode() - */ - @Override - public int hashCode() - { - return this.path.getName().toString().hashCode(); + /** + * @see org.apache.commons.vfs2.provider.AbstractFileObject#exists() + * @return boolean true if file exists, false if not + */ + @Override + public boolean exists() throws FileSystemException { + try { + doAttach(); + return this.stat != null; + } catch (final FileNotFoundException fne) { + return false; + } catch (final Exception e) { + throw new FileSystemException("Unable to check existance ", e); } + } + + /** + * @see java.lang.Object#hashCode() + */ + @Override + public int hashCode() { + return this.path.getName().toString().hashCode(); + } } http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/start/src/main/java/org/apache/accumulo/start/classloader/vfs/providers/HdfsFileProvider.java ---------------------------------------------------------------------- diff --git a/start/src/main/java/org/apache/accumulo/start/classloader/vfs/providers/HdfsFileProvider.java b/start/src/main/java/org/apache/accumulo/start/classloader/vfs/providers/HdfsFileProvider.java index 5bea2b9..9ddfab5 100644 --- a/start/src/main/java/org/apache/accumulo/start/classloader/vfs/providers/HdfsFileProvider.java +++ b/start/src/main/java/org/apache/accumulo/start/classloader/vfs/providers/HdfsFileProvider.java @@ -31,58 +31,45 @@ import org.apache.commons.vfs2.provider.http.HttpFileNameParser; /** * FileProvider for HDFS files. - * + * * @since 2.1 */ -public class HdfsFileProvider extends AbstractOriginatingFileProvider -{ - protected static final Collection<Capability> CAPABILITIES = Collections.unmodifiableCollection(Arrays - .asList(new Capability[] - { - Capability.GET_TYPE, - Capability.READ_CONTENT, - Capability.URI, - Capability.GET_LAST_MODIFIED, - Capability.ATTRIBUTES, - Capability.RANDOM_ACCESS_READ, - Capability.DIRECTORY_READ_CONTENT, - Capability.LIST_CHILDREN })); +public class HdfsFileProvider extends AbstractOriginatingFileProvider { + protected static final Collection<Capability> CAPABILITIES = Collections.unmodifiableCollection(Arrays.asList(new Capability[] {Capability.GET_TYPE, + Capability.READ_CONTENT, Capability.URI, Capability.GET_LAST_MODIFIED, Capability.ATTRIBUTES, Capability.RANDOM_ACCESS_READ, + Capability.DIRECTORY_READ_CONTENT, Capability.LIST_CHILDREN})); - /** - * Constructs a new HdfsFileProvider - */ - public HdfsFileProvider() - { - super(); - this.setFileNameParser(HttpFileNameParser.getInstance()); - } + /** + * Constructs a new HdfsFileProvider + */ + public HdfsFileProvider() { + super(); + this.setFileNameParser(HttpFileNameParser.getInstance()); + } - /** - * @see org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider#doCreateFileSystem(org.apache.commons.vfs2.FileName, org.apache.commons.vfs2.FileSystemOptions) - */ - @Override - protected FileSystem doCreateFileSystem(final FileName rootName, final FileSystemOptions fileSystemOptions) - throws FileSystemException - { - return new HdfsFileSystem(rootName, fileSystemOptions); - } + /** + * @see org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider#doCreateFileSystem(org.apache.commons.vfs2.FileName, + * org.apache.commons.vfs2.FileSystemOptions) + */ + @Override + protected FileSystem doCreateFileSystem(final FileName rootName, final FileSystemOptions fileSystemOptions) throws FileSystemException { + return new HdfsFileSystem(rootName, fileSystemOptions); + } - /** - * @see org.apache.commons.vfs2.provider.FileProvider#getCapabilities() - */ - @Override - public Collection<Capability> getCapabilities() - { - return CAPABILITIES; - } + /** + * @see org.apache.commons.vfs2.provider.FileProvider#getCapabilities() + */ + @Override + public Collection<Capability> getCapabilities() { + return CAPABILITIES; + } - /** - * @see org.apache.commons.vfs2.provider.AbstractFileProvider#getConfigBuilder() - */ - @Override - public FileSystemConfigBuilder getConfigBuilder() - { - return HdfsFileSystemConfigBuilder.getInstance(); - } + /** + * @see org.apache.commons.vfs2.provider.AbstractFileProvider#getConfigBuilder() + */ + @Override + public FileSystemConfigBuilder getConfigBuilder() { + return HdfsFileSystemConfigBuilder.getInstance(); + } } http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/start/src/main/java/org/apache/accumulo/start/classloader/vfs/providers/HdfsFileSystem.java ---------------------------------------------------------------------- diff --git a/start/src/main/java/org/apache/accumulo/start/classloader/vfs/providers/HdfsFileSystem.java b/start/src/main/java/org/apache/accumulo/start/classloader/vfs/providers/HdfsFileSystem.java index 2973750..7ad68f9 100644 --- a/start/src/main/java/org/apache/accumulo/start/classloader/vfs/providers/HdfsFileSystem.java +++ b/start/src/main/java/org/apache/accumulo/start/classloader/vfs/providers/HdfsFileSystem.java @@ -37,123 +37,100 @@ import org.apache.hadoop.fs.Path; /** * A VFS FileSystem that interacts with HDFS. - * + * * @since 2.1 */ -public class HdfsFileSystem extends AbstractFileSystem -{ +public class HdfsFileSystem extends AbstractFileSystem { private static final Log log = LogFactory.getLog(HdfsFileSystem.class); - + private FileSystem fs; - - protected HdfsFileSystem(final FileName rootName, final FileSystemOptions fileSystemOptions) - { + + protected HdfsFileSystem(final FileName rootName, final FileSystemOptions fileSystemOptions) { super(rootName, null, fileSystemOptions); } - + /** * @see org.apache.commons.vfs2.provider.AbstractFileSystem#addCapabilities(java.util.Collection) */ @Override - protected void addCapabilities(final Collection<Capability> capabilities) - { + protected void addCapabilities(final Collection<Capability> capabilities) { capabilities.addAll(HdfsFileProvider.CAPABILITIES); } - + /** * @see org.apache.commons.vfs2.provider.AbstractFileSystem#close() */ @Override - synchronized public void close() - { - try - { - if (null != fs) - { + synchronized public void close() { + try { + if (null != fs) { fs.close(); } - } - catch (final IOException e) - { + } catch (final IOException e) { throw new RuntimeException("Error closing HDFS client", e); } super.close(); } - + /** * @see org.apache.commons.vfs2.provider.AbstractFileSystem#createFile(org.apache.commons.vfs2.provider.AbstractFileName) */ @Override - protected FileObject createFile(final AbstractFileName name) throws Exception - { + protected FileObject createFile(final AbstractFileName name) throws Exception { throw new FileSystemException("Operation not supported"); } - + /** * @see org.apache.commons.vfs2.provider.AbstractFileSystem#resolveFile(org.apache.commons.vfs2.FileName) */ @Override - public FileObject resolveFile(final FileName name) throws FileSystemException - { - - synchronized (this) - { - if (null == this.fs) - { + public FileObject resolveFile(final FileName name) throws FileSystemException { + + synchronized (this) { + if (null == this.fs) { final String hdfsUri = name.getRootURI(); final Configuration conf = new Configuration(true); conf.set(org.apache.hadoop.fs.FileSystem.FS_DEFAULT_NAME_KEY, hdfsUri); this.fs = null; - try - { + try { fs = org.apache.hadoop.fs.FileSystem.get(conf); - } - catch (final IOException e) - { + } catch (final IOException e) { log.error("Error connecting to filesystem " + hdfsUri, e); throw new FileSystemException("Error connecting to filesystem " + hdfsUri, e); } } } - + boolean useCache = (null != getContext().getFileSystemManager().getFilesCache()); FileObject file; - if (useCache) - { + if (useCache) { file = this.getFileFromCache(name); - } - else - { + } else { file = null; } - if (null == file) - { + if (null == file) { String path = null; - try - { + try { path = URLDecoder.decode(name.getPath(), "UTF-8"); - } - catch (final UnsupportedEncodingException e) - { + } catch (final UnsupportedEncodingException e) { path = name.getPath(); } final Path filePath = new Path(path); file = new HdfsFileObject((AbstractFileName) name, this, fs, filePath); - if (useCache) - { + if (useCache) { this.putFileToCache(file); } - + } - + /** * resync the file information if requested */ if (getFileSystemManager().getCacheStrategy().equals(CacheStrategy.ON_RESOLVE)) { file.refresh(); } - + return file; } - + } http://git-wip-us.apache.org/repos/asf/accumulo/blob/6bc67602/start/src/main/java/org/apache/accumulo/start/classloader/vfs/providers/HdfsFileSystemConfigBuilder.java ---------------------------------------------------------------------- diff --git a/start/src/main/java/org/apache/accumulo/start/classloader/vfs/providers/HdfsFileSystemConfigBuilder.java b/start/src/main/java/org/apache/accumulo/start/classloader/vfs/providers/HdfsFileSystemConfigBuilder.java index 6aa6d96..0defa56 100644 --- a/start/src/main/java/org/apache/accumulo/start/classloader/vfs/providers/HdfsFileSystemConfigBuilder.java +++ b/start/src/main/java/org/apache/accumulo/start/classloader/vfs/providers/HdfsFileSystemConfigBuilder.java @@ -21,28 +21,25 @@ import org.apache.commons.vfs2.FileSystemConfigBuilder; /** * Configuration settings for the HdfsFileSystem. - * + * * @since 2.1 */ -public class HdfsFileSystemConfigBuilder extends FileSystemConfigBuilder -{ - private static final HdfsFileSystemConfigBuilder BUILDER = new HdfsFileSystemConfigBuilder(); +public class HdfsFileSystemConfigBuilder extends FileSystemConfigBuilder { + private static final HdfsFileSystemConfigBuilder BUILDER = new HdfsFileSystemConfigBuilder(); - /** - * @return HdfsFileSystemConfigBuilder instance - */ - public static HdfsFileSystemConfigBuilder getInstance() - { - return BUILDER; - } + /** + * @return HdfsFileSystemConfigBuilder instance + */ + public static HdfsFileSystemConfigBuilder getInstance() { + return BUILDER; + } - /** - * @return HDFSFileSystem - */ - @Override - protected Class<? extends FileSystem> getConfigClass() - { - return HdfsFileSystem.class; - } + /** + * @return HDFSFileSystem + */ + @Override + protected Class<? extends FileSystem> getConfigClass() { + return HdfsFileSystem.class; + } }