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


001:        /*
002:         * Created on 21 Aug 2007
003:         */
004:        package uk.org.ponder.rsf.state.entity.support;
005:
006:        import org.springframework.beans.factory.BeanNameAware;
007:        import org.springframework.beans.factory.FactoryBean;
008:
009:        import uk.org.ponder.beanutil.BeanModelAlterer;
010:        import uk.org.ponder.beanutil.WriteableBeanLocator;
011:        import uk.org.ponder.beanutil.entity.EntityBeanLocator;
012:        import uk.org.ponder.reflect.ReflectiveCache;
013:        import uk.org.ponder.rsac.RSACBeanLocator;
014:        import uk.org.ponder.rsf.state.entity.EntityNameInferrer;
015:
016:        /**
017:         * An "automated" implementation of BeanLocator, useful for managing "entities", 
018:         * addressed by a unique ID convertible to String, which are already provided with
019:         * some form of (probably application-scope) "DAO"-type API. This implementation
020:         * allows the DAO API to be expressed by means of EL method bindings to its 
021:         * various methods, from which the managed entities are mapped into this 
022:         * this request-scope cache.
023:         * </p>
024:         * Typically the user will provide a <code>fetchMethod</code> which will fetch
025:         * entities by ID, and (at least one of) a <code>newMethod</code> or an
026:         * <code>entityClass</code> which is used to instantiate new entities which
027:         * are not persistent. <p/> At any time, the "cache" of currently addressed
028:         * entities within this request may be accessed through the map
029:         * <code>deliveredBeans</code> 
030:         * <p/> If the <code>saveEL</code> is also
031:         * supplied, this locator will also implement a <code>saveAll()</code> method
032:         * which will return all the delivered entities back to persistence. If this is
033:         * not supplied, they are assumed to be persisted by some other means (perhaps
034:         * an auto-commit of some kind).
035:         * 
036:         * @author Antranig Basman (antranig@caret.cam.ac.uk)
037:         * 
038:         */
039:
040:        public class StaticEntityBeanLocatorImpl implements  BeanNameAware,
041:                FactoryBean, EntityNameInferrer {
042:            // package level members for access from EntityBeanLocatorImpl
043:            String fetchEL;
044:            String newEL;
045:            Class entityClazz;
046:            String saveEL;
047:            String removeEL;
048:
049:            BeanModelAlterer bma;
050:            RSACBeanLocator RSACbeanlocator;
051:            ReflectiveCache reflectivecache;
052:            private String beanName;
053:
054:            public void setFetchMethod(String fetchEL) {
055:                this .fetchEL = fetchEL;
056:            }
057:
058:            public void setNewMethod(String newEL) {
059:                this .newEL = newEL;
060:            }
061:
062:            public void setEntityClass(Class entityClazz) {
063:                this .entityClazz = entityClazz;
064:            }
065:
066:            public void setSaveMethod(String saveEL) {
067:                this .saveEL = saveEL;
068:            }
069:
070:            public void setRemoveMethod(String removeEL) {
071:                this .removeEL = removeEL;
072:            }
073:
074:            public void setBeanModelAlterer(BeanModelAlterer bma) {
075:                this .bma = bma;
076:            }
077:
078:            public void setRSACBeanLocator(RSACBeanLocator RSACbeanlocator) {
079:                this .RSACbeanlocator = RSACbeanlocator;
080:            }
081:
082:            public void setReflectiveCache(ReflectiveCache reflectivecache) {
083:                this .reflectivecache = reflectivecache;
084:            }
085:
086:            public void init() {
087:                if (entityClazz == null && newEL == null) {
088:                    throw new IllegalArgumentException(
089:                            "At least one of entityClass and newEL must be set");
090:                }
091:            }
092:
093:            public Object getObject() throws Exception {
094:                WriteableBeanLocator wbl = RSACbeanlocator.getDeadBeanLocator();
095:                if (wbl.locateBean(beanName) != null) {
096:                    throw new IllegalStateException(
097:                            "Incorrect use of EntityBeanLocator detected. "
098:                                    + "This implementation is designed to work only with the RSACBeanLocator, "
099:                                    + "and must cause the delivered BeanLocator to be immediately cached "
100:                                    + "in the RSAC on first use per request");
101:                }
102:                EntityBeanLocatorImpl togo = new EntityBeanLocatorImpl(this );
103:                wbl.set(beanName, togo);
104:                return togo;
105:            }
106:
107:            public Class getObjectType() {
108:                return EntityBeanLocator.class;
109:            }
110:
111:            public boolean isSingleton() {
112:                return false;
113:            }
114:
115:            public void setBeanName(String beanName) {
116:                this .beanName = beanName;
117:            }
118:
119:            public String getEntityName(Class entityClazz) {
120:                return (entityClazz == this.entityClazz ? beanName : null);
121:            }
122:        }
w__w___w.__j_a__v__a__2_s.___co__m_ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.