%line | %branch | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
org.apache.commons.jelly.tags.quartz.JellyJob |
|
|
1 | package org.apache.commons.jelly.tags.quartz; |
|
2 | ||
3 | /* |
|
4 | * Copyright 2002,2004 The Apache Software Foundation. |
|
5 | * |
|
6 | * Licensed under the Apache License, Version 2.0 (the "License"); |
|
7 | * you may not use this file except in compliance with the License. |
|
8 | * You may obtain a copy of the License at |
|
9 | * |
|
10 | * http://www.apache.org/licenses/LICENSE-2.0 |
|
11 | * |
|
12 | * Unless required by applicable law or agreed to in writing, software |
|
13 | * distributed under the License is distributed on an "AS IS" BASIS, |
|
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
15 | * See the License for the specific language governing permissions and |
|
16 | * limitations under the License. |
|
17 | */ |
|
18 | ||
19 | import org.apache.commons.jelly.JellyContext; |
|
20 | import org.apache.commons.jelly.Script; |
|
21 | import org.apache.commons.jelly.XMLOutput; |
|
22 | ||
23 | import org.quartz.Job; |
|
24 | import org.quartz.JobDetail; |
|
25 | import org.quartz.JobDataMap; |
|
26 | import org.quartz.JobExecutionContext; |
|
27 | import org.quartz.JobExecutionException; |
|
28 | ||
29 | /** Implementation of a quart <code>Job</code> to execute jellyscript. |
|
30 | * |
|
31 | * @author <a href="mailto:bob@eng.werken.com">bob mcwhirter</a> |
|
32 | */ |
|
33 | public class JellyJob implements Job |
|
34 | { |
|
35 | // ------------------------------------------------------------ |
|
36 | // Constructors |
|
37 | // ------------------------------------------------------------ |
|
38 | ||
39 | /** Construct. |
|
40 | */ |
|
41 | public JellyJob() |
|
42 | 0 | { |
43 | // intentionally left blank. |
|
44 | 0 | } |
45 | ||
46 | // ------------------------------------------------------------ |
|
47 | // Instance methods |
|
48 | // ------------------------------------------------------------ |
|
49 | ||
50 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
51 | // org.quartz.Job |
|
52 | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
53 | ||
54 | /** Execute this job. |
|
55 | * |
|
56 | * @param jobContext Job context data. |
|
57 | * |
|
58 | * @throws JobExecutionException If an error occurs during job execution. |
|
59 | */ |
|
60 | public void execute(JobExecutionContext jobContext) throws JobExecutionException |
|
61 | { |
|
62 | ||
63 | 0 | JobDetail detail = jobContext.getJobDetail(); |
64 | ||
65 | 0 | JobDataMap data = detail.getJobDataMap(); |
66 | ||
67 | 0 | Script script = (Script) data.get( "jelly.script" ); |
68 | ||
69 | 0 | JellyContext jellyContext = (JellyContext) data.get( "jelly.context" ); |
70 | ||
71 | 0 | XMLOutput output = (XMLOutput) data.get( "jelly.output" ); |
72 | ||
73 | try |
|
74 | { |
|
75 | 0 | script.run( jellyContext, |
76 | output ); |
|
77 | 0 | output.flush(); |
78 | 0 | } |
79 | catch (Exception e) |
|
80 | { |
|
81 | 0 | e.printStackTrace(); |
82 | 0 | throw new JobExecutionException( e, |
83 | false ); |
|
84 | } |
|
85 | 0 | } |
86 | } |
This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |