1 24 25 package org.objectweb.dream.router; 26 27 import java.util.Map ; 28 29 import org.objectweb.dream.AbstractComponent; 30 import org.objectweb.dream.Push; 31 import org.objectweb.dream.PushException; 32 import org.objectweb.dream.message.Message; 33 import org.objectweb.fractal.api.NoSuchInterfaceException; 34 import org.objectweb.fractal.api.control.IllegalBindingException; 35 import org.objectweb.fractal.api.control.IllegalLifeCycleException; 36 37 48 public class RouterChunkNameImpl extends AbstractComponent 49 implements 50 Push, 51 RouterChunkNameAttributeController 52 { 53 54 58 public static final String OUTPUSH_WITH_CHUNK_ITF_NAME = "out-push-with-chunk"; 59 60 64 public static final String OUTPUSH_WITHOUT_CHUNK_ITF_NAME = "out-push-without-chunk"; 65 66 67 protected Push outPushWithChunkItf; 68 69 protected Push outPushWithoutChunkItf; 70 71 protected String chunkName; 72 73 76 public void push(Message message, Map context) throws PushException 77 { 78 if (message.getChunk(chunkName) == null) 79 { 80 outPushWithoutChunkItf.push(message, context); 81 } 82 else 83 { 84 outPushWithChunkItf.push(message, context); 85 } 86 } 87 88 92 95 public String getChunkName() 96 { 97 return chunkName; 98 } 99 100 103 public void setChunkName(String chunkName) 104 { 105 this.chunkName = chunkName; 106 } 107 108 112 115 public String [] listFc() 116 { 117 return new String []{OUTPUSH_WITH_CHUNK_ITF_NAME, 118 OUTPUSH_WITHOUT_CHUNK_ITF_NAME}; 119 } 120 121 125 public synchronized void bindFc(String clientItfName, Object serverItf) 126 throws NoSuchInterfaceException, IllegalBindingException, 127 IllegalLifeCycleException 128 { 129 super.bindFc(clientItfName, serverItf); 130 if (clientItfName.equals(OUTPUSH_WITH_CHUNK_ITF_NAME)) 131 { 132 outPushWithChunkItf = (Push) serverItf; 133 } 134 else if (clientItfName.equals(OUTPUSH_WITHOUT_CHUNK_ITF_NAME)) 135 { 136 outPushWithoutChunkItf = (Push) serverItf; 137 } 138 } 139 } | Popular Tags |