1 24 25 package org.objectweb.dream.aggregator; 26 27 import java.util.Iterator ; 28 import java.util.Map ; 29 30 import org.objectweb.dream.PushException; 31 import org.objectweb.dream.PushPushDreamComponent; 32 import org.objectweb.dream.message.ExtensibleMessage; 33 import org.objectweb.dream.message.Message; 34 import org.objectweb.dream.message.manager.MessageManager; 35 import org.objectweb.fractal.api.NoSuchInterfaceException; 36 import org.objectweb.fractal.api.control.IllegalBindingException; 37 import org.objectweb.fractal.api.control.IllegalLifeCycleException; 38 39 43 public class PushPushDeAggregatorImpl extends PushPushDreamComponent 44 { 45 46 47 protected MessageManager messageManagerItf; 48 49 52 public void push(Message message, Map context) throws PushException 53 { 54 if (!(message instanceof ExtensibleMessage)) 55 { 56 throw new PushException( 57 "Invalid aggregated message, not an extensible message"); 58 } 59 Iterator iterator = message.getSubMessageIterator(); 60 while (iterator.hasNext()) 61 { 62 outPushItf.push((Message) iterator.next(), context); 63 } 64 ((ExtensibleMessage) message).removeSubMessages(); 65 messageManagerItf.deleteMessage(message); 66 } 67 68 72 75 public String [] listFc() 76 { 77 return new String []{OUT_PUSH_ITF_NAME, MessageManager.ITF_NAME}; 78 } 79 80 84 public synchronized void bindFc(String clientItfName, Object serverItf) 85 throws NoSuchInterfaceException, IllegalBindingException, 86 IllegalLifeCycleException 87 { 88 super.bindFc(clientItfName, serverItf); 89 if (clientItfName.equals(MessageManager.ITF_NAME)) 90 { 91 messageManagerItf = (MessageManager) serverItf; 92 } 93 } 94 95 } | Popular Tags |