1 24 25 package org.objectweb.dream.protocol.utobcast; 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.dream.message.manager.MessageManager; 34 import org.objectweb.dream.protocol.utobcast.message.UPDChunk; 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 45 public class UPDImpl extends AbstractComponent implements Push 46 { 47 48 52 56 public static final String PENDING_MESSAGES_IN_ITF_NAME = "pending-messages-in"; 57 58 59 protected Push pendingMessagesInItf; 60 61 62 protected ProcessMembership processMembershipItf; 63 64 65 protected SequenceNumber sequenceNumberItf; 66 67 68 protected MessageManager messageManagerItf; 69 70 74 77 public UPDImpl() 78 { 79 } 80 81 85 89 public void push(Message message, Map context) throws PushException 90 { 91 UPDChunk chunk = (UPDChunk) message.getChunk(UPDChunk.DEFAULT_NAME); 92 processMembershipItf.setOtherProcesses(chunk.getProcesses()); 93 sequenceNumberItf.setSequenceNumber(chunk.getSequenceNumber()); 94 } 95 96 100 104 public void bindFc(String clientItfName, Object serverItf) 105 throws NoSuchInterfaceException, IllegalBindingException, 106 IllegalLifeCycleException 107 { 108 super.bindFc(clientItfName, serverItf); 109 if (clientItfName.equals(PENDING_MESSAGES_IN_ITF_NAME)) 110 { 111 pendingMessagesInItf = (Push) serverItf; 112 } 113 else if (clientItfName.equals(SequenceNumber.ITF_NAME)) 114 { 115 sequenceNumberItf = (SequenceNumber) serverItf; 116 } 117 else if (clientItfName.equals(ProcessMembership.ITF_NAME)) 118 { 119 processMembershipItf = (ProcessMembership) serverItf; 120 } 121 else if (clientItfName.equals(MessageManager.ITF_NAME)) 122 { 123 messageManagerItf = (MessageManager) serverItf; 124 } 125 126 } 127 128 131 public String [] listFc() 132 { 133 return new String []{PENDING_MESSAGES_IN_ITF_NAME, SequenceNumber.ITF_NAME, 134 ProcessMembership.ITF_NAME, MessageManager.ITF_NAME}; 135 } 136 137 } | Popular Tags |