001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017: package org.apache.cocoon.portal.event.impl;
018:
019: import java.util.Iterator;
020: import java.util.Map;
021:
022: import org.apache.avalon.framework.parameters.Parameters;
023: import org.apache.cocoon.portal.PortalService;
024: import org.apache.cocoon.portal.event.EventConverter;
025: import org.apache.cocoon.portal.event.Publisher;
026: import org.apache.cocoon.portal.event.aspect.EventAspect;
027: import org.apache.cocoon.portal.event.aspect.EventAspectContext;
028: import org.apache.cocoon.util.Deprecation;
029:
030: /**
031: *
032: * @author <a href="mailto:cziegeler@s-und-n.de">Carsten Ziegeler</a>
033: * @author <a href="mailto:volker.schmitt@basf-it-services.com">Volker Schmitt</a>
034: *
035: * @version CVS $Id: DefaultEventAspectContext.java 433543 2006-08-22 06:22:54Z crossley $
036: */
037: public final class DefaultEventAspectContext implements
038: EventAspectContext {
039:
040: private Iterator iterator;
041: private Iterator configIterator;
042: private Parameters config;
043:
044: private Publisher publisher;
045: private Map objectModel;
046: private EventConverter converter;
047:
048: public DefaultEventAspectContext(EventAspectChain chain) {
049: this .iterator = chain.getIterator();
050: this .configIterator = chain.getConfigIterator();
051: }
052:
053: /* (non-Javadoc)
054: * @see org.apache.cocoon.portal.layout.renderer.RendererAspectContext#invokeNext(org.apache.cocoon.portal.layout.Layout, org.apache.cocoon.portal.PortalService, org.xml.sax.ContentHandler)
055: */
056: public void invokeNext(PortalService service) {
057: if (iterator.hasNext()) {
058: this .config = (Parameters) this .configIterator.next();
059: final EventAspect aspect = (EventAspect) iterator.next();
060: aspect.process(this , service);
061: }
062:
063: }
064:
065: /* (non-Javadoc)
066: * @see org.apache.cocoon.portal.layout.renderer.RendererAspectContext#getConfiguration()
067: */
068: public Parameters getAspectParameters() {
069: return this .config;
070: }
071:
072: /**
073: * Get the encoder
074: */
075: public EventConverter getEventConverter() {
076: return this .converter;
077: }
078:
079: /**
080: * Get the publisher
081: */
082: public Publisher getEventPublisher() {
083: Deprecation.logger
084: .info("The getEventPublisher() method in the EventAspectContext is deprecated.");
085: return this .publisher;
086: }
087:
088: /**
089: * Get the object model
090: */
091: public Map getObjectModel() {
092: return this .objectModel;
093: }
094:
095: /**
096: * @param converter
097: */
098: public void setEventConverter(EventConverter converter) {
099: this .converter = converter;
100: }
101:
102: /**
103: * @param map
104: */
105: public void setObjectModel(Map map) {
106: objectModel = map;
107: }
108:
109: /**
110: * @param publisher
111: */
112: public void setEventPublisher(Publisher publisher) {
113: this.publisher = publisher;
114: }
115:
116: }
|