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 Security API.25 * 26 * @author <a href="mailto:tcunning@apache.org">Tom Cunningham</a>27 */28public enum SecurityQueryimplementsUDDIQuery {
29 GET_AUTHTOKEN("get_authToken"),
30 DISCARD_AUTHTOKEN("discard_authToken");
3132private String _query;
33privatestatic Hashtable<String, SecurityQuery> _securityQueries = null;
3435SecurityQuery(final String query) {
36 _query = query;
37 }
3839public String getQuery() {
40return _query;
41 }
4243publicsynchronizedstaticvoid initSecurityQueries () {
44if (_securityQueries == null) {
45 _securityQueries = new Hashtable();
4647 _securityQueries.put(SecurityQuery.GET_AUTHTOKEN.getQuery(), SecurityQuery.GET_AUTHTOKEN);
48 _securityQueries.put(SecurityQuery.DISCARD_AUTHTOKEN.getQuery(), SecurityQuery.DISCARD_AUTHTOKEN);
49 }
50 }
5152publicstatic List<String> getQueries() {
53if (_securityQueries == null) {
54 initSecurityQueries();
55 }
5657 List list = new ArrayList<String>(_securityQueries.keySet());
58return list;
59 }
6061/**62 * this doesn't appear to be used anywhere and will be removed in a future version63 * @param query64 * @return65 * @deprecated66 */67publicstaticSecurityQuery fromQuery(final String query) {
68if (_securityQueries == null) {
69 initSecurityQueries();
70 }
7172if (_securityQueries.contains(query)) {
73return _securityQueries.get(query);
74 } else {
75thrownew IllegalArgumentException("Unrecognized query " + query);
76 }
77 }
78 }