This project has retired. For details please refer to its Attic page.
InquiryQuery 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 queries within the Inquiry API.
25   * 
26   * @author <a href="mailto:tcunning@apache.org">Tom Cunningham</a>
27   */
28  public enum InquiryQuery implements UDDIQuery {
29      FIND_BUSINESS ("find_business"),
30      FIND_SERVICE ("find_service"),
31      FIND_BINDING ("find_binding"), 
32      FIND_TMODEL ("find_tModel"),
33      FIND_RELATEDBUSINESSES ("find_relatedBusinesses"),
34      GET_BUSINESSDETAIL ("get_businessDetail"),
35      GET_SERVICEDETAIL ("get_serviceDetail"),
36      GET_BINDINGDETAIL ("get_bindingDetail"),
37      GET_TMODELDETAIL ("get_tModelDetail"),
38      GET_OPERATIONALINFO ("get_operationalInfo");
39      
40      private String _query;
41      private static Hashtable<String,InquiryQuery> _inquiryQueries = null;
42      
43      InquiryQuery(final String query) {
44          _query = query;
45      }
46      
47      public String getQuery() {
48          return _query;
49      }
50      
51      public synchronized static void initInquiryQueries () {
52          if (_inquiryQueries == null) {
53              _inquiryQueries = new Hashtable();        
54              _inquiryQueries.put("find_business", InquiryQuery.FIND_BUSINESS);
55              _inquiryQueries.put("find_service", InquiryQuery.FIND_SERVICE);
56              _inquiryQueries.put("find_binding", InquiryQuery.FIND_BINDING);
57              _inquiryQueries.put("find_tModel", InquiryQuery.FIND_TMODEL);
58              _inquiryQueries.put("find_relatedBusinesses", InquiryQuery.FIND_RELATEDBUSINESSES);
59              _inquiryQueries.put("get_businessDetail", InquiryQuery.GET_BUSINESSDETAIL);
60              _inquiryQueries.put("get_serviceDetail", InquiryQuery.GET_SERVICEDETAIL);
61              _inquiryQueries.put("get_bindingDetail", InquiryQuery.GET_BINDINGDETAIL);
62              _inquiryQueries.put("get_tModelDetail", InquiryQuery.GET_TMODELDETAIL);
63              _inquiryQueries.put("get_operationalInfo", InquiryQuery.GET_OPERATIONALINFO);
64          }
65      }
66      
67      public static List<String> getQueries() {
68          if (_inquiryQueries == null) {
69              initInquiryQueries();
70          }
71          
72          List list = new ArrayList<String>(_inquiryQueries.keySet());
73          return list;
74      }
75          
76      /**
77       * this doesn't appear to be used anywhere and will be removed in a future version
78       * @param query
79       * @return
80       * @deprecated
81       */
82      @Deprecated
83      public static InquiryQuery fromQuery(final String query) {
84          if (_inquiryQueries == null) {
85              initInquiryQueries();
86          }
87          
88          if (_inquiryQueries.contains(query)) {
89              return _inquiryQueries.get(query);
90          } else {
91              throw new IllegalArgumentException("Unrecognized query " + query);
92          }
93      }    
94  }