Skip to content

Instantly share code, notes, and snippets.

@gurbuzali
Created October 14, 2014 08:30
Show Gist options
  • Save gurbuzali/5843beacd599f11b3625 to your computer and use it in GitHub Desktop.
Save gurbuzali/5843beacd599f11b3625 to your computer and use it in GitHub Desktop.
msp store factory example
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