KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cocoon > portal > event > impl > DefaultEventAspectContext


1 /*
2  * Copyright 1999-2002,2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.cocoon.portal.event.impl;
17
18 import java.util.Iterator JavaDoc;
19 import java.util.Map JavaDoc;
20
21 import org.apache.avalon.framework.parameters.Parameters;
22 import org.apache.cocoon.portal.PortalService;
23 import org.apache.cocoon.portal.event.EventConverter;
24 import org.apache.cocoon.portal.event.Publisher;
25 import org.apache.cocoon.portal.event.aspect.EventAspect;
26 import org.apache.cocoon.portal.event.aspect.EventAspectContext;
27 import org.apache.cocoon.util.Deprecation;
28
29 /**
30  *
31  * @author <a HREF="mailto:cziegeler@s-und-n.de">Carsten Ziegeler</a>
32  * @author <a HREF="mailto:volker.schmitt@basf-it-services.com">Volker Schmitt</a>
33  *
34  * @version CVS $Id: DefaultEventAspectContext.java 219049 2005-07-14 15:11:52Z cziegeler $
35  */

36 public final class DefaultEventAspectContext
37     implements EventAspectContext {
38
39     private Iterator JavaDoc iterator;
40     private Iterator JavaDoc configIterator;
41     private Parameters config;
42     
43     private Publisher publisher;
44     private Map JavaDoc objectModel;
45     private EventConverter converter;
46
47     public DefaultEventAspectContext(EventAspectChain chain) {
48         this.iterator = chain.getIterator();
49         this.configIterator = chain.getConfigIterator();
50     }
51     
52     /* (non-Javadoc)
53      * @see org.apache.cocoon.portal.layout.renderer.RendererAspectContext#invokeNext(org.apache.cocoon.portal.layout.Layout, org.apache.cocoon.portal.PortalService, org.xml.sax.ContentHandler)
54      */

55     public void invokeNext(PortalService service) {
56         if (iterator.hasNext()) {
57             this.config = (Parameters) this.configIterator.next();
58             final EventAspect aspect = (EventAspect) iterator.next();
59             aspect.process( this, service );
60         }
61
62     }
63
64     /* (non-Javadoc)
65      * @see org.apache.cocoon.portal.layout.renderer.RendererAspectContext#getConfiguration()
66      */

67     public Parameters getAspectParameters() {
68         return this.config;
69     }
70
71     /**
72      * Get the encoder
73      */

74     public EventConverter getEventConverter(){
75         return this.converter;
76     }
77     
78     /**
79      * Get the publisher
80      */

81     public Publisher getEventPublisher() {
82         Deprecation.logger.info("The getEventPublisher() method in the EventAspectContext is deprecated.");
83         return this.publisher;
84     }
85     
86     /**
87      * Get the object model
88      */

89     public Map JavaDoc getObjectModel() {
90         return this.objectModel;
91     }
92
93     /**
94      * @param converter
95      */

96     public void setEventConverter(EventConverter converter) {
97         this.converter = converter;
98     }
99
100     /**
101      * @param map
102      */

103     public void setObjectModel(Map JavaDoc map) {
104         objectModel = map;
105     }
106
107     /**
108      * @param publisher
109      */

110     public void setEventPublisher(Publisher publisher) {
111         this.publisher = publisher;
112     }
113
114 }
115
Popular Tags