Source Code Cross Referenced for CacheRepository.java in  » Report » jmagallanes-1.0 » com » calipso » reportgenerator » reportmanager » 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 » Report » jmagallanes 1.0 » com.calipso.reportgenerator.reportmanager 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.calipso.reportgenerator.reportmanager;
002:
003:        import com.calipso.reportgenerator.common.InfoException;
004:
005:        import java.util.HashMap;
006:
007:        import com.calipso.reportgenerator.common.LanguageTraslator;
008:
009:        /**
010:         * Esta clase se encarga de cachear los repositorios
011:         */
012:        public class CacheRepository {
013:            private HashMap cache;
014:            private String repositoryName;
015:
016:            /**
017:             * Inicializa y asigna un nombre al repositorio
018:             * @param name
019:             */
020:            public CacheRepository(String name) {
021:                this .repositoryName = name;
022:            }
023:
024:            /**
025:             * Devuelve el cache
026:             * @return
027:             */
028:            public HashMap getCache() {
029:                if (cache == null) {
030:                    cache = new HashMap();
031:                }
032:                return cache;
033:            }
034:
035:            /**
036:             * Indica si existe un objeto cacheado con el nombre indicado
037:             * @param name
038:             * @return
039:             */
040:            public boolean containsObject(String name) {
041:                return getCache().containsKey(name.toUpperCase());
042:            }
043:
044:            /**
045:             * Indica si existe cacheado el objeto indicado
046:             * @param object
047:             * @return
048:             */
049:            public boolean containsObject(Object object) {
050:                return getCache().containsValue(object);
051:            }
052:
053:            /**
054:             * Agrega al repositorio de objectos cacheados el objeto indicado
055:             * @param name Nombre del objeto
056:             * @param object Objeto a cachear
057:             */
058:            public void addObject(String name, Object object) {
059:                if (!containsObject(name)) {
060:                    System.out.println(repositoryName
061:                            + LanguageTraslator.traslate("494") + name);
062:                    getCache().put(name, object);
063:                }
064:            }
065:
066:            /**
067:             * Remueve el objeto del cache
068:             * @param name Nombre del objeto
069:             * @throws InfoException
070:             */
071:            public void removeObject(String name) throws InfoException {
072:                if (name.equalsIgnoreCase("")) {
073:                    throw new InfoException(LanguageTraslator.traslate("72"));
074:                } else {
075:                    if (getCache().remove(name) == null) {
076:                        throw new InfoException(LanguageTraslator
077:                                .traslate("73")
078:                                + name);
079:                    }
080:                }
081:            }
082:
083:            /**
084:             * Devuelve el objeto con el nombre indicado
085:             * @param name
086:             * @return
087:             * @throws InfoException
088:             */
089:            public Object getObject(String name) throws InfoException {
090:                Object returnObject = null;
091:                if (name.equalsIgnoreCase("")) {
092:                    throw new InfoException(LanguageTraslator.traslate("74"));
093:                } else {
094:                    returnObject = getCache().get(name);
095:                    System.out.println(repositoryName
096:                            + LanguageTraslator.traslate("495") + name);
097:                    if (returnObject == null) {
098:                        throw new InfoException(LanguageTraslator
099:                                .traslate("75")
100:                                + name);
101:                    } else {
102:                        return returnObject;
103:                    }
104:                }
105:            }
106:
107:            /**
108:             * Borra el cache
109:             */
110:            public void deleteAll() {
111:                getCache().clear();
112:            }
113:
114:            /**
115:             * Elimina del cache el objeto indicado
116:             * @param name
117:             */
118:            public void delete(String name) {
119:                getCache().remove(name);
120:            }
121:
122:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.