forked from apolloconfig/apollo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request apolloconfig#1470 from nobodyiam/config-source
add getSourceType api
- Loading branch information
Showing
16 changed files
with
268 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
package com.ctrip.framework.apollo; | ||
|
||
import com.ctrip.framework.apollo.core.enums.ConfigFileFormat; | ||
import com.ctrip.framework.apollo.enums.ConfigSourceType; | ||
|
||
/** | ||
* @author Jason Song([email protected]) | ||
|
@@ -36,4 +37,19 @@ public interface ConfigFile { | |
* @param listener the config file change listener | ||
*/ | ||
void addChangeListener(ConfigFileChangeListener listener); | ||
|
||
/** | ||
* Remove the change listener | ||
* | ||
* @param listener the specific config change listener to remove | ||
* @return true if the specific config change listener is found and removed | ||
*/ | ||
public boolean removeChangeListener(ConfigChangeListener listener); | ||
|
||
/** | ||
* Return the config's source type, i.e. where is the config loaded from | ||
* | ||
* @return the config's source type | ||
*/ | ||
public ConfigSourceType getSourceType(); | ||
} |
18 changes: 18 additions & 0 deletions
18
apollo-client/src/main/java/com/ctrip/framework/apollo/enums/ConfigSourceType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.ctrip.framework.apollo.enums; | ||
|
||
/** | ||
* To indicate the config's source type, i.e. where is the config loaded from | ||
*/ | ||
public enum ConfigSourceType { | ||
REMOTE("Loaded from remote config service"), LOCAL("Loaded from local cache"), NONE("Load failed"); | ||
|
||
private final String description; | ||
|
||
ConfigSourceType(String description) { | ||
this.description = description; | ||
} | ||
|
||
public String getDescription() { | ||
return description; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.