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


001:        /*
002:         * Created on 17-Dec-2005
003:         */
004:        package uk.org.ponder.rsac;
005:
006:        import java.util.ArrayList;
007:        import java.util.HashMap;
008:        import java.util.Map;
009:
010:        import org.springframework.aop.framework.ProxyFactoryBean;
011:        import org.springframework.beans.factory.BeanFactory;
012:        import org.springframework.beans.factory.BeanInitializationException;
013:
014:        import uk.org.ponder.beanutil.WriteableBeanLocator;
015:        import uk.org.ponder.beanutil.support.ConcreteWBL;
016:        import uk.org.ponder.springutil.TLABPostProcessor;
017:        import uk.org.ponder.stringutil.StringList;
018:        import uk.org.ponder.util.UniversalRuntimeException;
019:
020:        class PerRequestInfo {
021:            // HashMap beans = new HashMap();
022:            int cbeans = 0;
023:            ConcreteWBL beans = new ConcreteWBL(); // the raw bean container
024:            WriteableBeanLocator requestwbl; // "active" container with lazy-init
025:            ArrayList postprocessors = new ArrayList();
026:            StringList todestroy = new StringList();
027:            // a cached BeanFactory corresponding to the lazy container, for any
028:            // BeanFactoryAware beans
029:            BeanFactory blfactory;
030:            TLABPostProcessor tlabpp;
031:            // the container of RSACLazyTargetSources, permanent in this ThreadLocal.
032:            Map lazysources;
033:            Map seedbeans = new HashMap();
034:
035:            public void clear() {
036:                cbeans = 0;
037:                // we now know that all of this stuff is actually SLOWER than throwing the
038:                // whole entry away. But we NEED to cache the lazytargets, so what the
039:                // heck...
040:                beans.clear();
041:                todestroy.clear();
042:                postprocessors.clear();
043:            }
044:
045:            public PerRequestInfo(final RSACBeanLocatorImpl rsacbl,
046:                    StringList lazysources, TLABPostProcessor tlabpp) {
047:
048:                requestwbl = new WriteableBeanLocator() {
049:                    public Object locateBean(String beanname) {
050:                        return rsacbl.getBean(PerRequestInfo.this , beanname,
051:                                false);
052:                    }
053:
054:                    public boolean remove(String beanname) {
055:                        return beans.remove(beanname);
056:                    }
057:
058:                    public void set(String beanname, Object toset) {
059:                        seedbeans.put(beanname, toset);
060:                        beans.set(beanname, toset);
061:                    }
062:                };
063:
064:                HashMap this lazies = new HashMap();
065:                blfactory = new RSACBeanFactory(rsacbl, requestwbl);
066:                for (int i = 0; i < lazysources.size(); ++i) {
067:                    String lazysource = lazysources.stringAt(i);
068:                    try {
069:                        ProxyFactoryBean pfb = new ProxyFactoryBean();
070:
071:                        Class beanclass = rsacbl.getBeanClass(lazysource);
072:                        if (beanclass == null) {
073:                            throw UniversalRuntimeException
074:                                    .accumulate(
075:                                            new BeanInitializationException(""),
076:                                            "Unable to determine the class of bean "
077:                                                    + lazysource
078:                                                    + " which has bean marked as (very) lazy");
079:                        }
080:                        // NB - report as bug! This proxies NOTHING if the supplied class
081:                        // is not a concrete class.
082:                        RSACLazyTargetSource rlts = new RSACLazyTargetSource(
083:                                rsacbl, this , beanclass, lazysource);
084:                        if (beanclass.isInterface()) {
085:                            pfb.setInterfaces(new Class[] { beanclass });
086:                        } else {
087:                            pfb.setProxyTargetClass(true);
088:                        }
089:                        pfb.setTargetSource(rlts);
090:                        pfb.setBeanFactory(blfactory);
091:
092:                        this lazies.put(lazysource, pfb);
093:                    } catch (Exception e) {
094:                        throw UniversalRuntimeException.accumulate(e,
095:                                "Error constructing Bridge proxy for bean name "
096:                                        + lazysource);
097:                    }
098:                }
099:                this.lazysources = thislazies;
100:                this.tlabpp = tlabpp.copy();
101:                this.tlabpp.setRSACBeanLocator(rsacbl);
102:            }
103:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.