1 16 package org.apache.cocoon.portal.aspect.impl; 17 18 import org.apache.avalon.framework.CascadingRuntimeException; 19 import org.apache.avalon.framework.parameters.ParameterException; 20 import org.apache.avalon.framework.parameters.Parameterizable; 21 import org.apache.avalon.framework.parameters.Parameters; 22 import org.apache.avalon.framework.service.ServiceException; 23 import org.apache.cocoon.portal.LinkService; 24 import org.apache.cocoon.portal.aspect.Aspectalizable; 25 import org.apache.cocoon.portal.coplet.CopletInstanceData; 26 import org.apache.cocoon.portal.event.impl.ChangeAspectDataEvent; 27 import org.apache.cocoon.portal.event.impl.ChangeCopletInstanceAspectDataEvent; 28 29 36 public class RequestAspectDataStore 37 extends TemporaryAspectDataStore 38 implements Parameterizable { 39 40 protected String requestParameterName; 41 42 public void setAspectData(Aspectalizable owner, String aspectName, Object data) { 43 super.setAspectData(owner, aspectName, data); 44 45 ChangeAspectDataEvent e; 47 if ( owner instanceof CopletInstanceData) { 48 e = new ChangeCopletInstanceAspectDataEvent((CopletInstanceData)owner, aspectName, data); 49 } else { 50 e = new ChangeAspectDataEvent( owner, aspectName, data ); 51 } 52 if ( this.requestParameterName != null ) { 53 e.setRequestParameterName( this.requestParameterName ); 54 } 55 LinkService service = null; 56 try { 57 service = (LinkService)this.manager.lookup(LinkService.ROLE); 58 service.addEventToLink( e ); 59 } catch (ServiceException ce) { 60 throw new CascadingRuntimeException("Unable to lookup link service.", ce); 61 } finally { 62 this.manager.release( service ); 63 } 64 65 } 66 67 70 public void parameterize(Parameters pars) throws ParameterException { 71 requestParameterName = pars.getParameter("parameter-name", null); 72 } 73 74 } 75 | Popular Tags |