Source Code Cross Referenced for PaymentException.java in  » 6.0-JDK-Modules » j2me » com » sun » j2me » payment » 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 » 6.0 JDK Modules » j2me » com.sun.j2me.payment 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *   
003:         *
004:         * Copyright  1990-2007 Sun Microsystems, Inc. All Rights Reserved.
005:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
006:         * 
007:         * This program is free software; you can redistribute it and/or
008:         * modify it under the terms of the GNU General Public License version
009:         * 2 only, as published by the Free Software Foundation.
010:         * 
011:         * This program is distributed in the hope that it will be useful, but
012:         * WITHOUT ANY WARRANTY; without even the implied warranty of
013:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014:         * General Public License version 2 for more details (a copy is
015:         * included at /legal/license.txt).
016:         * 
017:         * You should have received a copy of the GNU General Public License
018:         * version 2 along with this work; if not, write to the Free Software
019:         * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020:         * 02110-1301 USA
021:         * 
022:         * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
023:         * Clara, CA 95054 or visit www.sun.com if you need additional
024:         * information or have any questions.
025:         */
026:
027:        package com.sun.j2me.payment;
028:
029:        /**
030:         * Thrown when validating MIDlet's payment information or when downloading and
031:         * validating a payment update file (JPP).
032:         *
033:         * @version 1.2
034:         */
035:        public class PaymentException extends Exception {
036:
037:            /** 
038:             * The payment information has an unsupported version. The 
039:             * <code>getParam()</code> method returns the number of this version.
040:             */
041:            public static final int UNSUPPORTED_PAYMENT_INFO = 0;
042:            /** 
043:             * The payment information doesn't contain a mandatory attribute. The 
044:             * <code>getParam()</code> method returns the name of the attribute.
045:             */
046:            public static final int MISSING_MANDATORY_ATTRIBUTE = 1;
047:            /** 
048:             * The payment information contains an attribute with an invalid value. The 
049:             * <code>getParam()</code> method returns the name of the attribute.
050:             */
051:            public static final int INVALID_ATTRIBUTE_VALUE = 2;
052:            /** 
053:             * The device doesn't support any of the adapters listed in the payment
054:             * information file. The <code>getParam()</code> method returns the name of 
055:             * the attribute which contains the adapter names.
056:             */
057:            public static final int UNSUPPORTED_ADAPTERS = 3;
058:            /** 
059:             * The device doesn't support any of the adapters listed in the payment
060:             * information file. The <code>getParam()</code> method returns the name of 
061:             * the attribute which contains the provider names.
062:             */
063:            public static final int UNSUPPORTED_PROVIDERS = 4;
064:            /** 
065:             * The device doesn't support the scheme of the update URL. The 
066:             * <code>getParam()</code> method returns the update URL. 
067:             */
068:            public static final int UNSUPPORTED_URL_SCHEME = 5;
069:            /** The payment information is not yet valid. */
070:            public static final int INFORMATION_NOT_YET_VALID = 6;
071:            /** The payment information has been expired. */
072:            public static final int INFORMATION_EXPIRED = 7;
073:            /** The payment information is incomplete. */
074:            public static final int INCOMPLETE_INFORMATION = 8;
075:            /** 
076:             * The payment information contains an invalid PaymentSpecificInformation
077:             * field. The <code>getParam()</code> method returns the name of the 
078:             * attribute which contains the invalid field.
079:             */
080:            public static final int INVALID_ADAPTER_CONFIGURATION = 9;
081:            /** 
082:             * The payment information contains an invalid PaymentSpecificPrice-
083:             * Information field. The <code>getParam()</code> method returns the name 
084:             * of the attribute which contains the invalid field.
085:             */
086:            public static final int INVALID_PRICE_INFORMATION = 10;
087:            /** 
088:             * The payment update failed because the update URL is invalid. The
089:             * <code>getParam()</code> method returns the URL.
090:             */
091:            public static final int INVALID_UPDATE_URL = 11;
092:            /** 
093:             * The update server has been not found. The <code>getParam()</code> method 
094:             * returns the URL of the payment update file.
095:             */
096:            public static final int UPDATE_SERVER_NOT_FOUND = 12;
097:            /** 
098:             * The payment update file has not been found on the server. The 
099:             * <code>getParam()</code> method returns the URL of the payment update 
100:             * file. 
101:             */
102:            public static final int UPDATE_NOT_FOUND = 13;
103:            /** The update server is busy. */
104:            public static final int UPDATE_SERVER_BUSY = 14;
105:            /** 
106:             * The http request failed. The <code>getParam()</code> method returns the 
107:             * HTTP response code.
108:             */
109:            public static final int UPDATE_REQUEST_ERROR = 15;
110:            /** 
111:             * The payment update file has an invalid or missing MIME-type. The 
112:             * <code>getParam()</code> method returns this type.
113:             */
114:            public static final int INVALID_UPDATE_TYPE = 16;
115:            /** 
116:             * The payment update file has an unsupported character set. The 
117:             * <code>getParam()</code> method returns the character set name.
118:             */
119:            public static final int UNSUPPORTED_UPDATE_CHARSET = 17;
120:            /** 
121:             * The provider's certificate has expired or is not yet valid. The 
122:             * <code>getParam()</code> method returns the subject name of the 
123:             * certificate.
124:             */
125:            public static final int EXPIRED_PROVIDER_CERT = 18;
126:            /** 
127:             * The public key of the provider's root CA has expired. The 
128:             * <code>getParam()</code> method returns the subject name of the CA 
129:             * certificate.
130:             */
131:            public static final int EXPIRED_CA_CERT = 19;
132:            /** 
133:             * The provider's certificate is invalid. The <code>getParam()</code> method
134:             * returns the subject name of the certificate. 
135:             */
136:            public static final int INVALID_PROVIDER_CERT = 20;
137:            /** 
138:             * The payment update file does not contain any certification chain which 
139:             * can be verified. 
140:             */
141:            public static final int NO_TRUSTED_CHAIN = 21;
142:            /** The verification of the payment update file's signature has failed. */
143:            public static final int SIGNATURE_VERIFICATION_FAILED = 22;
144:            /** The payment update file has an invalid properties file format. */
145:            public static final int INVALID_PROPERTIES_FORMAT = 23;
146:
147:            // the reason for the exception
148:            private int reason;
149:            // an additional string param
150:            private String param;
151:
152:            /**
153:             * Creates an instance of the <code>PaymentException</code> class with the 
154:             * given reason.
155:             *
156:             * @param reason the reason
157:             */
158:            public PaymentException(int reason) {
159:                this .reason = reason;
160:            }
161:
162:            /**
163:             * Creates an instance of the <code>PaymentException</code> class with the 
164:             * given reason and the detail message.
165:             *
166:             * @param reason the reason
167:             * @param detail the detail message
168:             */
169:            public PaymentException(int reason, String detail) {
170:                super (detail);
171:                this .reason = reason;
172:            }
173:
174:            /**
175:             * Creates an instance of the <code>PaymentException</code> class with the 
176:             * given reason, an additional string value which meaning depends on the 
177:             * reason and the detail message.
178:             *
179:             * @param reason the reason
180:             * @param param the string value
181:             * @param detail the detail message
182:             */
183:            public PaymentException(int reason, String param, String detail) {
184:                super (detail);
185:                this .reason = reason;
186:                this .param = param;
187:            }
188:
189:            /**
190:             * Returns the reason for the exception as a number.
191:             *
192:             * @return the reason
193:             */
194:            public final int getReason() {
195:                return reason;
196:            }
197:
198:            /**
199:             * Sets an additional string value which depends on the reason for the 
200:             * exception.
201:             *
202:             * @param param the string value
203:             * @see #getParam
204:             */
205:            public final void setParam(String param) {
206:                this .param = param;
207:            }
208:
209:            /**
210:             * Returns an additional string value which depends on the reason for the 
211:             * exception.
212:             *
213:             * @return the string value
214:             * @see #setParam
215:             */
216:            public final String getParam() {
217:                return param;
218:            }
219:
220:            /**
221:             * Returns the detail message for the exception.
222:             *
223:             * @return the detail message
224:             */
225:            public final String getDetail() {
226:                return super .getMessage();
227:            }
228:
229:            /**
230:             * Returns the full description of the exception. It uses the reason code,
231:             * the param value and the detail message to construct the description.
232:             *
233:             * @return the full description of the exception
234:             */
235:            public final String getMessage() {
236:                String message;
237:
238:                switch (reason) {
239:                case UNSUPPORTED_PAYMENT_INFO:
240:                    message = "Unsupported version of the payment information ("
241:                            + param + ")";
242:                    break;
243:                case MISSING_MANDATORY_ATTRIBUTE:
244:                    message = "The required " + param + " attribute is missing";
245:                    break;
246:                case INVALID_ATTRIBUTE_VALUE:
247:                    message = "The " + param + " attribute contains an "
248:                            + "invalid value";
249:                    if (super .getMessage() != null) {
250:                        message += " (" + super .getMessage() + ")";
251:                    }
252:                    break;
253:                case UNSUPPORTED_ADAPTERS:
254:                    message = "None of the adapters is supported (" + param
255:                            + ")";
256:                    break;
257:                case UNSUPPORTED_PROVIDERS:
258:                    message = "None of the providers is supported (" + param
259:                            + ")";
260:                    break;
261:                case UNSUPPORTED_URL_SCHEME:
262:                    message = "The update URL has an unsupported scheme ("
263:                            + param + ")";
264:                    break;
265:                case INFORMATION_NOT_YET_VALID:
266:                    message = "Payment information is not yet valid";
267:                    break;
268:                case INFORMATION_EXPIRED:
269:                    message = "Payment information is expired";
270:                    break;
271:                case INCOMPLETE_INFORMATION:
272:                    message = "The payment information is incomplete";
273:                    break;
274:                case INVALID_ADAPTER_CONFIGURATION:
275:                    message = "The " + param + " attribute contains an "
276:                            + "invalid adapter configuration string";
277:                    if (super .getMessage() != null) {
278:                        message += " (" + super .getMessage() + ")";
279:                    }
280:                    break;
281:                case INVALID_PRICE_INFORMATION:
282:                    message = "The " + param + " attribute contains "
283:                            + "invalid payment specific price information";
284:                    if (super .getMessage() != null) {
285:                        message += " (" + super .getMessage() + ")";
286:                    }
287:                    break;
288:                case INVALID_UPDATE_URL:
289:                    message = "The update URL " + param + " is invalid";
290:                    break;
291:                case UPDATE_SERVER_NOT_FOUND:
292:                    message = "The server for the payment update was not found "
293:                            + "at the URL " + param;
294:                    break;
295:                case UPDATE_NOT_FOUND:
296:                    message = "The payment update file was not found at the URL "
297:                            + param;
298:                    break;
299:                case UPDATE_SERVER_BUSY:
300:                    message = "The payment update server is busy";
301:                    break;
302:                case UPDATE_REQUEST_ERROR:
303:                    message = "The payment update request has been denied by the "
304:                            + "update server (HTTP response code = "
305:                            + param
306:                            + ")";
307:                    break;
308:                case INVALID_UPDATE_TYPE:
309:                    message = "The payment update file has a missing or "
310:                            + "incorrect type (" + param + ")";
311:                    break;
312:                case UNSUPPORTED_UPDATE_CHARSET:
313:                    message = "The payment update file is in an unsupported "
314:                            + "character set (" + param + ")";
315:                    break;
316:                case EXPIRED_PROVIDER_CERT:
317:                    message = "The provider certificate (" + param + ") is "
318:                            + "expired or not yet valid";
319:                    break;
320:                case EXPIRED_CA_CERT:
321:                    message = "The root CA's public key expired (" + param
322:                            + ")";
323:                    break;
324:                case INVALID_PROVIDER_CERT:
325:                    message = "The provider certificate (" + param + ") is "
326:                            + "invalid or unsupported";
327:                    break;
328:                case NO_TRUSTED_CHAIN:
329:                    message = "Can't verify any provider certificate";
330:                    break;
331:                case SIGNATURE_VERIFICATION_FAILED:
332:                    message = "Verification of the payment update signature failed";
333:                    break;
334:                case INVALID_PROPERTIES_FORMAT:
335:                    message = "The payment update file is not a valid properties "
336:                            + "file";
337:                    if (super .getMessage() != null) {
338:                        message += " (" + super .getMessage() + ")";
339:                    }
340:                    break;
341:                default:
342:                    message = super.getMessage();
343:                    break;
344:                }
345:
346:                return message;
347:            }
348:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.