Source Code Cross Referenced for ViewParamsRegistryImpl.java in  » Web-Framework » RSF » uk » org » ponder » rsf » viewstate » support » 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 » Web Framework » RSF » uk.org.ponder.rsf.viewstate.support 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Created on 21 May 2007
003:         */
004:        package uk.org.ponder.rsf.viewstate.support;
005:
006:        import java.util.HashMap;
007:        import java.util.Map;
008:
009:        import uk.org.ponder.reflect.DeepBeanCloner;
010:        import uk.org.ponder.reflect.ReflectiveCache;
011:        import uk.org.ponder.rsf.viewstate.SimpleViewParameters;
012:        import uk.org.ponder.rsf.viewstate.ViewParameters;
013:        import uk.org.ponder.rsf.viewstate.ViewParamsReceiver;
014:        import uk.org.ponder.rsf.viewstate.ViewParamsRegistry;
015:        import uk.org.ponder.rsf.viewstate.ViewParamsReporter;
016:        import uk.org.ponder.util.Logger;
017:
018:        /** Receives and coordinates view parameters information from the ViewProducers,
019:         * as well as contributing the default view marked there.
020:         * @author Antranig Basman (antranig@caret.cam.ac.uk)
021:         *
022:         */
023:
024:        public class ViewParamsRegistryImpl implements  ViewParamsReceiver,
025:                ViewParamsReporter, ViewParamsRegistry {
026:            // a concurrent map to be used when live
027:            private Map exemplarmap;
028:
029:            // A single-threaded hashmap to be used during startup.
030:            private Map pendingmap = new HashMap();
031:
032:            private String defaultview;
033:
034:            // Called from ConcreteViewResolver.init(), i.e. "somewhat late"
035:            public void setDefaultView(String viewid) {
036:                defaultview = viewid;
037:            }
038:
039:            private DeepBeanCloner beancloner;
040:
041:            public void setDeepBeanCloner(DeepBeanCloner beancloner) {
042:                this .beancloner = beancloner;
043:            }
044:
045:            public void init() {
046:                exemplarmap.putAll(pendingmap);
047:                pendingmap = null;
048:            }
049:
050:            public void setReflectiveCache(ReflectiveCache reflectivecache) {
051:                exemplarmap = reflectivecache.getConcurrentMap(1);
052:            }
053:
054:            /**
055:             * DO NOT call this method in application scope. Default view cannot be
056:             * guaranteed to be called until all views are read.
057:             * 
058:             * @return The default view to be redirected to in case of a Level-1
059:             *         exception.
060:             */
061:            public String getDefaultView() {
062:                if (defaultview == null) {
063:                    Logger.log
064:                            .warn("Warning: no view has been marked as default during initialisation -"
065:                                    + "\nDid you remember to define ViewProducers?");
066:                }
067:                return "/" + defaultview;
068:            }
069:
070:            private ViewParameters defaultexemplar = new SimpleViewParameters();
071:
072:            public void setDefaultExemplar(ViewParameters defaultexemplar) {
073:                this .defaultexemplar = defaultexemplar;
074:            }
075:
076:            /**
077:             * AT MOST ONE view parameters map may be set as "pending" during startup
078:             * (presumably through reading of a static file). It will be actioned on
079:             * initialisation of the bean, all further will be actioned immediately.
080:             */
081:            public void setViewParametersMap(Map exemplarmap) {
082:                (this .exemplarmap == null ? pendingmap : this .exemplarmap)
083:                        .putAll(exemplarmap);
084:            }
085:
086:            public ViewParameters getViewParamsExemplar(String viewID) {
087:                ViewParameters togo = (ViewParameters) exemplarmap.get(viewID);
088:                if (togo == null)
089:                    togo = defaultexemplar;
090:                togo = togo.copyBase(beancloner);
091:                togo.viewID = viewID;
092:                return togo;
093:            }
094:
095:            public void setViewParamsExemplar(String viewid,
096:                    ViewParameters vpexemplar) {
097:                if (vpexemplar != null) {
098:                    (exemplarmap == null ? pendingmap : exemplarmap).put(
099:                            viewid, vpexemplar);
100:                }
101:            }
102:
103:            public ViewParameters getViewParameters() {
104:                if (defaultview == null) {
105:                    Logger.log
106:                            .warn("Warning: no view has been marked as default during initialisation -"
107:                                    + "\nDid you remember to define ViewProducers?");
108:                    return null;
109:                } else {
110:                    ViewParameters togo = getViewParamsExemplar(defaultview)
111:                            .copyBase();
112:                    togo.viewID = defaultview;
113:                    return togo;
114:                }
115:
116:            }
117:
118:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.