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 */package org.apache.juddi.api.util;
1718import java.util.ArrayList;
19import java.util.Hashtable;
20import java.util.List;
2122/**23 * Enum to represent the queries within the ValueSetValidation API.24 * 25 * @author <a href="mailto:tcunning@apache.org">Tom Cunningham</a>26 */27public enum ValueSetValidationQueryimplementsUDDIQuery {
28 VALIDATE_VALUES("validate_values");
2930private String _query;
31privatestatic Hashtable<String, ValueSetValidationQuery> _valueSetValidationQueries = null;
3233ValueSetValidationQuery(final String query) {
34 _query = query;
35 }
3637public String getQuery() {
38return _query;
39 }
4041publicsynchronizedstaticvoid initValueSetValidationQueries () {
42if (_valueSetValidationQueries == null) {
43 _valueSetValidationQueries = new Hashtable<String, ValueSetValidationQuery>();
4445 _valueSetValidationQueries.put(ValueSetValidationQuery.VALIDATE_VALUES.getQuery(), ValueSetValidationQuery.VALIDATE_VALUES);
46 }
47 }
4849publicstatic List<String> getQueries() {
50if (_valueSetValidationQueries == null) {
51 initValueSetValidationQueries();
52 }
5354 List list = new ArrayList<String>(_valueSetValidationQueries.keySet());
55return list;
56 }
5758/**59 * this doesn't appear to be used anywhere and will be removed in a future version60 * @param query61 * @return62 * @deprecated63 */64publicstaticValueSetValidationQuery fromQuery(final String query) {
65if (_valueSetValidationQueries == null) {
66 initValueSetValidationQueries();
67 }
6869if (_valueSetValidationQueries.contains(query)) {
70return _valueSetValidationQueries.get(query);
71 } else {
72thrownew IllegalArgumentException("Unrecognized query " + query);
73 }
74 }
75 }