Package org.glassfish.api.admin.progress

Examples of org.glassfish.api.admin.progress.JobInfos


    public void doPersist(JobInfos jobInfos, JobInfo jobInfo) {
        File file = jobInfo.getJobsFile();
        synchronized (file) {

            if (jobInfos == null)
                jobInfos = new JobInfos();

            try {
                JAXBContext jaxbContext = JAXBContext.newInstance(JobInfos.class);
                jaxbMarshaller = jaxbContext.createMarshaller();
                jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
View Full Code Here


    public void postConstruct() {

        jaxbContext = jobManager.getJAXBContext();
        jobInfos = jobManager.getCompletedJobs();
        if (jobInfos == null)
            jobInfos = new JobInfos();
    }
View Full Code Here

     * and need to be purged
     * @return  list of jobs to be purged
     */
    public synchronized ArrayList<JobInfo> getExpiredJobs() {
        ArrayList<JobInfo> expiredJobs = new ArrayList<JobInfo>();
        JobInfos jobInfos = getCompletedJobs();
        for(JobInfo job:jobInfos.getJobInfoList()) {

            long executedTime = job.commandExecutionDate;
            long currentTime = System.currentTimeMillis();

            long jobsRetentionPeriod = 86400000;
View Full Code Here

                if (jaxbContext == null)
                    jaxbContext = JAXBContext.newInstance(JobInfos.class);
                Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();

                if (jobsFile != null && jobsFile.exists())  {
                    JobInfos jobInfos = (JobInfos)unmarshaller.unmarshal(jobsFile);
                    return jobInfos;
                }
            } catch (JAXBException e) {
                throw new RuntimeException(adminStrings.getLocalString("error.reading.completed.jobs","Error reading completed jobs ",  e.getLocalizedMessage()), e);
            }
View Full Code Here

     * @param jobId the job to purge
     * @return  the new list of completed jobs
     */
    @Override
    public  JobInfos purgeCompletedJobForId(String jobId) {
        JobInfos completedJobInfos = getCompletedJobs();
        synchronized (jobsFile) {
            CopyOnWriteArrayList<JobInfo> jobList = new CopyOnWriteArrayList<JobInfo>();

            if (completedJobInfos != null)   {
                jobList.addAll(completedJobInfos.getJobInfoList());

                for (JobInfo jobInfo: jobList ) {
                    if (jobInfo.jobId.equals(jobId)) {
                        jobList.remove(jobInfo);
                    }

                }
            }

            JobInfos jobInfos = new JobInfos();
            try {
                if (jaxbContext == null)
                    jaxbContext = JAXBContext.newInstance(JobInfos.class);

                jobInfos.setJobInfoList(jobList);
                Marshaller jaxbMarshaller = jaxbContext.createMarshaller();
                jaxbMarshaller.marshal(jobInfos, jobsFile);
            } catch (JAXBException e) {
                throw new RuntimeException(adminStrings.getLocalString("error.purging.completed.job","Error purging completed job ", jobId,e.getLocalizedMessage()), e);
            }
View Full Code Here

                    String exitCode = actionReport == null ? "" : actionReport.getActionExitCode().name();
                    jobsToReport.add(new JobInfo(job.getId(),job.getName(),job.getCommandExecutionDate(),exitCode,userList.get(0),message,job.getJobsFile(),job.getState().name(),0));
                }
            }

            JobInfos completedJobs = getCompletedJobs();
            if (completedJobs != null ) {
                for (JobInfo info : completedJobs.getJobInfoList()) {
                    if (!skipJob(info.jobName)) {
                        jobsToReport.add(info);
                    }
                }
            }
View Full Code Here

        JobInfo jobInfo = (JobInfo)obj;
        File file = new File(
              serverEnvironment.getConfigDirPath(),JOBS_FILE);
        jobInfos = jobManager.getCompletedJobs();
                if (jobInfos == null)
                    jobInfos = new JobInfos();
        try {
            JAXBContext jaxbContext = JAXBContext.newInstance(JobInfos.class);
            jaxbMarshaller = jaxbContext.createMarshaller();
            jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
            jobInfos.getJobInfoList().add(jobInfo);
View Full Code Here

                    String message = job.getActionReport() == null ? "" : job.getActionReport().getMessage();
                    jobInfoList.add(new JobInfo(job.getId(),job.getName(),job.getCommandExecutionDate(),job.getState().name(),"user",message));
                }
            }

            JobInfos completedJobs = jobManagerService.getCompletedJobs();
            if (completedJobs != null ) {
                for (JobInfo info : completedJobs.getJobInfoList()) {
                    if (!skipJob(info.jobName)) {
                        jobInfoList.add(info);
                    }
                }
            }
View Full Code Here

                    String message = job.getActionReport() == null ? "" : job.getActionReport().getMessage();
                    jobInfoList.add(new JobInfo(job.getId(),job.getName(),job.getCommandExecutionDate(),job.getState().name(),userList.get(0),message));
                }
            }

            JobInfos completedJobs = jobManagerService.getCompletedJobs();
            if (completedJobs != null ) {
                for (JobInfo info : completedJobs.getJobInfoList()) {
                    if (!skipJob(info.jobName)) {
                        jobInfoList.add(info);
                    }
                }
            }
View Full Code Here

     * and need to be purged
     * @return  list of jobs to be purged
     */
    public synchronized ArrayList<JobInfo> getExpiredJobs() {
        ArrayList<JobInfo> expiredJobs = new ArrayList<JobInfo>();
        JobInfos jobInfos = getCompletedJobs();
        for(JobInfo job:jobInfos.getJobInfoList()) {

            long executedTime = job.commandExecutionDate;
            long currentTime = System.currentTimeMillis();

            long jobsRetentionPeriod = 86400000;
View Full Code Here

TOP

Related Classes of org.glassfish.api.admin.progress.JobInfos

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.