Source Code Cross Referenced for NameSpaceInfo.java in  » GIS » GeoServer » org » vfny » geoserver » global » 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 » GIS » GeoServer » org.vfny.geoserver.global 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* Copyright (c) 2001 - 2007 TOPP - www.openplans.org.  All rights reserved.
002:         * This code is licensed under the GPL 2.0 license, availible at the root
003:         * application directory.
004:         */
005:
006:        /* Copyright (c) 2001 - 2007 TOPP - www.openplans.org.  All rights reserved.
007:         * This code is licensed under the GPL 2.0 license, availible at the root
008:         * application directory.
009:         */
010:        package org.vfny.geoserver.global;
011:
012:        import org.vfny.geoserver.global.dto.NameSpaceInfoDTO;
013:        import java.util.HashSet;
014:        import java.util.Iterator;
015:        import java.util.Map;
016:        import java.util.Set;
017:
018:        /**
019:         * NameSpaceInfo purpose.
020:         *
021:         * <p>
022:         * A representation of a namespace for the Geoserver application.
023:         * </p>
024:         *
025:         * <p></p>
026:         *
027:         * <p>
028:         * NameSpaceInfo ns = new NameSpaceInfo(dto); System.out.println(ns.getPrefix()
029:         * + ns.getUri());
030:         * </p>
031:         *
032:         * @author dzwiers, Refractions Research, Inc.
033:         * @version $Id: NameSpaceInfo.java 6326 2007-03-15 18:36:40Z jdeolive $
034:         */
035:        public class NameSpaceInfo extends GlobalLayerSupertype {
036:            private String prefix;
037:            private String uri;
038:            private boolean _default;
039:
040:            /** ref to parent set of datastores. */
041:            private Data data;
042:
043:            /** metadata */
044:            private Map meta;
045:
046:            /**
047:             * NameSpaceConfig constructor.
048:             *
049:             * <p>
050:             * Creates a NameSpaceConfig based on the data provided. All the data
051:             * structures are cloned.
052:             * </p>
053:             *
054:             * @param data DOCUMENT ME!
055:             * @param ns The namespace to copy.
056:             *
057:             * @throws NullPointerException when the param is null
058:             */
059:            public NameSpaceInfo(Data data, NameSpaceInfoDTO ns) {
060:                if (ns == null) {
061:                    throw new NullPointerException(
062:                            "Non null NameSpaceInfoDTO required");
063:                }
064:
065:                if (data == null) {
066:                    throw new NullPointerException("Non null Data required");
067:                }
068:
069:                this .data = data;
070:
071:                prefix = ns.getPrefix();
072:                uri = ns.getUri();
073:                _default = ns.isDefault();
074:            }
075:
076:            /**
077:             * NameSpaceConfig constructor.
078:             *
079:             * <p>
080:             * Creates a copy of the NameSpaceConfig provided. All the data structures
081:             * are cloned.
082:             * </p>
083:             *
084:             * @param ns The namespace to copy.
085:             *
086:             * @throws NullPointerException when the param is null
087:             */
088:            public NameSpaceInfo(NameSpaceInfo ns) {
089:                if (ns == null) {
090:                    throw new NullPointerException();
091:                }
092:
093:                setPrefix(ns.getPrefix());
094:                setUri(ns.getUri());
095:                setDefault(ns.isDefault());
096:            }
097:
098:            /**
099:             * Implement toDTO.
100:             *
101:             * <p>
102:             * Package method used by GeoServer. This method may return references, and
103:             * does not clone, so extreme caution sould be used when traversing the
104:             * results.
105:             * </p>
106:             *
107:             * @return NameSpaceInfoDTO An instance of the data this class represents.
108:             *         Please see Caution Above.
109:             *
110:             * @see org.vfny.geoserver.global.GlobalLayerSupertype#toDTO()
111:             * @see NameSpaceInfoDTO
112:             */
113:            Object toDTO() {
114:                NameSpaceInfoDTO dto = new NameSpaceInfoDTO();
115:                dto.setDefault(isDefault());
116:                dto.setPrefix(getPrefix());
117:                dto.setUri(getUri());
118:
119:                return dto;
120:            }
121:
122:            /**
123:             * Implement clone.
124:             *
125:             * <p>
126:             * creates a clone of this object
127:             * </p>
128:             *
129:             * @return A copy of this NameSpaceConfig
130:             *
131:             * @see java.lang.Object#clone()
132:             */
133:            public Object clone() {
134:                return new NameSpaceInfo(this );
135:            }
136:
137:            /**
138:             * Implement equals.
139:             *
140:             * <p>
141:             * recursively tests to determine if the object passed in is a copy of this
142:             * object.
143:             * </p>
144:             *
145:             * @param obj The NameSpaceConfig object to test.
146:             *
147:             * @return true when the object passed is the same as this object.
148:             *
149:             * @see java.lang.Object#equals(java.lang.Object)
150:             */
151:            public boolean equals(Object obj) {
152:                NameSpaceInfo ns = (NameSpaceInfo) obj;
153:
154:                return ((getPrefix() == ns.getPrefix()) && ((getUri() == ns
155:                        .getUri()) && (isDefault() == ns.isDefault())));
156:            }
157:
158:            /**
159:             * isDefault purpose.
160:             *
161:             * <p>
162:             * Whether this is the default namespace.
163:             * </p>
164:             *
165:             * @return true when this is the default namespace.
166:             */
167:            public boolean isDefault() {
168:                return _default;
169:            }
170:
171:            /**
172:             * getPrefix purpose.
173:             *
174:             * <p>
175:             * returns the namespace's prefix.
176:             * </p>
177:             *
178:             * @return String the namespace's prefix
179:             */
180:            public String getPrefix() {
181:                return prefix;
182:            }
183:
184:            /**
185:             * getUri purpose.
186:             *
187:             * <p>
188:             * returns the namespace's uri.
189:             * </p>
190:             *
191:             * @return String the namespace's uri.
192:             */
193:            public String getUri() {
194:                return uri;
195:            }
196:
197:            /**
198:             * Implementation of getURI.
199:             *
200:             * @see org.geotools.data.NamespaceMetaData#getURI()
201:             *
202:             * @return
203:             */
204:            public String getURI() {
205:                return uri;
206:            }
207:
208:            /**
209:             * setDdefault purpose.
210:             *
211:             * <p>
212:             * sets the default namespace.
213:             * </p>
214:             *
215:             * @param b this is the default namespace.
216:             */
217:            public void setDefault(boolean b) {
218:                _default = b;
219:            }
220:
221:            /**
222:             * setPrefix purpose.
223:             *
224:             * <p>
225:             * stores the namespace's prefix.
226:             * </p>
227:             *
228:             * @param string the namespace's prefix.
229:             */
230:            public void setPrefix(String string) {
231:                prefix = string;
232:            }
233:
234:            /**
235:             * setUri purpose.
236:             *
237:             * <p>
238:             * Stores the namespace's uri.
239:             * </p>
240:             *
241:             * @param string the namespace's uri.
242:             */
243:            public void setUri(String string) {
244:                uri = string;
245:            }
246:
247:            /**
248:             * Implement containsMetaData.
249:             *
250:             * @param key
251:             *
252:             * @return
253:             *
254:             * @see org.geotools.data.MetaData#containsMetaData(java.lang.String)
255:             */
256:            public boolean containsMetaData(String key) {
257:                return meta.containsKey(key);
258:            }
259:
260:            /**
261:             * Implement putMetaData.
262:             *
263:             * @param key
264:             * @param value
265:             *
266:             * @see org.geotools.data.MetaData#putMetaData(java.lang.String,
267:             *      java.lang.Object)
268:             */
269:            public void putMetaData(String key, Object value) {
270:                meta.put(key, value);
271:            }
272:
273:            /**
274:             * Implement getMetaData.
275:             *
276:             * @param key
277:             *
278:             * @return
279:             *
280:             * @see org.geotools.data.MetaData#getMetaData(java.lang.String)
281:             */
282:            public Object getMetaData(String key) {
283:                return meta.get(key);
284:            }
285:
286:            /**
287:             * This should be a list of available typeNames for the namespace.
288:             *
289:             * <p>
290:             * Makes use of data to get the list of all FeatureTypes, returns the names
291:             * that match this prefix. This is just the typeName and not the full
292:             * prefix:typeName.
293:             * </p>
294:             *
295:             * @return
296:             *
297:             * @see org.geotools.data.NamespaceMetaData#getTypeNames()
298:             */
299:            public Set getTypeNames() {
300:                Set set = new HashSet();
301:
302:                for (Iterator i = data.getFeatureTypeInfos().values()
303:                        .iterator(); i.hasNext();) {
304:                    FeatureTypeInfo type = (FeatureTypeInfo) i.next();
305:
306:                    if (type.getNameSpace() == this ) {
307:                        set.add(type.getName());
308:                    }
309:                }
310:
311:                return set;
312:            }
313:
314:            /**
315:             * Search for FeatureTypeInfo based on prefix:typeName
316:             *
317:             * <p>
318:             * Convience method for data.getFeatureTypeInfo( typeName, uri );
319:             * </p>
320:             *
321:             * @param typeName
322:             *
323:             * @return
324:             *
325:             * @see org.geotools.data.NamespaceMetaData#getFeatureTypeMetaData(java.lang.String)
326:             */
327:            public FeatureTypeInfo getFeatureTypeInfo(String typeName) {
328:                return data.getFeatureTypeInfo(typeName, uri);
329:            }
330:
331:            public String toString() {
332:                return getPrefix() + ":" + getUri();
333:            }
334:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.