Created
October 14, 2014 08:30
-
-
Save gurbuzali/5843beacd599f11b3625 to your computer and use it in GitHub Desktop.
msp store factory example
This file contains hidden or 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
| public static void main(String args[]) throws Exception { | |
| MapStoreFactory factory = new MapStoreFactory() { | |
| @Override | |
| public MapLoader newMapStore(String mapName, Properties properties) { | |
| return new BasicMapStore(mapName); | |
| } | |
| }; | |
| final Config config = new Config(); | |
| MapConfig mapConfig = config.getMapConfig("default"); | |
| MapStoreConfig mapStoreConfig = new MapStoreConfig(); | |
| mapStoreConfig.setEnabled(true).setFactoryImplementation(factory); | |
| mapConfig.setMapStoreConfig(mapStoreConfig); | |
| } | |
| static class BasicMapStore implements MapStore { | |
| String name; | |
| BasicMapStore(String name) { | |
| this.name = name; | |
| } | |
| @Override | |
| public void store(Object key, Object value) { | |
| } | |
| @Override | |
| public void storeAll(Map map) { | |
| } | |
| @Override | |
| public void delete(Object key) { | |
| } | |
| @Override | |
| public void deleteAll(Collection keys) { | |
| } | |
| @Override | |
| public Object load(Object key) { | |
| return null; | |
| } | |
| @Override | |
| public Map loadAll(Collection keys) { | |
| return null; | |
| } | |
| @Override | |
| public Set loadAllKeys() { | |
| return null; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment