diff --git a/client/src/main/resources/META-INF/services/com.alibaba.nacos.client.address.ServerListProvider b/client-basic/src/main/resources/META-INF/services/com.alibaba.nacos.client.address.ServerListProvider
similarity index 100%
rename from client/src/main/resources/META-INF/services/com.alibaba.nacos.client.address.ServerListProvider
rename to client-basic/src/main/resources/META-INF/services/com.alibaba.nacos.client.address.ServerListProvider
diff --git a/client/src/test/resources/META-INF/services/com.alibaba.nacos.client.address.ServerListProvider b/client-basic/src/test/resources/META-INF/services/com.alibaba.nacos.client.address.ServerListProvider
similarity index 100%
rename from client/src/test/resources/META-INF/services/com.alibaba.nacos.client.address.ServerListProvider
rename to client-basic/src/test/resources/META-INF/services/com.alibaba.nacos.client.address.ServerListProvider
diff --git a/maintainer-client/pom.xml b/maintainer-client/pom.xml
index d422d08e0e..11899d1316 100644
--- a/maintainer-client/pom.xml
+++ b/maintainer-client/pom.xml
@@ -40,10 +40,6 @@
commons-collections
commons-collections
-
- org.springframework.boot
- spring-boot-starter-web
-
com.alibaba.nacos
nacos-common
diff --git a/maintainer-client/src/main/java/com/alibaba/nacos/maintainer/client/NacosMaintainerFactory.java b/maintainer-client/src/main/java/com/alibaba/nacos/maintainer/client/NacosMaintainerFactory.java
index 73bbc32e05..eea3ca383e 100644
--- a/maintainer-client/src/main/java/com/alibaba/nacos/maintainer/client/NacosMaintainerFactory.java
+++ b/maintainer-client/src/main/java/com/alibaba/nacos/maintainer/client/NacosMaintainerFactory.java
@@ -29,8 +29,7 @@ import java.util.Properties;
*/
public class NacosMaintainerFactory {
- public static ConfigMaintainerService createConfigMaintainerService(String serverList)
- throws NacosException, NacosException {
+ public static ConfigMaintainerService createConfigMaintainerService(String serverList) throws NacosException {
return ConfigMaintainerFactory.createConfigMaintainerService(serverList);
}
diff --git a/maintainer-client/src/main/java/com/alibaba/nacos/maintainer/client/address/DefaultServerListManager.java b/maintainer-client/src/main/java/com/alibaba/nacos/maintainer/client/address/DefaultServerListManager.java
index f7a3f818bb..d92413395e 100644
--- a/maintainer-client/src/main/java/com/alibaba/nacos/maintainer/client/address/DefaultServerListManager.java
+++ b/maintainer-client/src/main/java/com/alibaba/nacos/maintainer/client/address/DefaultServerListManager.java
@@ -24,7 +24,6 @@ import com.alibaba.nacos.common.utils.StringUtils;
import com.alibaba.nacos.maintainer.client.remote.HttpClientManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Collections;
@@ -37,7 +36,6 @@ import java.util.Random;
*
* @author Nacos
*/
-@Service
public class DefaultServerListManager extends AbstractServerListManager {
private static final Logger LOGGER = LoggerFactory.getLogger(DefaultServerListManager.class);
diff --git a/maintainer-client/src/main/java/com/alibaba/nacos/maintainer/client/config/ConfigMaintainerFactory.java b/maintainer-client/src/main/java/com/alibaba/nacos/maintainer/client/config/ConfigMaintainerFactory.java
index 3903c6834f..f2fa3b3e52 100644
--- a/maintainer-client/src/main/java/com/alibaba/nacos/maintainer/client/config/ConfigMaintainerFactory.java
+++ b/maintainer-client/src/main/java/com/alibaba/nacos/maintainer/client/config/ConfigMaintainerFactory.java
@@ -37,7 +37,7 @@ public class ConfigMaintainerFactory {
public static ConfigMaintainerService createConfigMaintainerService(String serverList) throws NacosException {
Properties properties = new Properties();
properties.setProperty("serverAddr", serverList);
- return new NacosConfigMaintainerService(properties);
+ return new NacosConfigMaintainerServiceImpl(properties);
}
/**
@@ -51,6 +51,6 @@ public class ConfigMaintainerFactory {
if (properties == null) {
throw new NacosException(NacosException.INVALID_PARAM, "Properties cannot be null");
}
- return new NacosConfigMaintainerService(properties);
+ return new NacosConfigMaintainerServiceImpl(properties);
}
}
\ No newline at end of file
diff --git a/maintainer-client/src/main/java/com/alibaba/nacos/maintainer/client/config/ConfigMaintainerService.java b/maintainer-client/src/main/java/com/alibaba/nacos/maintainer/client/config/ConfigMaintainerService.java
index 87f22ff8f0..e9e36b658c 100644
--- a/maintainer-client/src/main/java/com/alibaba/nacos/maintainer/client/config/ConfigMaintainerService.java
+++ b/maintainer-client/src/main/java/com/alibaba/nacos/maintainer/client/config/ConfigMaintainerService.java
@@ -17,7 +17,6 @@
package com.alibaba.nacos.maintainer.client.config;
import com.alibaba.nacos.api.exception.NacosException;
-import com.alibaba.nacos.api.exception.api.NacosApiException;
import com.alibaba.nacos.maintainer.client.model.config.Capacity;
import com.alibaba.nacos.maintainer.client.model.config.ConfigAdvanceInfo;
import com.alibaba.nacos.maintainer.client.model.config.ConfigAllInfo;
@@ -33,9 +32,6 @@ import com.alibaba.nacos.maintainer.client.model.core.Connection;
import com.alibaba.nacos.maintainer.client.model.core.IdGeneratorVO;
import com.alibaba.nacos.maintainer.client.model.core.Member;
import com.alibaba.nacos.maintainer.client.model.core.ServerLoaderMetrics;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.context.request.async.DeferredResult;
-import org.springframework.web.multipart.MultipartFile;
import java.util.Collection;
import java.util.List;
@@ -56,7 +52,7 @@ public interface ConfigMaintainerService {
* @return Configuration information.
* @throws NacosException If the query fails.
*/
- ConfigAllInfo getConfig(String dataId, String groupName) throws Exception;
+ ConfigAllInfo getConfig(String dataId, String groupName) throws NacosException;
/**
* Get configuration information by dataId, groupName, and namespaceId.
@@ -67,7 +63,7 @@ public interface ConfigMaintainerService {
* @return Configuration information.
* @throws NacosException If the query fails.
*/
- ConfigAllInfo getConfig(String dataId, String groupName, String namespaceId) throws Exception;
+ ConfigAllInfo getConfig(String dataId, String groupName, String namespaceId) throws NacosException;
/**
* Publish a configuration by dataId and groupName.
@@ -78,7 +74,7 @@ public interface ConfigMaintainerService {
* @return Whether the configuration was published successfully.
* @throws NacosException If the publish operation fails.
*/
- boolean publishConfig(String dataId, String groupName, String content) throws Exception;
+ boolean publishConfig(String dataId, String groupName, String content) throws NacosException;
/**
* Publish a configuration by dataId, groupName, and namespaceId.
@@ -90,30 +86,30 @@ public interface ConfigMaintainerService {
* @return Whether the configuration was published successfully.
* @throws NacosException If the publish operation fails.
*/
- boolean publishConfig(String dataId, String groupName, String namespaceId, String content) throws Exception;
+ boolean publishConfig(String dataId, String groupName, String namespaceId, String content) throws NacosException;
/**
- * Publish a configuration.
+ * Publish a configuration with additional metadata.
*
- * @param dataId Configuration data ID (required)
- * @param groupName Configuration group name (required)
- * @param namespaceId Namespace ID (optional, default is "public")
- * @param content Configuration content (required)
- * @param tag Configuration tag (optional)
- * @param appName Application name (optional)
- * @param srcUser Source user (optional)
- * @param configTags Configuration tags, multiple tags separated by commas (optional)
- * @param desc Configuration description (optional)
- * @param use Configuration usage (optional)
- * @param effect Configuration effect (optional)
- * @param type Configuration type (optional)
- * @param schema Configuration schema (optional)
- * @return Whether the configuration was published successfully
- * @throws NacosException If publishing fails
+ * @param dataId Configuration data ID (required).
+ * @param groupName Configuration group name (required).
+ * @param namespaceId Namespace ID (optional, defaults to "public").
+ * @param content Configuration content (required).
+ * @param tag Configuration tag (optional).
+ * @param appName Application name (optional).
+ * @param srcUser Source user (optional).
+ * @param configTags Configuration tags, multiple tags separated by commas (optional).
+ * @param desc Configuration description (optional).
+ * @param use Configuration usage (optional).
+ * @param effect Configuration effect (optional).
+ * @param type Configuration type (optional).
+ * @param schema Configuration schema (optional).
+ * @return Whether the configuration was published successfully.
+ * @throws NacosException If publishing fails.
*/
- boolean publishConfig(String dataId, String groupName, String namespaceId, String content, String tag, String appName,
- String srcUser, String configTags, String desc, String use, String effect, String type, String schema)
- throws Exception;
+ boolean publishConfig(String dataId, String groupName, String namespaceId, String content, String tag,
+ String appName, String srcUser, String configTags, String desc, String use, String effect, String type,
+ String schema) throws NacosException;
/**
* Delete a configuration by dataId and groupName.
@@ -123,21 +119,21 @@ public interface ConfigMaintainerService {
* @return Whether the configuration was deleted successfully.
* @throws NacosException If deletion fails.
*/
- boolean deleteConfig(String dataId, String groupName) throws Exception;
+ boolean deleteConfig(String dataId, String groupName) throws NacosException;
/**
- * Delete a configuration.
+ * Delete a configuration by dataId, groupName, and namespaceId.
*
* @param dataId Configuration data ID (required).
* @param groupName Configuration group name (required).
* @param namespaceId Namespace ID (optional, defaults to "public").
* @return Whether the configuration was deleted successfully.
- * @throws Exception If deletion fails.
+ * @throws NacosException If deletion fails.
*/
- boolean deleteConfig(String dataId, String groupName, String namespaceId) throws Exception;
+ boolean deleteConfig(String dataId, String groupName, String namespaceId) throws NacosException;
/**
- * Delete a configuration.
+ * Delete a configuration by dataId, groupName, namespaceId, and tag.
*
* @param dataId Configuration data ID (required).
* @param groupName Configuration group name (required).
@@ -146,29 +142,29 @@ public interface ConfigMaintainerService {
* @return Whether the configuration was deleted successfully.
* @throws NacosException If deletion fails.
*/
- boolean deleteConfig(String dataId, String groupName, String namespaceId, String tag) throws Exception;
+ boolean deleteConfig(String dataId, String groupName, String namespaceId, String tag) throws NacosException;
/**
- * Delete multiple configurations.
+ * Delete multiple configurations by their IDs.
*
* @param ids List of configuration IDs to delete.
* @return Whether the configurations were deleted successfully.
* @throws NacosException If deletion fails.
*/
- boolean deleteConfigs(List ids) throws Exception;
+ boolean deleteConfigs(List ids) throws NacosException;
/**
- * Get the advanced information of a configuration.
+ * Get the advanced information of a configuration by dataId and groupName.
*
* @param dataId Configuration data ID (required).
* @param groupName Configuration group name (required).
* @return Advanced information of the configuration.
* @throws NacosException If retrieval fails.
*/
- ConfigAdvanceInfo getConfigAdvanceInfo(String dataId, String groupName) throws Exception;
+ ConfigAdvanceInfo getConfigAdvanceInfo(String dataId, String groupName) throws NacosException;
/**
- * Get the advanced information of a configuration.
+ * Get the advanced information of a configuration by dataId, groupName, and namespaceId.
*
* @param dataId Configuration data ID (required).
* @param groupName Configuration group name (required).
@@ -176,37 +172,37 @@ public interface ConfigMaintainerService {
* @return Advanced information of the configuration.
* @throws NacosException If retrieval fails.
*/
- ConfigAdvanceInfo getConfigAdvanceInfo(String dataId, String groupName, String namespaceId) throws Exception;
+ ConfigAdvanceInfo getConfigAdvanceInfo(String dataId, String groupName, String namespaceId) throws NacosException;
/**
- * Get the listeners of a configuration.
+ * Get the listeners of a configuration by dataId and groupName.
*
- * @param dataId Configuration data ID (required).
- * @param groupName Configuration group name (required).
+ * @param dataId Configuration data ID (required).
+ * @param groupName Configuration group name (required).
* @return List of listeners for the configuration.
- * @throws Exception If retrieval fails.
+ * @throws NacosException If retrieval fails.
*/
- GroupkeyListenserStatus getListeners(String dataId, String groupName) throws Exception;
+ GroupkeyListenserStatus getListeners(String dataId, String groupName) throws NacosException;
/**
- * Get the advanced information of a configuration.
+ * Get the listeners of a configuration by dataId, groupName, namespaceId, and sampleTime.
*
* @param dataId Configuration data ID (required).
* @param groupName Configuration group name (required).
* @param namespaceId Namespace ID (optional, defaults to "public").
* @param sampleTime Sample time (optional).
- * @return Advanced information of the configuration.
+ * @return List of listeners for the configuration.
* @throws NacosException If retrieval fails.
*/
- GroupkeyListenserStatus getListeners(String dataId, String groupName, String namespaceId, int sampleTime) throws Exception;
-
+ GroupkeyListenserStatus getListeners(String dataId, String groupName, String namespaceId, int sampleTime)
+ throws NacosException;
/**
* Search configurations by details.
*
- * @param namespaceId Namespace ID (optional, defaults to "public").
* @param dataId Configuration data ID (optional, defaults to "").
* @param groupName Configuration group name (optional, defaults to "").
+ * @param namespaceId Namespace ID (optional, defaults to "public").
* @param configDetail Configuration detail (optional).
* @param search Search mode ("blur" or "exact", optional, defaults to "blur").
* @param pageNo Page number (required, defaults to 1).
@@ -215,20 +211,20 @@ public interface ConfigMaintainerService {
* @throws NacosException If the search fails.
*/
Page searchConfigByDetails(String dataId, String groupName, String namespaceId, String configDetail,
- String search, int pageNo, int pageSize) throws Exception;
-
+ String search, int pageNo, int pageSize) throws NacosException;
+
/**
- * Stop a beta configuration.
+ * Stop a beta configuration by dataId and groupName.
*
- * @param dataId Configuration data ID (required).
- * @param groupName Configuration group name (required).
+ * @param dataId Configuration data ID (required).
+ * @param groupName Configuration group name (required).
* @return Whether the beta configuration was stopped successfully.
* @throws NacosException If stopping fails.
*/
- boolean stopBeta(String dataId, String groupName) throws Exception;
+ boolean stopBeta(String dataId, String groupName) throws NacosException;
/**
- * Stop a beta configuration.
+ * Stop a beta configuration by dataId, groupName, and namespaceId.
*
* @param dataId Configuration data ID (required).
* @param groupName Configuration group name (required).
@@ -236,7 +232,7 @@ public interface ConfigMaintainerService {
* @return Whether the beta configuration was stopped successfully.
* @throws NacosException If stopping fails.
*/
- boolean stopBeta(String dataId, String groupName, String namespaceId) throws Exception;
+ boolean stopBeta(String dataId, String groupName, String namespaceId) throws NacosException;
/**
* Query beta configuration by dataId and groupName.
@@ -246,7 +242,7 @@ public interface ConfigMaintainerService {
* @return Beta configuration information.
* @throws NacosException If the query fails.
*/
- ConfigInfo4Beta queryBeta(String dataId, String groupName) throws Exception;
+ ConfigInfo4Beta queryBeta(String dataId, String groupName) throws NacosException;
/**
* Query beta configuration by dataId, groupName, and namespaceId.
@@ -257,49 +253,23 @@ public interface ConfigMaintainerService {
* @return Beta configuration information.
* @throws NacosException If the query fails.
*/
- ConfigInfo4Beta queryBeta(String dataId, String groupName, String namespaceId) throws Exception;
-
- /**
- * Import and publish configurations from a file.
- *
- * @param namespaceId Namespace ID (optional, defaults to "public").
- * @param srcUser Source user (optional).
- * @param policy Conflict resolution policy (required).
- * @param file Configuration file to import (required).
- * @return A map containing the import result (e.g., success count, unrecognized data).
- * @throws NacosException If the import fails.
- */
- Map importAndPublishConfig(String namespaceId, String srcUser, SameConfigPolicy policy, MultipartFile file)
- throws Exception;
-
- /**
- * Export configurations as a zip file.
- *
- * @param dataId Configuration data ID (optional).
- * @param groupName Configuration group name (optional).
- * @param namespaceId Namespace ID (optional, defaults to "public").
- * @param ids List of configuration IDs to export (optional).
- * @return A ResponseEntity containing the exported zip file.
- * @throws NacosException If the export fails.
- */
- ResponseEntity exportConfig(String dataId, String groupName, String namespaceId, List ids)
- throws Exception;
+ ConfigInfo4Beta queryBeta(String dataId, String groupName, String namespaceId) throws NacosException;
/**
* Clone configurations within the same namespace.
*
- * @param namespaceId Namespace ID (optional, defaults to "public").
- * @param configBeansList List of configurations to clone (required).
- * @param srcUser Source user (optional).
- * @param policy Conflict resolution policy (required).
+ * @param namespaceId Namespace ID (optional, defaults to "public").
+ * @param configBeansList List of configurations to clone (required).
+ * @param srcUser Source user (optional).
+ * @param policy Conflict resolution policy (required).
* @return A map containing the clone result (e.g., success count, unrecognized data).
* @throws NacosException If the clone operation fails.
*/
- Map cloneConfig(String namespaceId, List configBeansList, String srcUser, SameConfigPolicy policy)
- throws Exception;
+ Map cloneConfig(String namespaceId, List configBeansList,
+ String srcUser, SameConfigPolicy policy) throws NacosException;
/**
- * Query the list of configuration history.
+ * Query the list of configuration history by dataId, groupName, namespaceId, pageNo, and pageSize.
*
* @param dataId Configuration data ID (required).
* @param groupName Configuration group name (required).
@@ -307,45 +277,45 @@ public interface ConfigMaintainerService {
* @param pageNo Page number (required).
* @param pageSize Page size (required, max 500).
* @return A paginated list of configuration history.
- * @throws NacosApiException If the query fails.
+ * @throws NacosException If the query fails.
*/
- Page listConfigHistory(String dataId, String groupName, String namespaceId, int pageNo, int pageSize)
- throws Exception;
+ Page listConfigHistory(String dataId, String groupName, String namespaceId, int pageNo,
+ int pageSize) throws NacosException;
/**
- * Query detailed configuration history information.
+ * Query detailed configuration history information by dataId, groupName, namespaceId, and nid.
*
* @param dataId Configuration data ID (required).
* @param groupName Configuration group name (required).
* @param namespaceId Namespace ID (optional, defaults to "public").
* @param nid History record ID (required).
* @return Detailed configuration history information.
- * @throws NacosApiException If the history record does not exist or the query fails.
+ * @throws NacosException If the history record does not exist or the query fails.
*/
ConfigHistoryInfo getConfigHistoryInfo(String dataId, String groupName, String namespaceId, Long nid)
- throws Exception;
+ throws NacosException;
/**
- * Query previous configuration history information.
+ * Query previous configuration history information by dataId, groupName, namespaceId, and id.
*
* @param dataId Configuration data ID (required).
* @param groupName Configuration group name (required).
* @param namespaceId Namespace ID (optional, defaults to "public").
* @param id Current history record ID (required).
* @return Previous configuration history information.
- * @throws NacosApiException If the previous history record does not exist or the query fails.
+ * @throws NacosException If the previous history record does not exist or the query fails.
*/
ConfigHistoryInfo getPreviousConfigHistoryInfo(String dataId, String groupName, String namespaceId, Long id)
- throws Exception;
+ throws NacosException;
/**
* Query configurations list by namespace.
*
* @param namespaceId Namespace ID (required).
* @return A list of configurations in the specified namespace.
- * @throws NacosApiException If the namespace is invalid or the query fails.
+ * @throws NacosException If the namespace is invalid or the query fails.
*/
- List getConfigListByNamespace(String namespaceId) throws Exception;
+ List getConfigListByNamespace(String namespaceId) throws NacosException;
/**
* Get capacity information for a specific group or namespace.
@@ -353,31 +323,32 @@ public interface ConfigMaintainerService {
* @param groupName Group name (optional).
* @param namespaceId Namespace ID (optional).
* @return Capacity information.
- * @throws NacosApiException If the query fails or parameters are invalid.
+ * @throws NacosException If the query fails or parameters are invalid.
*/
- Capacity getCapacityWithDefault(String groupName, String namespaceId) throws Exception;
+ Capacity getCapacityWithDefault(String groupName, String namespaceId) throws NacosException;
/**
* Insert or update capacity information.
*
- * @param groupName Group name (required).
- * @param namespaceId Namespace ID (required).
- * @param quota Quota value (required).
- * @param maxSize Maximum size (required).
- * @param maxAggrCount Maximum aggregation count (required).
- * @param maxAggrSize Maximum aggregation size (required).
+ * @param groupName Group name (required).
+ * @param namespaceId Namespace ID (required).
+ * @param quota Quota value (required).
+ * @param maxSize Maximum size (required).
+ * @param maxAggrCount Maximum aggregation count (required).
+ * @param maxAggrSize Maximum aggregation size (required).
* @return Whether the operation was successful.
- * @throws NacosApiException If the operation fails.
+ * @throws NacosException If the operation fails.
*/
boolean insertOrUpdateCapacity(String groupName, String namespaceId, Integer quota, Integer maxSize,
- Integer maxAggrCount, Integer maxAggrSize) throws Exception;
+ Integer maxAggrCount, Integer maxAggrSize) throws NacosException;
/**
* Manually trigger dump of local configuration files from the store.
*
* @return A success message or error details.
+ * @throws NacosException if the operation fails.
*/
- String updateLocalCacheFromStore() throws Exception;
+ String updateLocalCacheFromStore() throws NacosException;
/**
* Set the log level for a specific module.
@@ -385,36 +356,31 @@ public interface ConfigMaintainerService {
* @param logName Name of the log module (required).
* @param logLevel Desired log level (required).
* @return A success message or error details.
+ * @throws NacosException if the operation fails.
*/
- String setLogLevel(String logName, String logLevel) throws Exception;
+ String setLogLevel(String logName, String logLevel) throws NacosException;
/**
* Execute a SQL query on the embedded Derby database.
*
* @param sql SQL query to execute (required).
* @return Query results or an error message.
+ * @throws NacosException if the operation fails.
*/
- Object derbyOps(String sql) throws Exception;
+ Object derbyOps(String sql) throws NacosException;
/**
- * Import data into the embedded Derby database from a file.
- *
- * @param multipartFile File containing the data to import (required).
- * @return A deferred result indicating success or failure.
- */
- DeferredResult importDerby(MultipartFile multipartFile) throws Exception;
-
- /**
- * Get all subscribed client configurations by IP.
+ * Get the status of all subscriptions for a specific IP.
*
* @param ip Client IP address (required).
- * @param all Whether to retrieve all configurations (optional, default is false).
+ * @param all Whether to include all subscriptions (optional, defaults to false).
* @param namespaceId Namespace ID (optional).
- * @param sampleTime Sampling time in seconds (optional, default is 1).
- * @return Client subscription status.
+ * @param sampleTime Sample time (optional, defaults to 0).
+ * @return the subscription status.
+ * @throws NacosException if the operation fails.
*/
GroupkeyListenserStatus getAllSubClientConfigByIp(String ip, boolean all, String namespaceId, int sampleTime)
- throws Exception;
+ throws NacosException;
/**
* Get client metrics for a specific IP.
@@ -423,10 +389,11 @@ public interface ConfigMaintainerService {
* @param dataId Configuration data ID (optional).
* @param groupName Configuration group name (optional).
* @param namespaceId Namespace ID (optional).
- * @return Client metrics.
- * @throws NacosException If the operation fails.
+ * @return a map containing the client metrics.
+ * @throws NacosException if the operation fails.
*/
- Map getClientMetrics(String ip, String dataId, String groupName, String namespaceId) throws Exception;
+ Map getClientMetrics(String ip, String dataId, String groupName, String namespaceId)
+ throws NacosException;
/**
* Get cluster-wide metrics for a specific IP.
@@ -435,118 +402,129 @@ public interface ConfigMaintainerService {
* @param dataId Configuration data ID (optional).
* @param groupName Configuration group name (optional).
* @param namespaceId Namespace ID (optional).
- * @return Cluster-wide metrics.
- * @throws NacosException If the operation fails.
+ * @return a map containing the cluster-wide metrics.
+ * @throws NacosException if the operation fails.
*/
Map getClusterMetrics(String ip, String dataId, String groupName, String namespaceId)
- throws Exception;
+ throws NacosException;
// ------------------------- Core Operations -------------------------
/**
* Execute a Raft operation with the specified command, value, and group ID.
*
- * @param command the command to execute
- * @param value the value associated with the command
- * @param groupId the group ID for the operation
- * @return the result of the Raft operation
+ * @param command the command to execute.
+ * @param value the value associated with the command.
+ * @param groupId the group ID for the operation.
+ * @return the result of the Raft operation.
+ * @throws NacosException if the operation fails.
*/
- String raftOps(String command, String value, String groupId) throws Exception;
+ String raftOps(String command, String value, String groupId) throws NacosException;
/**
* Retrieve the current health status of the ID generator.
*
- * @return a list of ID generator status objects
+ * @return a list of ID generator status objects.
+ * @throws NacosException if the operation fails.
*/
- List getIdsHealth() throws Exception;
+ List getIdsHealth() throws NacosException;
/**
* Update the log level for a specific logger.
*
- * @param logName the name of the logger to update
- * @param logLevel the new log level to set
+ * @param logName the name of the logger to update.
+ * @param logLevel the new log level to set.
+ * @throws NacosException if the operation fails.
*/
- void updateLogLevel(String logName, String logLevel) throws Exception;
+ void updateLogLevel(String logName, String logLevel) throws NacosException;
/**
* Retrieve information about the current node.
*
- * @return the current node's information
+ * @return the current node's information.
+ * @throws NacosException if the operation fails.
*/
- Member getSelfNode() throws Exception;
+ Member getSelfNode() throws NacosException;
/**
* List cluster nodes based on the specified address and state.
*
- * @param address the address to filter nodes by
- * @param state the state to filter nodes by
- * @return a collection of matching nodes
- * @throws NacosException if an error occurs during the operation
+ * @param address the address to filter nodes by.
+ * @param state the state to filter nodes by.
+ * @return a collection of matching nodes.
+ * @throws NacosException if an error occurs during the operation.
*/
- Collection listClusterNodes(String address, String state) throws Exception;
+ Collection listClusterNodes(String address, String state) throws NacosException;
/**
* Retrieve the health status of the current node.
*
- * @return the health status of the current node
+ * @return the health status of the current node.
+ * @throws NacosException if the operation fails.
*/
- String getSelfNodeHealth() throws Exception;
+ String getSelfNodeHealth() throws NacosException;
/**
* Update the list of cluster nodes.
*
- * @param nodes the list of nodes to update
- * @return true if the operation was successful, false otherwise
- * @throws NacosApiException if an error occurs during the operation
+ * @param nodes the list of nodes to update.
+ * @return true if the operation was successful, false otherwise.
+ * @throws NacosException if an error occurs during the operation.
*/
- Boolean updateClusterNodes(List nodes) throws Exception;
+ Boolean updateClusterNodes(List nodes) throws NacosException;
/**
* Update the lookup mode for the cluster.
*
- * @param type the type of lookup mode to set
- * @return true if the operation was successful, false otherwise
- * @throws NacosException if an error occurs during the operation
+ * @param type the type of lookup mode to set.
+ * @return true if the operation was successful, false otherwise.
+ * @throws NacosException if an error occurs during the operation.
*/
- Boolean updateLookupMode(String type) throws Exception;
+ Boolean updateLookupMode(String type) throws NacosException;
/**
* Retrieve the current client connections.
*
- * @return a map of current client connections
+ * @return a map of current client connections.
+ * @throws NacosException if the operation fails.
*/
- Map getCurrentClients() throws Exception;
+ Map getCurrentClients() throws NacosException;
/**
* Reload the number of SDK connections on the current server.
*
- * @param count the number of connections to reload
- * @param redirectAddress the address to redirect connections to
- * @return the result of the operation
+ * @param count the number of connections to reload.
+ * @param redirectAddress the address to redirect connections to.
+ * @return the result of the operation.
+ * @throws NacosException if the operation fails.
*/
- String reloadConnectionCount(Integer count, String redirectAddress) throws Exception;
+ String reloadConnectionCount(Integer count, String redirectAddress) throws NacosException;
/**
* Smartly reload the cluster based on the specified loader factor.
*
- * @param loaderFactorStr the loader factor string
- * @return the result of the operation
+ * @param loaderFactorStr the loader factor string.
+ * @return the result of the operation.
+ * @throws NacosException if the operation fails.
*/
- String smartReloadCluster(String loaderFactorStr) throws Exception;
+ String smartReloadCluster(String loaderFactorStr) throws NacosException;
/**
* Reload a single client connection.
*
- * @param connectionId the ID of the connection to reload
- * @param redirectAddress the address to redirect the connection to
- * @return the result of the operation
+ * @param connectionId the ID of the connection to reload.
+ * @param redirectAddress the address to redirect the connection to.
+ * @return the result of the operation.
+ * @throws NacosException if the operation fails.
*/
- String reloadSingleClient(String connectionId, String redirectAddress) throws Exception;
+ String reloadSingleClient(String connectionId, String redirectAddress) throws NacosException;
/**
* Retrieve the current cluster loader metrics.
*
- * @return the loader metrics for the cluster
+ * @return the loader metrics for the cluster.
+ * @throws NacosException if the operation fails.
*/
- ServerLoaderMetrics getClusterLoaderMetrics() throws Exception;
+ ServerLoaderMetrics getClusterLoaderMetrics() throws NacosException;
+
}
diff --git a/maintainer-client/src/main/java/com/alibaba/nacos/maintainer/client/config/NacosConfigMaintainerService.java b/maintainer-client/src/main/java/com/alibaba/nacos/maintainer/client/config/NacosConfigMaintainerServiceImpl.java
similarity index 83%
rename from maintainer-client/src/main/java/com/alibaba/nacos/maintainer/client/config/NacosConfigMaintainerService.java
rename to maintainer-client/src/main/java/com/alibaba/nacos/maintainer/client/config/NacosConfigMaintainerServiceImpl.java
index 219960aa09..a41325cb1d 100644
--- a/maintainer-client/src/main/java/com/alibaba/nacos/maintainer/client/config/NacosConfigMaintainerService.java
+++ b/maintainer-client/src/main/java/com/alibaba/nacos/maintainer/client/config/NacosConfigMaintainerServiceImpl.java
@@ -18,10 +18,7 @@ package com.alibaba.nacos.maintainer.client.config;
import com.alibaba.nacos.api.exception.NacosException;
import com.alibaba.nacos.api.model.v2.Result;
-import com.alibaba.nacos.common.constant.HttpHeaderConsts;
-import com.alibaba.nacos.common.http.Callback;
import com.alibaba.nacos.common.http.HttpRestResult;
-import com.alibaba.nacos.common.model.RestResult;
import com.alibaba.nacos.common.utils.HttpMethod;
import com.alibaba.nacos.common.utils.JacksonUtils;
import com.alibaba.nacos.maintainer.client.constants.Constants;
@@ -46,45 +43,35 @@ import com.alibaba.nacos.maintainer.client.utils.ParamUtil;
import com.fasterxml.jackson.core.type.TypeReference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.http.MediaType;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.context.request.async.DeferredResult;
-import org.springframework.web.multipart.MultipartFile;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.nio.charset.StandardCharsets;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
-import java.util.stream.Collectors;
/**
* Configuration management.
*
* @author Nacos
*/
-public class NacosConfigMaintainerService implements ConfigMaintainerService {
+public class NacosConfigMaintainerServiceImpl implements ConfigMaintainerService {
- private static final Logger LOGGER = LoggerFactory.getLogger(NacosConfigMaintainerService.class);
+ private static final Logger LOGGER = LoggerFactory.getLogger(NacosConfigMaintainerServiceImpl.class);
private final ClientHttpProxy clientHttpProxy;
- public NacosConfigMaintainerService(Properties properties) throws NacosException {
+ public NacosConfigMaintainerServiceImpl(Properties properties) throws NacosException {
this.clientHttpProxy = new ClientHttpProxy(properties);
}
@Override
- public ConfigAllInfo getConfig(String dataId, String groupName) throws Exception {
+ public ConfigAllInfo getConfig(String dataId, String groupName) throws NacosException {
return getConfig(dataId, groupName, ParamUtil.getDefaultNamespaceId());
}
@Override
- public ConfigAllInfo getConfig(String dataId, String groupName, String namespaceId) throws Exception {
+ public ConfigAllInfo getConfig(String dataId, String groupName, String namespaceId) throws NacosException {
Map params = new HashMap<>(8);
params.put("dataId", dataId);
params.put("groupName", groupName);
@@ -103,12 +90,12 @@ public class NacosConfigMaintainerService implements ConfigMaintainerService {
}
@Override
- public boolean publishConfig(String dataId, String groupName, String content) throws Exception {
+ public boolean publishConfig(String dataId, String groupName, String content) throws NacosException {
return publishConfig(dataId, groupName, ParamUtil.getDefaultNamespaceId(), content);
}
@Override
- public boolean publishConfig(String dataId, String groupName, String namespaceId, String content) throws Exception {
+ public boolean publishConfig(String dataId, String groupName, String namespaceId, String content) throws NacosException {
return publishConfig(dataId, groupName, namespaceId, content, null, null, null, null, null, null, null, null,
null);
}
@@ -116,7 +103,7 @@ public class NacosConfigMaintainerService implements ConfigMaintainerService {
@Override
public boolean publishConfig(String dataId, String groupName, String namespaceId, String content, String tag,
String appName, String srcUser, String configTags, String desc, String use, String effect, String type,
- String schema) throws Exception {
+ String schema) throws NacosException {
Map params = new HashMap<>(8);
params.put("dataId", dataId);
params.put("groupName", groupName);
@@ -144,17 +131,17 @@ public class NacosConfigMaintainerService implements ConfigMaintainerService {
}
@Override
- public boolean deleteConfig(String dataId, String groupName) throws Exception {
+ public boolean deleteConfig(String dataId, String groupName) throws NacosException {
return deleteConfig(dataId, groupName, ParamUtil.getDefaultNamespaceId(), null);
}
@Override
- public boolean deleteConfig(String dataId, String groupName, String namespaceId) throws Exception {
+ public boolean deleteConfig(String dataId, String groupName, String namespaceId) throws NacosException {
return deleteConfig(dataId, groupName, namespaceId, null);
}
@Override
- public boolean deleteConfig(String dataId, String groupName, String namespaceId, String tag) throws Exception {
+ public boolean deleteConfig(String dataId, String groupName, String namespaceId, String tag) throws NacosException {
Map params = new HashMap<>(8);
params.put("dataId", dataId);
params.put("groupName", groupName);
@@ -173,7 +160,7 @@ public class NacosConfigMaintainerService implements ConfigMaintainerService {
}
@Override
- public boolean deleteConfigs(List ids) throws Exception {
+ public boolean deleteConfigs(List ids) throws NacosException {
Map params = new HashMap<>(8);
StringBuilder idStr = new StringBuilder();
for (Long id : ids) {
@@ -196,13 +183,13 @@ public class NacosConfigMaintainerService implements ConfigMaintainerService {
}
@Override
- public ConfigAdvanceInfo getConfigAdvanceInfo(String dataId, String groupName) throws Exception {
+ public ConfigAdvanceInfo getConfigAdvanceInfo(String dataId, String groupName) throws NacosException {
return getConfigAdvanceInfo(dataId, groupName, ParamUtil.getDefaultNamespaceId());
}
@Override
public ConfigAdvanceInfo getConfigAdvanceInfo(String dataId, String groupName, String namespaceId)
- throws Exception {
+ throws NacosException {
Map params = new HashMap<>(8);
params.put("dataId", dataId);
params.put("groupName", groupName);
@@ -222,7 +209,7 @@ public class NacosConfigMaintainerService implements ConfigMaintainerService {
@Override
public Page searchConfigByDetails(String dataId, String groupName, String namespaceId,
- String configDetail, String search, int pageNo, int pageSize) throws Exception {
+ String configDetail, String search, int pageNo, int pageSize) throws NacosException {
Map params = new HashMap<>(8);
params.put("dataId", dataId);
params.put("groupName", groupName);
@@ -245,13 +232,13 @@ public class NacosConfigMaintainerService implements ConfigMaintainerService {
}
@Override
- public GroupkeyListenserStatus getListeners(String dataId, String groupName) throws Exception {
+ public GroupkeyListenserStatus getListeners(String dataId, String groupName) throws NacosException {
return getListeners(dataId, groupName, ParamUtil.getDefaultNamespaceId(), 1);
}
@Override
public GroupkeyListenserStatus getListeners(String dataId, String groupName, String namespaceId, int sampleTime)
- throws Exception {
+ throws NacosException {
Map params = new HashMap<>(8);
params.put("dataId", dataId);
params.put("groupName", groupName);
@@ -271,12 +258,12 @@ public class NacosConfigMaintainerService implements ConfigMaintainerService {
}
@Override
- public boolean stopBeta(String dataId, String groupName) throws Exception {
+ public boolean stopBeta(String dataId, String groupName) throws NacosException {
return stopBeta(dataId, groupName, ParamUtil.getDefaultNamespaceId());
}
@Override
- public boolean stopBeta(String dataId, String groupName, String namespaceId) throws Exception {
+ public boolean stopBeta(String dataId, String groupName, String namespaceId) throws NacosException {
Map params = new HashMap<>(8);
params.put("dataId", dataId);
params.put("groupName", groupName);
@@ -294,12 +281,12 @@ public class NacosConfigMaintainerService implements ConfigMaintainerService {
}
@Override
- public ConfigInfo4Beta queryBeta(String dataId, String groupName) throws Exception {
+ public ConfigInfo4Beta queryBeta(String dataId, String groupName) throws NacosException {
return queryBeta(dataId, groupName, ParamUtil.getDefaultNamespaceId());
}
@Override
- public ConfigInfo4Beta queryBeta(String dataId, String groupName, String namespaceId) throws Exception {
+ public ConfigInfo4Beta queryBeta(String dataId, String groupName, String namespaceId) throws NacosException {
Map params = new HashMap<>(8);
params.put("dataId", dataId);
params.put("groupName", groupName);
@@ -317,61 +304,9 @@ public class NacosConfigMaintainerService implements ConfigMaintainerService {
return result.getData();
}
- @Override
- public Map importAndPublishConfig(String namespaceId, String srcUser, SameConfigPolicy policy,
- MultipartFile multipartFile) throws Exception {
- if (multipartFile == null) {
- return new HashMap<>(8);
- }
- File file = convertToFile(multipartFile);
- try {
- Map params = new HashMap<>(8);
- params.put("namespaceId", namespaceId);
- params.put("srcUser", srcUser);
- params.put("policy", policy.toString());
-
- HttpRequest httpRequest = new HttpRequest.Builder()
- .setHttpMethod(HttpMethod.POST)
- .setPath(Constants.AdminApiPath.CONFIG_ADMIN_PATH + "/import")
- .setParamValue(params)
- .setFile(file)
- .build();
- HttpRestResult httpRestResult = clientHttpProxy.executeSyncHttpRequest(httpRequest);
- Result