01: /**
02: * Licensed to the Apache Software Foundation (ASF) under one
03: * or more contributor license agreements. See the NOTICE file
04: * distributed with this work for additional information
05: * regarding copyright ownership. The ASF licenses this file
06: * to you under the Apache License, Version 2.0 (the
07: * "License"); you may not use this file except in compliance
08: * with the License. You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing,
13: * software distributed under the License is distributed on an
14: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15: * KIND, either express or implied. See the License for the
16: * specific language governing permissions and limitations
17: * under the License.
18: */package org.apache.cxf.tools.wsdlto.frontend.jaxws;
19:
20: import java.io.IOException;
21: import java.util.Set;
22:
23: import org.apache.cxf.common.i18n.Message;
24: import org.apache.cxf.resource.URIResolver;
25: import org.apache.cxf.tools.common.ToolConstants;
26: import org.apache.cxf.tools.common.ToolContext;
27: import org.apache.cxf.tools.common.ToolException;
28: import org.apache.cxf.tools.common.toolspec.ToolSpec;
29: import org.apache.cxf.tools.wsdlto.WSDLToJavaContainer;
30:
31: public class JAXWSContainer extends WSDLToJavaContainer {
32:
33: private static final String TOOL_NAME = "wsdl2java";
34:
35: public JAXWSContainer(ToolSpec toolspec) throws Exception {
36: super (TOOL_NAME, toolspec);
37: }
38:
39: public Set<String> getArrayKeys() {
40: Set<String> set = super .getArrayKeys();
41: set.add(ToolConstants.CFG_BINDING);
42: return set;
43: }
44:
45: public void validate(ToolContext env) throws ToolException {
46: super .validate(env);
47: if (env.containsKey(ToolConstants.CFG_BINDING)) {
48: String[] bindings = (String[]) env
49: .get(ToolConstants.CFG_BINDING);
50: URIResolver resolver = null;
51: for (int i = 0; i < bindings.length; i++) {
52: try {
53: resolver = new URIResolver(bindings[i]);
54: } catch (IOException ioe) {
55: throw new ToolException(ioe);
56: }
57: if (!resolver.isResolved()) {
58: Message msg = new Message("FILE_NOT_EXIST", LOG,
59: bindings[i]);
60: throw new ToolException(msg);
61: }
62: }
63: env.put(ToolConstants.CFG_BINDING, bindings);
64: }
65: }
66: }
|