1 24 package org.objectweb.joram.mom.dest; 25 26 import java.util.Properties ; 27 28 import org.objectweb.joram.mom.dest.AdminTopicImpl.AdminRequestNot; 29 import org.objectweb.joram.mom.notifications.AdminReply; 30 import org.objectweb.joram.mom.notifications.GetProxyIdListNot; 31 import org.objectweb.joram.mom.notifications.GetProxyIdNot; 32 import org.objectweb.joram.mom.notifications.RegisterDestNot; 33 import org.objectweb.joram.mom.notifications.RegisterTmpDestNot; 34 import org.objectweb.joram.mom.notifications.RegisteredDestNot; 35 import org.objectweb.joram.mom.proxies.AdminNotification; 36 import org.objectweb.util.monolog.api.BasicLevel; 37 38 import fr.dyade.aaa.agent.AgentId; 39 import fr.dyade.aaa.agent.AgentServer; 40 import fr.dyade.aaa.agent.Notification; 41 42 48 public class AdminTopic extends Topic { 49 52 public AdminTopic() { 53 super("JoramAdminTopic", true, AgentId.JoramAdminStamp); 54 init(null, null); 55 } 56 57 63 public DestinationImpl createsImpl(AgentId adminId, Properties prop) { 64 return new AdminTopicImpl(getId()); 65 } 66 67 70 public static AgentId getDefault(short serverId) { 71 return new AgentId(serverId, serverId, AgentId.JoramAdminStamp); 72 } 73 74 static AgentId adminId = null; 75 76 80 public static AgentId getDefault() { 81 if (adminId == null) 82 adminId = new AgentId(AgentServer.getServerId(), 83 AgentServer.getServerId(), 84 AgentId.JoramAdminStamp); 85 return adminId; 86 } 87 88 92 public void react(AgentId from, Notification not) throws Exception { 93 if (logger.isLoggable(BasicLevel.DEBUG)) 94 logger.log(BasicLevel.DEBUG, "--- " + this 95 + ": got " + not 96 + " from: " + from.toString()); 97 98 setSave(); 100 101 if (not instanceof AdminNotification) 102 ((AdminTopicImpl)destImpl).AdminNotification(from, (AdminNotification) not); 103 else if (not instanceof AdminRequestNot) 104 ((AdminTopicImpl)destImpl).AdminRequestNot(from, (AdminRequestNot) not); 105 else if (not instanceof org.objectweb.joram.mom.notifications.AdminReply) 106 ((AdminTopicImpl)destImpl).AdminReply(from, (AdminReply) not); 107 else if (not instanceof GetProxyIdNot) 108 ((AdminTopicImpl)destImpl).GetProxyIdNot((GetProxyIdNot)not); 109 else if (not instanceof GetProxyIdListNot) 110 ((AdminTopicImpl)destImpl).GetProxyIdListNot((GetProxyIdListNot)not); 111 else if (not instanceof RegisterTmpDestNot) 112 ((AdminTopicImpl)destImpl).RegisterTmpDestNot((RegisterTmpDestNot)not); 113 else if (not instanceof RegisterDestNot) 114 ((AdminTopicImpl)destImpl).RegisterDestNot((RegisterDestNot)not); 115 else if (not instanceof RegisteredDestNot) 116 ((AdminTopicImpl)destImpl).RegisteredDestNot(from, (RegisteredDestNot)not); 117 else 118 super.react(from, not); 119 } 120 } 121 | Popular Tags |