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 queries within the Custody Transfer API.25 * 26 * @author <a href="mailto:tcunning@apache.org">Tom Cunningham</a>27 */28public enum CustodyTransferQueryimplementsUDDIQuery {
29 DISCARD_TRANSFERTOKEN("discard_transferToken"),
30 GET_TRANSFERTOKEN("get_transferToken"),
31 TRANSFER_ENTITIES("transfer_entities");
3233private String _query;
34privatestatic Hashtable<String, CustodyTransferQuery> _custodyTransferQueries = null;
3536CustodyTransferQuery(final String query) {
37 _query = query;
38 }
3940public String getQuery() {
41return _query;
42 }
4344publicsynchronizedstaticvoid initCustodyTransferQueries () {
45if (_custodyTransferQueries == null) {
46 _custodyTransferQueries = new Hashtable();
47 _custodyTransferQueries.put("discard_transferToken", CustodyTransferQuery.DISCARD_TRANSFERTOKEN);
48 _custodyTransferQueries.put("get_transferToken", CustodyTransferQuery.GET_TRANSFERTOKEN);
49 _custodyTransferQueries.put("transfer_entities", CustodyTransferQuery.TRANSFER_ENTITIES);
50 }
51 }
5253publicstatic List<String> getQueries() {
54if (_custodyTransferQueries == null) {
55 initCustodyTransferQueries();
56 }
5758 List list = new ArrayList<String>(_custodyTransferQueries.keySet());
59return list;
60 }
6162/**63 * this doesn't appear to be used anywhere and will be removed in a future version64 * @param query65 * @return66 * @deprecated67 */68 @Deprecated
69publicstaticCustodyTransferQuery fromQuery(final String query) {
70if (_custodyTransferQueries == null) {
71 initCustodyTransferQueries();
72 }
7374//note: at one point this was just .contains(query) which shouldn't work75if (_custodyTransferQueries.containsKey(query)) {
76return _custodyTransferQueries.get(query);
77 } else {
78thrownew IllegalArgumentException("Unrecognized query " + query);
79 }
80 }
81 }