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 SubscriptionListener API.25 * 26 * @author <a href="mailto:tcunning@apache.org">Tom Cunningham</a>27 */28public enum SubscriptionListenerQueryimplementsUDDIQuery {
29 NOTIFY_SUBSCRIPTIONLISTENER("notify_subscriptionListener");
3031private String _query;
32privatestatic Hashtable<String, SubscriptionListenerQuery> _subscriptionListenerQueries = null;
3334SubscriptionListenerQuery(final String query) {
35 _query = query;
36 }
3738public String getQuery() {
39return _query;
40 }
4142publicsynchronizedstaticvoid initSubscriptionListenerQueries () {
43if (_subscriptionListenerQueries == null) {
44 _subscriptionListenerQueries = new Hashtable();
4546 _subscriptionListenerQueries.put(SubscriptionListenerQuery.NOTIFY_SUBSCRIPTIONLISTENER.getQuery(), SubscriptionListenerQuery.NOTIFY_SUBSCRIPTIONLISTENER);
47 }
48 }
4950publicstatic List<String> getQueries() {
51if (_subscriptionListenerQueries == null) {
52 initSubscriptionListenerQueries();
53 }
5455 List<String> list = new ArrayList<String>(_subscriptionListenerQueries.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 */6566publicstaticSubscriptionListenerQuery fromQuery(final String query) {
67if (_subscriptionListenerQueries == null) {
68 initSubscriptionListenerQueries();
69 }
7071if (_subscriptionListenerQueries.contains(query)) {
72return _subscriptionListenerQueries.get(query);
73 } else {
74thrownew IllegalArgumentException("Unrecognized query " + query);
75 }
76 }
77 }