KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cocoon > portal > event > aspect > impl > LinkEventAspect


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.aspect.impl;
17
18 import org.apache.cocoon.portal.event.Event;
19 import org.apache.cocoon.portal.event.EventManager;
20 import org.apache.cocoon.portal.event.impl.ChangeAspectDataEvent;
21 import org.apache.cocoon.portal.layout.Layout;
22 import org.apache.cocoon.portal.layout.impl.LinkLayout;
23
24 /**
25  *
26  * @author <a HREF="mailto:juergen.seitz@basf-it-services.com">J&uuml;rgen Seitz</a>
27  *
28  * @version CVS $Id: LinkEventAspect.java 219049 2005-07-14 15:11:52Z cziegeler $
29  */

30 public class LinkEventAspect extends AbstractContentEventAspect {
31
32     protected String JavaDoc getRequestParameterName() {
33         // TODO - make this configurable
34
return "link";
35     }
36
37     protected int getRequiredValueCount() {
38         return 4;
39     }
40
41     /* (non-Javadoc)
42      * @see org.apache.cocoon.portal.event.aspect.impl.AbstractContentEventAspect#publish(org.apache.cocoon.portal.event.Publisher, org.apache.cocoon.portal.layout.Layout, java.lang.String[])
43      */

44     protected void publish(EventManager publisher,
45                              Layout layout,
46                               String JavaDoc[] values) {
47         if (layout instanceof LinkLayout) {
48             LinkLayout linkLayout = (LinkLayout) layout;
49             Event e = new ChangeAspectDataEvent(linkLayout,
50                                                 "link-layout-key",
51                                                 values[2]);
52             publisher.send(e);
53             e = new ChangeAspectDataEvent(linkLayout,
54                                           "link-layout-id",
55                                           values[3]);
56             publisher.send(e);
57         } else {
58             this.getLogger().warn(
59                 "the configured layout: "
60                     + layout.getName()
61                     + " is not a LinkLayout.");
62         }
63     }
64
65 }
66
Popular Tags