1 17 18 package org.objectweb.jac.aspects.session; 19 20 import java.util.Arrays ; 21 import java.util.HashSet ; 22 import org.apache.log4j.Logger; 23 import org.objectweb.jac.core.*; 24 import org.objectweb.jac.util.*; 25 26 41 42 public class SessionAC extends AspectComponent implements SessionConf { 43 static Logger logger = Logger.getLogger("session"); 44 45 public static final String SESSION_ID = "Session.sid"; 46 public static final String INITIALIZED = "Session.initialized"; 47 48 static { 49 Collaboration.setGlobal(SESSION_ID); 50 Collaboration.setGlobal(INITIALIZED); 51 } 52 53 public String [] getDefaultConfigs() { 54 return new String [] {"org/objectweb/jac/aspects/session/session.acc"}; 55 } 56 57 SessionWrapper wrapper; 58 59 public void clearCurrentSessionAttribute(String name) { 60 wrapper.clearCurrentSessionAttribute(name); 61 } 62 63 protected SessionWrapper getWrapper() { 64 if (wrapper==null) 67 wrapper = new SessionWrapper(this); 68 return wrapper; 69 } 70 71 public void defineSessionHandlers(String classExpr, 72 String methodExpr, 73 String objectExpr) { 74 pointcut(objectExpr, classExpr, methodExpr, 75 getWrapper(), null); 76 } 77 78 public void definePerSessionObjects(String classExpr, 79 String objectExpr) { 80 logger.debug("defining per-session objects: "+ 81 classExpr+","+objectExpr ); 82 pointcut(objectExpr, classExpr, "ALL", 83 PerSessionObjectWrapper.class.getName(), 84 null, false); 85 } 86 87 HashSet storedAttributes = new HashSet (); 88 89 public void declareStoredAttributes(String attributes[]) { 90 storedAttributes.addAll(Arrays.asList(attributes)); 91 } 92 93 98 public String [] getStoredAttributes() { 99 return (String [])storedAttributes.toArray(new String [] {}); 100 } 101 102 } 103 | Popular Tags |