1 24 25 package org.objectweb.dream.queue; 26 27 import java.util.Map ; 28 29 import org.objectweb.dream.AbstractComponent; 30 import org.objectweb.dream.Pull; 31 import org.objectweb.dream.Push; 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 42 public class PushPullQueueNotSynchronizedImpl extends AbstractComponent 43 implements 44 Push, 45 Pull, 46 PushQueuePrimitiveComponentAttributeController 47 { 48 49 protected List listItf; 50 protected int size = 0; 51 52 55 public void push(Message message, Map context) 56 { 57 size++; 58 listItf.add(message); 59 } 60 61 64 public Message pull(Map context) 65 { 66 if (listItf.isEmpty()) 67 { 68 return null; 69 } 70 else 71 { 72 size--; 73 return (Message) listItf.remove(); 74 } 75 } 76 77 80 public String getOverflowPolicy() 81 { 82 return EXCEPTION_OVERFLOW_POLICY; 83 } 84 85 88 public void setOverflowPolicy(String policy) 89 { 90 } 92 93 96 public int getCurrentSize() 97 { 98 return size; 99 } 100 101 104 public int getMaxCapacity() 105 { 106 return 0; 107 } 108 109 112 public void setMaxCapacity(int maxCapacity) 113 { 114 } 116 117 121 124 public String [] listFc() 125 { 126 return new String []{List.ITF_NAME}; 127 } 128 129 133 public void bindFc(String clientItfName, Object serverItf) 134 throws NoSuchInterfaceException, IllegalBindingException, 135 IllegalLifeCycleException 136 { 137 super.bindFc(clientItfName, serverItf); 138 if (clientItfName.equals(List.ITF_NAME)) 139 { 140 listItf = (List) serverItf; 141 } 142 } 143 } | Popular Tags |