Source Code Cross Referenced for TransactionSensitiveCacheImpl.java in  » Database-ORM » ODAL » com » completex » objective » components » ocache » impl » 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 » Database ORM » ODAL » com.completex.objective.components.ocache.impl 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.completex.objective.components.ocache.impl;
002:
003:        import com.completex.objective.components.ocache.OdalCache;
004:        import com.completex.objective.components.ocache.OdalCacheWrapper;
005:        import com.completex.objective.components.ocache.OdalKeyFactory;
006:        import com.completex.objective.components.ocache.OdalKeyedCache;
007:        import com.completex.objective.components.ocache.OdalRuntimeCacheException;
008:        import com.completex.objective.components.ocache.OdalTransactionSensitiveCache;
009:        import com.completex.objective.components.persistency.transact.TransactionListener;
010:
011:        /**
012:         * Cache implementation that is combined with TransactionListener implementation.
013:         * Entries get removed and invalidated on removal from the cache and redundantly removed on
014:         * transaction commit or rollback prividing for distributed cache consistency.
015:         * Cache has to be registered with current transaction.
016:         *
017:         * @see com.completex.objective.components.persistency.transact.Transaction#addListerner(Object, com.completex.objective.components.persistency.transact.TransactionListener) 
018:         * @author Gennady Krizhevsky
019:         */
020:        public class TransactionSensitiveCacheImpl extends
021:                CacheTransactionListenerImpl implements 
022:                OdalTransactionSensitiveCache, OdalKeyedCache, OdalCacheWrapper {
023:
024:            private OdalKeyFactory odalKeyFactory = OdalKeyFactory.NULL_ODAL_KEY_FACTORY;
025:            private boolean markCacheCollectionElements;
026:
027:            public TransactionSensitiveCacheImpl(OdalCache coreCache,
028:                    OdalKeyFactory odalKeyFactory,
029:                    boolean markCacheCollectionElements) {
030:                super (coreCache);
031:                setOdalKeyFactory(odalKeyFactory);
032:                setMarkCacheCollectionElements(markCacheCollectionElements);
033:            }
034:
035:            /**
036:             * @see OdalCache#get(Object)
037:             */
038:            public Object get(Object key) {
039:                return getCache().get(key);
040:            }
041:
042:            /**
043:             * @see OdalCache#put(Object, Object)
044:             */
045:            public Object put(Object key, Object value) {
046:                return getCache().put(key, value);
047:            }
048:
049:            /**
050:             * @see com.completex.objective.components.ocache.OdalLinkedCache#put(Object)
051:             */
052:            public void put(Object value) {
053:                OdalKeyFactory odalKeyFactory = getKeyFactory();
054:                if (odalKeyFactory == null) {
055:                    throw new OdalRuntimeCacheException(
056:                            "OdalKeyFactory is null for OdalKeyedCache");
057:                }
058:
059:                put(odalKeyFactory.key(value), value);
060:            }
061:
062:            /**
063:             * @see OdalCache#remove(Object)
064:             */
065:            public Object remove(Object key) {
066:                invalidateEntry(key);
067:                //        return getCache().remove(key);
068:                return getCache().get(key);
069:            }
070:
071:            /**
072:             * @see com.completex.objective.components.ocache.OdalCache#clear()
073:             */
074:            public void clear() {
075:                clearInvalid();
076:                getCache().clear();
077:            }
078:
079:            /**
080:             * @see com.completex.objective.components.ocache.OdalKeyedCache#getKeyFactory()
081:             */
082:            public OdalKeyFactory getKeyFactory() {
083:                return odalKeyFactory;
084:            }
085:
086:            public void setOdalKeyFactory(OdalKeyFactory odalKeyFactory) {
087:                if (odalKeyFactory != null) {
088:                    this .odalKeyFactory = odalKeyFactory;
089:                }
090:            }
091:
092:            public boolean isMarkCacheCollectionElements() {
093:                return markCacheCollectionElements;
094:            }
095:
096:            public void setMarkCacheCollectionElements(
097:                    boolean markCacheCollectionElements) {
098:                this .markCacheCollectionElements = markCacheCollectionElements;
099:            }
100:
101:            /**
102:             * @see com.completex.objective.components.ocache.OdalCacheWrapper#getCoreCache() 
103:             */
104:            public OdalCache getCoreCache() {
105:                return getCache();
106:            }
107:
108:            /**
109:             * Returns odalCache if it is instance of TransactionListener or othewise recurcively goes through OdalCacheWrapper instances (if applicable) and returns the delegate
110:             * if it is instance of TransactionListener
111:             * 
112:             * @param odalCache cache to probe 
113:             * @return odalCache if it is instance of TransactionListener or othewise recurcively goes through OdalCacheWrapper instances (if applicable) and returns the delegate
114:             * if it is instance of TransactionListener
115:             */
116:            public static TransactionListener extractTransactionListener(
117:                    OdalCache odalCache) {
118:                if (odalCache == null) {
119:                    return null;
120:                }
121:
122:                if (odalCache instanceof  TransactionListener) {
123:                    return (TransactionListener) odalCache;
124:                } else if (odalCache instanceof  OdalCacheWrapper) {
125:                    OdalCacheWrapper wrapper = (OdalCacheWrapper) odalCache;
126:                    return extractTransactionListener(wrapper.getCoreCache());
127:                } else {
128:                    return null;
129:                }
130:            }
131:
132:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.