View Javadoc

1   /*
2    * Copyright (c) 2003 Peter Antman, Teknik i Media  <peter.antman@tim.se>
3    *
4    * $Id: HelloWorld.java,v 1.1.1.1 2004/05/19 12:14:31 pra Exp $
5    *
6    * This library is free software; you can redistribute it and/or
7    * modify it under the terms of the GNU Lesser General Public
8    * License as published by the Free Software Foundation; either
9    * version 2 of the License, or (at your option) any later version
10   * 
11   * This library is distributed in the hope that it will be useful,
12   * but WITHOUT ANY WARRANTY; without even the implied warranty of
13   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14   * Lesser General Public License for more details.
15   * 
16   * You should have received a copy of the GNU Lesser General Public
17   * License along with this library; if not, write to the Free Software
18   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19   */
20  package org.backsource.qcron;
21  import javax.management.ObjectName;
22  import javax.management.MBeanServer;
23  import javax.management.MalformedObjectNameException;
24  import org.quartz.Job;
25  import org.quartz.JobExecutionContext;
26  import org.quartz.JobExecutionException;
27  import org.backsource.jmx.ServiceMBeanSupport;
28  import org.backsource.jmx.ObjectNameFactory;
29  /***
30   *
31   *
32   * @author <a href="mailto:pra@tim.se">Peter Antman</a>
33   * @version $Revision: 1.1.1.1 $
34   * @jmx:mbean name="cron:name=HelloWorld" extends="org.backsource.jmx.ServiceMBean,org.quartz.Job"
35   */
36  
37  public class HelloWorld extends ServiceMBeanSupport
38     implements HelloWorldMBean,Job {
39     public static final javax.management.ObjectName OBJECT_NAME = ObjectNameFactory.create("cron:name=CronEntry");
40     protected ObjectName objectName = OBJECT_NAME;
41  
42     protected MBeanServer server;
43     public HelloWorld (){
44        
45     }
46     
47     protected ObjectName getObjectName(MBeanServer server, ObjectName name)
48        throws MalformedObjectNameException
49     {
50        this.server = server;
51        if ( objectName != null) {
52           this.objectName = name;
53        } // end of if ()
54        
55        return this.objectName;
56     }
57     /***
58      * @jmx:managed-operation
59      */
60     public void execute(JobExecutionContext context)
61        throws JobExecutionException {
62        log.info("Hello World called with: " + context);
63     }
64  }// HelloWorld