Source Code Cross Referenced for ResourceLookup.java in  » Content-Management-System » harmonise » org » openharmonise » vfs » metadata » 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 » Content Management System » harmonise » org.openharmonise.vfs.metadata 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * The contents of this file are subject to the 
003:         * Mozilla Public License Version 1.1 (the "License"); 
004:         * you may not use this file except in compliance with the License. 
005:         * You may obtain a copy of the License at http://www.mozilla.org/MPL/
006:         *
007:         * Software distributed under the License is distributed on an "AS IS"
008:         * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. 
009:         * See the License for the specific language governing rights and 
010:         * limitations under the License.
011:         *
012:         * The Initial Developer of the Original Code is Simulacra Media Ltd.
013:         * Portions created by Simulacra Media Ltd are Copyright (C) Simulacra Media Ltd, 2004.
014:         *
015:         * All Rights Reserved.
016:         *
017:         * Contributor(s):
018:         */
019:        package org.openharmonise.vfs.metadata;
020:
021:        import java.util.Collection;
022:        import java.util.HashMap;
023:        import java.util.Set;
024:
025:        /**
026:         * The ResourceLookup class provides a store of objects which can be
027:         * requested out by either their full path or their fully qualified name,
028:         * i.e. their namespace#name.
029:         * 
030:         * @author Matthew Large
031:         * @version $Revision: 1.1 $
032:         *
033:         */
034:        public class ResourceLookup {
035:
036:            /**
037:             * Map of fully qualified names to objects.
038:             */
039:            HashMap m_qnameLookup = null;
040:
041:            /**
042:             * Map of full paths to objects.
043:             */
044:            HashMap m_hrefLookup = null;
045:
046:            /**
047:             * Map of fully qualified names to full paths.
048:             */
049:            HashMap m_qname2href = null;
050:
051:            /**
052:             * Map of full paths to fully qualified names.
053:             */
054:            HashMap m_href2qname = null;
055:
056:            /**
057:             * Constructs a new ResoruceLookup
058:             * 
059:             * @param nInitialSize Initial size
060:             */
061:            public ResourceLookup(int nInitialSize) {
062:                super ();
063:                m_qnameLookup = new HashMap(nInitialSize);
064:                m_hrefLookup = new HashMap(nInitialSize);
065:                m_qname2href = new HashMap(nInitialSize);
066:                m_href2qname = new HashMap(nInitialSize);
067:            }
068:
069:            /**
070:             * Adds a new object to the lookup.
071:             * 
072:             * @param sQName Fully qualified name
073:             * @param sHREF Full path
074:             * @param obj Object
075:             */
076:            public void put(String sQName, String sHREF, Object obj) {
077:                this .m_qnameLookup.put(sQName, obj);
078:                this .m_hrefLookup.put(sHREF, obj);
079:                this .m_qname2href.put(sQName, sHREF);
080:                this .m_href2qname.put(sHREF, sQName);
081:            }
082:
083:            /**
084:             * Returns a fully qualified name for a given full path.
085:             * 
086:             * @param sHref Full path
087:             * @return Fully qualified name or null if not found
088:             */
089:            public String getQName(String sHref) {
090:                return (String) this .m_href2qname.get(sHref);
091:            }
092:
093:            /**
094:             * Returns a full path for a given fully qualified name.
095:             * 
096:             * @param sQName Fully qualified name
097:             * @return Full path or null if not found
098:             */
099:            public String getHref(String sQName) {
100:                return (String) this .m_qname2href.get(sQName);
101:            }
102:
103:            /**
104:             * Returns an object for a given fully qualified name.
105:             * 
106:             * @param sQName Fully qualified name
107:             * @return Object or null if not found
108:             */
109:            public Object getByQName(String sQName) {
110:                return this .m_qnameLookup.get(sQName);
111:            }
112:
113:            /**
114:             * Returns an object for a given full path.
115:             * 
116:             * @param sHREF Full path
117:             * @return Object or null if not found
118:             */
119:            public Object getByHREF(String sHREF) {
120:                return this .m_hrefLookup.get(sHREF);
121:            }
122:
123:            /**
124:             * Removes an object for a given fully qualified name.
125:             * 
126:             * @param sQName Fully qualified name
127:             */
128:            public void removeByQName(String sQName) {
129:                Object obj = this .m_qnameLookup.get(sQName);
130:                if (obj != null) {
131:                    this .m_qnameLookup.remove(obj);
132:                    this .m_hrefLookup.remove(obj);
133:                }
134:            }
135:
136:            /**
137:             * Remove an object for a given full path.
138:             * 
139:             * @param sHREF Full path
140:             */
141:            public void removeByHREF(String sHREF) {
142:                Object obj = this .m_hrefLookup.get(sHREF);
143:                if (obj != null) {
144:                    Object objcheck = this .m_hrefLookup.remove(sHREF);
145:                    if (objcheck == null) {
146:                        System.err.println("Object removal for href[" + sHREF
147:                                + "] is null!!! " + this .m_hrefLookup.keySet());
148:                    }
149:                    objcheck = this .m_qnameLookup.remove(((Property) obj)
150:                            .getNamespace()
151:                            + "#" + ((Property) obj).getName());
152:                    if (objcheck == null) {
153:                        System.err.println("Object removal for href["
154:                                + ((Property) obj).getNamespace() + "#"
155:                                + ((Property) obj).getName() + "] is null!!! "
156:                                + this .m_qnameLookup.keySet());
157:                    }
158:                }
159:            }
160:
161:            /**
162:             * Removes a given object.
163:             * 
164:             * @param obj Object
165:             */
166:            public void remove(Object obj) {
167:                this .m_qnameLookup.remove(obj);
168:                this .m_hrefLookup.remove(obj);
169:            }
170:
171:            /**
172:             * Returns all the values in this ResourceLookup.
173:             * 
174:             * @return Collection of objects
175:             */
176:            public Collection getValues() {
177:                return this .m_hrefLookup.values();
178:            }
179:
180:            /**
181:             * Returns all the fully qualified names in this ResourceLookup.
182:             * 
183:             * @return Set of fully qualified names
184:             */
185:            public Set getQNameKeySet() {
186:                return this .m_qnameLookup.keySet();
187:            }
188:
189:            /**
190:             * Returns all the full paths in this ResoruceLookup.
191:             * 
192:             * @return Set of full paths
193:             */
194:            public Set getHREFKeySet() {
195:                return this.m_hrefLookup.keySet();
196:            }
197:
198:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.