Source Code Cross Referenced for EntityStore.java in  » Development » rapla » org » rapla » storage » 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 » Development » rapla » org.rapla.storage.impl 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * 
003:         */package org.rapla.storage.impl;
004:
005:        import java.util.ArrayList;
006:        import java.util.Collection;
007:        import java.util.HashMap;
008:        import java.util.HashSet;
009:        import java.util.Iterator;
010:        import java.util.List;
011:
012:        import org.rapla.components.util.Assert;
013:        import org.rapla.entities.EntityNotFoundException;
014:        import org.rapla.entities.RaplaObject;
015:        import org.rapla.entities.RaplaType;
016:        import org.rapla.entities.dynamictype.DynamicType;
017:        import org.rapla.entities.internal.CategoryImpl;
018:        import org.rapla.entities.storage.EntityResolver;
019:        import org.rapla.entities.storage.RefEntity;
020:        import org.rapla.storage.LocalCache;
021:
022:        public class EntityStore implements  EntityResolver {
023:            HashMap entities = new HashMap();
024:            HashSet idsToRemove = new HashSet();
025:            LocalCache parent;
026:            HashMap dynamicTypes = new HashMap();
027:            CategoryImpl super Category;
028:            HashMap passwordList = new HashMap();
029:            long repositoryVersion;
030:
031:            public EntityStore(LocalCache parent, CategoryImpl super Category) {
032:                this .parent = parent;
033:                this .super Category = super Category;
034:                // put( superCategory);
035:            }
036:
037:            public void addAll(Collection collection) {
038:                Iterator it = collection.iterator();
039:                while (it.hasNext()) {
040:                    put((RefEntity) it.next());
041:                }
042:            }
043:
044:            public void put(RefEntity entity) {
045:                Object id = entity.getId();
046:                Assert.notNull(id);
047:                if (entity.getRaplaType().equals(DynamicType.TYPE)) {
048:                    DynamicType dynamicType = (DynamicType) entity;
049:                    dynamicTypes.put(dynamicType.getElementKey(), entity);
050:                }
051:                entities.put(id, entity);
052:            }
053:
054:            public void addRemoveId(Object id) {
055:                idsToRemove.add(id);
056:            }
057:
058:            public DynamicType getDynamicType(String key) {
059:                // todo super 
060:                DynamicType type = (DynamicType) dynamicTypes.get(key);
061:                if (type == null && parent != null) {
062:                    type = parent.getDynamicType(key);
063:                }
064:                return type;
065:            }
066:
067:            public Collection getList() {
068:                return entities.values();
069:            }
070:
071:            public Collection getRemoveIds() {
072:                return idsToRemove;
073:            }
074:
075:            // Implementation of EntityResolver
076:            public RefEntity resolve(Object id) throws EntityNotFoundException {
077:                RefEntity result = get(id);
078:                if (result == null) {
079:                    throw new EntityNotFoundException("Object for id "
080:                            + id.toString() + " not found");
081:                }
082:                return result;
083:            }
084:
085:            public CategoryImpl getSuperCategory() {
086:                return super Category;
087:            }
088:
089:            public void putPassword(Object userid, String password) {
090:                passwordList.put(userid, password);
091:            }
092:
093:            public String getPassword(Object userid) {
094:                return (String) passwordList.get(userid);
095:            }
096:
097:            public RefEntity get(Object id) {
098:                if (id.equals(super Category.getId())) {
099:                    return super Category;
100:                }
101:                RefEntity entity = (RefEntity) entities.get(id);
102:                if (entity != null)
103:                    return entity;
104:
105:                if (parent != null) {
106:                    return parent.get(id);
107:
108:                }
109:                return null;
110:            }
111:
112:            public Collection getCollection(RaplaType raplaType) {
113:                List collection = new ArrayList();
114:                Iterator it = entities.values().iterator();
115:                while (it.hasNext()) {
116:                    RaplaObject obj = (RaplaObject) it.next();
117:                    if (obj.getRaplaType().equals(raplaType)) {
118:                        collection.add(obj);
119:                    }
120:                }
121:                return collection;
122:            }
123:
124:            public long getRepositoryVersion() {
125:                return repositoryVersion;
126:            }
127:
128:            public void setRepositoryVersion(long repositoryVersion) {
129:                this.repositoryVersion = repositoryVersion;
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.