public Config(String name, List<Feature> features) { this.name = name; this.features = features; generateFeatureMap(); }
@Override public void onSuccess(Config config) { // calculate the map config.generateFeatureMap(); // store in mem Toggle.storeConfigInMem(config); // call the success method configRetrievedSuccess(config, checkRequest); }
@Override protected SetConfigResponse doInBackground(Void... params) { Config config = ConversionUtils.convertStringToConfig(configInString); // generate the map config.generateFeatureMap(); // store in memory Toggle.storeConfigInMem(config); // persist PersistUtils.storeConfig(context, config); return new SetConfigResponse(config); }
public CheckResponse getAndProcessCachedConfigSync(final CheckRequest checkRequest) { Config config = null; try { config = PersistUtils.getConfigSync(getContext()); } catch (Exception exception) { exception.printStackTrace(); return getExceptionCheckResponse(checkRequest); } // check for null if (config == null) { if (checkRequest.defaultState == null) { throw new IllegalStateException("No configuration found (Config) and no default state configured in the state check"); } return new CheckResponse(checkRequest.featureName, checkRequest.defaultState, null, null, true); } else { // generate the map config.generateFeatureMap(); } // process the config CheckResponse checkResponse = processConfig(config, checkRequest); return checkResponse; }
config.generateFeatureMap();
@Override protected CheckResponse doInBackground(Void... params) { // convert string to config Config config = ConversionUtils.convertStringToConfig(configInString); // generate the map config.generateFeatureMap(); // store config Toggle.storeConfigInMem(config); PersistUtils.storeConfig(checkRequest.toggle.getContext(), config); // process the resultant config CheckResponse result = checkRequest.toggle.processConfig(config, checkRequest); // disable the cache flag since this is a live request result.cached = false; return result; }
public void setConfig(String configInString) { setSourceType(SourceType.STRING); // store source PersistUtils.storeSourceType(getContext(), SourceType.STRING); // convert from string to config Config config = ConversionUtils.convertStringToConfig(configInString); // generate the map config.generateFeatureMap(); // store config storeConfigInMem(config); PersistUtils.storeConfig(getContext(), config); }
public void setConfig(JsonElement configInJson) { setSourceType(SourceType.JSONOBJECT); // store source PersistUtils.storeSourceType(getContext(), SourceType.JSONOBJECT); // convert from json to config Config config = ConversionUtils.convertJSONObjectToConfig(configInJson); // generate the map config.generateFeatureMap(); // store config storeConfigInMem(config); PersistUtils.storeConfig(getContext(), config); }
public void setConfig(Config config) { // check for the config map if (config.getFeatureMap() == null) config.generateFeatureMap(); setSourceType(SourceType.CONFIG); // store source PersistUtils.storeSourceType(getContext(), SourceType.CONFIG); // store config storeConfigInMem(config); PersistUtils.storeConfig(getContext(), config); }