You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by bt...@apache.org on 2019/11/20 01:56:32 UTC
[james-project] 04/49: [Refactoring] Repository::getChildRepository
is never used
This is an automated email from the ASF dual-hosted git repository.
btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git
commit 282d1e7cb8dd15bafb7e5da306f970b90a7a2fb9
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Mon Nov 18 13:56:59 2019 +0700
[Refactoring] Repository::getChildRepository is never used
---
.../james/repository/api/ObjectRepository.java | 2 +-
.../apache/james/repository/api/Repository.java | 25 ----------------
.../james/repository/api/StreamRepository.java | 2 +-
.../repository/file/AbstractFileRepository.java | 34 +---------------------
4 files changed, 3 insertions(+), 60 deletions(-)
diff --git a/server/data/data-library/src/main/java/org/apache/james/repository/api/ObjectRepository.java b/server/data/data-library/src/main/java/org/apache/james/repository/api/ObjectRepository.java
index d4631bd..2a9c372 100644
--- a/server/data/data-library/src/main/java/org/apache/james/repository/api/ObjectRepository.java
+++ b/server/data/data-library/src/main/java/org/apache/james/repository/api/ObjectRepository.java
@@ -21,7 +21,7 @@ package org.apache.james.repository.api;
import java.util.stream.Stream;
-public interface ObjectRepository extends Repository {
+public interface ObjectRepository {
boolean containsKey(String key);
diff --git a/server/data/data-library/src/main/java/org/apache/james/repository/api/Repository.java b/server/data/data-library/src/main/java/org/apache/james/repository/api/Repository.java
deleted file mode 100644
index b33bdc6..0000000
--- a/server/data/data-library/src/main/java/org/apache/james/repository/api/Repository.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one *
- * or more contributor license agreements. See the NOTICE file *
- * distributed with this work for additional information *
- * regarding copyright ownership. The ASF licenses this file *
- * to you under the Apache License, Version 2.0 (the *
- * "License"); you may not use this file except in compliance *
- * with the License. You may obtain a copy of the License at *
- * *
- * http://www.apache.org/licenses/LICENSE-2.0 *
- * *
- * Unless required by applicable law or agreed to in writing, *
- * software distributed under the License is distributed on an *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
- * KIND, either express or implied. See the License for the *
- * specific language governing permissions and limitations *
- * under the License. *
- ****************************************************************/
-
-package org.apache.james.repository.api;
-
-public interface Repository {
-
- Repository getChildRepository(String childName);
-}
diff --git a/server/data/data-library/src/main/java/org/apache/james/repository/api/StreamRepository.java b/server/data/data-library/src/main/java/org/apache/james/repository/api/StreamRepository.java
index 4358aa9..6c3b449 100644
--- a/server/data/data-library/src/main/java/org/apache/james/repository/api/StreamRepository.java
+++ b/server/data/data-library/src/main/java/org/apache/james/repository/api/StreamRepository.java
@@ -23,7 +23,7 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.util.stream.Stream;
-public interface StreamRepository extends Repository {
+public interface StreamRepository {
InputStream get(String key);
diff --git a/server/data/data-library/src/main/java/org/apache/james/repository/file/AbstractFileRepository.java b/server/data/data-library/src/main/java/org/apache/james/repository/file/AbstractFileRepository.java
index 23486c9..a2185ff 100644
--- a/server/data/data-library/src/main/java/org/apache/james/repository/file/AbstractFileRepository.java
+++ b/server/data/data-library/src/main/java/org/apache/james/repository/file/AbstractFileRepository.java
@@ -39,14 +39,13 @@ import org.apache.commons.configuration2.tree.ImmutableNode;
import org.apache.commons.io.FileUtils;
import org.apache.james.filesystem.api.FileSystem;
import org.apache.james.lifecycle.api.Configurable;
-import org.apache.james.repository.api.Repository;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* This an abstract class implementing functionality for creating a file-store.
*/
-public abstract class AbstractFileRepository implements Repository, Configurable {
+public abstract class AbstractFileRepository implements Configurable {
private static final Logger LOGGER = LoggerFactory.getLogger(AbstractFileRepository.class);
protected static final boolean DEBUG = false;
@@ -166,37 +165,6 @@ public abstract class AbstractFileRepository implements Repository, Configurable
return getClass().newInstance();
}
- @Override
- public Repository getChildRepository(String childName) {
- AbstractFileRepository child;
-
- try {
- child = createChildRepository();
- } catch (Exception e) {
- throw new RuntimeException("Cannot create child repository " + childName, e);
- }
-
- child.setFileSystem(fileSystem);
-
- try {
- child.setDestination(baseDirectory.getAbsolutePath() + File.pathSeparatorChar + childName + File.pathSeparator);
- } catch (ConfigurationException ce) {
- throw new RuntimeException("Cannot set destination for child child " + "repository " + childName + " : " + ce);
- }
-
- try {
- child.init();
- } catch (Exception e) {
- throw new RuntimeException("Cannot initialize child " + "repository " + childName, e);
- }
-
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("Child repository of " + name + " created in " + baseDirectory + File.pathSeparatorChar + childName + File.pathSeparator);
- }
-
- return child;
- }
-
/**
* Return the File Object which belongs to the given key
*
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org