1 24 25 package org.objectweb.dream.router; 26 27 import java.util.Hashtable ; 28 import java.util.Map ; 29 30 import org.objectweb.dream.Push; 31 import org.objectweb.dream.PushException; 32 import org.objectweb.dream.message.Message; 33 34 48 public abstract class AbstractRouterKeyBasedImpl extends AbstractRouterImpl 49 { 50 51 55 protected Map outPushRouteTable; 56 57 60 public AbstractRouterKeyBasedImpl() 61 { 62 super(); 63 outPushRouteTable = new Hashtable (); 64 } 65 66 70 protected Push getOutput(Message message, Map context) throws PushException 71 { 72 initRouteTable(); 73 Object key = getOutputKey(message); 74 if (key == null) 75 { 76 return null; 77 } 78 return (Push) outPushRouteTable.get(key); 79 } 80 81 89 protected abstract Object getOutputKey(Message message); 90 91 98 protected void initRouteTable() throws PushException 99 { 100 } 101 102 } | Popular Tags |