/** * Sets the id. * * @param id * the new id */ public void setId(final String id) { this.put("id", id); }
@Override public WakeService build(){ final WakeServiceConfig config = new WakeServiceConfig(getParams()); final String id = new StateConfig(config.getState()).getId(); WakeService service = null; if (SERVICES.containsKey(id)) { service = SERVICES.get(id); } service = new WakeService(config); return service; }
/** * Load state. * * @param sc * the sc */ private void loadState(final ObjectNode sc) { if (sc != null) { final StateConfig stateConfig = new StateConfig(sc); if (agentId != null && stateConfig.getId() == null) { stateConfig.setId(agentId); } state = new StateBuilder().withConfig(stateConfig).build(); config.set("state", stateConfig); } }
/** * Load. * * @param key * the key * @return the instantiation entry */ private InstantiationEntry load(final String key) { final State innerState = new StateBuilder().withConfig( new StateConfig((ObjectNode) myParams.get("state")).put("id", key)).build(); final InstantiationEntry result = innerState.get("entry", INSTANTIATIONENTRY); if(result!=null) { result.setState(innerState); } return result; }
@Override public InstantiationService build() { final InstantiationServiceConfig config = new InstantiationServiceConfig( getParams()); final String id = new StateConfig(config.getState()).getId(); InstantiationService service = null; if (SERVICES.containsKey(id)) { service = SERVICES.get(id); } else { service = new InstantiationService(config, cl); } return service; }
/** * Load scheduler. * * @param schedulerConfig * the scheduler config */ private void loadScheduler(final ObjectNode params) { final SimpleSchedulerConfig schedulerConfig = new SimpleSchedulerConfig( params); if (schedulerConfig != null) { if (agentId != null && schedulerConfig.has("state")) { final StateConfig stateConfig = new StateConfig( (ObjectNode) schedulerConfig.get("state")); if (stateConfig.getId() == null) { stateConfig.setId("scheduler_" + agentId); schedulerConfig.set("state", stateConfig); } } if (agentId != null && schedulerConfig.getId() == null) { schedulerConfig.setId(agentId); } scheduler = new SchedulerBuilder().withConfig(schedulerConfig) .withHandle(receiver).build(); config.set("scheduler", schedulerConfig); } }
/** * Removes the specific state. * * @param key * the key * @param val * the val */ private void remove(final String key, final InstantiationEntry val) { State innerState = null; if (val != null) { innerState = val.getState(); } if (innerState == null) { innerState = new StateBuilder().withConfig( new StateConfig((ObjectNode) myParams.get("state")).put( "id", key)).build(); } if (innerState != null) { innerState.delete(); } }
final StateConfig config = new StateConfig(params); final String id = config.getId();
/** * Store. * * @param key * the key * @param val * the val */ private void store(final String key, final InstantiationEntry val) { State innerState = null; if (val != null) { innerState = val.getState(); } if (innerState == null) { innerState = new StateBuilder().withConfig( new StateConfig((ObjectNode) myParams.get("state")).put( "id", key)).build(); } if (innerState != null) { innerState.put("entry", JOM.getInstance().valueToTree(val)); } }