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.impl;
1819import java.util.ArrayList;
20import java.util.List;
21import javax.jws.WebService;
2223import javax.xml.ws.Holder;
2425import org.apache.commons.logging.Log;
26import org.apache.commons.logging.LogFactory;
27import org.apache.juddi.api.util.QueryStatus;
28import org.apache.juddi.api.util.ValueSetCachingQuery;
29import org.uddi.v3_service.DispositionReportFaultMessage;
30import org.uddi.v3_service.UDDIValueSetCachingPortType;
31import org.uddi.vscache_v3.ValidValue;
3233 @WebService(serviceName="UDDIValueSetCachingService",
34 endpointInterface="org.uddi.v3_service.UDDIValueSetCachingPortType",
35 targetNamespace = "urn:uddi-org:v3_service")
36publicclassUDDIValueSetCachingImplextendsAuthenticatedServiceimplements UDDIValueSetCachingPortType {
3738privatestatic Log logger = LogFactory.getLog(UDDIValueSetCachingImpl.class);
39privateUDDIServiceCounter serviceCounter;
4041publicUDDIValueSetCachingImpl() {
42super();
43 serviceCounter = ServiceCounterLifecycleResource.getServiceCounter(this.getClass());
44 }
4546/**47 *48 * @param authInfo An optional element that contains an authentication49 * token. Authentication tokens are obtained using the get_authToken API50 * call or through some other means external to this specification.51 * Providers of get_allValidValues Web services that serve multiple52 * registries and providers that restrict who can use their service may53 * require authInfo for this API.54 * @param modelKey A required uddiKey value that identifies the specific55 * instance of the tModel which describes the value set or category56 * group system for which a Web service to get all valid values has been57 * provided. It uniquely identifies the category, identifier, or58 * category group system for which valid values are being requested.59 * @param chunkToken Optional element used to retrieve subsequent groups60 * of data when the first invocation of this API indicates more data is61 * available. This occurs when a chunkToken is returned whose value is62 * not "0" in the validValuesList structure described in the next63 * section. To retrieve the next chunk of data, the chunkToken returned64 * should be used as an argument to the next invocation of this API.65 * @param validValue A validValuesList structure is returned containing66 * the set of valid values for the external category or identifier67 * system. The list MUST contain a chunkToken if the Web service68 * provider wishes to provide the data in packets.69 * @throws DispositionReportFaultMessage70 */71 @Override
72publicvoid getAllValidValues(String authInfo, String modelKey,
73 Holder<String> chunkToken, Holder<List<ValidValue>> validValue)
74throws DispositionReportFaultMessage {
7576long startTime = System.currentTimeMillis();
77 List<String> validValues = UDDIValueSetValidationImpl.getValidValues(modelKey);
7879 Holder<List<ValidValue>> ret = new Holder<List<ValidValue>>(new ArrayList<ValidValue>());
80if (validValues != null) {
81for (int i = 0; i < validValues.size(); i++) {
82 ValidValue x = new ValidValue(validValues.get(i));
83 ret.value.add(x);
84 }
85 }
86//findbugs will flag the following as "UC_USELESS_OBJECT" when in fact87//it is returned as part of the service call88 chunkToken = new Holder<String>();
89 chunkToken.value ="0";
9091long procTime = System.currentTimeMillis() - startTime;
92 serviceCounter.update(ValueSetCachingQuery.GET_ALLVALIDVALUES,
93 QueryStatus.SUCCESS, procTime);
949596 }
97 }