EMMA Coverage Report (generated Sun Sep 18 11:34:27 PHT 2011)
[all classes][org.apache.maven.continuum.scheduler]

COVERAGE SUMMARY FOR SOURCE FILE [ContinuumPurgeJob.java]

nameclass, %method, %block, %line, %
ContinuumPurgeJob.java0%   (0/1)0%   (0/2)0%   (0/76)0%   (0/19)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ContinuumPurgeJob0%   (0/1)0%   (0/2)0%   (0/76)0%   (0/19)
ContinuumPurgeJob (): void 0%   (0/1)0%   (0/3)0%   (0/1)
execute (JobExecutionContext): void 0%   (0/1)0%   (0/73)0%   (0/18)

1package org.apache.maven.continuum.scheduler;
2 
3/*
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements.  See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership.  The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License.  You may obtain a copy of the License at
11 *
12 *   http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied.  See the License for the
18 * specific language governing permissions and limitations
19 * under the License.
20 */
21 
22import org.apache.continuum.purge.ContinuumPurgeManager;
23import org.apache.continuum.purge.ContinuumPurgeManagerException;
24import org.apache.maven.continuum.Continuum;
25import org.apache.maven.continuum.model.project.Schedule;
26import org.codehaus.plexus.scheduler.AbstractJob;
27import org.slf4j.Logger;
28import org.quartz.JobDetail;
29import org.quartz.JobExecutionContext;
30 
31/**
32 * @author Maria Catherine Tan
33 * @version $Id: ContinuumPurgeJob.java 780708 2009-06-01 16:29:31Z jmorales $
34 * @since 25 jul 07
35 */
36public class ContinuumPurgeJob
37    extends AbstractJob
38{
39    public static final String PURGE_GROUP = "PURGE_GROUP";
40        
41    public void execute( JobExecutionContext context )
42    {
43        if ( isInterrupted() )
44        {
45            return;
46        }
47 
48        // ----------------------------------------------------------------------
49        // Get the job detail
50        // ----------------------------------------------------------------------
51 
52        JobDetail jobDetail = context.getJobDetail();
53 
54        // ----------------------------------------------------------------------
55        // Get data map out of the job detail
56        // ----------------------------------------------------------------------
57 
58        Logger logger = (Logger) jobDetail.getJobDataMap().get( AbstractJob.LOGGER );
59 
60        String jobName = jobDetail.getName();
61 
62        logger.info( ">>>>>>>>>>>>>>>>>>>>> Executing purge job (" + jobName + ")..." );
63 
64        Continuum continuum = (Continuum) jobDetail.getJobDataMap().get( ContinuumSchedulerConstants.CONTINUUM );
65 
66        ContinuumPurgeManager purgeManager = continuum.getPurgeManager();
67        
68        Schedule schedule = (Schedule) jobDetail.getJobDataMap().get( ContinuumSchedulerConstants.SCHEDULE );
69 
70        try
71        {
72            purgeManager.purge( schedule );
73        }
74        catch ( ContinuumPurgeManagerException e )
75        {
76            logger.error( "Error purging for job" + jobName + ".", e );
77        }
78 
79        try
80        {
81            if ( schedule.getDelay() > 0 )
82            {
83                Thread.sleep( schedule.getDelay() * 1000 );
84            }
85        }
86        catch ( InterruptedException e )
87        {
88        }
89    }
90}

[all classes][org.apache.maven.continuum.scheduler]
EMMA 2.0.5312 (C) Vladimir Roubtsov