Source Code Cross Referenced for MetadataException.java in  » GIS » GeoTools-2.4.1 » org » geotools » coverage » io » 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 » GeoTools 2.4.1 » org.geotools.coverage.io 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *    GeoTools - OpenSource mapping toolkit
003:         *    http://geotools.org
004:         *    (C) 2005-2006, Geotools Project Managment Committee (PMC)
005:         *    (C) 2001, Institut de Recherche pour le Développement
006:         *
007:         *    This library is free software; you can redistribute it and/or
008:         *    modify it under the terms of the GNU Lesser General Public
009:         *    License as published by the Free Software Foundation; either
010:         *    version 2.1 of the License, or (at your option) any later version.
011:         *
012:         *    This library is distributed in the hope that it will be useful,
013:         *    but WITHOUT ANY WARRANTY; without even the implied warranty of
014:         *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
015:         *    Lesser General Public License for more details.
016:         */
017:        package org.geotools.coverage.io;
018:
019:        // J2SE dependencies
020:        import javax.imageio.IIOException;
021:
022:        /**
023:         * The base class for error related to grid coverage's metadata.
024:         * This exception is thrown by the helper class {@link MetadataBuilder}.
025:         *
026:         * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/unsupported/coverageio/src/main/java/org/geotools/coverage/io/MetadataException.java $
027:         * @version $Id: MetadataException.java 25699 2007-05-31 15:55:07Z desruisseaux $
028:         * @author Martin Desruisseaux
029:         *
030:         * @since 2.2
031:         */
032:        public class MetadataException extends IIOException {
033:            /**
034:             * Serial number for interoperability with different versions.
035:             */
036:            private static final long serialVersionUID = -3146379152278866037L;
037:
038:            /**
039:             * The key for the faulty metadata, or {@code null} if none.
040:             */
041:            private final MetadataBuilder.Key key;
042:
043:            /**
044:             * The alias used for the metadata, or {@code null} if none.
045:             */
046:            private final String alias;
047:
048:            /**
049:             * Constructs an exception with the specified message and no key.
050:             *
051:             * @param message The message, or {@code null} if none.
052:             */
053:            public MetadataException(final String message) {
054:                super (message);
055:                key = null;
056:                alias = null;
057:            }
058:
059:            /**
060:             * Constructs an exception with the specified message and exception as its cause.
061:             *
062:             * @param message The message, or {@code null} if none.
063:             * @param cause   The cause for this exception.
064:             */
065:            public MetadataException(final String message, final Throwable cause) {
066:                super (message, cause);
067:                key = null;
068:                alias = null;
069:            }
070:
071:            /**
072:             * Constructs an exception with the specified message. This exception is usually raised because
073:             * no value was defined for the key {@code key}, or the value was ambiguous.
074:             *
075:             * @param message The message, or {@code null} if none.
076:             * @param key     The metadata key which was the cause for this exception, or {@code null} if
077:             *                none. This is a format neutral key, for example {@link MetadataBuilder#DATUM}.
078:             * @param alias   The alias used for for the key {@code key}, or {@code null} if none. This is
079:             *                usually the name used in the external file parsed.
080:             */
081:            public MetadataException(final String message,
082:                    final MetadataBuilder.Key key, final String alias) {
083:                super (message);
084:                this .key = key;
085:                this .alias = alias;
086:            }
087:
088:            /**
089:             * Constructs an exception from the specified cause.
090:             *
091:             * @param cause   The cause for this exception.
092:             * @param key     The metadata key which was the cause for this exception, or {@code null} if
093:             *                none. This is a format neutral key, for example {@link MetadataBuilder#DATUM}.
094:             * @param alias   The alias used for for the key {@code key}, or {@code null} if none. This is
095:             *                usually the name used in the external file parsed.
096:             */
097:            public MetadataException(final Exception cause,
098:                    final MetadataBuilder.Key key, final String alias) {
099:                super (cause.getLocalizedMessage(), cause);
100:                this .key = key;
101:                this .alias = alias;
102:            }
103:
104:            /**
105:             * Returns the metadata key which has raised this exception. This exception has usually
106:             * been raised because no value was defined for this key, or the value was ambiguous.
107:             *
108:             * @return The metadata key, or {@code null} if none.
109:             */
110:            public MetadataBuilder.Key getMetadataKey() {
111:                return key;
112:            }
113:
114:            /**
115:             * Returns the alias used for the key {@link #getMetadataKey}. This is usually the name
116:             * used in the external file to be parsed. The alias is format-dependent, while the key
117:             * (as returned by {@link #getMetadataKey}) if format neutral.
118:             *
119:             * @return The alias, or {@code null} if none.
120:             */
121:            public String getMetadataAlias() {
122:                return alias;
123:            }
124:
125:            /**
126:             * Returns a string representation of this exception. This implementation is similar to
127:             * {@link Throwable#toString()}, except that the string will includes key and alias names
128:             * if they are defined. The localized message, if any, may be written on the next line.
129:             * Example:
130:             *
131:             * <blockquote><pre>
132:             * org.geotools.coverage.io.MissingMetadataException(key="YMaximum", alias="ULY"):
133:             * Aucune valeur n'est définie pour la propriété "ULY".
134:             * </pre></blockquote>
135:             */
136:            public String toString() {
137:                final MetadataBuilder.Key key = getMetadataKey();
138:                final String alias = getMetadataAlias();
139:                if (key == null && alias == null) {
140:                    return super .toString();
141:                }
142:                final StringBuffer buffer = new StringBuffer(getClass()
143:                        .getName());
144:                buffer.append('[');
145:                if (key != null) {
146:                    buffer.append("key=\"").append(key).append('"');
147:                    if (alias != null) {
148:                        buffer.append(", ");
149:                    }
150:                }
151:                if (alias != null) {
152:                    buffer.append("alias=\"").append(alias).append('"');
153:                }
154:                buffer.append(']');
155:                final String message = getLocalizedMessage();
156:                if (message != null) {
157:                    buffer.append(':').append(
158:                            System.getProperty("line.separator", "\n")).append(
159:                            message);
160:                }
161:                return buffer.toString();
162:            }
163:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.