Source Code Cross Referenced for EventConfig.java in  » J2EE » Enhydra-Demos » org » enhydra » barracuda » config » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » J2EE » Enhydra Demos » org.enhydra.barracuda.config 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Enhydra Java Application Server Project
003:         * 
004:         * The contents of this file are subject to the Enhydra Public License
005:         * Version 1.1 (the "License"); you may not use this file except in
006:         * compliance with the License. You may obtain a copy of the License on
007:         * the Enhydra web site (http://www.enhydra.org/).
008:         * 
009:         * Software distributed under the License is distributed on an "AS IS"
010:         * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 
011:         * the License for the specific terms governing rights and limitations
012:         * under the License.
013:         * 
014:         * The Initial Developer of the Enhydra Application Server is Lutris
015:         * Technologies, Inc. The Enhydra Application Server and portions created
016:         * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
017:         * All Rights Reserved.
018:         * 
019:         * Contributor(s):
020:         * 
021:         * $Id: EventConfig.java,v 1.1 2006-09-11 12:30:02 sinisa Exp $
022:         */
023:        package org.enhydra.barracuda.config;
024:
025:        import java.io.*;
026:        import java.util.*;
027:        import javax.servlet.*;
028:        import javax.servlet.http.*;
029:
030:        import org.apache.log4j.*;
031:
032:        import org.enhydra.barracuda.config.events.*;
033:        import org.barracudamvc.core.comp.*;
034:        import org.barracudamvc.core.event.*;
035:        import org.barracudamvc.core.event.helper.*;
036:        import org.barracudamvc.core.forms.*;
037:        import org.barracudamvc.core.util.dom.*;
038:        import org.barracudamvc.core.util.srv.*;
039:        import org.barracudamvc.plankton.data.*;
040:        import org.barracudamvc.plankton.http.*;
041:
042:        /**
043:         * This class provides the methods needed to configure the event
044:         * screen
045:         */
046:        public class EventConfig extends DefaultEventGateway {
047:
048:            protected static final Logger logger = Logger
049:                    .getLogger(EventConfig.class.getName());
050:
051:            //event id (must be unique)
052:            public static final String FORM = EventConfig.class.getName()
053:                    + ".Form";
054:
055:            //model name
056:            public static final String MODEL_NAME = "Event";
057:
058:            //model elements (these are the data items supported)
059:            public static final String APPLICATION_GATEWAY_DL = "ApplicationGateway_DebugLevel";
060:            public static final String APPLICATION_GATEWAY_USE_EVENT_POOLING = "ApplicationGateway_UseEventPooling";
061:            public static final String APPLICATION_GATEWAY_FORCE_GC = "ApplicationGateway_ForceGC";
062:            public static final String DEFAULT_BASE_EVENT_USE_ID_ALIASES = "DefaultBaseEvent_UseIDAliases";
063:            public static final String DEFAULT_DOM_WRITER_DPP_FALSE = "DefaultDOMWriter_DefaultPrintPretty_False";
064:            public static final String DEFAULT_BASE_EVENT_LISTENER_DL = "DefaultBaseEventListener_DebugLevel";
065:            public static final String DEFAULT_DISPATCH_QUEUE_DL = "DefaultDispatchQueue_DebugLevel";
066:            public static final String DEFAULT_EVENT_BROKER_DL = "DefaultEventBroker_DebugLevel";
067:            public static final String DEFAULT_EVENT_CONTEXT_DL = "DefaultEventContext_DebugLevel";
068:            public static final String DEFAULT_EVENT_DISPATCHER_DL = "DefaultEventDispatcher_DebugLevel";
069:            public static final String DEFAULT_EVENT_DISPATCHER_MAX_POLY = "DefaultEventDispatcher_MaxPolyChainDepth";
070:            public static final String DEFAULT_EVENT_DISPATCHER_MAX_DISPATCH = "DefaultEventDispatcher_MaxDispatchQueueDepth";
071:            public static final String DEFAULT_EVENT_GATEWAY_DL = "DefaultEventGateway_DebugLevel";
072:            public static final String DEFAULT_EVENT_POOL_DL = "DefaultEventPool_DebugLevel";
073:            public static final String DEFAULT_EVENT_POOL_CLEANUP_LOCKED_EVENTS = "DefaultEventPool_CleanupLockedEvents";
074:            public static final String EVENT_FORWARDING_FACTORY_DL = "EventForwardingFactory_DebugLevel";
075:            public static final String EVENT_REDIRECT_FACTORY_DL = "EventRedirectFactory_DebugLevel";
076:            public static final String ERROR_MESSAGE = "ErrorMessage";
077:            public static final String SUCCESS_MESSAGE = "SuccessMessage";
078:            public static final String UPDATE_BUTTON = "UpdateButton";
079:
080:            //private vars
081:            private ListenerFactory updateConfigFactory = new DefaultListenerFactory() {
082:                public BaseEventListener getInstance() {
083:                    return new UpdateConfigHandler();
084:                }
085:
086:                public String getListenerID() {
087:                    return getID(UpdateConfigHandler.class);
088:                }
089:            };
090:            private ListenerFactory forceGCFactory = new DefaultListenerFactory() {
091:                public BaseEventListener getInstance() {
092:                    return new ForceGCHandler();
093:                }
094:
095:                public String getListenerID() {
096:                    return getID(ForceGCHandler.class);
097:                }
098:            };
099:            private ListenerFactory cleanupLockedEventsFactory = new DefaultListenerFactory() {
100:                public BaseEventListener getInstance() {
101:                    return new CleanupLockedEventsHandler();
102:                }
103:
104:                public String getListenerID() {
105:                    return getID(CleanupLockedEventsHandler.class);
106:                }
107:            };
108:
109:            public EventConfig() {
110:                //specify generic interest
111:                specifyLocalEventInterests(updateConfigFactory);
112:                specifyLocalEventInterests(forceGCFactory);
113:                specifyLocalEventInterests(cleanupLockedEventsFactory);
114:            }
115:
116:            //------------------------------------------------------------
117:            //                       Data Models
118:            //------------------------------------------------------------
119:            /**
120:             * define the template model that backs this screen
121:             */
122:            class EventModel extends AbstractTemplateModel {
123:
124:                //register the model by name
125:                public String getName() {
126:                    return MODEL_NAME;
127:                }
128:
129:                //provide items by key
130:                public Object getItem(String key) {
131:                    if (logger.isDebugEnabled())
132:                        logger.debug("Asking for key:" + key);
133:                    ViewContext vc = getViewContext();
134:
135:                    //Handle requests for data
136:                    if (key.equals(APPLICATION_GATEWAY_DL)) {
137:                        return ScreenUtil.getDebugLevelComp2(vc, key,
138:                                ApplicationGateway.class);
139:                    } else if (key
140:                            .equals(APPLICATION_GATEWAY_USE_EVENT_POOLING)) {
141:                        return ScreenUtil.getToggleButton(vc,
142:                                APPLICATION_GATEWAY_USE_EVENT_POOLING, "true",
143:                                ApplicationGateway.USE_EVENT_POOLING);
144:                    } else if (key.equals(APPLICATION_GATEWAY_FORCE_GC)) {
145:                        return ScreenUtil.getActionLink(vc, forceGCFactory);
146:                    } else if (key.equals(DEFAULT_BASE_EVENT_USE_ID_ALIASES)) {
147:                        BToggleButton bcomp = ScreenUtil.getToggleButton(vc,
148:                                DEFAULT_BASE_EVENT_USE_ID_ALIASES, "true",
149:                                DefaultBaseEvent.USE_ID_ALIASES);
150:                        //because this is a read-only, we want to disable this field 
151:                        //(this doesn't currently work in NN)
152:                        bcomp.setEnabled(false);
153:                        return bcomp;
154:                    } else if (key.equals(DEFAULT_BASE_EVENT_LISTENER_DL)) {
155:                        return ScreenUtil.getDebugLevelComp2(vc, key,
156:                                DefaultBaseEventListener.class);
157:                    } else if (key.equals(DEFAULT_DISPATCH_QUEUE_DL)) {
158:                        return ScreenUtil.getDebugLevelComp2(vc, key,
159:                                DefaultDispatchQueue.class);
160:                    } else if (key.equals(DEFAULT_EVENT_BROKER_DL)) {
161:                        return ScreenUtil.getDebugLevelComp2(vc, key,
162:                                DefaultEventBroker.class);
163:                    } else if (key.equals(DEFAULT_EVENT_CONTEXT_DL)) {
164:                        return ScreenUtil.getDebugLevelComp2(vc, key,
165:                                DefaultEventContext.class);
166:                    } else if (key.equals(DEFAULT_EVENT_DISPATCHER_DL)) {
167:                        return ScreenUtil.getDebugLevelComp2(vc, key,
168:                                DefaultEventDispatcher.class);
169:                    } else if (key.equals(DEFAULT_EVENT_DISPATCHER_MAX_POLY)) {
170:                        DefaultListModel dlm = new DefaultListModel();
171:                        for (int i = 0; i < 101; i++)
172:                            dlm.add(new Integer(i));
173:                        return ScreenUtil.getSelectComp(vc, key, dlm,
174:                                DefaultEventDispatcher.MAX_POLY_CHAIN_DEPTH);
175:                    } else if (key
176:                            .equals(DEFAULT_EVENT_DISPATCHER_MAX_DISPATCH)) {
177:                        DefaultListModel dlm = new DefaultListModel();
178:                        for (int i = 0; i < 101; i++)
179:                            dlm.add(new Integer(i));
180:                        //because this is a read-only, we want to disable this field 
181:                        //(this doesn't currently work in NN)
182:                        BSelect bselect = ScreenUtil
183:                                .getSelectComp(
184:                                        vc,
185:                                        key,
186:                                        dlm,
187:                                        DefaultEventDispatcher.MAX_DISPATCH_QUEUE_DEPTH);
188:                        bselect.setEnabled(false);
189:                        return bselect;
190:                    } else if (key.equals(DEFAULT_EVENT_GATEWAY_DL)) {
191:                        return ScreenUtil.getDebugLevelComp2(vc, key,
192:                                DefaultEventGateway.class);
193:                    } else if (key.equals(DEFAULT_EVENT_POOL_DL)) {
194:                        return ScreenUtil.getDebugLevelComp2(vc, key,
195:                                DefaultEventPool.class);
196:                    } else if (key
197:                            .equals(DEFAULT_EVENT_POOL_CLEANUP_LOCKED_EVENTS)) {
198:                        BAction baction = ScreenUtil.getActionLink(vc,
199:                                cleanupLockedEventsFactory);
200:                        baction
201:                                .setEnabled(ApplicationGateway.USE_EVENT_POOLING);
202:                        //System.out.println("Here we are! Getting a new BAction component!");            
203:                        return baction;
204:                    } else if (key.equals(EVENT_FORWARDING_FACTORY_DL)) {
205:                        return ScreenUtil.getDebugLevelComp2(vc, key,
206:                                EventForwardingFactory.class);
207:                    } else if (key.equals(EVENT_REDIRECT_FACTORY_DL)) {
208:                        return ScreenUtil.getDebugLevelComp2(vc, key,
209:                                EventRedirectFactory.class);
210:                    } else if (key.equals(ERROR_MESSAGE)) {
211:                        return ScreenUtil.getErrMsg(vc, FORM, ERROR_MESSAGE);
212:                    } else if (key.equals(SUCCESS_MESSAGE)) {
213:                        return ScreenUtil.getSuccessMsg(vc, FORM,
214:                                SUCCESS_MESSAGE);
215:                    } else if (key.equals(UPDATE_BUTTON)) {
216:                        return ScreenUtil.getUpdateButtonComp(vc,
217:                                updateConfigFactory);
218:                    } else
219:                        return super .getItem(key);
220:                }
221:            }
222:
223:            //------------------------------------------------------------
224:            //                  Form Mappings, Validators
225:            //------------------------------------------------------------
226:            /**
227:             * define the event map that backs the model
228:             */
229:            class EventForm extends DefaultFormMap {
230:                public EventForm() {
231:                    //define the elements (note: these don't need any validators). Note
232:                    //also that we set the defaults to the current values. This allows
233:                    //us just to reset all current values down below without checking to
234:                    //see if the elements actually got passed in from the event.
235:                    if (logger.isDebugEnabled())
236:                        logger.debug("Defining form elements");
237:                    this .defineElement(new DefaultFormElement(
238:                            APPLICATION_GATEWAY_DL, FormType.INTEGER,
239:                            new Integer(ScreenUtil
240:                                    .cvtLevelToInt(ApplicationGateway.class)),
241:                            null, false));
242:                    this .defineElement(new DefaultFormElement(
243:                            APPLICATION_GATEWAY_USE_EVENT_POOLING,
244:                            FormType.BOOLEAN, new Boolean(false), null, false));
245:                    this .defineElement(new DefaultFormElement(
246:                            DEFAULT_BASE_EVENT_USE_ID_ALIASES,
247:                            FormType.BOOLEAN, new Boolean(false), null, false));
248:                    this 
249:                            .defineElement(new DefaultFormElement(
250:                                    DEFAULT_BASE_EVENT_LISTENER_DL,
251:                                    FormType.INTEGER,
252:                                    new Integer(
253:                                            ScreenUtil
254:                                                    .cvtLevelToInt(DefaultBaseEventListener.class)),
255:                                    null, false));
256:                    this 
257:                            .defineElement(new DefaultFormElement(
258:                                    DEFAULT_DISPATCH_QUEUE_DL,
259:                                    FormType.INTEGER,
260:                                    new Integer(
261:                                            ScreenUtil
262:                                                    .cvtLevelToInt(DefaultDispatchQueue.class)),
263:                                    null, false));
264:                    this .defineElement(new DefaultFormElement(
265:                            DEFAULT_EVENT_BROKER_DL, FormType.INTEGER,
266:                            new Integer(ScreenUtil
267:                                    .cvtLevelToInt(DefaultEventBroker.class)),
268:                            null, false));
269:                    this .defineElement(new DefaultFormElement(
270:                            DEFAULT_EVENT_CONTEXT_DL, FormType.INTEGER,
271:                            new Integer(ScreenUtil
272:                                    .cvtLevelToInt(DefaultEventContext.class)),
273:                            null, false));
274:                    this 
275:                            .defineElement(new DefaultFormElement(
276:                                    DEFAULT_EVENT_DISPATCHER_DL,
277:                                    FormType.INTEGER,
278:                                    new Integer(
279:                                            ScreenUtil
280:                                                    .cvtLevelToInt(DefaultEventDispatcher.class)),
281:                                    null, false));
282:                    this 
283:                            .defineElement(new DefaultFormElement(
284:                                    DEFAULT_EVENT_DISPATCHER_MAX_POLY,
285:                                    FormType.INTEGER,
286:                                    new Integer(
287:                                            DefaultEventDispatcher.MAX_POLY_CHAIN_DEPTH),
288:                                    null, false));
289:                    this 
290:                            .defineElement(new DefaultFormElement(
291:                                    DEFAULT_EVENT_DISPATCHER_MAX_DISPATCH,
292:                                    FormType.INTEGER,
293:                                    new Integer(
294:                                            DefaultEventDispatcher.MAX_DISPATCH_QUEUE_DEPTH),
295:                                    null, false));
296:                    this .defineElement(new DefaultFormElement(
297:                            DEFAULT_EVENT_GATEWAY_DL, FormType.INTEGER,
298:                            new Integer(ScreenUtil
299:                                    .cvtLevelToInt(DefaultEventGateway.class)),
300:                            null, false));
301:                    this .defineElement(new DefaultFormElement(
302:                            DEFAULT_EVENT_POOL_DL, FormType.INTEGER,
303:                            new Integer(ScreenUtil
304:                                    .cvtLevelToInt(DefaultEventPool.class)),
305:                            null, false));
306:                    this 
307:                            .defineElement(new DefaultFormElement(
308:                                    EVENT_FORWARDING_FACTORY_DL,
309:                                    FormType.INTEGER,
310:                                    new Integer(
311:                                            ScreenUtil
312:                                                    .cvtLevelToInt(EventForwardingFactory.class)),
313:                                    null, false));
314:                    this 
315:                            .defineElement(new DefaultFormElement(
316:                                    EVENT_REDIRECT_FACTORY_DL,
317:                                    FormType.INTEGER,
318:                                    new Integer(
319:                                            ScreenUtil
320:                                                    .cvtLevelToInt(EventRedirectFactory.class)),
321:                                    null, false));
322:                }
323:            }
324:
325:            //------------------------------------------------------------
326:            //             Model 2 - Controller Event Handlers
327:            //------------------------------------------------------------
328:            /**
329:             * UpdateConfigHandler - handle the request to update the config 
330:             * screen.
331:             */
332:            class UpdateConfigHandler extends DefaultBaseEventListener {
333:                public void handleControlEvent(ControlEventContext context)
334:                        throws EventException, ServletException, IOException {
335:                    //figure out our target locale and get the appropriate screen
336:                    Locale locale = context.getViewCapabilities()
337:                            .getClientLocale();
338:                    MasterScreen screen = new MasterScreenFactory()
339:                            .getInstance(EventConfig.this , context, locale);
340:                    if (logger.isDebugEnabled())
341:                        ServletUtil.showParams(context.getRequest(), logger);
342:
343:                    //create the login event
344:                    ValidationException ve = null;
345:                    EventForm formMap = new EventForm();
346:                    try {
347:                        //map/validate the event
348:                        formMap.map(context.getRequest()).validate(true);
349:
350:                        //If there were no errors, update the data. Note that we just
351:                        //assume that all the data is here. The reason we can do this is
352:                        //because we prepopulated the event up above with the default values.
353:                        //The more proper way would be to check each value, see if it's set,
354:                        //and then only update it if the value has actually changed. Lot more
355:                        //code to do that though, and since we're just setting statics, the
356:                        //cost of doing it this way is minimal.
357:                        ScreenUtil.setLevel(ApplicationGateway.class,
358:                                ((Integer) formMap
359:                                        .getVal(APPLICATION_GATEWAY_DL))
360:                                        .intValue());
361:                        ApplicationGateway.USE_EVENT_POOLING = ((Boolean) formMap
362:                                .getVal(APPLICATION_GATEWAY_USE_EVENT_POOLING))
363:                                .booleanValue();
364:                        ScreenUtil
365:                                .setLevel(
366:                                        DefaultBaseEventListener.class,
367:                                        ((Integer) formMap
368:                                                .getVal(DEFAULT_BASE_EVENT_LISTENER_DL))
369:                                                .intValue());
370:                        ScreenUtil.setLevel(DefaultDispatchQueue.class,
371:                                ((Integer) formMap
372:                                        .getVal(DEFAULT_DISPATCH_QUEUE_DL))
373:                                        .intValue());
374:                        ScreenUtil.setLevel(DefaultEventBroker.class,
375:                                ((Integer) formMap
376:                                        .getVal(DEFAULT_EVENT_BROKER_DL))
377:                                        .intValue());
378:                        ScreenUtil.setLevel(DefaultEventContext.class,
379:                                ((Integer) formMap
380:                                        .getVal(DEFAULT_EVENT_CONTEXT_DL))
381:                                        .intValue());
382:                        ScreenUtil.setLevel(DefaultEventDispatcher.class,
383:                                ((Integer) formMap
384:                                        .getVal(DEFAULT_EVENT_DISPATCHER_DL))
385:                                        .intValue());
386:                        DefaultEventDispatcher.MAX_POLY_CHAIN_DEPTH = ((Integer) formMap
387:                                .getVal(DEFAULT_EVENT_DISPATCHER_MAX_POLY))
388:                                .intValue();
389:                        ScreenUtil.setLevel(DefaultEventGateway.class,
390:                                ((Integer) formMap
391:                                        .getVal(DEFAULT_EVENT_GATEWAY_DL))
392:                                        .intValue());
393:                        ScreenUtil.setLevel(DefaultEventPool.class,
394:                                ((Integer) formMap
395:                                        .getVal(DEFAULT_EVENT_POOL_DL))
396:                                        .intValue());
397:                        ScreenUtil.setLevel(EventForwardingFactory.class,
398:                                ((Integer) formMap
399:                                        .getVal(EVENT_FORWARDING_FACTORY_DL))
400:                                        .intValue());
401:                        ScreenUtil.setLevel(EventRedirectFactory.class,
402:                                ((Integer) formMap
403:                                        .getVal(EVENT_REDIRECT_FACTORY_DL))
404:                                        .intValue());
405:
406:                        //remember our success
407:                        formMap.putState(SUCCESS_MESSAGE, new Boolean(true));
408:
409:                    } catch (ValidationException e) {
410:                        ve = e;
411:                    }
412:
413:                    //store the error message in the event and then put the event in the
414:                    //the event context
415:                    formMap.putState(ERROR_MESSAGE, ve);
416:                    context.putState(FORM, formMap);
417:
418:                    //fire an update so that the screen will redraw
419:                    ((EventModel) screen.eventModel).fireModelChanged();
420:
421:                    //redirect to the get screen again
422:                    throw new ClientSideRedirectException(new GetBConfig());
423:                }
424:            }
425:
426:            /**
427:             * ForceGCHandler - Force a System.gc()
428:             */
429:            class ForceGCHandler extends DefaultBaseEventListener {
430:                public void handleControlEvent(ControlEventContext context)
431:                        throws EventException, ServletException, IOException {
432:                    //release locked events
433:                    logger.debug("Forcing System.gc();");
434:                    System.gc();
435:
436:                    //redirect to the config screen
437:                    throw new ClientSideRedirectException(new GetBConfig());
438:                }
439:            }
440:
441:            /**
442:             * CleanupLockedEventsHandler
443:             */
444:            class CleanupLockedEventsHandler extends DefaultBaseEventListener {
445:                public void handleControlEvent(ControlEventContext context)
446:                        throws EventException, ServletException, IOException {
447:                    //release locked events
448:                    logger.debug("Looking for ApplicationGateway...");
449:                    ApplicationGateway ag = (ApplicationGateway) SimpleServiceFinder
450:                            .findInstance(ApplicationGateway.class,
451:                                    EventConfig.this );
452:                    if (ag != null) {
453:                        logger
454:                                .debug("Found it! Getting event pool and manually cleaning up locked events.");
455:                        EventPool ep = ag.getEventPool();
456:                        if (ep != null)
457:                            ep.cleanupLockedEvents();
458:                    }
459:
460:                    //figure out our target locale and get the appropriate screen
461:                    Locale locale = context.getViewCapabilities()
462:                            .getClientLocale();
463:                    MasterScreen screen = new MasterScreenFactory()
464:                            .getInstance(EventConfig.this , context, locale);
465:
466:                    //fire an update so that the screen will redraw
467:                    ((EventModel) screen.eventModel).fireModelChanged();
468:
469:                    //redirect to the config screen
470:                    throw new ClientSideRedirectException(new GetBConfig());
471:                }
472:            }
473:
474:            //------------------------------------------------------------
475:            //                         Utility Methods
476:            //------------------------------------------------------------
477:            public TemplateModel getModel() {
478:                return new EventModel();
479:            }
480:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.