1/*2 * Copyright 2001-2008 The Apache Software Foundation.3 * 4 * Licensed under the Apache License, Version 2.0 (the "License");5 * you may not use this file except in compliance with the License.6 * You may obtain a copy of the License at7 * 8 * http://www.apache.org/licenses/LICENSE-2.09 * 10 * Unless required by applicable law or agreed to in writing, software11 * distributed under the License is distributed on an "AS IS" BASIS,12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.13 * See the License for the specific language governing permissions and14 * limitations under the License.15 *16 */1718package org.apache.juddi.v3.error;
1920import org.apache.juddi.config.ResourceConfig;
21import org.uddi.api_v3.DispositionReport;
22import org.uddi.api_v3.Result;
23import org.uddi.api_v3.ErrInfo;
2425/**26 * @author <a href="mailto:jfaath@apache.org">Jeff Faath</a>27 */28publicclassUDDIErrorHelper {
29/**30 * E_assertionNotFound: (30000) Signifies that a particular publisher assertion cannot be identified in a save or delete operation.31 */32publicstaticfinalint E_ASSERTION_NOT_FOUND = 30000;
33/**34 * E_authTokenExpired: (10110) Signifies that the authentication token information has timed out.35 */36publicstaticfinalint E_AUTH_TOKEN_EXPIRED = 10110;
37/**38 * E_authTokenRequired: (10120) Signifies that an authentication token is missing or is invalid for an API call that requires authentication.39 */40publicstaticfinalint E_AUTH_TOKEN_REQUIRED = 10120;
41/**42 * E_accountLimitExceeded: (10160) Signifies that a save request exceeded the quantity limits for a given data type. Account limits are established based on the relationship between an individual publisher and an individual node. See your UDDI node’s policy for account limits for details. Other nodes in the registry MAY NOT place additional restrictions on publishing limits established by a custodial node.43 */44publicstaticfinalint E_ACCOUNT_LIMIT_EXCEEDED = 10160;
45/**46 * E_busy: (10400) Signifies that the request cannot be processed at the current time.47 */48publicstaticfinalint E_BUSY = 10400;
49/**50 * NON UDDIv3 spec error51 */52publicstaticfinalint E_CATEGORIZATION_NOT_ALLOWED = 20100;
53/**54 * E_fatalError: (10500) Signifies that a serious technical error has occurred while processing the request.55 */56publicstaticfinalint E_FATAL_ERROR = 10500;
57/**58 * E_invalidKeyPassed: (10210) Signifies that the uddiKey value passed did not match with any known key values. The details on the invalid key SHOULD be included in the dispositionReport element.59 */60publicstaticfinalint E_INVALID_KEY_PASSED = 10210;
61/**62 * E_invalidProjection: (20230) Signifies that an attempt was made to save a businessEntity containing a service projection where the serviceKey does not belong to the business designated by the businessKey. The serviceKey of at least one such businessService SHOULD be included in the dispositionReport.63 */64publicstaticfinalint E_INVALID_PROJECTION = 20230;
65/**66 * NON UDDIv3 spec67 */68publicstaticfinalint E_INVALID_CATEGORY = 20000;
69/**70 * E_invalidCompletionStatus: (30100) Signifies that one of the assertion status values passed is unrecognized. The completion status that caused the problem SHOULD be clearly indicated in the error text.71 */72publicstaticfinalint E_INVALID_COMPLETION_STATUS = 30100;
7374publicstaticfinalint E_INVALID_URL_PASSED = 10220;
75/**76 * E_invalidValue: (20200) This error code has multiple uses. This error code applies to the subscription APIs and the value set APIs. It can be used to indicate that a value that was passed in a keyValue attribute did not pass validation. This applies to checked value sets that are referenced using keyedReferences. The error text SHOULD clearly indicate the key and value combination that failed validation. It can also be used to indicate that a chunkToken supplied is invalid. This applies in both subscription and value set APIs. The error text SHOULD clearly indicate the reason for failure.77 */78publicstaticfinalint E_INVALID_VALUE = 20200;
79/**80 * E_invalidCombination: (40500) Signifies conflicting find qualifiers have been specified. The find qualifiers that caused the problem SHOULD be clearly indicated in the error text.81 */82publicstaticfinalint E_INVALID_COMBINATION = 40500;
83publicstaticfinalint E_KEY_RETIRED = 10310;
84/**85 * E_keyUnavailable: (40100) Signifies that the proposed key is in a partition that has already been assigned to some other publisher.86 */87publicstaticfinalint E_KEY_UNAVAILABLE = 40100;
88publicstaticfinalint E_LANGUAGE_ERROR = 10060;
89/**90 * E_messageTooLarge: (30110) Signifies that the message is too large. The upper limit SHOULD be clearly indicated in the error text.91 */92publicstaticfinalint E_MESSAGE_TOO_LARGE = 30110;
93publicstaticfinalint E_NAME_TOO_LONG = 10020;
94publicstaticfinalint E_OPERATOR_MISMATCH = 10130;
95publicstaticfinalint E_PUBLISHER_CANCELLED = 30220;
96/**97 * Signifies that a subscription cannot be renewed. The request has been denied due to either node or registry policy.98 */99publicstaticfinalint E_REQUEST_DENIED = 30210;
100publicstaticfinalint E_SECRET_UNKNOWN = 30230;
101publicstaticfinalint E_SUCCESS = 0;
102publicstaticfinalint E_TOO_MANY_OPTIONS = 10030;
103publicstaticfinalint E_TRANSFER_ABORTED = 30200;
104/**105 * E_unrecognizedVersion: (10040) Signifies that the value of the namespace attribute is unsupported by the node being queried.106 */107publicstaticfinalint E_UNRECOGNIZED_VERSION = 10040;
108/**109 * E_unknownUser: (10150) Signifies that the user ID and password pair passed in a get_authToken API is not known to the UDDI node or is not valid.110 */111publicstaticfinalint E_UNKNOWN_USER = 10150;
112/**113 * E_unsupported: (10050) Signifies that the implementer does not support a feature or API.114 */115publicstaticfinalint E_UNSUPPORTED = 10050;
116/**117 * E_userMismatch: (10140) Signifies that an attempt was made to use the publishing API to change data that is controlled by another party.118 */119publicstaticfinalint E_USER_MISMATCH = 10140;
120/**121 * E_valueNotAllowed: (20210) Signifies that a value did not pass validation because of contextual issues. The value may be valid in some contexts, but not in the context used. The error text MAY contain information about the contextual problem.122 */123publicstaticfinalint E_VALUE_NOT_ALLOWED = 20210;
124/**125 * E_unvalidatable: (20220) Signifies that an attempt was made to reference a value set in a keyedReference whose tModel is categorized with the unvalidatable categorization.126 */127publicstaticfinalint E_UNVALIDATABLE = 20220;
128publicstaticfinalint E_REQUEST_TIMEOUT = 20240;
129/**130 * E_invalidTime: (40030) Signifies that the time period, the date/time, or the pair of date/time is invalid. The error structure signifies the condition that occurred and the error text clearly calls out the cause of the problem.131 */132publicstaticfinalint E_INVALID_TIME = 40030;
133/**134 * E_resultSetTooLarge: (40300) Signifies that the UDDI node deems that a result set from an inquiry is too large, and requests to obtain the results are not honored, even using subsets. The inquiry that triggered this error should be refined and re-issued.135 */136publicstaticfinalint E_RESULT_SET_TOO_LARGE = 40300;
137/**138 * E_tokenAlreadyExists: (40070) Signifies that one or more of the businessKey or tModelKey elements that identify entities to be transferred are not owned by the publisher identified by the authInfo element. The error text SHOULD clearly indicate which entity keys caused the error.139 */140publicstaticfinalint E_TOKEN_ALREADY_EXISTS = 40070;
141/**142 * E_transferNotAllowed: (40600) Signifies that the transfer of one or more entities has been by either the custodial node or the target node because the transfer token has expired or an attempt was made to transfer an unauthorized entity.143 */144publicstaticfinalint E_TRANSFER_NOT_ALLOWED = 40600;
145146publicstaticfinal String lookupErrCode(int errno) {
147switch (errno) {
148case E_ACCOUNT_LIMIT_EXCEEDED : return DispositionReport.E_ACCOUNT_LIMIT_EXCEEDED;
149case E_ASSERTION_NOT_FOUND : return DispositionReport.E_ASSERTION_NOT_FOUND;
150case E_AUTH_TOKEN_EXPIRED : return DispositionReport.E_AUTH_TOKEN_EXPIRED;
151case E_AUTH_TOKEN_REQUIRED : return DispositionReport.E_AUTH_TOKEN_REQUIRED;
152case E_BUSY : return DispositionReport.E_BUSY;
153case E_CATEGORIZATION_NOT_ALLOWED : return DispositionReport.E_CATEGORIZATION_NOT_ALLOWED;
154case E_FATAL_ERROR : return DispositionReport.E_FATAL_ERROR;
155case E_INVALID_COMBINATION : return DispositionReport.E_INVALID_COMBINATION;
156case E_INVALID_CATEGORY : return DispositionReport.E_INVALID_CATEGORY;
157case E_INVALID_COMPLETION_STATUS : return DispositionReport.E_INVALID_COMPLETION_STATUS;
158case E_INVALID_KEY_PASSED : return DispositionReport.E_INVALID_KEY_PASSED;
159case E_KEY_UNAVAILABLE : return DispositionReport.E_KEY_UNAVAILABLE;
160case E_INVALID_PROJECTION : return DispositionReport.E_INVALID_PROJECTION;
161case E_INVALID_TIME : return DispositionReport.E_INVALID_TIME;
162case E_INVALID_URL_PASSED : return DispositionReport.E_INVALID_URL_PASSED;
163case E_INVALID_VALUE : return DispositionReport.E_INVALID_VALUE;
164case E_KEY_RETIRED : return DispositionReport.E_KEY_RETIRED;
165case E_LANGUAGE_ERROR : return DispositionReport.E_LANGUAGE_ERROR;
166case E_MESSAGE_TOO_LARGE : return DispositionReport.E_MESSAGE_TOO_LARGE;
167case E_NAME_TOO_LONG : return DispositionReport.E_NAME_TOO_LONG;
168case E_OPERATOR_MISMATCH : return DispositionReport.E_OPERATOR_MISMATCH;
169case E_PUBLISHER_CANCELLED : return DispositionReport.E_PUBLISHER_CANCELLED;
170case E_REQUEST_DENIED : return DispositionReport.E_REQUEST_DENIED;
171case E_REQUEST_TIMEOUT : return DispositionReport.E_REQUEST_TIMEOUT;
172case E_RESULT_SET_TOO_LARGE : return DispositionReport.E_RESULT_SET_TOO_LARGE;
173case E_SECRET_UNKNOWN : return DispositionReport.E_SECRET_UNKNOWN;
174case E_SUCCESS : return DispositionReport.E_SUCCESS;
175case E_TOO_MANY_OPTIONS : return DispositionReport.E_TOO_MANY_OPTIONS;
176case E_TRANSFER_ABORTED : return DispositionReport.E_TRANSFER_ABORTED;
177case E_UNKNOWN_USER : return DispositionReport.E_UNKNOWN_USER;
178case E_UNRECOGNIZED_VERSION : return DispositionReport.E_UNRECOGNIZED_VERSION;
179case E_UNSUPPORTED : return DispositionReport.E_UNSUPPORTED;
180case E_UNVALIDATABLE : return DispositionReport.E_UNVALIDATABLE;
181case E_USER_MISMATCH : return DispositionReport.E_USER_MISMATCH;
182case E_VALUE_NOT_ALLOWED : return DispositionReport.E_VALUE_NOT_ALLOWED;
183case E_TOKEN_ALREADY_EXISTS : return DispositionReport.E_TOKEN_ALREADY_EXISTS;
184case E_TRANSFER_NOT_ALLOWED : return DispositionReport.E_TRANSFER_NOT_ALLOWED;
185default : returnnull;
186 }
187 }
188189publicstaticfinal String lookupErrText(int errno) {
190 String errCode = lookupErrCode(errno);
191if (errCode == null)
192returnnull;
193return ResourceConfig.getGlobalMessage(errCode);
194 }
195196publicstaticfinalDispositionReport buildDispositionReport(int errNo) {
197 DispositionReport dr = newDispositionReport();
198 Result res = newResult();
199 res.setErrno(errNo);
200201 ErrInfo ei = newErrInfo();
202 ei.setErrCode(lookupErrCode(errNo));
203 ei.setValue(lookupErrText(errNo));
204205 res.setErrInfo(ei);
206207 dr.getResult().add(res);
208209return dr;
210 }
211 }