1 46 50 package org.mr.core.util.byteable; 51 52 import java.util.HashMap ; 53 54 import javax.jms.JMSException ; 55 56 import org.apache.commons.logging.Log; 57 import org.apache.commons.logging.LogFactory; 58 import org.mr.api.jms.MantaFileMessage; 59 import org.mr.api.jms.MantaXADescriptor; 60 import org.mr.core.net.SimpleMantaAddress; 61 import org.mr.core.net.TransportInfo; 62 import org.mr.core.protocol.DeadEndRecipient; 63 import org.mr.indexing.messages.AgentRoleChanged; 64 import org.mr.indexing.messages.AgentTransportsChanged; 65 import org.mr.indexing.messages.ServiceParticipationChanged; 66 import org.mr.kernel.services.ServiceActorInfoContainer; 67 import org.mr.kernel.services.queues.QueueMaster; 68 69 79 public class ByteableRegistry { 80 81 private static HashMap byteableMap = new HashMap (); 82 83 public static final String NULL_NAME = "n"; 84 85 90 public static void registerByteableFactory(String byteableName , Byteable factory){ 91 byteableMap.put(byteableName ,factory ); 92 } 93 98 protected static Byteable getByteableFactory(String byteableName){ 99 return (Byteable)byteableMap.get(byteableName); 100 } 101 102 106 public static String desc(){ 107 return byteableMap.toString(); 108 } 109 110 111 public static void init(){ 112 Log log=LogFactory.getLog("ByteableRegistry"); 113 DeadEndRecipient.register(); 115 org.mr.kernel.services.ServiceProducer.register(); 116 org.mr.kernel.services.ServiceConsumer.register(); 117 org.mr.kernel.control.ControlSignal.register(); 118 org.mr.core.protocol.MantaBusMessage.register(); 119 org.mr.core.util.byteable.ByteableText.register(); 120 org.mr.core.util.byteable.ByteableMap.register(); 121 org.mr.core.util.byteable.ByteableList.register(); 122 org.mr.core.util.byteable.ByteableMapEntry.register(); 123 org.mr.core.cmc.CMCResponse.register(); 124 org.mr.core.cmc.CMCRequest.register(); 125 org.mr.core.stats.cmc.CMCAgentStats.register(); 126 org.mr.core.net.Link.register(); 127 ByteableSerializable.register(); 128 TransportInfo.register(); 129 SimpleMantaAddress.register(); 130 ByteableByteArray.register(); 131 ServiceActorInfoContainer.register(); 132 QueueMaster.register(); 133 AgentRoleChanged.register(); 134 ServiceParticipationChanged.register(); 135 AgentTransportsChanged.register(); 136 MantaXADescriptor.register(); 137 try { 138 org.mr.api.jms.MantaMessage.register(); 139 } 140 catch (JMSException e) { 141 if(log.isErrorEnabled()) 142 log.error("MantRay init() had an Exception ",e); 143 } 144 try{ 145 org.mr.api.jms.MantaTextMessage.register(); 146 } 147 catch (JMSException e) { 148 if(log.isErrorEnabled()) 149 log.error("MantRay init() had an Exception ",e); 150 } 151 152 try { 153 org.mr.api.jms.MantaBytesMessage.register(); 154 } 155 catch (JMSException e1) { 156 if(log.isErrorEnabled()) 157 log.error("init had an Exception ",e1); } 158 try { 159 org.mr.api.jms.MantaStreamMessage.register(); 160 } 161 catch (JMSException e2) { 162 if(log.isErrorEnabled()) 163 log.error("MantRay init() had an Exception ",e2); } 164 try { 165 org.mr.api.jms.MantaMapMessage.register(); 166 } 167 catch (JMSException e3) { 168 if(log.isErrorEnabled()) 169 log.error("MantRay init() had an Exception ",e3); } 170 try { 171 org.mr.api.jms.MantaDestination.register(); 172 } 173 catch (JMSException e4) { 174 if(log.isErrorEnabled()) 175 log.error("MantRay init() had an Exception ",e4); 176 } 177 try { 178 org.mr.api.jms.MantaTemporaryTopic.register(); 179 } 180 catch (JMSException e5) { 181 if(log.isErrorEnabled()) 182 log.error("MantRay init() had an Exception ",e5); 183 } 184 try { 185 org.mr.api.jms.MantaTemporaryQueue.register(); 186 } 187 catch (JMSException e6) { 188 if(log.isErrorEnabled()) 189 log.error("MantRay init() had an Exception ",e6); 190 } 191 try { 192 org.mr.api.jms.MantaStreamMessage.register(); 193 } 194 catch (JMSException e7) { 195 if(log.isErrorEnabled()) 196 log.error("MantRay init() had an Exception ",e7); 197 } 198 try { 199 org.mr.api.jms.MantaObjectMessage.register(); 200 } 201 catch (JMSException e8) { 202 if(log.isErrorEnabled()) 203 log.error("MantRay init() had an Exception ",e8); 204 } 205 try { 206 org.mr.api.jms.MantaQueue.register(); 207 } 208 catch (JMSException e9) { 209 if(log.isErrorEnabled()) 210 log.error("MantRay init() had an Exception ",e9); 211 } 212 try { 213 org.mr.api.jms.MantaTopic.register(); 214 } 215 catch (JMSException eA) { 216 if(log.isErrorEnabled()) 217 log.error("MantRay init() had an Exception ",eA); 218 } 219 try { 220 MantaFileMessage.register(); 221 } 222 catch (JMSException eA) { 223 if(log.isErrorEnabled()) 224 log.error("MantRay init() had an Exception ",eA); 225 } 226 } 227 228 } 229 | Popular Tags |