Package org.lab41.dendrite.jobs

Examples of org.lab41.dendrite.jobs.AbstractJob


            throw e;
        }
    }

    protected void setJobProgress(JobMetadata.Id jobId, float progress) {
        MetaGraphTx tx = metaGraphService.newTransaction();
        try {
            JobMetadata jobMetadata = tx.getJob(jobId);
            jobMetadata.setProgress(progress);
            tx.commit();
        } catch (TitanException e) {
            logger.debug("exception", e);
            throw e;
        }
    }
View Full Code Here


    @RequestMapping(value = "/users/{userId}", method = RequestMethod.GET)
    @ResponseBody
    public GetUserResponse getUser(@PathVariable String userId) throws NotFound {

        MetaGraphTx tx = metaGraphService.buildTransaction().readOnly().start();

        try {
            UserMetadata userMetadata = tx.getUser(userId);

            if (userMetadata == null) {
                throw new NotFound(UserMetadata.class, userId);
            }

            return new GetUserResponse(userMetadata);
        } finally {
            tx.commit();
        }
    }
View Full Code Here

    public JobMetadata.Id getJobId() {
        return jobId;
    }

    protected void setJobName(JobMetadata.Id jobId, String name) {
        MetaGraphTx tx = metaGraph.newTransaction();
        try {
            JobMetadata jobMetadata = tx.getJob(jobId);
            jobMetadata.setName(name);
            tx.commit();
        } catch (TitanException e) {
            logger.debug("exception", e);
            throw e;
        }
    }
View Full Code Here

    protected void setJobState(JobMetadata.Id jobId, String state) {
        setJobState(jobId, state, null);
    }

    protected void setJobState(JobMetadata.Id jobId, String state, String msg) {
        MetaGraphTx tx = metaGraph.newTransaction();
        try {
            JobMetadata jobMetadata = tx.getJob(jobId);
            jobMetadata.setState(state);
            jobMetadata.setMessage(msg);

            if (state.equals(JobMetadata.DONE)) {
                jobMetadata.setProgress(1.0f);
            }

            tx.commit();
        } catch (TitanException e) {
            logger.debug("exception", e);
            throw e;
        }
    }
View Full Code Here

            throw e;
        }
    }

    protected void setJobProgress(JobMetadata.Id jobId, float progress) {
        MetaGraphTx tx = metaGraph.newTransaction();
        try {
            JobMetadata jobMetadata = tx.getJob(jobId);
            jobMetadata.setProgress(progress);
            tx.commit();
        } catch (TitanException e) {
            logger.debug("exception", e);
            throw e;
        }
    }
View Full Code Here

        MetaGraphTx tx = metaGraphService.buildTransaction().readOnly().start();

        try {
            JobMetadata jobMetadata = tx.getJob(jobId);
            if (jobMetadata == null) {
                throw new NotFound(JobMetadata.class, jobId);
            }

            return new GetJobResponse(jobMetadata);
        } finally {
            tx.commit();
View Full Code Here

        MetaGraphTx tx = metaGraphService.buildTransaction().readOnly().start();

        try {
            ProjectMetadata project = tx.getProject(projectId);
            if (project == null) {
                throw new NotFound(ProjectMetadata.class, projectId);
            }

            List<GetJobResponse> jobs = new ArrayList<>();
            for (JobMetadata jobMetadata : project.getJobs()) {
                jobs.add(new GetJobResponse(jobMetadata));
View Full Code Here

        DeleteJobResponse deleteJobResponse;

        try {
            JobMetadata jobMetadata = tx.getJob(jobId);
            if (jobMetadata == null) {
                throw new NotFound(JobMetadata.class, jobId);
            }

            tx.deleteJob(jobMetadata);

            deleteJobResponse = new DeleteJobResponse();
View Full Code Here

        try {
            UserMetadata userMetadata = tx.getUser(userId);

            if (userMetadata == null) {
                throw new NotFound(UserMetadata.class, userId);
            }

            return new GetUserResponse(userMetadata);
        } finally {
            tx.commit();
View Full Code Here

        MetaGraphTx tx = metaGraphService.buildTransaction().readOnly().start();

        try {
            BranchMetadata branchMetadata = tx.getBranch(branchId);
            if (branchMetadata == null) {
                throw new NotFound(BranchMetadata.class, branchId);
            }

            return new GetBranchResponse(branchMetadata);
        } finally {
            tx.commit();
View Full Code Here

TOP

Related Classes of org.lab41.dendrite.jobs.AbstractJob

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.