ACCUMULO-2061 Formatting fixes
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/575e5418 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/575e5418 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/575e5418 Branch: refs/heads/ACCUMULO-2061 Commit: 575e54182f06ba19290e6a6f72c983dc189a42c1 Parents: 4ddaab8 Author: Josh Elser <els...@apache.org> Authored: Wed Mar 12 12:12:05 2014 -0400 Committer: Josh Elser <els...@apache.org> Committed: Wed Mar 12 12:12:05 2014 -0400 ---------------------------------------------------------------------- .../org/apache/accumulo/core/volume/Volume.java | 4 +-- .../core/volume/VolumeConfiguration.java | 27 +++++++++++--------- .../apache/accumulo/core/volume/VolumeImpl.java | 19 +++++++------- .../accumulo/server/fs/VolumeManager.java | 2 -- .../accumulo/server/fs/VolumeManagerImpl.java | 19 +++++++------- .../apache/accumulo/server/fs/VolumeUtil.java | 2 +- .../accumulo/server/fs/VolumeUtilTest.java | 2 +- 7 files changed, 38 insertions(+), 37 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/575e5418/core/src/main/java/org/apache/accumulo/core/volume/Volume.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/volume/Volume.java b/core/src/main/java/org/apache/accumulo/core/volume/Volume.java index 08f61d4..487b699 100644 --- a/core/src/main/java/org/apache/accumulo/core/volume/Volume.java +++ b/core/src/main/java/org/apache/accumulo/core/volume/Volume.java @@ -21,7 +21,7 @@ import org.apache.hadoop.fs.Path; /** * Encapsulates a {@link FileSystem} and a base {@link Path} within that filesystem. This - * also avoid the necessity to pass around a Configuration. + * also avoid the necessity to pass around a Configuration. */ public interface Volume { @@ -36,7 +36,7 @@ public interface Volume { * @return */ public String getBasePath(); - + /** * Convert the given Path into a Path that is relative to the base path for this Volume * @param p http://git-wip-us.apache.org/repos/asf/accumulo/blob/575e5418/core/src/main/java/org/apache/accumulo/core/volume/VolumeConfiguration.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/volume/VolumeConfiguration.java b/core/src/main/java/org/apache/accumulo/core/volume/VolumeConfiguration.java index 3005174..33d3c35 100644 --- a/core/src/main/java/org/apache/accumulo/core/volume/VolumeConfiguration.java +++ b/core/src/main/java/org/apache/accumulo/core/volume/VolumeConfiguration.java @@ -30,10 +30,10 @@ import org.apache.hadoop.fs.Path; import com.google.common.base.Preconditions; public class VolumeConfiguration { - + public static Volume getVolume(String path, Configuration conf, AccumuloConfiguration acuconf) throws IOException { Preconditions.checkNotNull(path); - + if (path.contains(":")) { // An absolute path return create(new Path(path), conf); @@ -64,7 +64,7 @@ public class VolumeConfiguration { String singleNamespace = conf.get(Property.INSTANCE_DFS_DIR); String dfsUri = conf.get(Property.INSTANCE_DFS_URI); String baseDir; - + if (dfsUri == null || dfsUri.isEmpty()) { Configuration hadoopConfig = CachedConfiguration.getInstance(); try { @@ -82,14 +82,15 @@ public class VolumeConfiguration { /** * Compute the URIs to be used by Accumulo + * * @param conf * @return */ public static String[] getVolumeUris(AccumuloConfiguration conf) { String ns = conf.get(Property.INSTANCE_VOLUMES); - + String configuredBaseDirs[]; - + if (ns == null || ns.isEmpty()) { // Fall back to using the old config values configuredBaseDirs = new String[] {getConfiguredBaseDir(conf)}; @@ -101,7 +102,7 @@ public class VolumeConfiguration { if (!namespace.contains(":")) { throw new IllegalArgumentException("Expected fully qualified URI for " + Property.INSTANCE_VOLUMES.getKey() + " got " + namespace); } - + try { // pass through URI to unescape hex encoded chars (e.g. convert %2C to "," char) configuredBaseDirs[i++] = new Path(new URI(namespace)).toString(); @@ -110,7 +111,7 @@ public class VolumeConfiguration { } } } - + return configuredBaseDirs; } @@ -126,24 +127,26 @@ public class VolumeConfiguration { /** * Create a Volume with the given FileSystem that writes to the default path - * @param fs A FileSystem to write to - * @return A Volume instance writing to the given FileSystem in the default path + * + * @param fs + * A FileSystem to write to + * @return A Volume instance writing to the given FileSystem in the default path */ @SuppressWarnings("deprecation") public static <T extends FileSystem> Volume create(T fs, AccumuloConfiguration acuconf) { String dfsDir = acuconf.get(Property.INSTANCE_DFS_DIR); return new VolumeImpl(fs, null == dfsDir ? Property.INSTANCE_DFS_DIR.getDefaultValue() : dfsDir); } - + public static <T extends FileSystem> Volume create(T fs, String basePath) { return new VolumeImpl(fs, basePath); } - + public static Volume create(String path, Configuration conf) throws IOException { Preconditions.checkNotNull(path); return create(new Path(path), conf); } - + public static Volume create(Path path, Configuration conf) throws IOException { return new VolumeImpl(path, conf); } http://git-wip-us.apache.org/repos/asf/accumulo/blob/575e5418/core/src/main/java/org/apache/accumulo/core/volume/VolumeImpl.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/volume/VolumeImpl.java b/core/src/main/java/org/apache/accumulo/core/volume/VolumeImpl.java index 0aaf482..babdcfc 100644 --- a/core/src/main/java/org/apache/accumulo/core/volume/VolumeImpl.java +++ b/core/src/main/java/org/apache/accumulo/core/volume/VolumeImpl.java @@ -24,30 +24,29 @@ import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; - /** * */ public class VolumeImpl implements Volume { protected final FileSystem fs; protected final String basePath; - + public VolumeImpl(Path path, Configuration conf) throws IOException { checkNotNull(path); checkNotNull(conf); - + this.fs = path.getFileSystem(conf); this.basePath = path.toUri().getPath(); } - + public VolumeImpl(FileSystem fs, String basePath) { checkNotNull(fs); checkNotNull(basePath); - + this.fs = fs; this.basePath = basePath; } - + @Override public FileSystem getFileSystem() { return fs; @@ -66,20 +65,20 @@ public class VolumeImpl implements Volume { @Override public boolean isValidPath(Path p) { checkNotNull(p); - + return p.toUri().getPath().startsWith(basePath); } - + @Override public boolean equals(Object o) { if (o instanceof VolumeImpl) { VolumeImpl other = (VolumeImpl) o; return getFileSystem().equals(other.getFileSystem()) && getBasePath().equals(other.getBasePath()); } - + return false; } - + @Override public String toString() { return getFileSystem() + " " + basePath; http://git-wip-us.apache.org/repos/asf/accumulo/blob/575e5418/server/base/src/main/java/org/apache/accumulo/server/fs/VolumeManager.java ---------------------------------------------------------------------- diff --git a/server/base/src/main/java/org/apache/accumulo/server/fs/VolumeManager.java b/server/base/src/main/java/org/apache/accumulo/server/fs/VolumeManager.java index 9b8fb98..cbfdb5e 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/fs/VolumeManager.java +++ b/server/base/src/main/java/org/apache/accumulo/server/fs/VolumeManager.java @@ -160,13 +160,11 @@ public interface VolumeManager { /** * Fetch the default Volume - * @return */ public Volume getDefaultVolume(); /** * Fetch the configured Volumes, excluding the default Volume - * @return */ public Collection<Volume> getVolumes(); http://git-wip-us.apache.org/repos/asf/accumulo/blob/575e5418/server/base/src/main/java/org/apache/accumulo/server/fs/VolumeManagerImpl.java ---------------------------------------------------------------------- diff --git a/server/base/src/main/java/org/apache/accumulo/server/fs/VolumeManagerImpl.java b/server/base/src/main/java/org/apache/accumulo/server/fs/VolumeManagerImpl.java index ca5167d..b860f53 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/fs/VolumeManagerImpl.java +++ b/server/base/src/main/java/org/apache/accumulo/server/fs/VolumeManagerImpl.java @@ -86,11 +86,12 @@ public class VolumeManagerImpl implements VolumeManager { inverted.put(volume.getFileSystem(), volume); } } - + public static org.apache.accumulo.server.fs.VolumeManager getLocal(String localBasePath) throws IOException { AccumuloConfiguration accConf = DefaultConfiguration.getDefaultConfiguration(); Volume defaultLocalVolume = VolumeConfiguration.create(FileSystem.getLocal(CachedConfiguration.getInstance()), localBasePath); - + + // The default volume gets placed in the map, but local filesystem is only used for testing purposes return new VolumeManagerImpl(Collections.singletonMap(DEFAULT, defaultLocalVolume), defaultLocalVolume, accConf); } @@ -112,16 +113,16 @@ public class VolumeManagerImpl implements VolumeManager { @Override public FSDataOutputStream create(Path path) throws IOException { checkNotNull(path); - + Volume v = getVolumeByPath(path); - + return v.getFileSystem().create(path); } @Override public FSDataOutputStream create(Path path, boolean overwrite) throws IOException { checkNotNull(path); - + Volume v = getVolumeByPath(path); return v.getFileSystem().create(path, overwrite); @@ -149,7 +150,7 @@ public class VolumeManagerImpl implements VolumeManager { Volume v = getVolumeByPath(path); FileSystem fs = v.getFileSystem(); - + if (bufferSize == 0) { fs.getConf().getInt("io.file.buffer.size", 4096); } @@ -314,7 +315,7 @@ public class VolumeManagerImpl implements VolumeManager { return defaultVolume; } - + log.debug("Could not determine volume for Path '" + path + "' from defined volumes"); } catch (IOException ex) { throw new RuntimeException(ex); @@ -404,7 +405,7 @@ public class VolumeManagerImpl implements VolumeManager { // The "default" Volume for Accumulo (in case no volumes are specified) for (String volumeUriOrDir : VolumeConfiguration.getVolumeUris(conf)) { if (volumeUriOrDir.equals(DEFAULT)) - // Cannot re-define the default volume + // Cannot re-define the default volume throw new IllegalArgumentException(); // We require a URI here, fail if it doesn't look like one @@ -554,7 +555,7 @@ public class VolumeManagerImpl implements VolumeManager { public Volume getDefaultVolume() { return defaultVolume; } - + @Override public Collection<Volume> getVolumes() { return volumesByName.values(); http://git-wip-us.apache.org/repos/asf/accumulo/blob/575e5418/server/base/src/main/java/org/apache/accumulo/server/fs/VolumeUtil.java ---------------------------------------------------------------------- diff --git a/server/base/src/main/java/org/apache/accumulo/server/fs/VolumeUtil.java b/server/base/src/main/java/org/apache/accumulo/server/fs/VolumeUtil.java index bcfb008..2ef438f 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/fs/VolumeUtil.java +++ b/server/base/src/main/java/org/apache/accumulo/server/fs/VolumeUtil.java @@ -52,7 +52,7 @@ import org.apache.log4j.Logger; public class VolumeUtil { private static final Logger log = Logger.getLogger(VolumeUtil.class); - + private static boolean isActiveVolume(Path dir) { // consider relative path as active and take no action http://git-wip-us.apache.org/repos/asf/accumulo/blob/575e5418/server/base/src/test/java/org/apache/accumulo/server/fs/VolumeUtilTest.java ---------------------------------------------------------------------- diff --git a/server/base/src/test/java/org/apache/accumulo/server/fs/VolumeUtilTest.java b/server/base/src/test/java/org/apache/accumulo/server/fs/VolumeUtilTest.java index 3b905c9..0013d04 100644 --- a/server/base/src/test/java/org/apache/accumulo/server/fs/VolumeUtilTest.java +++ b/server/base/src/test/java/org/apache/accumulo/server/fs/VolumeUtilTest.java @@ -202,7 +202,7 @@ public class VolumeUtilTest { List<Pair<Path,Path>> replacements = new ArrayList<Pair<Path,Path>>(); replacements.add(new Pair<Path,Path>(new Path("file:/foo/v1"), new Path("file:/foo/v8"))); replacements.add(new Pair<Path,Path>(new Path("file:/foo/v2"), new Path("file:/foo/v9"))); - + FileType ft = FileType.TABLE; Assert.assertEquals("file:/foo/v8/tables/+r/root_tablet",