Source Code Cross Referenced for BeanCacheEntry.java in  » Net » Coadunation_1.0.1 » com » rift » coad » lib » bean » 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 » Net » Coadunation_1.0.1 » com.rift.coad.lib.bean 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * MessageService: The message service daemon
003:         * Copyright (C) 2006  Rift IT Contracting
004:         *
005:         * This library is free software; you can redistribute it and/or
006:         * modify it under the terms of the GNU Lesser General Public
007:         * License as published by the Free Software Foundation; either
008:         * version 2.1 of the License, or (at your option) any later version.
009:         *
010:         * This library is distributed in the hope that it will be useful,
011:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
012:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
013:         * Lesser General Public License for more details.
014:         *
015:         * You should have received a copy of the GNU Lesser General Public
016:         * License along with this library; if not, write to the Free Software
017:         * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
018:         *
019:         * BeanCacheEntry.java
020:         */
021:
022:        // package paths
023:        package com.rift.coad.lib.bean;
024:
025:        // java imports
026:        import java.util.Date;
027:
028:        // coadunation imports
029:        import com.rift.coad.lib.cache.CacheEntry;
030:
031:        /**
032:         * The bean cache entry is responsible for
033:         *
034:         * @author Brett Chaldecott
035:         */
036:        public class BeanCacheEntry {
037:            // the classes private member variables
038:            private long timeout = 0;
039:            private Object cacheKey = null;
040:            private Object wrappedObject = null;
041:            private CacheEntry cacheEntry = null;
042:            private Object proxy = null;
043:            private CacheEntry beanHandler = null;
044:
045:            /**
046:             * The constructor of the BeanCacheEntry object.
047:             *
048:             * @param timeout The time out value.
049:             * @param cacheKey The cache key that uniqly identifies this object.
050:             * @param wrapperObject The wrapper object reference.
051:             * @param cacheEntry The new entry to add to the cache.
052:             */
053:            public BeanCacheEntry(long timeout, Object cacheKey,
054:                    Object wrappedObject, CacheEntry cacheEntry) {
055:                this .timeout = timeout;
056:                this .cacheKey = cacheKey;
057:                this .wrappedObject = wrappedObject;
058:                this .cacheEntry = cacheEntry;
059:            }
060:
061:            /**
062:             * The constructor of the BeanCacheEntry object.
063:             *
064:             * @param timeout The time out period.
065:             * @param cacheKey The cache key that uniqly identifies this object.
066:             * @param proxy The proxy object.
067:             * @param beanHandler The handler to perform the search for.
068:             */
069:            public BeanCacheEntry(long timeout, Object cacheKey,
070:                    Object wrappedObject, Object proxy, CacheEntry beanHandler) {
071:                this .timeout = timeout;
072:                this .cacheKey = cacheKey;
073:                this .wrappedObject = wrappedObject;
074:                this .proxy = proxy;
075:                this .beanHandler = beanHandler;
076:            }
077:
078:            /**
079:             * This method returns the cache key object.
080:             *
081:             * @return The cache key object.
082:             */
083:            public Object getCacheKey() {
084:                return cacheKey;
085:            }
086:
087:            /**
088:             * This method returns the wrapped object.
089:             *
090:             * @return The wrapped object.
091:             */
092:            public Object getWrappedObject() {
093:                return wrappedObject;
094:            }
095:
096:            /**
097:             * This method returns the cache entry that this object wrapps.
098:             */
099:            public CacheEntry getCacheEntry() {
100:                return cacheEntry;
101:            }
102:
103:            /**
104:             * This method sets the cache entry.
105:             *
106:             * @param cacheEntry The new cache entry to set.
107:             */
108:            public void setCacheEntry(CacheEntry cacheEntry) {
109:                this .cacheEntry = cacheEntry;
110:            }
111:
112:            /**
113:             * This methos returns the proxy object.
114:             *
115:             * @return The proxy object.
116:             */
117:            public Object getProxy() {
118:                return proxy;
119:            }
120:
121:            /**
122:             * This method sets the proxy object.
123:             *
124:             * @param proxy The proxy object value to set.
125:             */
126:            public void setProxy(Object proxy) {
127:                this .proxy = proxy;
128:            }
129:
130:            /**
131:             * This method retrieves the bean handler object.
132:             *
133:             * @return The bean handler reference.
134:             */
135:            public CacheEntry getBeanHandler() {
136:                return beanHandler;
137:            }
138:
139:            /**
140:             * This method sets the bean handler flag.
141:             *
142:             * @param beanHandler The bean handler to set.
143:             */
144:            public void setBeanHandler(CacheEntry beanHandler) {
145:                this .beanHandler = beanHandler;
146:            }
147:
148:            /**
149:             * This method sets the last touch time
150:             */
151:            public void touch() {
152:                if (cacheEntry != null) {
153:                    cacheEntry.touch();
154:                }
155:                if (beanHandler != null) {
156:                    beanHandler.touch();
157:                }
158:            }
159:
160:            /**
161:             * This method returns true if this object is expired.
162:             *
163:             * @return TRUE if expired, FALSE if not.
164:             * @param expiryDate The expiry date.
165:             */
166:            public boolean isExpired(Date expiryDate) {
167:                Date calculatedExpiryTime = new Date(expiryDate.getTime()
168:                        - timeout);
169:                if ((((cacheEntry != null) && (cacheEntry
170:                        .isExpired(calculatedExpiryTime))) || (cacheEntry == null))
171:                        && ((beanHandler == null) || ((beanHandler != null) && (beanHandler
172:                                .isExpired(calculatedExpiryTime))))) {
173:                    return true;
174:                }
175:                return false;
176:            }
177:
178:            /**
179:             * Call the cache entries to release
180:             */
181:            public void cacheRelease() {
182:                if (cacheEntry != null) {
183:                    cacheEntry.cacheRelease();
184:                }
185:                if (beanHandler != null) {
186:                    beanHandler.cacheRelease();
187:                }
188:            }
189:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.