diff --git a/plugins/repository-hdfs/build.gradle b/plugins/repository-hdfs/build.gradle index f193fa2aba1..361166a2d0b 100644 --- a/plugins/repository-hdfs/build.gradle +++ b/plugins/repository-hdfs/build.gradle @@ -26,7 +26,7 @@ import java.nio.file.Paths esplugin { description 'The HDFS repository plugin adds support for Hadoop Distributed File-System (HDFS) repositories.' - classname 'org.elasticsearch.plugin.hadoop.hdfs.HdfsPlugin' + classname 'org.elasticsearch.repositories.hdfs.HdfsPlugin' } versions << [ diff --git a/plugins/repository-hdfs/src/main/java/org/elasticsearch/repositories/hdfs/HdfsBlobContainer.java b/plugins/repository-hdfs/src/main/java/org/elasticsearch/repositories/hdfs/HdfsBlobContainer.java index 47024796b03..723cfc2e8f5 100644 --- a/plugins/repository-hdfs/src/main/java/org/elasticsearch/repositories/hdfs/HdfsBlobContainer.java +++ b/plugins/repository-hdfs/src/main/java/org/elasticsearch/repositories/hdfs/HdfsBlobContainer.java @@ -41,12 +41,12 @@ import java.util.EnumSet; import java.util.LinkedHashMap; import java.util.Map; -public class HdfsBlobContainer extends AbstractBlobContainer { +final class HdfsBlobContainer extends AbstractBlobContainer { - protected final HdfsBlobStore blobStore; - protected final Path path; + private final HdfsBlobStore blobStore; + private final Path path; - public HdfsBlobContainer(BlobPath blobPath, HdfsBlobStore blobStore, Path path) { + HdfsBlobContainer(BlobPath blobPath, HdfsBlobStore blobStore, Path path) { super(blobPath); this.blobStore = blobStore; this.path = path; diff --git a/plugins/repository-hdfs/src/main/java/org/elasticsearch/repositories/hdfs/HdfsBlobStore.java b/plugins/repository-hdfs/src/main/java/org/elasticsearch/repositories/hdfs/HdfsBlobStore.java index 815c0d1eff3..119908c313a 100644 --- a/plugins/repository-hdfs/src/main/java/org/elasticsearch/repositories/hdfs/HdfsBlobStore.java +++ b/plugins/repository-hdfs/src/main/java/org/elasticsearch/repositories/hdfs/HdfsBlobStore.java @@ -28,23 +28,19 @@ import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.ByteSizeUnit; import org.elasticsearch.common.unit.ByteSizeValue; -import org.elasticsearch.threadpool.ThreadPool; import java.io.IOException; -import java.util.concurrent.Executor; -public class HdfsBlobStore extends AbstractComponent implements BlobStore { +final class HdfsBlobStore extends AbstractComponent implements BlobStore { private final FileContextFactory fcf; private final Path rootHdfsPath; - private final ThreadPool threadPool; private final int bufferSizeInBytes; - public HdfsBlobStore(Settings settings, FileContextFactory fcf, Path path, ThreadPool threadPool) throws IOException { + HdfsBlobStore(Settings settings, FileContextFactory fcf, Path path) throws IOException { super(settings); this.fcf = fcf; this.rootHdfsPath = path; - this.threadPool = threadPool; this.bufferSizeInBytes = (int) settings.getAsBytesSize("buffer_size", new ByteSizeValue(100, ByteSizeUnit.KB)).bytes(); @@ -68,19 +64,11 @@ public class HdfsBlobStore extends AbstractComponent implements BlobStore { return rootHdfsPath.toUri().toString(); } - public FileContextFactory fileContextFactory() { + FileContextFactory fileContextFactory() { return fcf; } - public Path path() { - return rootHdfsPath; - } - - public Executor executor() { - return threadPool.executor(ThreadPool.Names.SNAPSHOT); - } - - public int bufferSizeInBytes() { + int bufferSizeInBytes() { return bufferSizeInBytes; } @@ -111,7 +99,7 @@ public class HdfsBlobStore extends AbstractComponent implements BlobStore { } private Path translateToHdfsPath(BlobPath blobPath) { - Path path = path(); + Path path = rootHdfsPath; for (String p : blobPath) { path = new Path(path, p); } diff --git a/plugins/repository-hdfs/src/main/java/org/elasticsearch/plugin/hadoop/hdfs/HdfsPlugin.java b/plugins/repository-hdfs/src/main/java/org/elasticsearch/repositories/hdfs/HdfsPlugin.java similarity index 96% rename from plugins/repository-hdfs/src/main/java/org/elasticsearch/plugin/hadoop/hdfs/HdfsPlugin.java rename to plugins/repository-hdfs/src/main/java/org/elasticsearch/repositories/hdfs/HdfsPlugin.java index 87f4f6024d7..f09b69aac48 100644 --- a/plugins/repository-hdfs/src/main/java/org/elasticsearch/plugin/hadoop/hdfs/HdfsPlugin.java +++ b/plugins/repository-hdfs/src/main/java/org/elasticsearch/repositories/hdfs/HdfsPlugin.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.elasticsearch.plugin.hadoop.hdfs; +package org.elasticsearch.repositories.hdfs; import java.io.IOException; import java.nio.file.Files; @@ -24,14 +24,11 @@ import java.nio.file.Path; import java.security.AccessController; import java.security.PrivilegedAction; -import org.apache.lucene.util.Constants; import org.elasticsearch.SpecialPermission; import org.elasticsearch.common.SuppressForbidden; import org.elasticsearch.index.snapshots.blobstore.BlobStoreIndexShardRepository; import org.elasticsearch.plugins.Plugin; import org.elasticsearch.repositories.RepositoriesModule; -import org.elasticsearch.repositories.hdfs.HdfsRepository; - // Code public class HdfsPlugin extends Plugin { diff --git a/plugins/repository-hdfs/src/main/java/org/elasticsearch/repositories/hdfs/HdfsRepository.java b/plugins/repository-hdfs/src/main/java/org/elasticsearch/repositories/hdfs/HdfsRepository.java index 7fbbcdac2ac..c4b608dc82a 100644 --- a/plugins/repository-hdfs/src/main/java/org/elasticsearch/repositories/hdfs/HdfsRepository.java +++ b/plugins/repository-hdfs/src/main/java/org/elasticsearch/repositories/hdfs/HdfsRepository.java @@ -49,7 +49,6 @@ import org.elasticsearch.index.snapshots.IndexShardRepository; import org.elasticsearch.repositories.RepositoryName; import org.elasticsearch.repositories.RepositorySettings; import org.elasticsearch.repositories.blobstore.BlobStoreRepository; -import org.elasticsearch.threadpool.ThreadPool; public class HdfsRepository extends BlobStoreRepository implements FileContextFactory { @@ -59,18 +58,16 @@ public class HdfsRepository extends BlobStoreRepository implements FileContextFa private final ByteSizeValue chunkSize; private final boolean compress; private final RepositorySettings repositorySettings; - private final ThreadPool threadPool; private final String path; private final String uri; private FileContext fc; private HdfsBlobStore blobStore; @Inject - public HdfsRepository(RepositoryName name, RepositorySettings repositorySettings, IndexShardRepository indexShardRepository, ThreadPool threadPool) throws IOException { + public HdfsRepository(RepositoryName name, RepositorySettings repositorySettings, IndexShardRepository indexShardRepository) throws IOException { super(name.getName(), repositorySettings, indexShardRepository); this.repositorySettings = repositorySettings; - this.threadPool = threadPool; uri = repositorySettings.settings().get("uri", settings.get("uri")); path = repositorySettings.settings().get("path", settings.get("path")); @@ -112,7 +109,7 @@ public class HdfsRepository extends BlobStoreRepository implements FileContextFa } }); logger.debug("Using file-system [{}] for URI [{}], path [{}]", fc.getDefaultFileSystem(), fc.getDefaultFileSystem().getUri(), hdfsPath); - blobStore = new HdfsBlobStore(settings, this, hdfsPath, threadPool); + blobStore = new HdfsBlobStore(settings, this, hdfsPath); } catch (IOException e) { throw new RuntimeException(e); } diff --git a/plugins/repository-hdfs/src/test/java/org/elasticsearch/plugin/hadoop/hdfs/HdfsRepositoryRestIT.java b/plugins/repository-hdfs/src/test/java/org/elasticsearch/repositories/hdfs/HdfsRepositoryRestIT.java similarity index 94% rename from plugins/repository-hdfs/src/test/java/org/elasticsearch/plugin/hadoop/hdfs/HdfsRepositoryRestIT.java rename to plugins/repository-hdfs/src/test/java/org/elasticsearch/repositories/hdfs/HdfsRepositoryRestIT.java index 30d1aafcaba..db423cdd44f 100644 --- a/plugins/repository-hdfs/src/test/java/org/elasticsearch/plugin/hadoop/hdfs/HdfsRepositoryRestIT.java +++ b/plugins/repository-hdfs/src/test/java/org/elasticsearch/repositories/hdfs/HdfsRepositoryRestIT.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.elasticsearch.plugin.hadoop.hdfs; +package org.elasticsearch.repositories.hdfs; import java.io.IOException; import java.util.Collection; @@ -24,8 +24,8 @@ import java.util.Collection; import com.carrotsearch.randomizedtesting.annotations.Name; import com.carrotsearch.randomizedtesting.annotations.ParametersFactory; -import org.elasticsearch.plugin.hadoop.hdfs.HdfsPlugin; import org.elasticsearch.plugins.Plugin; +import org.elasticsearch.repositories.hdfs.HdfsPlugin; import org.elasticsearch.test.rest.ESRestTestCase; import org.elasticsearch.test.rest.RestTestCandidate; import org.elasticsearch.test.rest.parser.RestTestParseException; diff --git a/plugins/repository-hdfs/src/test/java/org/elasticsearch/plugin/hadoop/hdfs/HdfsTests.java b/plugins/repository-hdfs/src/test/java/org/elasticsearch/repositories/hdfs/HdfsTests.java similarity index 98% rename from plugins/repository-hdfs/src/test/java/org/elasticsearch/plugin/hadoop/hdfs/HdfsTests.java rename to plugins/repository-hdfs/src/test/java/org/elasticsearch/repositories/hdfs/HdfsTests.java index d7c1a37c03d..b132296ce12 100644 --- a/plugins/repository-hdfs/src/test/java/org/elasticsearch/plugin/hadoop/hdfs/HdfsTests.java +++ b/plugins/repository-hdfs/src/test/java/org/elasticsearch/repositories/hdfs/HdfsTests.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.elasticsearch.plugin.hadoop.hdfs; +package org.elasticsearch.repositories.hdfs; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.greaterThan; @@ -31,6 +31,7 @@ import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.plugins.Plugin; import org.elasticsearch.repositories.RepositoryException; +import org.elasticsearch.repositories.hdfs.HdfsPlugin; import org.elasticsearch.snapshots.SnapshotState; import org.elasticsearch.test.ESIntegTestCase; import org.elasticsearch.test.ESIntegTestCase.ClusterScope; diff --git a/plugins/repository-hdfs/src/test/java/org/elasticsearch/plugin/hadoop/hdfs/TestingFs.java b/plugins/repository-hdfs/src/test/java/org/elasticsearch/repositories/hdfs/TestingFs.java similarity index 99% rename from plugins/repository-hdfs/src/test/java/org/elasticsearch/plugin/hadoop/hdfs/TestingFs.java rename to plugins/repository-hdfs/src/test/java/org/elasticsearch/repositories/hdfs/TestingFs.java index d39afe9cb74..c9c3c46c12c 100644 --- a/plugins/repository-hdfs/src/test/java/org/elasticsearch/plugin/hadoop/hdfs/TestingFs.java +++ b/plugins/repository-hdfs/src/test/java/org/elasticsearch/repositories/hdfs/TestingFs.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.plugin.hadoop.hdfs; +package org.elasticsearch.repositories.hdfs; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.DelegateToFileSystem;