Package javax.json

Examples of javax.json.JsonObject


    @Inject
    Log LOG;

    public JsonObject getApplicationsContainerStatistics() {
        JsonObjectBuilder builder = Json.createObjectBuilder();
        JsonObject applications = collector.fetchApplications();
        Set<Map.Entry<String, JsonValue>> applicationsSet = applications.entrySet();
        for (Map.Entry<String, JsonValue> applicationEntry : applicationsSet) {
            final String applicationName = applicationEntry.getKey();
            JsonObject stats = collector.fetchApplicationStatistics(applicationName);
            builder.add(applicationName, stats);
        }
        return builder.build();
    }
View Full Code Here


        return collector.fetchApplicationStatistics(applicationName);
    }

    public JsonObject getBeanStatistics(String applicationName) {
        JsonObjectBuilder builder = Json.createObjectBuilder();
        JsonObject components = collector.fetchApplicationComponents(applicationName);
        Set<Map.Entry<String, JsonValue>> entrySet = components.entrySet();
        for (Map.Entry<String, JsonValue> entry : entrySet) {
            String beanName = entry.getKey();
            if (!"server".equals(beanName)) {
                final JsonObject beanStatistics = getBeanStatistics(applicationName, beanName);
                if (beanName == null || beanStatistics == null) {
                    LOG.info("!!!NULL -> Beanname: " + beanName + " -> " + beanStatistics);
                } else {
                    builder.add(beanName, beanStatistics);
                }
View Full Code Here

        return builder.build();
    }

    public JsonObject getBeanStatistics(String applicationName, String beanName) {
        JsonObjectBuilder builder = Json.createObjectBuilder();
        JsonObject components = collector.fetchMethods(applicationName, beanName);
        if (components == null) {
            return builder.addNull("-- no methods --").build();
        }
        Set<Map.Entry<String, JsonValue>> entrySet = components.entrySet();
        for (Map.Entry<String, JsonValue> component : entrySet) {
            String methodName = component.getKey();
            JsonObject methodStatistics = collector.fetchMethodStatistics(applicationName, beanName, methodName);
            if (beanName == null || methodStatistics == null) {
                LOG.info("!!!NULL -> Beanname: " + beanName + " -> " + methodStatistics);
            } else {
                builder.add(methodName, methodStatistics);
            }
View Full Code Here

    public PoolStatistics(JsonObject statistics) {
        this.statistics = statistics;
    }

    public IntegerProperty currentThreadsWaitingProperty() {
        final JsonObject threadsStatistics = getThreadsStatistics();
        if (threadsStatistics == null) {
            return NOT_AVAILABLE;
        }
        int value = threadsStatistics.getInt("current");
        currentThreadsWaiting.set(value);
        return this.currentThreadsWaiting;
    }
View Full Code Here

    public int getCurrentThreadsWaiting() {
        return currentThreadsWaitingProperty().get();
    }

    public IntegerProperty threadsWaitingHighwatermarkProperty() {
        final JsonObject threadsStatistics = getThreadsStatistics();
        if (threadsStatistics == null) {
            return NOT_AVAILABLE;
        }
        int value = threadsStatistics.getInt("highwatermark");
        currentThreadsWaiting.set(value);
        return this.currentThreadsWaiting;
    }
View Full Code Here

    public IntegerProperty totalBeansCreatedProperty() {
        if (statistics == null) {
            return NOT_AVAILABLE;
        }
        final JsonObject jsonObject = statistics.getJsonObject("totalbeanscreated");
        int value = jsonObject.getInt("count");
        totalBeansCreated.set(value);
        return totalBeansCreated;
    }
View Full Code Here

    public IntegerProperty totalBeansDestroyedProperty() {
        if (statistics == null) {
            return NOT_AVAILABLE;
        }
        final JsonObject jsonObject = statistics.getJsonObject("totalbeansdestroyed");
        int value = jsonObject.getInt("count");
        totalBeansDestroyed.set(value);
        return totalBeansDestroyed;
    }
View Full Code Here

    public void init() {
        this.client = ClientBuilder.newClient();
    }

    public String changeInterval(String location,int newValue){
        JsonObject interval = Json.createObjectBuilder().add("interval", newValue).add("location",location).build();
        WebTarget administrationTarget = getAdministrationTarget();
        final Response response = administrationTarget.request().post(Entity.json(interval));
        return response.readEntity(JsonObject.class).getString("nextTimeout");

    }
View Full Code Here

        return this.client.target(getUri());
    }

    public Pair<String,String> status(){
        Response response = getAdministrationTarget().request().get();
        JsonObject status = response.readEntity(JsonObject.class);
        String nextTimeout = status.getString("nextTimeout");
        String currentInterval = status.getString("interval");
        return new Pair<String, String>(currentInterval,nextTimeout);


    }
View Full Code Here

            final JsonValue value = entry.getValue();
            //this bean has no methods, the content is: {"-- no methods --":null}
            if(!(value instanceof JsonObject)){
                continue;
            }
            JsonObject methodStatistics = (JsonObject)value;
            statistics.add(new MethodStatistics(methodName,methodStatistics));
        }
        return statistics;
    }
View Full Code Here

TOP

Related Classes of javax.json.JsonObject

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.