Source Code Cross Referenced for MetaInformationHandler.java in  » GIS » openjump » de » fho » jump » pirol » utilities » 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 » GIS » openjump » de.fho.jump.pirol.utilities.metaData 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Created on 13.07.2005 for PIROL
003:         *
004:         * SVN header information:
005:         *  $Author: javamap $
006:         *  $Rev: 856 $
007:         *  $Date: 2007-06-18 21:15:27 -0700 (Mon, 18 Jun 2007) $
008:         *  $Id: MetaInformationHandler.java 856 2007-06-19 04:15:27Z javamap $
009:         */
010:        package de.fho.jump.pirol.utilities.metaData;
011:
012:        import java.util.HashMap;
013:        import java.util.Set;
014:
015:        import com.vividsolutions.jump.feature.FeatureCollection;
016:        import com.vividsolutions.jump.workbench.model.Layer;
017:
018:        import de.fho.jump.pirol.utilities.FeatureCollection.PirolFeatureCollection;
019:        import de.fho.jump.pirol.utilities.FeatureCollection.PirolFeatureCollectionRole;
020:        import de.fho.jump.pirol.utilities.FeatureCollection.PirolFeatureCollectionRoleTypes;
021:        import de.fho.jump.pirol.utilities.FeatureCollection.RoleStandardFeatureCollection;
022:        import de.fho.jump.pirol.utilities.apiTools.HandlerToMakeYourLifeEasier;
023:        import de.fho.jump.pirol.utilities.debugOutput.DebugUserIds;
024:        import de.fho.jump.pirol.utilities.debugOutput.PersonalLogger;
025:
026:        /**
027:         * Tool class for easier handling of meta information on a layer basis.<br>
028:         * - objects will be created, if neccessary<br>
029:         * - you don't need to access the properties map of the data source (where the meta information is stored) yourself<br>
030:         *
031:         * @author Ole Rahn
032:         * <br>
033:         * <br>FH Osnabr&uuml;ck - University of Applied Sciences Osnabr&uuml;ck,
034:         * <br>Project: PIROL (2005),
035:         * <br>Subproject: Daten- und Wissensmanagement
036:         * 
037:         * @version $Rev: 856 $
038:         * @see de.fhOsnabrueck.jump.pirol.utilities.metaData.MetaInformationKeys
039:         * 
040:         */
041:        public class MetaInformationHandler implements 
042:                HandlerToMakeYourLifeEasier {
043:            protected ObjectContainingMetaInformation objectWithMetaInformation = null;
044:
045:            protected PersonalLogger logger = new PersonalLogger(
046:                    DebugUserIds.ALL);
047:
048:            /**
049:             * 
050:             *@param layerWithMetaInformation the layer you want the meta information of (has to have a DataSource!!)
051:             */
052:            public MetaInformationHandler(Layer layerWithMetaInformation) {
053:                super ();
054:                if (layerWithMetaInformation != null) {
055:                    FeatureCollection fc = layerWithMetaInformation
056:                            .getFeatureCollectionWrapper().getUltimateWrappee();
057:
058:                    if (!PirolFeatureCollection.class.isInstance(fc)) {
059:                        fc = createPirolFeatureCollection(fc);
060:                        layerWithMetaInformation.setFeatureCollection(fc);
061:                    }
062:
063:                    this .objectWithMetaInformation = (PirolFeatureCollection) fc;
064:                } else {
065:                    throw new RuntimeException("given layer is null.");
066:                }
067:            }
068:
069:            /**
070:             * 
071:             *@param objectWithMetaInformation the object you want the meta information of
072:             */
073:            public MetaInformationHandler(
074:                    ObjectContainingMetaInformation objectWithMetaInformation) {
075:                super ();
076:                if (objectWithMetaInformation != null) {
077:                    this .objectWithMetaInformation = objectWithMetaInformation;
078:                } else {
079:                    throw new RuntimeException("given layer is null.");
080:                }
081:            }
082:
083:            /**
084:             * creates a PirolFeatureCollection out of a regular FeatureCollection
085:             *@param fc regular FeatureCollection
086:             *@return PirolFeatureCollection
087:             */
088:            public static final PirolFeatureCollection createPirolFeatureCollection(
089:                    FeatureCollection fc) {
090:                return MetaInformationHandler.createPirolFeatureCollection(fc,
091:                        new RoleStandardFeatureCollection());
092:            }
093:
094:            /**
095:             * creates a PirolFeatureCollection out of a regular FeatureCollection
096:             *@param fc regular FeatureCollection
097:             *@return PirolFeatureCollection
098:             */
099:            public static final PirolFeatureCollection createPirolFeatureCollection(
100:                    FeatureCollection fc, PirolFeatureCollectionRole role) {
101:                PirolFeatureCollection pfc = null;
102:
103:                if (!PirolFeatureCollection.class.isInstance(fc)) {
104:                    pfc = new PirolFeatureCollection(fc, role);
105:                } else {
106:                    pfc = (PirolFeatureCollection) fc;
107:
108:                    if (!role
109:                            .equalsRole(PirolFeatureCollectionRoleTypes.STANDARD)) {
110:                        pfc.addRole(role);
111:                    }
112:
113:                }
114:
115:                return pfc;
116:            }
117:
118:            /**
119:             * Retrieve the existent meta information map. 
120:             *@return the existent meta information map or null, if there is none
121:             */
122:            public MetaDataMap getExistentMetaInformationMap() {
123:                if (this .containsMetaInformation()) {
124:                    return this .getMetaInformationMap();
125:                }
126:                return null;
127:            }
128:
129:            /**
130:             * Retrieve the existent meta information map or create one. 
131:             *@return the existent meta information map or an empty meta information map (that is now attached to the DataSource)
132:             *@throws RuntimeException, if the given DataSource doesn't even have properties (<code>getProperties()</code>)
133:             */
134:            public MetaDataMap getMetaInformationMap() {
135:                if (!this .containsMetaInformation()) {
136:                    MetaDataMap newMap = new MetaDataMap();
137:
138:                    if (this .objectWithMetaInformation != null) {
139:                        this .logger.printDebug("creating new meta map for "
140:                                + this .objectWithMetaInformation);
141:                        this .objectWithMetaInformation
142:                                .setMetaInformation(newMap);
143:                    } else
144:                        return null;
145:
146:                    return newMap;
147:                } else if (this .objectWithMetaInformation != null) {
148:                    return this .objectWithMetaInformation.getMetaInformation();
149:                }
150:
151:                return null;
152:            }
153:
154:            /**
155:             * @return true if the given layer already contains meta information, false if not
156:             */
157:            public boolean containsMetaInformation() {
158:                return (this .objectWithMetaInformation != null && this .objectWithMetaInformation
159:                        .getMetaInformation() != null);
160:            }
161:
162:            /**
163:             * Adds a new meta information key-value-pair to the meta information map, replaces
164:             * an existing pair with the same key.
165:             *@param key
166:             *@param value
167:             */
168:            public void addMetaInformation(String key, Object value) {
169:                MetaDataMap metaMap = this .getMetaInformationMap();
170:                if (metaMap.containsKey(key))
171:                    metaMap.remove(key);
172:                metaMap.addMetaInformation(key, value);
173:            }
174:
175:            public HashMap getMetaData() {
176:                MetaDataMap metaMap = this .getMetaInformationMap();
177:                return metaMap.getMetaData();
178:            }
179:
180:            public void setMetaData(HashMap<Object, Object> metaData) {
181:                MetaDataMap metaMap = this .getMetaInformationMap();
182:                metaMap.setMetaData(metaData);
183:            }
184:
185:            public void clear() {
186:                MetaDataMap metaMap = this .getMetaInformationMap();
187:                metaMap.clear();
188:            }
189:
190:            public boolean containsKey(String key) {
191:                MetaDataMap metaMap = this .getMetaInformationMap();
192:                return metaMap.containsKey(key);
193:            }
194:
195:            public Object getMetaInformation(String key) {
196:                MetaDataMap metaMap = this .getMetaInformationMap();
197:                return metaMap.get(key);
198:            }
199:
200:            public boolean containsValue(Object value) {
201:                MetaDataMap metaMap = this .getMetaInformationMap();
202:                return metaMap.containsValue(value);
203:            }
204:
205:            public Set keySet() {
206:                MetaDataMap metaMap = this .getMetaInformationMap();
207:                return metaMap.keySet();
208:            }
209:
210:            public Object remove(String key) {
211:                MetaDataMap metaMap = this .getMetaInformationMap();
212:                return metaMap.remove(key);
213:            }
214:
215:            // Specific information
216:
217:            /**
218:             * @return the Attribute2UnitMap of the given DataSource or null, if there is none
219:             */
220:            public Attribute2UnitMap getAttribute2UnitMap() {
221:                if (this .containsAttribute2UnitMap())
222:                    return (Attribute2UnitMap) this 
223:                            .getMetaInformation(Attribute2UnitMap.KEY_ATTRIBUTE2UNIT);
224:                return null;
225:            }
226:
227:            public void putAttribute2UnitMap(Attribute2UnitMap attribute2UnitMap) {
228:                this .addMetaInformation(Attribute2UnitMap.KEY_ATTRIBUTE2UNIT,
229:                        attribute2UnitMap);
230:            }
231:
232:            public boolean containsAttribute2UnitMap() {
233:                return this.containsKey(Attribute2UnitMap.KEY_ATTRIBUTE2UNIT);
234:            }
235:
236:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.