1 16 package org.apache.cocoon.portal.impl; 17 18 import java.util.Iterator ; 19 import java.util.Map ; 20 21 import org.apache.avalon.framework.parameters.Parameters; 22 import org.apache.cocoon.ProcessingException; 23 import org.apache.cocoon.portal.PortalManagerAspect; 24 import org.apache.cocoon.portal.PortalManagerAspectPrepareContext; 25 import org.apache.cocoon.portal.PortalManagerAspectRenderContext; 26 import org.apache.cocoon.portal.PortalService; 27 import org.xml.sax.ContentHandler ; 28 import org.xml.sax.SAXException ; 29 30 35 public final class DefaultPortalManagerAspectContext 36 implements PortalManagerAspectRenderContext, PortalManagerAspectPrepareContext { 37 38 private final PortalService service; 39 private final Map objectModel; 40 private Iterator iterator; 41 private Iterator configIterator; 42 private Parameters config; 43 44 public DefaultPortalManagerAspectContext(PortalManagerAspectChain chain, 45 PortalService service, 46 Map objectModel) { 47 this.service = service; 48 this.objectModel = objectModel; 49 this.iterator = chain.getIterator(); 50 this.configIterator = chain.getConfigIterator(); 51 } 52 53 56 public void invokeNext() 57 throws ProcessingException { 58 if (this.iterator.hasNext()) { 59 this.config = (Parameters)this.configIterator.next(); 60 final PortalManagerAspect aspect = (PortalManagerAspect) iterator.next(); 61 aspect.prepare(this, this.service); 62 } 63 } 64 65 68 public Parameters getAspectParameters() { 69 return this.config; 70 } 71 72 75 public void invokeNext(ContentHandler ch, Parameters parameters) 76 throws SAXException { 77 if (this.iterator.hasNext()) { 78 this.config = (Parameters)this.configIterator.next(); 79 final PortalManagerAspect aspect = (PortalManagerAspect) iterator.next(); 80 aspect.render(this, this.service, ch, parameters); 81 } 82 } 83 84 87 public Map getObjectModel() { 88 return this.objectModel; 89 } 90 } 91 | Popular Tags |