Skip to content

Commit

Permalink
Merge branch 'develop' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
mingyixu authored Jan 15, 2019
2 parents 63c704a + 663ed1a commit a689f0f
Show file tree
Hide file tree
Showing 230 changed files with 8,943 additions and 6,261 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
target
.project
.idea
.vscode
.DS_Store
.factorypath
/logs
*.iml
node_modules
Expand Down
2 changes: 1 addition & 1 deletion api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<parent>
<groupId>com.alibaba.nacos</groupId>
<artifactId>nacos-all</artifactId>
<version>0.7.0</version>
<version>0.8.0-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
8 changes: 4 additions & 4 deletions api/src/main/java/com/alibaba/nacos/api/NacosFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
public class NacosFactory {

/**
* Create config
* Create config service
*
* @param properties init param
* @return config
Expand All @@ -42,7 +42,7 @@ public static ConfigService createConfigService(Properties properties) throws Na
}

/**
* Create config
* Create config service
*
* @param serverAddr server list
* @return config
Expand All @@ -53,7 +53,7 @@ public static ConfigService createConfigService(String serverAddr) throws NacosE
}

/**
* Create Naming
* Create naming service
*
* @param serverAddr server list
* @return Naming
Expand All @@ -64,7 +64,7 @@ public static NamingService createNamingService(String serverAddr) throws NacosE
}

/**
* Create Naming
* Create naming service
*
* @param properties init param
* @return Naming
Expand Down
12 changes: 11 additions & 1 deletion api/src/main/java/com/alibaba/nacos/api/PropertyKeyConst.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,30 @@
package com.alibaba.nacos.api;

/**
* properties key
* Property Key Const
*
* @author Nacos
*/
public class PropertyKeyConst {

public final static String ENDPOINT = "endpoint";

public final static String NAMESPACE = "namespace";

public final static String ACCESS_KEY = "accessKey";

public final static String SECRET_KEY = "secretKey";

public final static String SERVER_ADDR = "serverAddr";

public final static String CONTEXT_PATH = "contextPath";

public final static String CLUSTER_NAME = "clusterName";

public final static String ENCODE = "encode";

public final static String NAMING_LOAD_CACHE_AT_START = "namingLoadCacheAtStart";
public final static String NAMING_CLIENT_BEAT_THREAD_COUNT = "namingClientBeatThreadCount";
public final static String NAMING_POLLING_THREAD_COUNT = "namingPollingThreadCount";

}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

/**
* @author <a href="mailto:[email protected]">nkorange</a>
* @since 0.7.0
*/
public class Entity {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

/**
* @author <a href="mailto:[email protected]">nkorange</a>
* @since 0.7.0
*/
public class EntityEvent {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

/**
* @author <a href="mailto:[email protected]">nkorange</a>
* @since 0.7.0
*/
public enum EntityEventType {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

/**
* @author <a href="mailto:[email protected]">nkorange</a>
* @since 0.7.0
*/
public class Label {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@

/**
* @author <a href="mailto:[email protected]">nkorange</a>
* @since 0.7.0
*/
public enum PreservedEntityTypes {
/**
*
* Ip
*/
ip,
/**
*
* Service
*/
service
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
* Service to visit CMDB store
*
* @author <a href="mailto:[email protected]">nkorange</a>
* @since 0.7.0
*/
public interface CmdbService {

Expand Down
13 changes: 7 additions & 6 deletions api/src/main/java/com/alibaba/nacos/api/common/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,6 @@ public class Constants {
*/
public static final int ONCE_TIMEOUT = 2000;

/**
* millisecond
*/
public static final int CONN_TIMEOUT = 2000;

/**
* millisecond
*/
Expand All @@ -114,7 +109,7 @@ public class Constants {

public static final String WORD_SEPARATOR = Character.toString((char)2);

public static final String LONGPULLING_LINE_SEPARATOR = "\r\n";
public static final String LONGPOLLING_LINE_SEPARATOR = "\r\n";

public static final String CLIENT_APPNAME_HEADER = "Client-AppName";
public static final String CLIENT_REQUEST_TS_HEADER = "Client-RequestTS";
Expand All @@ -127,4 +122,10 @@ public class Constants {
public static final String NAMING_HTTP_HEADER_SPILIER = "\\|";

public static final String NAMING_DEFAULT_CLUSTER_NAME = "DEFAULT";

public static final String REQUEST_PARAM_NAMESPACE_ID = "namespaceId";
public static final String REQUEST_PARAM_DEFAULT_NAMESPACE_ID = "public";
public static final String REQUEST_PARAM_SERVICE_NAME = "serviceName";
public static final String REQUEST_PARAM_GROUP = "group";
public static final String REQUEST_PARAM_DEFAULT_GROUP = "DEFAULT_GROUP";
}
17 changes: 5 additions & 12 deletions api/src/main/java/com/alibaba/nacos/api/config/ConfigFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ public class ConfigFactory {
* Create Config
*
* @param properties init param
* @return Config
* @return ConfigService
* @throws NacosException Exception
*/
public static ConfigService createConfigService(Properties properties) throws NacosException {
try {
Class<?> driverImplClass = Class.forName("com.alibaba.nacos.client.config.NacosConfigService");
Constructor constructor = driverImplClass.getConstructor(Properties.class);
ConfigService vendorImpl = (ConfigService)constructor.newInstance(properties);
ConfigService vendorImpl = (ConfigService) constructor.newInstance(properties);
return vendorImpl;
} catch (Throwable e) {
throw new NacosException(-400, e.getMessage());
Expand All @@ -49,21 +49,14 @@ public static ConfigService createConfigService(Properties properties) throws Na
/**
* Create Config
*
* @param ServerAddr serverlist
* @param serverAddr serverList
* @return Config
* @throws NacosException Exception
* @throws ConfigService Exception
*/
public static ConfigService createConfigService(String serverAddr) throws NacosException {
Properties properties = new Properties();
properties.put(PropertyKeyConst.SERVER_ADDR, serverAddr);
try {
Class<?> driverImplClass = Class.forName("com.alibaba.nacos.client.config.NacosConfigService");
Constructor constructor = driverImplClass.getConstructor(Properties.class);
ConfigService vendorImpl = (ConfigService)constructor.newInstance(properties);
return vendorImpl;
} catch (Throwable e) {
throw new NacosException(-400, e.getMessage());
}
return createConfigService(properties);
}

}
44 changes: 23 additions & 21 deletions api/src/main/java/com/alibaba/nacos/api/config/ConfigService.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,68 +19,70 @@
import com.alibaba.nacos.api.exception.NacosException;

/**
* Config Interface
* Config Service Interface
*
* @author Nacos
*/
public interface ConfigService {

/**
* Get Configuration
* Get config
*
* @param dataId Config ID
* @param group Config Group
* @param dataId dataId
* @param group group
* @param timeoutMs read timeout
* @return config value
* @throws NacosException NacosException
*/
String getConfig(String dataId, String group, long timeoutMs) throws NacosException;

/**
* Add a listener to the configuration, after the server to modify the configuration, the client will use the
* incoming listener callback. Recommended asynchronous processing, the application can implement the getExecutor
* method in the ManagerListener, provide a thread pool of execution. If provided, use the main thread callback, May
* block other configurations or be blocked by other configurations.
* Add a listener to the configuration, after the server modified the
* configuration, the client will use the incoming listener callback.
* Recommended asynchronous processing, the application can implement the
* getExecutor method in the ManagerListener, provide a thread pool of
* execution. If provided, use the main thread callback, May block other
* configurations or be blocked by other configurations.
*
* @param dataId Config ID
* @param group Config Group
* @param dataId dataId
* @param group group
* @param listener listener
* @throws NacosException NacosException
*/
void addListener(String dataId, String group, Listener listener) throws NacosException;

/**
* publish config.
* Publish config.
*
* @param dataId Config ID
* @param group Config Group
* @param content Config Content
* @param dataId dataId
* @param group group
* @param content content
* @return Whether publish
* @throws NacosException NacosException
*/
boolean publishConfig(String dataId, String group, String content) throws NacosException;

/**
* Remove Config
* Remove config
*
* @param dataId Config ID
* @param group Config Group
* @param dataId dataId
* @param group group
* @return whether remove
* @throws NacosException NacosException
*/
boolean removeConfig(String dataId, String group) throws NacosException;

/**
* Remove Listener
* Remove listener
*
* @param dataId Config ID
* @param group Config Group
* @param dataId dataId
* @param group group
* @param listener listener
*/
void removeListener(String dataId, String group, Listener listener);

/**
* server health info
* Get server status
*
* @return whether health
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
package com.alibaba.nacos.api.config.convert;

/**
* Nacos Configuration content Converter
* Nacos Config Converter
*
* @param <T> the target type that wanted
* @author <a href="mailto:[email protected]">Mercy</a>
Expand All @@ -25,17 +25,17 @@
public interface NacosConfigConverter<T> {

/**
* Can convert to be target type or not
* can convert to be target type or not
*
* @param targetType the type of target
* @return If can , return <code>true</code>, or <code>false</code>
*/
boolean canConvert(Class<T> targetType);

/**
* Convert the Naocs's configuration of type S to target type T.
* convert the Naocs's config of type S to target type T.
*
* @param config the Naocs's configuration to convert, which must be an instance of S (never {@code null})
* @param config the Naocs's config to convert, which must be an instance of S (never {@code null})
* @return the converted object, which must be an instance of T (potentially {@code null})
*/
T convert(String config);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,18 @@
*/
public interface IConfigContext {
/**
* get context by key
* Get context param by key
*
* @param key
* @return context
*/
public Object getParameter(String key);
Object getParameter(String key);

/**
* set context
* Set context param
*
* @param key key
* @param value value
*/
public void setParameter(String key, Object value);
void setParameter(String key, Object value);
}
Loading

0 comments on commit a689f0f

Please sign in to comment.