Source Code Cross Referenced for InvalidMessageResult.java in  » Web-Services » xins » org » xins » server » 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 » Web Services » xins » org.xins.server 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * $Id: InvalidMessageResult.java,v 1.5 2007/09/18 08:45:04 agoubard Exp $
003:         *
004:         * Copyright 2003-2007 Orange Nederland Breedband B.V.
005:         * See the COPYRIGHT file for redistribution and use restrictions.
006:         */
007:        package org.xins.server;
008:
009:        import java.util.Iterator;
010:        import java.util.List;
011:        import org.xins.common.xml.ElementBuilder;
012:
013:        /**
014:         * Result code that indicates that a request or a response parameter is either
015:         * missing or invalid.
016:         *
017:         * @version $Revision: 1.5 $ $Date: 2007/09/18 08:45:04 $
018:         * @author <a href="mailto:anthony.goubard@japplis.com">Anthony Goubard</a>
019:         *
020:         * @since XINS 2.0
021:         */
022:        class InvalidMessageResult extends FunctionResult {
023:
024:            /**
025:             * Constructs a new <code>InvalidMessageResult</code> object.
026:             *
027:             * @param errorCode
028:             *    the error code to return to the client, never <code>null</code>.
029:             */
030:            InvalidMessageResult(String errorCode) {
031:                super (errorCode);
032:            }
033:
034:            /**
035:             * Adds to the response that a paramater that is missing.
036:             *
037:             * @param parameter
038:             *    the missing parameter.
039:             */
040:            public void addMissingParameter(String parameter) {
041:                ElementBuilder missingParam = new ElementBuilder(
042:                        "missing-param");
043:                missingParam.setAttribute("param", parameter);
044:                add(missingParam.createElement());
045:            }
046:
047:            /**
048:             * Adds to the response a parameter that is missing in an element.
049:             *
050:             * @param parameter
051:             *    the missing parameter.
052:             *
053:             * @param element
054:             *    the element in which the parameter is missing.
055:             */
056:            public void addMissingParameter(String parameter, String element) {
057:                ElementBuilder missingParam = new ElementBuilder(
058:                        "missing-param");
059:                missingParam.setAttribute("param", parameter);
060:                missingParam.setAttribute("element", element);
061:                add(missingParam.createElement());
062:            }
063:
064:            /**
065:             * Adds an invalid value for a specified type.
066:             *
067:             * @param parameter
068:             *    the parameter passed by the user.
069:             *
070:             * @param type
071:             *    the type which this parameter should be compliant with.
072:             *
073:             * @deprecated since XINS 2.0, use {@link #addInvalidValueForType(String, String, String)}.
074:             */
075:            public void addInvalidValueForType(String parameter, String type) {
076:                ElementBuilder invalidValue = new ElementBuilder(
077:                        "invalid-value-for-type");
078:                invalidValue.setAttribute("param", parameter);
079:                invalidValue.setAttribute("type", type);
080:                add(invalidValue.createElement());
081:            }
082:
083:            /**
084:             * Adds an invalid value for a specified type.
085:             *
086:             * @param parameter
087:             *    the parameter passed by the user.
088:             *
089:             * @param value
090:             *    the value of the parameter passed by the user.
091:             *
092:             * @param type
093:             *    the type which this parameter should be compliant with.
094:             */
095:            public void addInvalidValueForType(String parameter, String value,
096:                    String type) {
097:                ElementBuilder invalidValue = new ElementBuilder(
098:                        "invalid-value-for-type");
099:                invalidValue.setAttribute("param", parameter);
100:                invalidValue.setAttribute("value", value);
101:                invalidValue.setAttribute("type", type);
102:                add(invalidValue.createElement());
103:            }
104:
105:            /**
106:             * Adds an invalid value for a specified type.
107:             *
108:             * @param parameter
109:             *    the parameter passed by the user.
110:             *
111:             * @param value
112:             *    the value of the parameter passed by the user.
113:             *
114:             * @param type
115:             *    the type which this parameter should be compliant with.
116:             *
117:             * @param element
118:             *    the element in which the parameter is missing.
119:             */
120:            public void addInvalidValueForType(String parameter, String value,
121:                    String type, String element) {
122:                ElementBuilder invalidValue = new ElementBuilder(
123:                        "invalid-value-for-type");
124:                invalidValue.setAttribute("param", parameter);
125:                invalidValue.setAttribute("value", value);
126:                invalidValue.setAttribute("type", type);
127:                invalidValue.setAttribute("element", element);
128:                add(invalidValue.createElement());
129:            }
130:
131:            /**
132:             * Adds an invalid combination of parameters.
133:             *
134:             * @param type
135:             *    the type of the combination.
136:             *
137:             * @param parameters
138:             *    list of the parameters in the combination passed as a list of
139:             *    {@link String} objects.
140:             */
141:            public void addParamCombo(String type, List parameters) {
142:
143:                ElementBuilder paramCombo = new ElementBuilder("param-combo");
144:                paramCombo.setAttribute("type", type);
145:
146:                // Iterate over all parameters
147:                Iterator itParameters = parameters.iterator();
148:                while (itParameters.hasNext()) {
149:                    ElementBuilder param = new ElementBuilder("param");
150:                    param.setAttribute("name", (String) itParameters.next());
151:                    paramCombo.addChild(param.createElement());
152:                }
153:
154:                add(paramCombo.createElement());
155:            }
156:
157:            /**
158:             * Adds an invalid combination of attributes.
159:             *
160:             * @param type
161:             *    the type of the combination.
162:             *
163:             * @param attributes
164:             *    list of the attributes in the combination passed as a list of
165:             *    {@link String} objects.
166:             *
167:             * @param elementName
168:             *    the name of the element to which these attributes belong.
169:             *
170:             * @since XINS 1.4.0
171:             */
172:            public void addAttributeCombo(String type, List attributes,
173:                    String elementName) {
174:
175:                ElementBuilder attributeCombo = new ElementBuilder(
176:                        "attribute-combo");
177:                attributeCombo.setAttribute("type", type);
178:
179:                // Iterate over all attributes
180:                Iterator itAttributes = attributes.iterator();
181:                while (itAttributes.hasNext()) {
182:                    ElementBuilder attribute = new ElementBuilder("attribute");
183:                    attribute
184:                            .setAttribute("name", (String) itAttributes.next());
185:                    attributeCombo.addChild(attribute.createElement());
186:                }
187:
188:                add(attributeCombo.createElement());
189:            }
190:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.