[ISSUE #6487] [nacos-api] export the constant in the directory naming. (#6540)

This commit is contained in:
brotherlu-xcq 2021-08-04 14:07:28 +08:00 committed by GitHub
parent 1119d0336f
commit 831bea12b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 9 deletions

View File

@ -219,4 +219,14 @@ public class Constants {
public static final String NOTIFY_HEADER = "notify";
}
/**
* The constants in naming directory.
*/
public static class Naming {
public static final String NAMING_MODULE = "naming";
public static final String CMDB_CONTEXT_TYPE = "CMDB";
}
}

View File

@ -18,6 +18,8 @@ package com.alibaba.nacos.api.naming.remote.request;
import com.alibaba.nacos.api.remote.request.Request;
import static com.alibaba.nacos.api.common.Constants.Naming.NAMING_MODULE;
/**
* Uniform remote request of naming module.
*
@ -25,8 +27,6 @@ import com.alibaba.nacos.api.remote.request.Request;
*/
public abstract class AbstractNamingRequest extends Request {
private static final String MODULE = "naming";
private String namespace;
private String serviceName;
@ -44,7 +44,7 @@ public abstract class AbstractNamingRequest extends Request {
@Override
public String getModule() {
return MODULE;
return NAMING_MODULE;
}
public String getNamespace() {

View File

@ -19,6 +19,8 @@ package com.alibaba.nacos.api.naming.remote.request;
import com.alibaba.nacos.api.naming.pojo.ServiceInfo;
import com.alibaba.nacos.api.remote.request.ServerRequest;
import static com.alibaba.nacos.api.common.Constants.Naming.NAMING_MODULE;
/**
* Notify subscriber response.
*
@ -26,8 +28,6 @@ import com.alibaba.nacos.api.remote.request.ServerRequest;
*/
public class NotifySubscriberRequest extends ServerRequest {
private static final String MODULE = "naming";
private String namespace;
private String serviceName;
@ -41,7 +41,7 @@ public class NotifySubscriberRequest extends ServerRequest {
@Override
public String getModule() {
return MODULE;
return NAMING_MODULE;
}
private NotifySubscriberRequest(ServiceInfo serviceInfo, String message) {

View File

@ -22,6 +22,8 @@ import com.alibaba.nacos.api.naming.selector.context.CmdbContext;
import java.util.List;
import static com.alibaba.nacos.api.common.Constants.Naming.CMDB_CONTEXT_TYPE;
/**
* {@link AbstractCmdbSelector} will provide one default implement of {@link Selector}, users can implement it to use the {@link CmdbContext}.
* And return the result as default subclass of {@link Instance}.
@ -31,8 +33,6 @@ import java.util.List;
*/
public abstract class AbstractCmdbSelector<T extends Instance> implements Selector<List<T>, CmdbContext<T>, String> {
private static final String DEFAULT_CONTEXT_TYPE = "CMDB";
@Override
public List<T> select(CmdbContext<T> context) {
return doSelect(context);
@ -48,6 +48,6 @@ public abstract class AbstractCmdbSelector<T extends Instance> implements Select
@Override
public String getContextType() {
return DEFAULT_CONTEXT_TYPE;
return CMDB_CONTEXT_TYPE;
}
}