Examples of WebServiceResponse


Examples of com.dtolabs.client.utils.WebserviceResponse

        }
        if (null != end) {
            params.put("end", Long.toString(end.getTime()));
        }

        final WebserviceResponse response;
        try {
            response = serverService.makeRundeckRequest(RUNDECK_API_EXECUTION_REPORT, null, params);
        } catch (MalformedURLException e) {
            throw new CentralDispatcherServerRequestException("Failed to make request", e);
        }
View Full Code Here

Examples of com.dtolabs.client.utils.WebserviceResponse

        if (null != otherparams) {
            params.putAll(otherparams);
        }
        final HashMap<String, String> formdata = new HashMap<String, String>();
        formdata.put("a", "a");
        final WebserviceResponse response;
        try {
            response = serverService.makeRundeckRequest(requestPath, params, tempxml, "POST", null,formdata,"xmlBatch");
        } catch (MalformedURLException e) {
            throw new CentralDispatcherServerRequestException("Failed to make request", e);
        }
View Full Code Here

Examples of com.dtolabs.client.utils.WebserviceResponse

        final HashMap<String, String> data = new HashMap<String, String>();
        if (null != dataValues) {
            data.putAll(dataValues);
        }

        final WebserviceResponse response;
        try {
            response = serverService.makeRundeckRequest(requestPath, params, tempxml, null, null, data, uploadFileParam);
        } catch (MalformedURLException e) {
            throw new CentralDispatcherServerRequestException("Failed to make request", e);
        }
        validateResponse(response);

        final Document resultDoc = response.getResultDoc();

        if (null != resultDoc.selectSingleNode("/result/execution") && null != resultDoc.selectSingleNode(
            "/result/execution/@id")) {
            final Node node = resultDoc.selectSingleNode("/result/execution/@id");
            final String succeededId = node.getStringValue();
View Full Code Here

Examples of com.dtolabs.client.utils.WebserviceResponse

                "Unsupported operation: project is required by the RunDeck API");
        }
        final HashMap<String, String> params = new HashMap<String, String>();
        params.put("project", project);

        final WebserviceResponse response;
        try {
            response = serverService.makeRundeckRequest(RUNDECK_API_LIST_EXECUTIONS_PATH, params, null, null,
                                                        null);
        } catch (MalformedURLException e) {
            throw new CentralDispatcherServerRequestException("Failed to make request", e);
View Full Code Here

Examples of com.dtolabs.client.utils.WebserviceResponse

        //:( trigger POST correctly
        data.put("a", "a");

        final String rundeckApiKillJobPath = substitutePathVariable(RUNDECK_API_KILL_JOB_PATH, "id", execId);
        //2. send request via ServerService
        final WebserviceResponse response;
        try {
            response = serverService.makeRundeckRequest(rundeckApiKillJobPath, params, null, "POST", null,data,null);
        } catch (MalformedURLException e) {
            throw new CentralDispatcherServerRequestException("Failed to make request", e);
        }
View Full Code Here

Examples of com.dtolabs.client.utils.WebserviceResponse

    public ExecutionDetail getExecution(final String execId) throws CentralDispatcherException {
        final HashMap<String, String> params = new HashMap<String, String>();

        final String rundeckApiKillJobPath = substitutePathVariable(RUNDECK_API_EXECUTION_PATH, "id", execId);
        //2. send request via ServerService
        final WebserviceResponse response;
        try {
            response = serverService.makeRundeckRequest(rundeckApiKillJobPath, params, null, null, null);
        } catch (MalformedURLException e) {
            throw new CentralDispatcherServerRequestException("Failed to make request", e);
        }
View Full Code Here

Examples of com.dtolabs.client.utils.WebserviceResponse

            }
            params.put("maxlines", "500");

            logger.debug("request" + rundeckApiExecOutputJobPath + " params: " + params);
            //2. send request via ServerService
            final WebserviceResponse response;
            try {
                response = serverService.makeRundeckRequest(rundeckApiExecOutputJobPath, params, null, null, null);
            } catch (MalformedURLException e) {
                throw new CentralDispatcherServerRequestException("Failed to make request", e);
            }
View Full Code Here

Examples of com.dtolabs.client.utils.WebserviceResponse

        if (null != idlistFilter) {
            params.put("idlist", idlistFilter);
        }

        //2. send request via ServerService
        final WebserviceResponse response;
        try {
            response = serverService.makeRundeckRequest(RUNDECK_API_JOBS_EXPORT_PATH, params, null, null,
                expectedContentType, null);
        } catch (MalformedURLException e) {
            throw new CentralDispatcherServerRequestException("Failed to make request", e);
        }
        checkErrorResponse(response);
        //if xml, do local validation and listing
        if (null == fformat || fformat == JobDefinitionFileFormat.xml) {
            validateJobsResponse(response);

            ////////////////////
            //parse result list of queued items, return the collection of QueuedItems
            ///////////////////

            final Document resultDoc = response.getResultDoc();

            final Node node = resultDoc.selectSingleNode("/joblist");
            final ArrayList<IStoredJob> list = new ArrayList<IStoredJob>();
            if (null == node) {
                return list;
            }
            final List items = node.selectNodes("job");
            if (null != items && items.size() > 0) {
                for (final Object o : items) {
                    final Node node1 = (Node) o;
                    final Node uuid = node1.selectSingleNode("uuid");
                    final Node id1 = node1.selectSingleNode("id");
                    final String id = null!=uuid?uuid.getStringValue():id1.getStringValue();
                    final String name = node1.selectSingleNode("name").getStringValue();
                    final String url = createJobURL(id);

                    final Node gnode = node1.selectSingleNode("group");
                    final String group = null != gnode ? gnode.getStringValue() : null;
                    final String description = node1.selectSingleNode("description").getStringValue();
                    list.add(StoredJobImpl.create(id, name, url, group, description, projectFilter));
                }
            }

            if (null != output) {
                //write output doc to the outputstream
                final OutputFormat format = OutputFormat.createPrettyPrint();
                try {
                    final XMLWriter writer = new XMLWriter(output, format);
                    writer.write(resultDoc);
                    writer.flush();
                } catch (IOException e) {
                    throw new CentralDispatcherServerRequestException(e);
                }
            }
            return list;
        } else if (fformat == JobDefinitionFileFormat.yaml) {
            //do rough yaml parse

            final Collection<Map> mapCollection;
            //write to temp file

            File temp;
            InputStream tempIn;
            try {
                temp= File.createTempFile("listStoredJobs", ".yaml");
                temp.deleteOnExit();
                OutputStream os = new FileOutputStream(temp);
                try{
                    Streams.copyStream(response.getResultStream(), os);
                }finally {
                    os.close();
                }
                tempIn = new FileInputStream(temp);
                try {
View Full Code Here

Examples of com.dtolabs.client.utils.WebserviceResponse

    public Collection<DeleteJobResult> deleteStoredJobs(Collection<String> jobIds) throws CentralDispatcherException {
        final Map<String, Object> params = new HashMap<String, Object>();

        params.put("ids", jobIds);
        final WebserviceResponse response;
        try {
            response = serverService.makeRundeckRequest(RUNDECK_API_JOBS_BULK_DELETE_PATH, null, params );
        } catch (MalformedURLException e) {
            throw new CentralDispatcherServerRequestException("Failed to make request", e);
        }
        checkErrorResponse(response);

        ////////////////////
        //parse result list of delete result items, return the collection of DeleteJobResult
        ///////////////////

        final Document result = response.getResultDoc();

        final int succeeded;
        final int failed;
        Node node = result.selectSingleNode("/result/deleteJobs/succeeded/@count");
        if (null != node) {
View Full Code Here

Examples of com.dtolabs.client.utils.WebserviceResponse

        if (null != idlistFilter) {
            params.put("idlist", idlistFilter);
        }

        //2. send request via ServerService
        final WebserviceResponse response;
        try {
            response = serverService.makeRundeckRequest(RUNDECK_API_JOBS_LIST_PATH, params, null, null, null);
        } catch (MalformedURLException e) {
            throw new CentralDispatcherServerRequestException("Failed to make request", e);
        }
        validateResponse(response);
        //extract job list
        final Document resultDoc = response.getResultDoc();
        final ArrayList<IStoredJob> list = new ArrayList<IStoredJob>();

        final Node jobs = resultDoc.selectSingleNode("/result/jobs");
        for (final Object job1 : jobs.selectNodes("job")) {
            final Node job = (Node) job1;
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.