1/*2 * Copyright 2001-2015 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 */17package org.apache.juddi.api.util;
1819import java.util.ArrayList;
20import java.util.Hashtable;
21import java.util.List;
2223/**24 * Statuses of a query. Successs represents a successful query, failed 25 * represents one that throws a DispositionFaultMessage.26 * 27 * @author <a href="mailto:tcunning@apache.org">Tom Cunningham</a>28 */29public enum QueryStatus {
30 SUCCESS("success"),
31 FAILED ("failed");
3233private String _status;
34privatestatic Hashtable<String, QueryStatus> _statuses = null;
3536QueryStatus(final String status) {
37 _status = status;
38 }
3940public String getStatus() {
41return _status;
42 }
4344publicsynchronizedstaticvoid initStatuses () {
45if (_statuses == null) {
46 _statuses = new Hashtable();
4748 _statuses.put(QueryStatus.SUCCESS.getStatus(), QueryStatus.SUCCESS);
49 _statuses.put(QueryStatus.FAILED.getStatus(), QueryStatus.FAILED);
50 }
51 }
5253publicstatic List<String> getQueries() {
54if (_statuses == null) {
55 initStatuses();
56 }
5758 List list = new ArrayList<String>(_statuses.keySet());
59return list;
60 }
6162/**63 * this doesn't appear to be used anywhere and will be removed in a future version64 * @param query65 * @return66 * @deprecated67 */68publicstaticQueryStatus fromStatus(final String status) {
69if (_statuses == null) {
70 initStatuses();
71 }
7273if (_statuses.contains(status)) {
74return _statuses.get(status);
75 } else {
76thrownew IllegalArgumentException("Unrecognized status " + status);
77 }
78 }
79 }