This project has retired. For details please refer to its Attic page.
SubscriptionListenerQuery xref
View Javadoc
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 at
7    * 
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * 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 and
14   * limitations under the License.
15   *
16   */
17  package org.apache.juddi.api.util;
18  
19  import java.util.ArrayList;
20  import java.util.Hashtable;
21  import java.util.List;
22  
23  /**
24   * Enum to represent the methods within the SubscriptionListener API.
25   * 
26   * @author <a href="mailto:tcunning@apache.org">Tom Cunningham</a>
27   */
28  public enum SubscriptionListenerQuery implements UDDIQuery {
29      NOTIFY_SUBSCRIPTIONLISTENER("notify_subscriptionListener");
30          
31      private String _query;
32      private static Hashtable<String, SubscriptionListenerQuery> _subscriptionListenerQueries = null;
33          
34      SubscriptionListenerQuery(final String query) {
35          _query = query;
36      }
37          
38      public String getQuery() {
39          return _query;
40      }
41          
42      public synchronized static void initSubscriptionListenerQueries () {
43              if (_subscriptionListenerQueries == null) {
44                  _subscriptionListenerQueries = new Hashtable();
45  
46                  _subscriptionListenerQueries.put(SubscriptionListenerQuery.NOTIFY_SUBSCRIPTIONLISTENER.getQuery(), SubscriptionListenerQuery.NOTIFY_SUBSCRIPTIONLISTENER);
47              }
48      }
49  
50      public static List<String> getQueries() {
51          if (_subscriptionListenerQueries == null) {
52              initSubscriptionListenerQueries();
53          }
54          
55          List<String> list = new ArrayList<String>(_subscriptionListenerQueries.keySet());
56          return list;
57      }
58      
59      /**
60       * this doesn't appear to be used anywhere and will be removed in a future version
61       * @param query
62       * @return
63       * @deprecated
64       */
65      
66      public static SubscriptionListenerQuery fromQuery(final String query) {
67          if (_subscriptionListenerQueries == null) {
68              initSubscriptionListenerQueries();
69          }
70          
71          if (_subscriptionListenerQueries.contains(query)) {
72              return _subscriptionListenerQueries.get(query);
73          } else {
74              throw new IllegalArgumentException("Unrecognized query " + query);
75          }       
76      }
77  }