@WriteOperation //FIXME: map with "message: Restarting" or couldn't restart public Boolean restart() { try { doRestart(); logger.info("Restarted"); return true; } catch (Exception e) { if (logger.isDebugEnabled()) { logger.info("Could not doRestart", e); } else { logger.info("Could not doRestart: " + e.getMessage()); } return false; } }
@Autowired EndpointCommand(ApplicationContext appCtx) { appCtx.getBeansWithAnnotation(Endpoint.class).entrySet().stream().forEachOrdered(entry -> { log.info("{} : {}", entry.getKey(), entry.getValue().getClass().getName()); for (Method m : entry.getValue().getClass().getDeclaredMethods()) { if (m.isAnnotationPresent(ReadOperation.class) || m.isAnnotationPresent(WriteOperation.class)) { log.info("\tOp: {}", m.getName()); for (Parameter p : m.getParameters()) { log.info("\t\tParameter {}, {}", p.getName(), p.getType().getName()); } } } }); }
@WriteOperation public Boolean pause() { if (isRunning()) { doPause(); return true; } return false; }
@WriteOperation public Boolean resume() { if (!isRunning()) { doResume(); return true; } return false; }
@WriteOperation public ResponseEntity<?> setStatus(String status) { Assert.notNull(status, "status may not by null"); if (this.registration == null) { return ResponseEntity.status(HttpStatus.NOT_FOUND).body("no registration found"); } this.serviceRegistry.setStatus(this.registration, status); return ResponseEntity.ok().build(); }
@WriteOperation public void busRefreshWithDestination(@Selector String destination) { //TODO: document destination publish(new RefreshRemoteApplicationEvent(this, getInstanceId(), destination)); }
@WriteOperation public void busRefresh() { publish(new RefreshRemoteApplicationEvent(this, getInstanceId(), null)); }
@WriteOperation public void busEnvWithDestination(String name, String value, @Selector String destination) { //TODO: document params Map<String, String> params = Collections.singletonMap(name, value); publish(new EnvironmentChangeRemoteApplicationEvent(this, getInstanceId(), destination, params)); }
@WriteOperation public void busEnv(String name, String value) { //TODO: document params Map<String, String> params = Collections.singletonMap(name, value); publish(new EnvironmentChangeRemoteApplicationEvent(this, getInstanceId(), null, params)); }
@WriteOperation public Object write(String name, String value) { environment.setProperty(name, value); return Collections.singletonMap(name, value); }
@WriteOperation public Collection<String> refresh() { Set<String> keys = contextRefresher.refresh(); return keys; }
@WriteOperation public Object reset() { this.publisher.publishEvent(new RoutesRefreshedEvent(this.routes)); return invoke(); }