diff --git a/apollo-adminservice/pom.xml b/apollo-adminservice/pom.xml
index 1081ded41347694b0be18561d20c5d945868c309..ce5b013c0cf1fd830d1f5d2a86f03da1b8e09117 100644
--- a/apollo-adminservice/pom.xml
+++ b/apollo-adminservice/pom.xml
@@ -4,7 +4,7 @@
com.ctrip.framework.apollo
apollo
- 0.0.9
+ 0.0.10-SNAPSHOT
../pom.xml
4.0.0
diff --git a/apollo-assembly/pom.xml b/apollo-assembly/pom.xml
index d641da304713ef6d2594a606cbdb63171591b242..30429bd775de76ed7e9301f1953bfb1c4d1d612a 100644
--- a/apollo-assembly/pom.xml
+++ b/apollo-assembly/pom.xml
@@ -4,7 +4,7 @@
com.ctrip.framework.apollo
apollo
- 0.0.9
+ 0.0.10-SNAPSHOT
../pom.xml
4.0.0
diff --git a/apollo-biz/pom.xml b/apollo-biz/pom.xml
index 5f2b323be20c2f4c185e76dff43a92b4d4cbefd7..4b99316dd5642b0a0ee5cf618f8518b6d41e5552 100644
--- a/apollo-biz/pom.xml
+++ b/apollo-biz/pom.xml
@@ -4,7 +4,7 @@
apollo
com.ctrip.framework.apollo
- 0.0.9
+ 0.0.10-SNAPSHOT
4.0.0
apollo-biz
diff --git a/apollo-buildtools/pom.xml b/apollo-buildtools/pom.xml
index 77d8bb63567c4acc4db579e70eb1c228864a6107..229cb16fcfbe45d81d9dbdb8e7696f35f3e82d13 100644
--- a/apollo-buildtools/pom.xml
+++ b/apollo-buildtools/pom.xml
@@ -4,7 +4,7 @@
com.ctrip.framework.apollo
apollo
- 0.0.9
+ 0.0.10-SNAPSHOT
../pom.xml
4.0.0
diff --git a/apollo-client/pom.xml b/apollo-client/pom.xml
index 24e41608b3e06b7d640836599bfa5ed283d78edc..eedb86c6e5739e6d8744a30b5a3e9f4d5f22936b 100644
--- a/apollo-client/pom.xml
+++ b/apollo-client/pom.xml
@@ -4,7 +4,7 @@
com.ctrip.framework.apollo
apollo
- 0.0.9
+ 0.0.10-SNAPSHOT
../pom.xml
4.0.0
diff --git a/apollo-client/src/main/java/com/ctrip/framework/apollo/Config.java b/apollo-client/src/main/java/com/ctrip/framework/apollo/Config.java
index 80e375ee06957bfb98767e08db2f83039152f311..67f9ede30222bcb738ef938fab106f1f26f1f10c 100644
--- a/apollo-client/src/main/java/com/ctrip/framework/apollo/Config.java
+++ b/apollo-client/src/main/java/com/ctrip/framework/apollo/Config.java
@@ -1,13 +1,15 @@
package com.ctrip.framework.apollo;
+import java.util.Set;
+
/**
* @author Jason Song(song_s@ctrip.com)
*/
public interface Config {
/**
* Return the property value with the given key, or {@code defaultValue} if the key doesn't exist.
- *
- * @param key the property name
+ *
+ * @param key the property name
* @param defaultValue the default value when key is not found
* @return the property value
*/
@@ -16,11 +18,10 @@ public interface Config {
/**
* Return the integer property value with the given key, or {@code defaultValue} if the key
* doesn't exist.
- *
- * @param key the property name
+ *
+ * @param key the property name
* @param defaultValue the default value when key is not found
* @return the property value as integer
- *
* @throws NumberFormatException if the property value is invalid
*/
public Integer getIntProperty(String key, Integer defaultValue);
@@ -28,11 +29,10 @@ public interface Config {
/**
* Return the long property value with the given key, or {@code defaultValue} if the key doesn't
* exist.
- *
- * @param key the property name
+ *
+ * @param key the property name
* @param defaultValue the default value when key is not found
* @return the property value as long
- *
* @throws NumberFormatException if the property value is invalid
*/
public Long getLongProperty(String key, Long defaultValue);
@@ -40,11 +40,10 @@ public interface Config {
/**
* Return the short property value with the given key, or {@code defaultValue} if the key doesn't
* exist.
- *
- * @param key the property name
+ *
+ * @param key the property name
* @param defaultValue the default value when key is not found
* @return the property value as short
- *
* @throws NumberFormatException if the property value is invalid
*/
public Short getShortProperty(String key, Short defaultValue);
@@ -52,11 +51,10 @@ public interface Config {
/**
* Return the float property value with the given key, or {@code defaultValue} if the key doesn't
* exist.
- *
- * @param key the property name
+ *
+ * @param key the property name
* @param defaultValue the default value when key is not found
* @return the property value as float
- *
* @throws NumberFormatException if the property value is invalid
*/
public Float getFloatProperty(String key, Float defaultValue);
@@ -64,11 +62,10 @@ public interface Config {
/**
* Return the double property value with the given key, or {@code defaultValue} if the key doesn't
* exist.
- *
- * @param key the property name
+ *
+ * @param key the property name
* @param defaultValue the default value when key is not found
* @return the property value as double
- *
* @throws NumberFormatException if the property value is invalid
*/
public Double getDoubleProperty(String key, Double defaultValue);
@@ -76,11 +73,10 @@ public interface Config {
/**
* Return the byte property value with the given key, or {@code defaultValue} if the key doesn't
* exist.
- *
- * @param key the property name
+ *
+ * @param key the property name
* @param defaultValue the default value when key is not found
* @return the property value as byte
- *
* @throws NumberFormatException if the property value is invalid
*/
public Byte getByteProperty(String key, Byte defaultValue);
@@ -88,8 +84,8 @@ public interface Config {
/**
* Return the boolean property value with the given key, or {@code defaultValue} if the key
* doesn't exist.
- *
- * @param key the property name
+ *
+ * @param key the property name
* @param defaultValue the default value when key is not found
* @return the property value as boolean
*/
@@ -98,18 +94,24 @@ public interface Config {
/**
* Return the array property value with the given key, or {@code defaultValue} if the key doesn't
* exist.
- *
- * @param key the property name
- * @param delimiter the delimiter regex
+ *
+ * @param key the property name
+ * @param delimiter the delimiter regex
* @param defaultValue the default value when key is not found
- * @return
*/
public String[] getArrayProperty(String key, String delimiter, String[] defaultValue);
/**
* Add change listener to this config instance.
- *
+ *
* @param listener the config change listener
*/
public void addChangeListener(ConfigChangeListener listener);
+
+ /**
+ * Return a set of the property names
+ *
+ * @return the property names
+ */
+ public Set getPropertyNames();
}
diff --git a/apollo-client/src/main/java/com/ctrip/framework/apollo/internals/DefaultConfig.java b/apollo-client/src/main/java/com/ctrip/framework/apollo/internals/DefaultConfig.java
index 7d069a329dba0e51ce2ca02ff4a6d50251a79854..92bf7c26540b2e2f20f8548c7feb2ee8a1885802 100644
--- a/apollo-client/src/main/java/com/ctrip/framework/apollo/internals/DefaultConfig.java
+++ b/apollo-client/src/main/java/com/ctrip/framework/apollo/internals/DefaultConfig.java
@@ -14,10 +14,12 @@ import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.io.InputStream;
+import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Properties;
+import java.util.Set;
import java.util.concurrent.atomic.AtomicReference;
@@ -90,6 +92,16 @@ public class DefaultConfig extends AbstractConfig implements RepositoryChangeLis
return value == null ? defaultValue : value;
}
+ @Override
+ public Set getPropertyNames() {
+ Properties properties = m_configProperties.get();
+ if (properties == null) {
+ return Collections.emptySet();
+ }
+
+ return properties.stringPropertyNames();
+ }
+
@Override
public synchronized void onRepositoryChange(String namespace, Properties newProperties) {
if (newProperties.equals(m_configProperties.get())) {
diff --git a/apollo-client/src/main/java/com/ctrip/framework/apollo/internals/SimpleConfig.java b/apollo-client/src/main/java/com/ctrip/framework/apollo/internals/SimpleConfig.java
index 4460540558f9fc99cd1365684acef9222164354e..a5a8129275aec47f8c15df8e1bc5f61e68157d61 100644
--- a/apollo-client/src/main/java/com/ctrip/framework/apollo/internals/SimpleConfig.java
+++ b/apollo-client/src/main/java/com/ctrip/framework/apollo/internals/SimpleConfig.java
@@ -11,9 +11,11 @@ import com.dianping.cat.Cat;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Properties;
+import java.util.Set;
/**
* @author Jason Song(song_s@ctrip.com)
@@ -59,6 +61,15 @@ public class SimpleConfig extends AbstractConfig implements RepositoryChangeList
return this.m_configProperties.getProperty(key, defaultValue);
}
+ @Override
+ public Set getPropertyNames() {
+ if (m_configProperties == null) {
+ return Collections.emptySet();
+ }
+
+ return m_configProperties.stringPropertyNames();
+ }
+
@Override
public synchronized void onRepositoryChange(String namespace, Properties newProperties) {
if (newProperties.equals(m_configProperties)) {
diff --git a/apollo-client/src/test/java/com/ctrip/framework/apollo/ConfigServiceTest.java b/apollo-client/src/test/java/com/ctrip/framework/apollo/ConfigServiceTest.java
index 37a6e951a07c96096be322b38e58f135bd313c0d..6c1b355a9be3cc9758d7818b80a4915c97dd17bd 100644
--- a/apollo-client/src/test/java/com/ctrip/framework/apollo/ConfigServiceTest.java
+++ b/apollo-client/src/test/java/com/ctrip/framework/apollo/ConfigServiceTest.java
@@ -10,6 +10,8 @@ import org.junit.Before;
import org.junit.Test;
import org.unidal.lookup.ComponentTestCase;
+import java.util.Set;
+
import static org.junit.Assert.assertEquals;
/**
@@ -92,6 +94,11 @@ public class ConfigServiceTest extends ComponentTestCase {
return m_namespace + ":" + key;
}
+
+ @Override
+ public Set getPropertyNames() {
+ return null;
+ }
}
private static class MockConfigFile implements ConfigFile {
diff --git a/apollo-client/src/test/java/com/ctrip/framework/apollo/internals/DefaultConfigManagerTest.java b/apollo-client/src/test/java/com/ctrip/framework/apollo/internals/DefaultConfigManagerTest.java
index fe909a2b97d26556d1072aaace84a44de392d087..6b119a14638b792fcf47b497d79ccbfc08edb465 100644
--- a/apollo-client/src/test/java/com/ctrip/framework/apollo/internals/DefaultConfigManagerTest.java
+++ b/apollo-client/src/test/java/com/ctrip/framework/apollo/internals/DefaultConfigManagerTest.java
@@ -11,6 +11,8 @@ import org.junit.Before;
import org.junit.Test;
import org.unidal.lookup.ComponentTestCase;
+import java.util.Set;
+
import static org.hamcrest.core.IsEqual.equalTo;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
@@ -94,6 +96,11 @@ public class DefaultConfigManagerTest extends ComponentTestCase {
public String getProperty(String key, String defaultValue) {
return namespace + ":" + key;
}
+
+ @Override
+ public Set getPropertyNames() {
+ return null;
+ }
};
}
diff --git a/apollo-common/pom.xml b/apollo-common/pom.xml
index d2f321ddc98d002102ad75c0da167137bff74426..d078e273aa002b547d5fb858519d39dedc4cc693 100644
--- a/apollo-common/pom.xml
+++ b/apollo-common/pom.xml
@@ -4,7 +4,7 @@
com.ctrip.framework.apollo
apollo
- 0.0.9
+ 0.0.10-SNAPSHOT
../pom.xml
4.0.0
diff --git a/apollo-configservice/pom.xml b/apollo-configservice/pom.xml
index 8bdcfec14c5544a2f5f0fdc794544144978510ae..7c61d76f2a99a4f9a95c9483ccf53bb2de13acf4 100644
--- a/apollo-configservice/pom.xml
+++ b/apollo-configservice/pom.xml
@@ -4,7 +4,7 @@
com.ctrip.framework.apollo
apollo
- 0.0.9
+ 0.0.10-SNAPSHOT
../pom.xml
4.0.0
diff --git a/apollo-core/pom.xml b/apollo-core/pom.xml
index 6f3ef2ad1711f9ce125bdc2b2089f91a25fd898b..53473734f7cc527efa9e9f5613305e0781bf5553 100644
--- a/apollo-core/pom.xml
+++ b/apollo-core/pom.xml
@@ -4,7 +4,7 @@
com.ctrip.framework.apollo
apollo
- 0.0.9
+ 0.0.10-SNAPSHOT
../pom.xml
4.0.0
diff --git a/apollo-demo/pom.xml b/apollo-demo/pom.xml
index d5a6d40b8447db2fee27db943fad351ba2afe498..530c0cf91e971d31ece6245dc38732c3bb5ecbef 100644
--- a/apollo-demo/pom.xml
+++ b/apollo-demo/pom.xml
@@ -4,7 +4,7 @@
apollo
com.ctrip.framework.apollo
- 0.0.9
+ 0.0.10-SNAPSHOT
4.0.0
apollo-demo
diff --git a/apollo-portal/pom.xml b/apollo-portal/pom.xml
index c3af43b41508cd80b854fa6632f48d65de99dc60..28edd3ea6e49b25408c112eee633782a7d3cb3e4 100644
--- a/apollo-portal/pom.xml
+++ b/apollo-portal/pom.xml
@@ -4,7 +4,7 @@
com.ctrip.framework.apollo
apollo
- 0.0.9
+ 0.0.10-SNAPSHOT
../pom.xml
4.0.0
diff --git a/pom.xml b/pom.xml
index d8319d209796c8c611249218341dce1f5944da8b..701fabc7f3cd3607772812b6a29da4e1ca05ca5d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
4.0.0
com.ctrip.framework.apollo
apollo
- 0.0.9
+ 0.0.10-SNAPSHOT
Apollo
pom
Ctrip Configuration Center