View Javadoc
1 package org.apache.commons.jelly.tags.quartz; 2 3 /* 4 * $Header: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/quartz/JellyJob.java,v 1.1 2002/07/25 01:51:20 werken Exp $ 5 * $Revision: 1.1 $ 6 * $Date: 2002/07/25 01:51:20 $ 7 * 8 * ==================================================================== 9 * 10 * The Apache Software License, Version 1.1 11 * 12 * Copyright (c) 1999-2001 The Apache Software Foundation. All rights 13 * reserved. 14 * 15 * Redistribution and use in source and binary forms, with or without 16 * modification, are permitted provided that the following conditions 17 * are met: 18 * 19 * 1. Redistributions of source code must retain the above copyright 20 * notice, this list of conditions and the following disclaimer. 21 * 22 * 2. Redistributions in binary form must reproduce the above copyright 23 * notice, this list of conditions and the following disclaimer in 24 * the documentation and/or other materials provided with the 25 * distribution. 26 * 27 * 3. The end-user documentation included with the redistribution, if 28 * any, must include the following acknowlegement: 29 * "This product includes software developed by the 30 * Apache Software Foundation (http://www.apache.org/)." 31 * Alternately, this acknowlegement may appear in the software itself, 32 * if and wherever such third-party acknowlegements normally appear. 33 * 34 * 4. The names "The Jakarta Project", "Commons", and "Apache Software 35 * Foundation" must not be used to endorse or promote products derived 36 * from this software without prior written permission. For written 37 * permission, please contact apache@apache.org. 38 * 39 * 5. Products derived from this software may not be called "Apache" 40 * nor may "Apache" appear in their names without prior written 41 * permission of the Apache Group. 42 * 43 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED 44 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 45 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 46 * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR 47 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 48 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 49 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 50 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 51 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 52 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 53 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 54 * SUCH DAMAGE. 55 * ==================================================================== 56 * 57 * This software consists of voluntary contributions made by many 58 * individuals on behalf of the Apache Software Foundation. For more 59 * information on the Apache Software Foundation, please see 60 * <http://www.apache.org/>;. 61 * 62 */ 63 64 import org.apache.commons.jelly.JellyContext; 65 import org.apache.commons.jelly.Script; 66 import org.apache.commons.jelly.XMLOutput; 67 68 import org.quartz.Job; 69 import org.quartz.JobDetail; 70 import org.quartz.JobDataMap; 71 import org.quartz.JobExecutionContext; 72 import org.quartz.JobExecutionException; 73 74 /*** Implementation of a quart <code>Job</code> to execute jellyscript. 75 * 76 * @author <a href="mailto:bob@eng.werken.com">bob mcwhirter</a> 77 */ 78 public class JellyJob implements Job 79 { 80 // ------------------------------------------------------------ 81 // Constructors 82 // ------------------------------------------------------------ 83 84 /*** Construct. 85 */ 86 public JellyJob() 87 { 88 // intentionally left blank. 89 } 90 91 // ------------------------------------------------------------ 92 // Instance methods 93 // ------------------------------------------------------------ 94 95 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 96 // org.quartz.Job 97 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 98 99 /*** Execute this job. 100 * 101 * @param jobContext Job context data. 102 * 103 * @throws JobExecutionException If an error occurs during job execution. 104 */ 105 public void execute(JobExecutionContext jobContext) throws JobExecutionException 106 { 107 108 JobDetail detail = jobContext.getJobDetail(); 109 110 JobDataMap data = detail.getJobDataMap(); 111 112 Script script = (Script) data.get( "jelly.script" ); 113 114 JellyContext jellyContext = (JellyContext) data.get( "jelly.context" ); 115 116 XMLOutput output = (XMLOutput) data.get( "jelly.output" ); 117 118 try 119 { 120 script.run( jellyContext, 121 output ); 122 output.flush(); 123 } 124 catch (Exception e) 125 { 126 e.printStackTrace(); 127 throw new JobExecutionException( e, 128 false ); 129 } 130 } 131 }

This page was automatically generated by Maven