KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > scalagent > joram > mom > dest > scheduler > SchedulerQueue


1 /*
2  * JORAM: Java(TM) Open Reliable Asynchronous Messaging
3  * Copyright (C) 2005 - 2007 ScalAgent Distributed Technologies
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
18  * USA.
19  *
20  * Initial developer(s): ScalAgent Distributed Technologies
21  * Contributor(s):
22  */

23 package com.scalagent.joram.mom.dest.scheduler;
24
25 import java.util.Properties JavaDoc;
26
27 import org.objectweb.joram.mom.dest.DestinationImpl;
28 import org.objectweb.joram.mom.dest.Queue;
29 import org.objectweb.util.monolog.api.BasicLevel;
30
31 import com.scalagent.scheduler.Condition;
32
33 import fr.dyade.aaa.agent.AgentId;
34 import fr.dyade.aaa.agent.Notification;
35
36 public class SchedulerQueue extends Queue {
37   public static final String JavaDoc QUEUE_SCHEDULER_TYPE = "queue_scheduler";
38
39   public static String JavaDoc getDestinationType() {
40     return QUEUE_SCHEDULER_TYPE;
41   }
42     
43   public static void init(String JavaDoc args, boolean firstTime) throws Exception JavaDoc {
44     if (! firstTime) return;
45   }
46     
47   /**
48    * Empty constructor for newInstance().
49    */

50   public SchedulerQueue() {}
51     
52   /**
53    * Creates the <tt>QueueImpl</tt>.
54    *
55    * @param adminId Identifier of the queue administrator.
56    * @param prop The initial set of properties.
57    */

58   public DestinationImpl createsImpl(AgentId adminId, Properties JavaDoc prop) {
59     return new SchedulerQueueImpl(getId(), adminId, prop);
60   }
61   
62   public void react(AgentId from, Notification not)
63   throws Exception JavaDoc {
64     if (logger.isLoggable(BasicLevel.DEBUG))
65       logger.log(BasicLevel.DEBUG,
66           "SchedulerQueue.react(" + from + ',' + not + ')');
67     if (not instanceof Condition) {
68       ((SchedulerQueueImpl) destImpl).condition((Condition) not);
69     } else
70       super.react(from, not);
71   }
72 }
73
74
Popular Tags