Examples of PredictionResponseHanlder


Examples of eu.irmosproject.pes.common.PredictionResponseHanlder

     * when the job is complete, it returns the response document
     */
    public static Document callEstimatePerformance(PesResource resource, Document request, String predictionRespSchema) {
        try {

            PredictionResponseHanlder respHandler = new PredictionResponseHanlder();
            Document response = null;

            resource.submitEstimationJob(request);

            String status = "";
            //loop until job complete
            try {
                while ((status != null) && (!status.equals(COMPLETED))) {
                    status = resource.checkStatus();
                    //sleep
                    Thread.sleep(intPollPeriod);
                }
            } catch (Exception ex) {
                throw new RuntimeException("error while checking job status ", ex);
            }
            System.out.println("status= " + status);
            //here we have a complete job
            response = resource.retrieveEstimationResult();

            if (response!=null && respHandler.validate(response, predictionRespSchema)) {
                System.out.println("Response Validated OK!!");
            }


            return response;
View Full Code Here

Examples of eu.irmosproject.pes.common.PredictionResponseHanlder

     * @return document which contains the new resource estimations
     */
    private static Document updateEstimation(PesResource resource, Document req, String responseSchema) {
        try {

            PredictionResponseHanlder respHandler = new PredictionResponseHanlder();
            Document response = null;

            resource.submitEstimationJob(req);

            String status = "";
            //loop until job complete
            try {
                while ((status != null) && (!status.equals(COMPLETED))) {
                    status = resource.checkStatus();
                    //sleep
                    Thread.sleep(intPollPeriod);
                }
            } catch (Exception ex) {
                throw new RuntimeException("error while checking job status ", ex);
            }

            //here we have a complete job
            response = resource.retrieveEstimationResult();

            if (respHandler.validate(response, responseSchema)) {
                System.out.println("Response Validated OK!!");
            }


            return response;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.