1 17 18 package org.objectweb.jac.aspects.queue; 19 20 import org.objectweb.jac.core.AspectComponent; 21 import org.objectweb.jac.core.rtti.ClassItem; 22 import org.objectweb.jac.core.rtti.FieldItem; 23 import org.objectweb.jac.core.rtti.MethodItem; 24 import java.util.HashSet ; 25 import java.util.Iterator ; 26 import java.util.Map ; 27 import java.util.Set ; 28 import org.objectweb.jac.util.Log; 29 30 31 public class MessageQueueAC extends AspectComponent implements MessageQueueConf { 32 33 MessageQueue mqueue = new MessageQueue(); 34 35 public void registerField(ClassItem cli, String fieldName, MethodItem callback) { 36 mqueue.registerFieldChange(cli.getField(fieldName),callback); 37 } 38 39 public void whenConfigured() { 40 Log.trace("mqueue",this+".whenConfigured"); 41 super.whenConfigured(); 42 Set treatedFields = new HashSet (); 43 Map fieldClients = mqueue.getFieldClients(); 44 Iterator it = fieldClients.keySet().iterator(); 45 while (it.hasNext()) { 46 FieldItem field = (FieldItem)it.next(); 47 if (!treatedFields.contains(field)) { 48 Log.trace("mqueue","installing pointcut for "+field.getLongName()); 49 pointcut("ALL",field.getClassItem().getName(),"WRITERS("+field.getName()+")", 50 MessageQueueWrapper.class.getName(),null,SHARED); 51 treatedFields.add(field); 52 } 53 } 54 } 55 56 public MessageQueue getMessageQueue() { 57 return mqueue; 58 } 59 } 60 | Popular Tags |