Skip to content

Commit

Permalink
[DUBBO-3137]: move constants from RegistryConstants back to dubbo-reg…
Browse files Browse the repository at this point in the history
…istry-api (#4101)

* [DUBBO-3137]: move constants from RegistryConstants back to dubbo-registry-api

* fix imports
  • Loading branch information
beiwei30 authored and CrazyHZM committed May 21, 2019
1 parent fcef1a1 commit 956d28b
Show file tree
Hide file tree
Showing 40 changed files with 203 additions and 215 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,16 @@ public interface Constants {
String OVERRIDE_PROVIDERS_KEY = "providerAddresses";

String TAG_KEY = "dubbo.tag";
/**
* key for router type, for e.g., "script"/"file", corresponding to ScriptRouterFactory.NAME, FileRouterFactory.NAME
*/
String ROUTER_KEY = "router";
/**
* The key name for reference URL in register center
*/
String REFER_KEY = "refer";
/**
* The key name for export URL in register center
*/
String EXPORT_KEY = "export";
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import java.util.List;
import java.util.Map;

import static org.apache.dubbo.common.constants.RegistryConstants.REFER_KEY;
import static org.apache.dubbo.rpc.cluster.Constants.REFER_KEY;
import static org.apache.dubbo.common.constants.CommonConstants.MONITOR_KEY;
import static org.apache.dubbo.common.constants.RegistryConstants.REGISTRY_PROTOCOL;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import java.io.FileReader;
import java.io.IOException;

import static org.apache.dubbo.common.constants.RegistryConstants.ROUTER_KEY;
import static org.apache.dubbo.rpc.cluster.Constants.ROUTER_KEY;
import static org.apache.dubbo.rpc.cluster.Constants.RULE_KEY;
import static org.apache.dubbo.rpc.cluster.Constants.RUNTIME_KEY;
import static org.apache.dubbo.rpc.cluster.Constants.TYPE_KEY;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

import static org.apache.dubbo.rpc.cluster.Constants.CLUSTER_AVAILABLE_CHECK_KEY;
import static org.apache.dubbo.rpc.cluster.Constants.INVOCATION_NEED_MOCK;
import static org.apache.dubbo.common.constants.RegistryConstants.REFER_KEY;
import static org.apache.dubbo.rpc.cluster.Constants.REFER_KEY;
import static org.apache.dubbo.common.constants.CommonConstants.MONITOR_KEY;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,13 @@
package org.apache.dubbo.common.constants;

public interface RegistryConstants {
String REGISTER_KEY = "register";

String SUBSCRIBE_KEY = "subscribe";

String REGISTRY_KEY = "registry";

String DEFAULT_REGISTRY = "dubbo";

String REGISTRY_PROTOCOL = "registry";

String DYNAMIC_KEY = "dynamic";

String REGISTER = "register";

String UNREGISTER = "unregister";

String SUBSCRIBE = "subscribe";

String UNSUBSCRIBE = "unsubscribe";

String CATEGORY_KEY = "category";

String PROVIDERS_CATEGORY = "providers";
Expand All @@ -56,90 +43,13 @@ public interface RegistryConstants {

String APP_DYNAMIC_CONFIGURATORS_CATEGORY = "appdynamicconfigurators";

String CONFIGURATORS_SUFFIX = ".configurators";

String ROUTERS_SUFFIX = ".routers";

String TRACE_PROTOCOL = "trace";

String EMPTY_PROTOCOL = "empty";

String ADMIN_PROTOCOL = "admin";

String PROVIDER_PROTOCOL = "provider";

String CONSUMER_PROTOCOL = "consumer";

String ROUTE_PROTOCOL = "route";

String SCRIPT_PROTOCOL = "script";

String CONDITION_PROTOCOL = "condition";

/**
* simple the registry for provider.
*
* @since 2.7.0
*/
String SIMPLIFIED_KEY = "simplified";

/**
* After simplify the registry, should add some paramter individually for provider.
*
* @since 2.7.0
*/
String EXTRA_KEYS_KEY = "extra-keys";

String OVERRIDE_PROTOCOL = "override";

String COMPATIBLE_CONFIG_KEY = "compatible_config";

/**
* To decide whether register center saves file synchronously, the default value is asynchronously
*/
String REGISTRY_FILESAVE_SYNC_KEY = "save.file";

/**
* Period of registry center's retry interval
*/
String REGISTRY_RETRY_PERIOD_KEY = "retry.period";

/**
* Most retry times
*/
String REGISTRY_RETRY_TIMES_KEY = "retry.times";

/**
* Default value for the period of retry interval in milliseconds: 5000
*/
int DEFAULT_REGISTRY_RETRY_PERIOD = 5 * 1000;

/**
* Default value for the times of retry: 3
*/
int DEFAULT_REGISTRY_RETRY_TIMES = 3;

/**
* Reconnection period in milliseconds for register center
*/
String REGISTRY_RECONNECT_PERIOD_KEY = "reconnect.period";

int DEFAULT_REGISTRY_RECONNECT_PERIOD = 3 * 1000;

String SESSION_TIMEOUT_KEY = "session";

int DEFAULT_SESSION_TIMEOUT = 60 * 1000;
/**
* key for router type, for e.g., "script"/"file", corresponding to ScriptRouterFactory.NAME, FileRouterFactory.NAME
*/
String ROUTER_KEY = "router";

/**
* The key name for export URL in register center
*/
String EXPORT_KEY = "export";
/**
* The key name for reference URL in register center
*/
String REFER_KEY = "refer";
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,16 @@
import static org.apache.dubbo.common.constants.ConfigConstants.DUBBO_PROTOCOL;
import static org.apache.dubbo.config.Constants.LAYER_KEY;
import static org.apache.dubbo.config.Constants.LISTENER_KEY;
import static org.apache.dubbo.common.constants.RegistryConstants.REFER_KEY;
import static org.apache.dubbo.rpc.cluster.Constants.REFER_KEY;
import static org.apache.dubbo.registry.Constants.REGISTER_IP_KEY;
import static org.apache.dubbo.config.Constants.REGISTRIES_SUFFIX;
import static org.apache.dubbo.common.constants.ConfigConstants.SHUTDOWN_WAIT_KEY;
import static org.apache.dubbo.common.constants.ConfigConstants.SHUTDOWN_WAIT_SECONDS_KEY;
import static org.apache.dubbo.monitor.Constants.LOGSTAT_PROTOCOL;
import static org.apache.dubbo.common.constants.RegistryConstants.REGISTER_KEY;
import static org.apache.dubbo.registry.Constants.REGISTER_KEY;
import static org.apache.dubbo.common.constants.RegistryConstants.REGISTRY_KEY;
import static org.apache.dubbo.common.constants.RegistryConstants.REGISTRY_PROTOCOL;
import static org.apache.dubbo.common.constants.RegistryConstants.SUBSCRIBE_KEY;
import static org.apache.dubbo.registry.Constants.SUBSCRIBE_KEY;
import static org.apache.dubbo.common.constants.RpcConstants.DUBBO_VERSION_KEY;
import static org.apache.dubbo.rpc.Constants.INVOKER_LISTENER_KEY;
import static org.apache.dubbo.rpc.Constants.LOCAL_KEY;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@
import static org.apache.dubbo.common.constants.CommonConstants.SIDE_KEY;
import static org.apache.dubbo.common.constants.ConfigConstants.CLUSTER_KEY;
import static org.apache.dubbo.config.Constants.DUBBO_IP_TO_REGISTRY;
import static org.apache.dubbo.common.constants.RegistryConstants.REFER_KEY;
import static org.apache.dubbo.rpc.cluster.Constants.REFER_KEY;
import static org.apache.dubbo.registry.Constants.REGISTER_IP_KEY;
import static org.apache.dubbo.common.constants.CommonConstants.MONITOR_KEY;
import static org.apache.dubbo.common.constants.RegistryConstants.CONSUMER_PROTOCOL;
import static org.apache.dubbo.registry.Constants.CONSUMER_PROTOCOL;
import static org.apache.dubbo.common.constants.RegistryConstants.REGISTRY_PROTOCOL;
import static org.apache.dubbo.rpc.Constants.LOCAL_PROTOCOL;
import static org.apache.dubbo.common.utils.NetUtils.isInvalidLocalHost;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import static org.apache.dubbo.common.constants.ConfigConstants.SHUTDOWN_WAIT_KEY;
import static org.apache.dubbo.common.constants.ConfigConstants.USERNAME_KEY;
import static org.apache.dubbo.config.Constants.ZOOKEEPER_PROTOCOL;
import static org.apache.dubbo.common.constants.RegistryConstants.EXTRA_KEYS_KEY;
import static org.apache.dubbo.registry.Constants.EXTRA_KEYS_KEY;

/**
* RegistryConfig
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
import static org.apache.dubbo.config.Constants.DUBBO_IP_TO_REGISTRY;
import static org.apache.dubbo.config.Constants.DUBBO_PORT_TO_BIND;
import static org.apache.dubbo.config.Constants.DUBBO_PORT_TO_REGISTRY;
import static org.apache.dubbo.common.constants.RegistryConstants.EXPORT_KEY;
import static org.apache.dubbo.rpc.cluster.Constants.EXPORT_KEY;
import static org.apache.dubbo.config.Constants.MULTICAST;
import static org.apache.dubbo.config.Constants.PROTOCOLS_SUFFIX;
import static org.apache.dubbo.rpc.Constants.SCOPE_KEY;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
import static org.apache.dubbo.common.constants.CommonConstants.METHODS_KEY;
import static org.apache.dubbo.common.constants.CommonConstants.PROVIDER;
import static org.apache.dubbo.common.constants.CommonConstants.SIDE_KEY;
import static org.apache.dubbo.common.constants.RegistryConstants.EXPORT_KEY;
import static org.apache.dubbo.rpc.cluster.Constants.EXPORT_KEY;
import static org.apache.dubbo.config.Constants.SHUTDOWN_TIMEOUT_KEY;
import static org.apache.dubbo.common.constants.ConfigConstants.SHUTDOWN_WAIT_KEY;
import static org.apache.dubbo.remoting.Constants.BIND_IP_KEY;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
import java.util.concurrent.TimeUnit;

import static java.nio.charset.StandardCharsets.UTF_8;
import static org.apache.dubbo.common.constants.RegistryConstants.SESSION_TIMEOUT_KEY;
import static org.apache.dubbo.remoting.etcd.Constants.SESSION_TIMEOUT_KEY;

/**
* Unit test for etcd config center support
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@
import java.util.Map;
import java.util.concurrent.CountDownLatch;

import static org.apache.dubbo.common.constants.RegistryConstants.SESSION_TIMEOUT_KEY;

/**
* Unit test for nacos config center support
*/
//FIXME: waiting for embedded Nacos suport, then we can open the switch.
@Disabled("https://github.com/alibaba/nacos/issues/1188")
public class NacosDynamicConfigurationTest {
private static final String SESSION_TIMEOUT_KEY = "session";

private static NacosDynamicConfiguration config;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,9 @@
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.locks.ReentrantLock;

import static org.apache.dubbo.common.constants.RegistryConstants.EXPORT_KEY;
import static org.apache.dubbo.common.constants.RegistryConstants.REFER_KEY;

/**
*/
public abstract class AbstractMetadataReportFactory implements MetadataReportFactory {
private static final String EXPORT_KEY = "export";
private static final String REFER_KEY = "refer";

// The lock for the acquisition process of the registry
private static final ReentrantLock LOCK = new ReentrantLock();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@

import static org.apache.dubbo.common.constants.CommonConstants.CONSUMER_SIDE;
import static org.apache.dubbo.common.constants.CommonConstants.PROVIDER_SIDE;
import static org.apache.dubbo.common.constants.RegistryConstants.SESSION_TIMEOUT_KEY;

//FIXME: waiting for embedded Nacos suport, then we can open the switch.
@Disabled("https://github.com/alibaba/nacos/issues/1188")
public class NacosMetadataReportTest {
private static final String SESSION_TIMEOUT_KEY = "session";
private static final String TEST_SERVICE = "org.apache.dubbo.metadata.store.nacos.NacosMetadata4TstService";
private NacosMetadataReport nacosMetadataReport;
private NacosMetadataReportFactory nacosMetadataReportFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,80 @@

public interface Constants {
String REGISTER_IP_KEY = "register.ip";

String REGISTER_KEY = "register";

String SUBSCRIBE_KEY = "subscribe";

String DEFAULT_REGISTRY = "dubbo";

String REGISTER = "register";

String UNREGISTER = "unregister";

String SUBSCRIBE = "subscribe";

String UNSUBSCRIBE = "unsubscribe";

String CONFIGURATORS_SUFFIX = ".configurators";

String ADMIN_PROTOCOL = "admin";

String PROVIDER_PROTOCOL = "provider";

String CONSUMER_PROTOCOL = "consumer";

String SCRIPT_PROTOCOL = "script";

String CONDITION_PROTOCOL = "condition";
String TRACE_PROTOCOL = "trace";
/**
* simple the registry for provider.
*
* @since 2.7.0
*/
String SIMPLIFIED_KEY = "simplified";

/**
* After simplify the registry, should add some paramter individually for provider.
*
* @since 2.7.0
*/
String EXTRA_KEYS_KEY = "extra-keys";

/**
* To decide whether register center saves file synchronously, the default value is asynchronously
*/
String REGISTRY_FILESAVE_SYNC_KEY = "save.file";

/**
* Reconnection period in milliseconds for register center
*/
String REGISTRY_RECONNECT_PERIOD_KEY = "reconnect.period";

int DEFAULT_SESSION_TIMEOUT = 60 * 1000;

/**
* Default value for the times of retry: 3
*/
int DEFAULT_REGISTRY_RETRY_TIMES = 3;

int DEFAULT_REGISTRY_RECONNECT_PERIOD = 3 * 1000;

/**
* Default value for the period of retry interval in milliseconds: 5000
*/
int DEFAULT_REGISTRY_RETRY_PERIOD = 5 * 1000;

/**
* Most retry times
*/
String REGISTRY_RETRY_TIMES_KEY = "retry.times";

/**
* Period of registry center's retry interval
*/
String REGISTRY_RETRY_PERIOD_KEY = "retry.period";

String SESSION_TIMEOUT_KEY = "session";
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
import java.util.Set;
import java.util.stream.Collectors;

import static org.apache.dubbo.common.constants.RegistryConstants.ROUTER_KEY;
import static org.apache.dubbo.rpc.cluster.Constants.ROUTER_KEY;
import static org.apache.dubbo.common.constants.CommonConstants.ANY_VALUE;
import static org.apache.dubbo.common.constants.CommonConstants.DEFAULT_KEY;
import static org.apache.dubbo.common.constants.CommonConstants.DISABLED_KEY;
Expand All @@ -67,13 +67,13 @@
import static org.apache.dubbo.common.constants.CommonConstants.INTERFACE_KEY;
import static org.apache.dubbo.common.constants.CommonConstants.PROTOCOL_KEY;
import static org.apache.dubbo.common.constants.ConfigConstants.DUBBO_PROTOCOL;
import static org.apache.dubbo.common.constants.RegistryConstants.REFER_KEY;
import static org.apache.dubbo.rpc.cluster.Constants.REFER_KEY;
import static org.apache.dubbo.common.constants.CommonConstants.MONITOR_KEY;
import static org.apache.dubbo.common.constants.RegistryConstants.APP_DYNAMIC_CONFIGURATORS_CATEGORY;
import static org.apache.dubbo.common.constants.RegistryConstants.CATEGORY_KEY;
import static org.apache.dubbo.common.constants.RegistryConstants.COMPATIBLE_CONFIG_KEY;
import static org.apache.dubbo.common.constants.RegistryConstants.CONFIGURATORS_CATEGORY;
import static org.apache.dubbo.common.constants.RegistryConstants.CONFIGURATORS_SUFFIX;
import static org.apache.dubbo.registry.Constants.CONFIGURATORS_SUFFIX;
import static org.apache.dubbo.common.constants.RegistryConstants.DEFAULT_CATEGORY;
import static org.apache.dubbo.common.constants.RegistryConstants.DYNAMIC_CONFIGURATORS_CATEGORY;
import static org.apache.dubbo.common.constants.RegistryConstants.EMPTY_PROTOCOL;
Expand Down
Loading

0 comments on commit 956d28b

Please sign in to comment.