Java 类org.springframework.boot.actuate.endpoint.annotation.ReadOperation 实例源码

项目:spring-cloud-netflix    文件:FiltersEndpoint.java   
@ReadOperation
public Map<String, List<Map<String, Object>>> invoke() {
    // Map of filters by type
    final Map<String, List<Map<String, Object>>> filterMap = new TreeMap<>();

    for (ZuulFilter filter : this.filterRegistry.getAllFilters()) {
        // Ensure that we have a list to store filters of each type
        if (!filterMap.containsKey(filter.filterType())) {
            filterMap.put(filter.filterType(), new ArrayList<>());
        }

        final Map<String, Object> filterInfo = new LinkedHashMap<>();
        filterInfo.put("class", filter.getClass().getName());
        filterInfo.put("order", filter.filterOrder());
        filterInfo.put("disabled", filter.isFilterDisabled());
        filterInfo.put("static", filter.isStaticFilter());

        filterMap.get(filter.filterType()).add(filterInfo);
    }

    return filterMap;
}
项目:spring-cloud-consul    文件:ConsulEndpoint.java   
@ReadOperation
public ConsulData invoke() {
    ConsulData data = new ConsulData();
    // data.setKeyValues(kvClient.getKeyValueRecurse());
    Response<Map<String, Service>> agentServices = consul.getAgentServices();
    data.setAgentServices(agentServices.getValue());

    Response<Map<String, List<String>>> catalogServices = consul
            .getCatalogServices(QueryParams.DEFAULT);

    for (String serviceId : catalogServices.getValue().keySet()) {
        Response<List<CatalogService>> response = consul.getCatalogService(serviceId,
                QueryParams.DEFAULT);
        data.getCatalogServices().put(serviceId, response.getValue());
    }

    Response<List<Node>> catalogNodes = consul.getCatalogNodes(QueryParams.DEFAULT);
    data.setCatalogNodes(catalogNodes.getValue());

    return data;
}
项目:sshd-shell-spring-boot    文件:EndpointCommand.java   
@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());
                }
            }
        }
    });
}
项目:spring-cloud-commons    文件:ServiceRegistryEndpoint.java   
@ReadOperation
public ResponseEntity getStatus() {
    if (this.registration == null) {
        return ResponseEntity.status(HttpStatus.NOT_FOUND).body("no registration found");
    }

    return ResponseEntity.ok().body(this.serviceRegistry.getStatus(this.registration));
}
项目:spring-cloud-netflix    文件:RoutesEndpoint.java   
@ReadOperation
public Map<String, String> invoke() {
    Map<String, String> map = new LinkedHashMap<>();
    for (Route route : this.routes.getRoutes()) {
        map.put(route.getFullPath(), route.getLocation());
    }
    return map;
}
项目:spring-cloud-netflix    文件:RoutesEndpoint.java   
/**
 * Expose Zuul {@link Route} information with details.
 */
@ReadOperation
public Object invokeRouteDetails(@Selector String format) {
    if (FORMAT_DETAILS.equalsIgnoreCase(format)) {
        return invokeRouteDetails();
    } else {
        return invoke();
    }
}
项目:spring-cloud-netflix    文件:ArchaiusEndpoint.java   
@ReadOperation
public Map<String, Object> invoke() {
    Map<String, Object> map = new LinkedHashMap<>();
    AbstractConfiguration config = ConfigurationManager.getConfigInstance();
    if (config instanceof ConcurrentCompositeConfiguration) {
        ConcurrentCompositeConfiguration composite = (ConcurrentCompositeConfiguration) config;
        for (Configuration item : composite.getConfigurations()) {
            append(map, item);
        }
    }
    else {
        append(map, config);
    }
    return map;
}