com.sun.tools.internal.ws.resources.WscompileMessages Java Examples

The following examples show how to use com.sun.tools.internal.ws.resources.WscompileMessages. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WsgenOptions.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public void validate() throws BadCommandLineException {
    if(nonclassDestDir == null)
        nonclassDestDir = destDir;

    if (!protocols.contains(protocol)) {
        throw new BadCommandLineException(WscompileMessages.WSGEN_INVALID_PROTOCOL(protocol, protocols));
    }

    if (endpoints.isEmpty()) {
        throw new BadCommandLineException(WscompileMessages.WSGEN_MISSING_FILE());
    }
    if (protocol == null || protocol.equalsIgnoreCase(X_SOAP12) && !isExtensionMode()) {
        throw new BadCommandLineException(WscompileMessages.WSGEN_SOAP_12_WITHOUT_EXTENSION());
    }

    if (nonstdProtocols.containsKey(protocol) && !isExtensionMode()) {
        throw new BadCommandLineException(WscompileMessages.WSGEN_PROTOCOL_WITHOUT_EXTENSION(protocol));
    }
    if (inlineSchemas && !genWsdl) {
        throw new BadCommandLineException(WscompileMessages.WSGEN_INLINE_SCHEMAS_ONLY_WITH_WSDL());
    }

    validateEndpointClass();
    validateArguments();
}
 
Example #2
Source File: WsimportOptions.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Parses a token to a file (or a set of files)
 * and add them as {@link InputSource} to the specified list.
 *
 * @param suffix If the given token is a directory name, we do a recusive search
 *               and find all files that have the given suffix.
 */
private void addFile(String name, List<InputSource> target, String suffix) throws BadCommandLineException {
    Object src;
    try {
        src = Util.getFileOrURL(name);
    } catch (IOException e) {
        throw new BadCommandLineException(WscompileMessages.WSIMPORT_NOT_A_FILE_NOR_URL(name));
    }
    if (src instanceof URL) {
        target.add(absolutize(new InputSource(Util.escapeSpace(((URL) src).toExternalForm()))));
    } else {
        File fsrc = (File) src;
        if (fsrc.isDirectory()) {
            addRecursive(fsrc, suffix, target);
        } else {
            target.add(absolutize(fileToInputSource(fsrc)));
        }
    }
}
 
Example #3
Source File: MetadataFinder.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private @Nullable Element getFromMetadataResolver(String systemId, Exception ex) {
    //try MEX
    MetaDataResolver resolver;
    ServiceDescriptor serviceDescriptor = null;
    for (MetadataResolverFactory resolverFactory : ServiceFinder.find(MetadataResolverFactory.class)) {
        resolver = resolverFactory.metadataResolver(options.entityResolver);
        try {
            serviceDescriptor = resolver.resolve(new URI(systemId));
            //we got the ServiceDescriptor, now break
            if (serviceDescriptor != null)
                break;
        } catch (URISyntaxException e) {
            throw new ParseException(e);
        }
    }

    if (serviceDescriptor != null) {
        errorReceiver.warning(new SAXParseException(WsdlMessages.TRY_WITH_MEX(ex.getMessage()), null, ex));
        return parseMetadata(systemId, serviceDescriptor);
    } else {
        errorReceiver.error(null, WsdlMessages.PARSING_UNABLE_TO_GET_METADATA(ex.getMessage(), WscompileMessages.WSIMPORT_NO_WSDL(systemId)), ex);
    }
    return null;
}
 
Example #4
Source File: WsgenOptions.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public void validate() throws BadCommandLineException {
    if(nonclassDestDir == null)
        nonclassDestDir = destDir;

    if (!protocols.contains(protocol)) {
        throw new BadCommandLineException(WscompileMessages.WSGEN_INVALID_PROTOCOL(protocol, protocols));
    }

    if (endpoints.isEmpty()) {
        throw new BadCommandLineException(WscompileMessages.WSGEN_MISSING_FILE());
    }
    if (protocol == null || protocol.equalsIgnoreCase(X_SOAP12) && !isExtensionMode()) {
        throw new BadCommandLineException(WscompileMessages.WSGEN_SOAP_12_WITHOUT_EXTENSION());
    }

    if (nonstdProtocols.containsKey(protocol) && !isExtensionMode()) {
        throw new BadCommandLineException(WscompileMessages.WSGEN_PROTOCOL_WITHOUT_EXTENSION(protocol));
    }
    if (inlineSchemas && !genWsdl) {
        throw new BadCommandLineException(WscompileMessages.WSGEN_INLINE_SCHEMAS_ONLY_WITH_WSDL());
    }

    validateEndpointClass();
    validateArguments();
}
 
Example #5
Source File: MetadataFinder.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private @Nullable Element getFromMetadataResolver(String systemId, Exception ex) {
    //try MEX
    MetaDataResolver resolver;
    ServiceDescriptor serviceDescriptor = null;
    for (MetadataResolverFactory resolverFactory : ServiceFinder.find(MetadataResolverFactory.class)) {
        resolver = resolverFactory.metadataResolver(options.entityResolver);
        try {
            serviceDescriptor = resolver.resolve(new URI(systemId));
            //we got the ServiceDescriptor, now break
            if (serviceDescriptor != null)
                break;
        } catch (URISyntaxException e) {
            throw new ParseException(e);
        }
    }

    if (serviceDescriptor != null) {
        errorReceiver.warning(new SAXParseException(WsdlMessages.TRY_WITH_MEX(ex.getMessage()), null, ex));
        return parseMetadata(systemId, serviceDescriptor);
    } else {
        errorReceiver.error(null, WsdlMessages.PARSING_UNABLE_TO_GET_METADATA(ex.getMessage(), WscompileMessages.WSIMPORT_NO_WSDL(systemId)), ex);
    }
    return null;
}
 
Example #6
Source File: WsgenOptions.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public void validate() throws BadCommandLineException {
    if(nonclassDestDir == null)
        nonclassDestDir = destDir;

    if (!protocols.contains(protocol)) {
        throw new BadCommandLineException(WscompileMessages.WSGEN_INVALID_PROTOCOL(protocol, protocols));
    }

    if (endpoints.isEmpty()) {
        throw new BadCommandLineException(WscompileMessages.WSGEN_MISSING_FILE());
    }
    if (protocol == null || protocol.equalsIgnoreCase(X_SOAP12) && !isExtensionMode()) {
        throw new BadCommandLineException(WscompileMessages.WSGEN_SOAP_12_WITHOUT_EXTENSION());
    }

    if (nonstdProtocols.containsKey(protocol) && !isExtensionMode()) {
        throw new BadCommandLineException(WscompileMessages.WSGEN_PROTOCOL_WITHOUT_EXTENSION(protocol));
    }
    if (inlineSchemas && !genWsdl) {
        throw new BadCommandLineException(WscompileMessages.WSGEN_INLINE_SCHEMAS_ONLY_WITH_WSDL());
    }

    validateEndpointClass();
    validateArguments();
}
 
Example #7
Source File: Options.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
List<String> getJavacOptions(List<String> existingOptions, WsimportListener listener) {
    List<String> result = new ArrayList<String>();
    for (String o: javacOptions) {
        if (o.contains("=") && !o.startsWith("A")) {
            int i = o.indexOf('=');
            String key = o.substring(0, i);
            if (existingOptions.contains(key)) {
                listener.message(WscompileMessages.WSCOMPILE_EXISTING_OPTION(key));
            } else {
                result.add(key);
                result.add(o.substring(i + 1));
            }
        } else {
            if (existingOptions.contains(o)) {
                listener.message(WscompileMessages.WSCOMPILE_EXISTING_OPTION(o));
            } else {
                result.add(o);
            }
        }
    }
    return result;
}
 
Example #8
Source File: Options.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
List<String> getJavacOptions(List<String> existingOptions, WsimportListener listener) {
    List<String> result = new ArrayList<String>();
    for (String o: javacOptions) {
        if (o.contains("=") && !o.startsWith("A")) {
            int i = o.indexOf('=');
            String key = o.substring(0, i);
            if (existingOptions.contains(key)) {
                listener.message(WscompileMessages.WSCOMPILE_EXISTING_OPTION(key));
            } else {
                result.add(key);
                result.add(o.substring(i + 1));
            }
        } else {
            if (existingOptions.contains(o)) {
                listener.message(WscompileMessages.WSCOMPILE_EXISTING_OPTION(o));
            } else {
                result.add(o);
            }
        }
    }
    return result;
}
 
Example #9
Source File: MetadataFinder.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private @Nullable Element getFromMetadataResolver(String systemId, Exception ex) {
    //try MEX
    MetaDataResolver resolver;
    ServiceDescriptor serviceDescriptor = null;
    for (MetadataResolverFactory resolverFactory : ServiceFinder.find(MetadataResolverFactory.class)) {
        resolver = resolverFactory.metadataResolver(options.entityResolver);
        try {
            serviceDescriptor = resolver.resolve(new URI(systemId));
            //we got the ServiceDescriptor, now break
            if (serviceDescriptor != null)
                break;
        } catch (URISyntaxException e) {
            throw new ParseException(e);
        }
    }

    if (serviceDescriptor != null) {
        errorReceiver.warning(new SAXParseException(WsdlMessages.TRY_WITH_MEX(ex.getMessage()), null, ex));
        return parseMetadata(systemId, serviceDescriptor);
    } else {
        errorReceiver.error(null, WsdlMessages.PARSING_UNABLE_TO_GET_METADATA(ex.getMessage(), WscompileMessages.WSIMPORT_NO_WSDL(systemId)), ex);
    }
    return null;
}
 
Example #10
Source File: MetadataFinder.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
private @Nullable Element getFromMetadataResolver(String systemId, Exception ex) {
    //try MEX
    MetaDataResolver resolver;
    ServiceDescriptor serviceDescriptor = null;
    for (MetadataResolverFactory resolverFactory : ServiceFinder.find(MetadataResolverFactory.class)) {
        resolver = resolverFactory.metadataResolver(options.entityResolver);
        try {
            serviceDescriptor = resolver.resolve(new URI(systemId));
            //we got the ServiceDescriptor, now break
            if (serviceDescriptor != null)
                break;
        } catch (URISyntaxException e) {
            throw new ParseException(e);
        }
    }

    if (serviceDescriptor != null) {
        errorReceiver.warning(new SAXParseException(WsdlMessages.TRY_WITH_MEX(ex.getMessage()), null, ex));
        return parseMetadata(systemId, serviceDescriptor);
    } else {
        errorReceiver.error(null, WsdlMessages.PARSING_UNABLE_TO_GET_METADATA(ex.getMessage(), WscompileMessages.WSIMPORT_NO_WSDL(systemId)), ex);
    }
    return null;
}
 
Example #11
Source File: MetadataFinder.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private @Nullable Element getFromMetadataResolver(String systemId, Exception ex) {
    //try MEX
    MetaDataResolver resolver;
    ServiceDescriptor serviceDescriptor = null;
    for (MetadataResolverFactory resolverFactory : ServiceFinder.find(MetadataResolverFactory.class)) {
        resolver = resolverFactory.metadataResolver(options.entityResolver);
        try {
            serviceDescriptor = resolver.resolve(new URI(systemId));
            //we got the ServiceDescriptor, now break
            if (serviceDescriptor != null)
                break;
        } catch (URISyntaxException e) {
            throw new ParseException(e);
        }
    }

    if (serviceDescriptor != null) {
        errorReceiver.warning(new SAXParseException(WsdlMessages.TRY_WITH_MEX(ex.getMessage()), null, ex));
        return parseMetadata(systemId, serviceDescriptor);
    } else {
        errorReceiver.error(null, WsdlMessages.PARSING_UNABLE_TO_GET_METADATA(ex.getMessage(), WscompileMessages.WSIMPORT_NO_WSDL(systemId)), ex);
    }
    return null;
}
 
Example #12
Source File: Options.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
List<String> getJavacOptions(List<String> existingOptions, WsimportListener listener) {
    List<String> result = new ArrayList<String>();
    for (String o: javacOptions) {
        if (o.contains("=") && !o.startsWith("A")) {
            int i = o.indexOf('=');
            String key = o.substring(0, i);
            if (existingOptions.contains(key)) {
                listener.message(WscompileMessages.WSCOMPILE_EXISTING_OPTION(key));
            } else {
                result.add(key);
                result.add(o.substring(i + 1));
            }
        } else {
            if (existingOptions.contains(o)) {
                listener.message(WscompileMessages.WSCOMPILE_EXISTING_OPTION(o));
            } else {
                result.add(o);
            }
        }
    }
    return result;
}
 
Example #13
Source File: MetadataFinder.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
private @Nullable Element getFromMetadataResolver(String systemId, Exception ex) {
    //try MEX
    MetaDataResolver resolver;
    ServiceDescriptor serviceDescriptor = null;
    for (MetadataResolverFactory resolverFactory : ServiceFinder.find(MetadataResolverFactory.class)) {
        resolver = resolverFactory.metadataResolver(options.entityResolver);
        try {
            serviceDescriptor = resolver.resolve(new URI(systemId));
            //we got the ServiceDescriptor, now break
            if (serviceDescriptor != null)
                break;
        } catch (URISyntaxException e) {
            throw new ParseException(e);
        }
    }

    if (serviceDescriptor != null) {
        errorReceiver.warning(new SAXParseException(WsdlMessages.TRY_WITH_MEX(ex.getMessage()), null, ex));
        return parseMetadata(systemId, serviceDescriptor);
    } else {
        errorReceiver.error(null, WsdlMessages.PARSING_UNABLE_TO_GET_METADATA(ex.getMessage(), WscompileMessages.WSIMPORT_NO_WSDL(systemId)), ex);
    }
    return null;
}
 
Example #14
Source File: WsimportOptions.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Parses a token to a file (or a set of files)
 * and add them as {@link InputSource} to the specified list.
 *
 * @param suffix If the given token is a directory name, we do a recusive search
 *               and find all files that have the given suffix.
 */
private void addFile(String name, List<InputSource> target, String suffix) throws BadCommandLineException {
    Object src;
    try {
        src = Util.getFileOrURL(name);
    } catch (IOException e) {
        throw new BadCommandLineException(WscompileMessages.WSIMPORT_NOT_A_FILE_NOR_URL(name));
    }
    if (src instanceof URL) {
        target.add(absolutize(new InputSource(Util.escapeSpace(((URL) src).toExternalForm()))));
    } else {
        File fsrc = (File) src;
        if (fsrc.isDirectory()) {
            addRecursive(fsrc, suffix, target);
        } else {
            target.add(absolutize(fileToInputSource(fsrc)));
        }
    }
}
 
Example #15
Source File: MetadataFinder.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private @Nullable Element getFromMetadataResolver(String systemId, Exception ex) {
    //try MEX
    MetaDataResolver resolver;
    ServiceDescriptor serviceDescriptor = null;
    for (MetadataResolverFactory resolverFactory : ServiceFinder.find(MetadataResolverFactory.class)) {
        resolver = resolverFactory.metadataResolver(options.entityResolver);
        try {
            serviceDescriptor = resolver.resolve(new URI(systemId));
            //we got the ServiceDescriptor, now break
            if (serviceDescriptor != null)
                break;
        } catch (URISyntaxException e) {
            throw new ParseException(e);
        }
    }

    if (serviceDescriptor != null) {
        errorReceiver.warning(new SAXParseException(WsdlMessages.TRY_WITH_MEX(ex.getMessage()), null, ex));
        return parseMetadata(systemId, serviceDescriptor);
    } else {
        errorReceiver.error(null, WsdlMessages.PARSING_UNABLE_TO_GET_METADATA(ex.getMessage(), WscompileMessages.WSIMPORT_NO_WSDL(systemId)), ex);
    }
    return null;
}
 
Example #16
Source File: WsgenOptions.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public void validate() throws BadCommandLineException {
    if(nonclassDestDir == null)
        nonclassDestDir = destDir;

    if (!protocols.contains(protocol)) {
        throw new BadCommandLineException(WscompileMessages.WSGEN_INVALID_PROTOCOL(protocol, protocols));
    }

    if (endpoints.isEmpty()) {
        throw new BadCommandLineException(WscompileMessages.WSGEN_MISSING_FILE());
    }
    if (protocol == null || protocol.equalsIgnoreCase(X_SOAP12) && !isExtensionMode()) {
        throw new BadCommandLineException(WscompileMessages.WSGEN_SOAP_12_WITHOUT_EXTENSION());
    }

    if (nonstdProtocols.containsKey(protocol) && !isExtensionMode()) {
        throw new BadCommandLineException(WscompileMessages.WSGEN_PROTOCOL_WITHOUT_EXTENSION(protocol));
    }
    if (inlineSchemas && !genWsdl) {
        throw new BadCommandLineException(WscompileMessages.WSGEN_INLINE_SCHEMAS_ONLY_WITH_WSDL());
    }

    validateEndpointClass();
    validateArguments();
}
 
Example #17
Source File: WsimportOptions.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Parses a token to a file (or a set of files)
 * and add them as {@link InputSource} to the specified list.
 *
 * @param suffix If the given token is a directory name, we do a recusive search
 *               and find all files that have the given suffix.
 */
private void addFile(String name, List<InputSource> target, String suffix) throws BadCommandLineException {
    Object src;
    try {
        src = Util.getFileOrURL(name);
    } catch (IOException e) {
        throw new BadCommandLineException(WscompileMessages.WSIMPORT_NOT_A_FILE_NOR_URL(name));
    }
    if (src instanceof URL) {
        target.add(absolutize(new InputSource(Util.escapeSpace(((URL) src).toExternalForm()))));
    } else {
        File fsrc = (File) src;
        if (fsrc.isDirectory()) {
            addRecursive(fsrc, suffix, target);
        } else {
            target.add(absolutize(fileToInputSource(fsrc)));
        }
    }
}
 
Example #18
Source File: WsgenOptions.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private void validateArguments() throws BadCommandLineException {
    if (!genWsdl) {
        if (serviceName != null) {
            throw new BadCommandLineException(WscompileMessages.WSGEN_WSDL_ARG_NO_GENWSDL(SERVICENAME_OPTION));
        }
        if (portName != null) {
            throw new BadCommandLineException(WscompileMessages.WSGEN_WSDL_ARG_NO_GENWSDL(PORTNAME_OPTION));
        }
    }
}
 
Example #19
Source File: WsgenOptions.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Get an implementation class annotated with @WebService annotation.
 */
private void validateEndpointClass() throws BadCommandLineException {
    Class clazz = null;
    for(String cls : endpoints){
        clazz = getClass(cls);
        if (clazz == null)
            continue;

        if (clazz.isEnum() || clazz.isInterface() ||
            clazz.isPrimitive()) {
            continue;
        }
        isImplClass = true;
        WebService webService = (WebService) clazz.getAnnotation(WebService.class);
        if(webService == null)
            continue;
        break;
    }
    if(clazz == null){
        throw new BadCommandLineException(WscompileMessages.WSGEN_CLASS_NOT_FOUND(endpoints.get(0)));
    }
    if(!isImplClass){
        throw new BadCommandLineException(WscompileMessages.WSGEN_CLASS_MUST_BE_IMPLEMENTATION_CLASS(clazz.getName()));
    }
    endpoint = clazz;
    validateBinding();
}
 
Example #20
Source File: WsgenOptions.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private void validateBinding() throws BadCommandLineException {
    if (genWsdl) {
        BindingID binding = BindingID.parse(endpoint);
        if ((binding.equals(BindingID.SOAP12_HTTP) ||
             binding.equals(BindingID.SOAP12_HTTP_MTOM)) &&
                !(protocol.equals(X_SOAP12) && isExtensionMode())) {
            throw new BadCommandLineException(WscompileMessages.WSGEN_CANNOT_GEN_WSDL_FOR_SOAP_12_BINDING(binding.toString(), endpoint.getName()));
        }
        if (binding.equals(BindingID.XML_HTTP)) {
            throw new BadCommandLineException(WscompileMessages.WSGEN_CANNOT_GEN_WSDL_FOR_NON_SOAP_BINDING(binding.toString(), endpoint.getName()));
        }
    }
}
 
Example #21
Source File: WSDLFetcher.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private File getWSDLDownloadDir() {
    File wsdlDir = new File(options.destDir, WSDL_PATH);
    boolean created = wsdlDir.mkdirs();
    if (options.verbose && !created) {
        listener.message(WscompileMessages.WSCOMPILE_NO_SUCH_DIRECTORY(wsdlDir));
    }
    return wsdlDir;
}
 
Example #22
Source File: WsgenOptions.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private void validateArguments() throws BadCommandLineException {
    if (!genWsdl) {
        if (serviceName != null) {
            throw new BadCommandLineException(WscompileMessages.WSGEN_WSDL_ARG_NO_GENWSDL(SERVICENAME_OPTION));
        }
        if (portName != null) {
            throw new BadCommandLineException(WscompileMessages.WSGEN_WSDL_ARG_NO_GENWSDL(PORTNAME_OPTION));
        }
    }
}
 
Example #23
Source File: WsgenOptions.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private void validateArguments() throws BadCommandLineException {
    if (!genWsdl) {
        if (serviceName != null) {
            throw new BadCommandLineException(WscompileMessages.WSGEN_WSDL_ARG_NO_GENWSDL(SERVICENAME_OPTION));
        }
        if (portName != null) {
            throw new BadCommandLineException(WscompileMessages.WSGEN_WSDL_ARG_NO_GENWSDL(PORTNAME_OPTION));
        }
    }
}
 
Example #24
Source File: Options.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Obtains an operand and reports an error if it's not there.
 */
public String requireArgument(String optionName, String[] args, int i) throws BadCommandLineException {
    //if (i == args.length || args[i].startsWith("-")) {
    if (args[i].startsWith("-")) {
        throw new BadCommandLineException(WscompileMessages.WSCOMPILE_MISSING_OPTION_ARGUMENT(optionName));
    }
    return args[i];
}
 
Example #25
Source File: ConsoleErrorReporter.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public void error(SAXParseException e) {
    if(debug)
        e.printStackTrace();
    hasError = true;
    if((e.getSystemId() == null && e.getPublicId() == null) && (e.getCause() instanceof UnknownHostException)) {
        print(WscompileMessages.WSIMPORT_ERROR_MESSAGE(e.toString()), e);
    } else {
        print(WscompileMessages.WSIMPORT_ERROR_MESSAGE(e.getMessage()), e);
    }
}
 
Example #26
Source File: WsgenTool.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
protected void usage(Options options) {
    // Just don't see any point in passing WsgenOptions
    // BadCommandLineException also shouldn't have options
    if (options == null)
        options = this.options;
    if (options instanceof WsgenOptions) {
        System.out.println(WscompileMessages.WSGEN_HELP("WSGEN",
                ((WsgenOptions)options).protocols,
                ((WsgenOptions)options).nonstdProtocols.keySet()));
        System.out.println(WscompileMessages.WSGEN_USAGE_EXTENSIONS());
        System.out.println(WscompileMessages.WSGEN_USAGE_EXAMPLES());
    }
}
 
Example #27
Source File: WsgenOptions.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private void validateArguments() throws BadCommandLineException {
    if (!genWsdl) {
        if (serviceName != null) {
            throw new BadCommandLineException(WscompileMessages.WSGEN_WSDL_ARG_NO_GENWSDL(SERVICENAME_OPTION));
        }
        if (portName != null) {
            throw new BadCommandLineException(WscompileMessages.WSGEN_WSDL_ARG_NO_GENWSDL(PORTNAME_OPTION));
        }
    }
}
 
Example #28
Source File: WsgenOptions.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private void validateBinding() throws BadCommandLineException {
    if (genWsdl) {
        BindingID binding = BindingID.parse(endpoint);
        if ((binding.equals(BindingID.SOAP12_HTTP) ||
             binding.equals(BindingID.SOAP12_HTTP_MTOM)) &&
                !(protocol.equals(X_SOAP12) && isExtensionMode())) {
            throw new BadCommandLineException(WscompileMessages.WSGEN_CANNOT_GEN_WSDL_FOR_SOAP_12_BINDING(binding.toString(), endpoint.getName()));
        }
        if (binding.equals(BindingID.XML_HTTP)) {
            throw new BadCommandLineException(WscompileMessages.WSGEN_CANNOT_GEN_WSDL_FOR_NON_SOAP_BINDING(binding.toString(), endpoint.getName()));
        }
    }
}
 
Example #29
Source File: WsgenOptions.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Get an implementation class annotated with @WebService annotation.
 */
private void validateEndpointClass() throws BadCommandLineException {
    Class clazz = null;
    for(String cls : endpoints){
        clazz = getClass(cls);
        if (clazz == null)
            continue;

        if (clazz.isEnum() || clazz.isInterface() ||
            clazz.isPrimitive()) {
            continue;
        }
        isImplClass = true;
        WebService webService = (WebService) clazz.getAnnotation(WebService.class);
        if(webService == null)
            continue;
        break;
    }
    if(clazz == null){
        throw new BadCommandLineException(WscompileMessages.WSGEN_CLASS_NOT_FOUND(endpoints.get(0)));
    }
    if(!isImplClass){
        throw new BadCommandLineException(WscompileMessages.WSGEN_CLASS_MUST_BE_IMPLEMENTATION_CLASS(clazz.getName()));
    }
    endpoint = clazz;
    validateBinding();
}
 
Example #30
Source File: WsgenTool.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
protected void usage(Options options) {
    // Just don't see any point in passing WsgenOptions
    // BadCommandLineException also shouldn't have options
    if (options == null)
        options = this.options;
    if (options instanceof WsgenOptions) {
        System.out.println(WscompileMessages.WSGEN_HELP("WSGEN",
                ((WsgenOptions)options).protocols,
                ((WsgenOptions)options).nonstdProtocols.keySet()));
        System.out.println(WscompileMessages.WSGEN_USAGE_EXTENSIONS());
        System.out.println(WscompileMessages.WSGEN_USAGE_EXAMPLES());
    }
}