KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > barracuda > contrib > dbroggisch > examples > controller > ExampleGateway


1 /*
2  * Copyright (C) 2003 Diez B. Roggisch [deets@web.de]
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * $Id: ExampleGateway.java,v 1.2 2004/02/01 05:16:27 christianc Exp $
19  */

20 package org.enhydra.barracuda.contrib.dbroggisch.examples.controller;
21
22 import org.enhydra.barracuda.core.event.DefaultEventGateway;
23 import org.enhydra.barracuda.core.event.helper.EventConnectorFactory;
24 import org.enhydra.barracuda.contrib.dbroggisch.page.DummyPageHandler;
25 import org.enhydra.barracuda.contrib.dbroggisch.page.PageFactory;
26 import org.apache.log4j.Logger;
27
28 import org.enhydra.barracuda.contrib.dbroggisch.examples.controller.events.*;
29 import org.enhydra.barracuda.contrib.dbroggisch.examples.controller.handlers.*;
30 import org.enhydra.barracuda.contrib.dbroggisch.examples.view.pages.*;
31
32
33 public class ExampleGateway extends DefaultEventGateway {
34
35     private static final Logger logger = Logger.getLogger(ExampleGateway.class.getName());
36
37 // static {
38
// try {
39
// logger.debug("Filter initialization...");
40
// FilterFactory.addMapping(ExampleGateway.class.getResourceAsStream("/standard_filter_mapping.xml"));
41
// FilterFactory.loadFilters(ExampleGateway.class.getResourceAsStream("/filter.xml"));
42
// }
43
// catch(Exception ex) {
44
// logger.error("Problem initializing filters", ex);
45
// }
46
// }
47

48     public ExampleGateway() {
49         specifyLocalEventInterests(new EventConnectorFactory(RepopulationHandler.class), Repopulation.class);
50         specifyLocalEventInterests(new EventConnectorFactory(RepopulationHandler.class), RenderRepopulation.class);
51         specifyLocalEventInterests(new EventConnectorFactory(FileUploadHandler.class), FileUpload.class);
52         specifyLocalEventInterests(new EventConnectorFactory(FileUploadHandler.class), RenderFileUpload.class);
53         specifyLocalEventInterests(new EventConnectorFactory(PrefixMappingHandler.class), PrefixMapping.class);
54         specifyLocalEventInterests(new EventConnectorFactory(PrefixMappingHandler.class), PrefixMappingAddChild.class);
55         specifyLocalEventInterests(new EventConnectorFactory(PrefixMappingHandler.class), RenderPrefixMapping.class);
56         specifyLocalEventInterests(new EventConnectorFactory(NavigationBarHandler.class), NavigationBar.class);
57         registerPages();
58     }
59
60     private void registerPages() {
61         PageFactory.addPageEventMapping(Repopulation.class, RepopulationPage.class);
62         PageFactory.addPageEventMapping(LoadPrefixMappingPage.class, PrefixmappingPage.class);
63         PageFactory.addPageEventMapping(FileUpload.class, FileUploadPage.class);
64         // Add the dummy handler for the load events
65
specifyLocalEventInterests(new EventConnectorFactory(DummyPageHandler.class), LoadPrefixMappingPage.class);
66     }
67
68 }
69
Popular Tags