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 */17package org.apache.juddi.api.util;
1819import java.util.ArrayList;
20import java.util.Hashtable;
21import java.util.List;
2223/**24 * Enum to represent the methods within the ValueSetCaching API.25 * 26 * @author <a href="mailto:tcunning@apache.org">Tom Cunningham</a>27 */28public enum ValueSetCachingQueryimplementsUDDIQuery {
29 GET_ALLVALIDVALUES("get_allValidValues");
3031private String _query;
32privatestatic Hashtable<String, ValueSetCachingQuery> _valueSetCachingQueries = null;
3334ValueSetCachingQuery(final String query) {
35 _query = query;
36 }
3738public String getQuery() {
39return _query;
40 }
4142publicsynchronizedstaticvoid initValueSetCachingQueries () {
43if (_valueSetCachingQueries == null) {
44 _valueSetCachingQueries = new Hashtable();
4546 _valueSetCachingQueries.put(ValueSetCachingQuery.GET_ALLVALIDVALUES.getQuery(), ValueSetCachingQuery.GET_ALLVALIDVALUES);
47 }
48 }
4950publicstatic List<String> getQueries() {
51if (_valueSetCachingQueries == null) {
52 initValueSetCachingQueries();
53 }
5455 List list = new ArrayList<String>(_valueSetCachingQueries.keySet());
56return list;
57 }
5859/**60 * this doesn't appear to be used anywhere and will be removed in a future version61 * @param query62 * @return63 * @deprecated64 */65publicstaticValueSetCachingQuery fromQuery(final String query) {
66if (_valueSetCachingQueries == null) {
67 initValueSetCachingQueries();
68 }
6970if (_valueSetCachingQueries.contains(query)) {
71return _valueSetCachingQueries.get(query);
72 } else {
73thrownew IllegalArgumentException("Unrecognized query " + query);
74 }
75 }
76 }